Skip to content

Handle azure_deployment Parameter Issue in GPTAssistantAgent to Maintain Compatibility with OpenAIWrapper#1721

Merged
sonichi merged 8 commits into
microsoft:mainfrom
IANTHEREAL:fix-gpt-assistant-model
Feb 24, 2024
Merged

Handle azure_deployment Parameter Issue in GPTAssistantAgent to Maintain Compatibility with OpenAIWrapper#1721
sonichi merged 8 commits into
microsoft:mainfrom
IANTHEREAL:fix-gpt-assistant-model

Conversation

@IANTHEREAL

Copy link
Copy Markdown
Contributor

Why are these changes needed?

context

The GPTAssistantAgent supports an optional azure_deployment parameter, which, when specified during the initialization of the AzureOpenAI client, leads to a NotFoundError with error code 404 on calling client.beta.assistants.list():

openai.NotFoundError: Error code: 404 - {'error': {'code': '404', 'message': 'Resource not found'}}

Omitting the azure_deployment parameter results in normal operation. This behavior is incompatible with the implementation logic of OpenAIWrapper and implies a potential deficiency in the AzureOpenAI implementation(openai/openai-python#1163).

Notably, GPTAssistantAgent requires the model/azure_deployment to be specified only when calling client.beta.assistants.create.

To circumvent this issue without affecting the existing logic of other agents and before a fix is released for the openai python library, we should locally handle the azure_deployment parameter within GPTAssistantAgent.

What to do in this PR?

The PR addresses the comprehensive handling of llm config issues outlined in #1688.

Related issue number

Closes #1688

Checks

@codecov-commenter

codecov-commenter commented Feb 19, 2024

Copy link
Copy Markdown

Codecov Report

Attention: 10 lines in your changes are missing coverage. Please review.

Comparison is base (2750391) 39.33% compared to head (13356a9) 51.17%.
Report is 2 commits behind head on main.

Files Patch % Lines
autogen/agentchat/contrib/gpt_assistant_agent.py 9.09% 10 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1721       +/-   ##
===========================================
+ Coverage   39.33%   51.17%   +11.83%     
===========================================
  Files          57       57               
  Lines        6096     6097        +1     
  Branches     1365     1482      +117     
===========================================
+ Hits         2398     3120      +722     
+ Misses       3502     2729      -773     
- Partials      196      248       +52     
Flag Coverage Δ
unittests 51.09% <9.09%> (+11.75%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sonichi sonichi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qingyun-wu please don't run the openai contrib test until the logging of api_keys etc. is removed.

Comment thread autogen/agentchat/contrib/gpt_assistant_agent.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] model in GPTAssistant

4 participants