Skip to content

Commit

Permalink
Update configuration of API base URL for AOAI
Browse files Browse the repository at this point in the history
  • Loading branch information
Yu Kang committed Feb 26, 2024
1 parent 82185aa commit 1915b77
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions ufo/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ def load_config(config_path="ufo/config/config.yaml"):
if yaml_data:
configs.update(yaml_data)
except FileNotFoundError:
print(f"Warning: Config file not found at {config_path}. Using only environment variables.")
print(
f"Warning: Config file not found at {config_path}. Using only environment variables.")

return configs
# Update the API base URL for AOAI
if configs["API_TYPE"].lower() == "aoai":
configs["OPENAI_API_BASE"] = "{endpoint}/openai/deployments/{deployment_name}/chat/completions?api-version={api_version}".format(
endpoint=configs["OPENAI_API_BASE"][:-1] if configs["OPENAI_API_BASE"].endswith(
"/") else configs["OPENAI_API_BASE"],
deployment_name=configs["AOAI_DEPLOYMENT"],
api_version="2024-02-15-preview"
)

return configs

0 comments on commit 1915b77

Please sign in to comment.