Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testbed can now read the OPENAI_API_KEY in addition to OAI_CONFIG_LIST #848

Merged
merged 2 commits into from
Dec 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion samples/tools/testbed/run_scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,15 @@ def run_scenarios(scenario, n_repeats, is_native, config_list, requirements, res
expand_scenario(scenario_dir, instance, results_repetition)

# Append the config list to the ENV file
config_list_json = json.dumps(config_list)
with open(os.path.join(results_repetition, "ENV"), "at") as fh:
config_list_json = json.dumps(config_list)
fh.write(f"export OAI_CONFIG_LIST='{config_list_json}'\n")

# If set, append the OpenAI API Key
openai_api_key = os.environ.get("OPENAI_API_KEY")
if openai_api_key is not None and len(openai_api_key.strip()) > 0:
fh.write(f"export OPENAI_API_KEY='{openai_api_key}'\n")

# Run the scenario
if is_native:
run_scenario_natively(results_repetition)
Expand Down
Loading