Skip to content

Commit

Permalink
Testbed can now read the OPENAI_API_KEY in addition to the OAI_CONFIG…
Browse files Browse the repository at this point in the history
…_LIST (#848)

Co-authored-by: Victor Dibia <victordibia@microsoft.com>
  • Loading branch information
afourney and victordibia authored Dec 4, 2023
1 parent 26f6e0c commit a107233
Showing 1 changed file with 6 additions and 1 deletion.
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

0 comments on commit a107233

Please sign in to comment.