mirror of
https://github.com/microsoft/autogen.git
synced 2025-12-12 15:31:21 +00:00
Testbed can now read the OPENAI_API_KEY in addition to the OAI_CONFIG_LIST (#848)
Co-authored-by: Victor Dibia <victordibia@microsoft.com>
This commit is contained in:
parent
26f6e0cfb2
commit
a107233e23
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user