-
Notifications
You must be signed in to change notification settings - Fork 44.6k
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
Fix Azure OpenAI setup problems #4875
Fix Azure OpenAI setup problems #4875
Conversation
✅ Deploy Preview for auto-gpt-docs canceled.
|
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #4875 +/- ##
==========================================
+ Coverage 50.05% 50.21% +0.16%
==========================================
Files 116 116
Lines 4799 4809 +10
Branches 643 645 +2
==========================================
+ Hits 2402 2415 +13
+ Misses 2218 2215 -3
Partials 179 179
☔ View full report in Codecov by Sentry. |
@jayden5744, thanks for the PR. Please write some tests! |
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request. |
Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly. |
- Refactor the `azure_config_file` attribute in the `Config` class to be optional. - Refactor the `azure_model_to_deployment_id_map` attribute in the `Config` class to be optional and provide default values. - Update the `get_azure_deployment_id_for_model` function to accept additional parameters. - Update references to `get_azure_deployment_id_for_model` in `create_text_completion`, `create_chat_completion`, and `get_embedding` functions to pass the required parameters.
@jayden5744 Overall great work. I've added some changes to reduce code duplication and avoid setting global parameters. |
…to fix/azure-setting
@collijk # autogpt/config/config.py
if config_dict["use_azure"]: # line 294
azure_config = cls.load_azure_config(config_dict["azure_config_file"])
config_dict.update(azure_config)
# Add the three lines of code below
openai.api_type = azure_config["openai_api_type"]
openai.api_base = azure_config["openai_api_base"]
openai.api_version = azure_config["openai_api_version"] which causes the error openai.error.AuthenticationError: Incorrect API key provided to occur when calling the openai api without changing to the azure settings. |
We specifically don't want to do
as this reaches into module namespace and has global impacts. These should be passed as arguments to the API call (as they are now). I'm setting up some testing on azure tomorrow (we unfortunately don't have access as part of our CI) and will try to reproduce your issue. |
* [Fix] Recover the azure config load function * [Style] Apply black, isort, mypy, autoflake * [Fix] Rename the return parameter from 'azure_model_map' to 'azure_model_to_deployment_id_map' * [Feat] Change the azure config file path to be dynamically configurable * [Test] Add azure_config and azure deployment_id_for_model * [Style] Apply black, isort, mypy, autoflake * [Style] Apply black, isort, mypy, autoflake * Refactor Azure configuration - Refactor the `azure_config_file` attribute in the `Config` class to be optional. - Refactor the `azure_model_to_deployment_id_map` attribute in the `Config` class to be optional and provide default values. - Update the `get_azure_deployment_id_for_model` function to accept additional parameters. - Update references to `get_azure_deployment_id_for_model` in `create_text_completion`, `create_chat_completion`, and `get_embedding` functions to pass the required parameters. * Clean up process for azure * Docstring * revert some unneccessary fiddling * Avoid altering args to models * Retry on 404s * Don't permanently change the environment * Formatting --------- Co-authored-by: Luke <[email protected]> Co-authored-by: lc0rp <[email protected]> Co-authored-by: collijk <[email protected]>
Background
Changes
Documentation
x
Test Plan
CI
PR Quality Checklist