Skip to content
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

Support openai assistant v2 API #2466

Merged
merged 6 commits into from
Apr 23, 2024
Merged

Support openai assistant v2 API #2466

merged 6 commits into from
Apr 23, 2024

Conversation

IANTHEREAL
Copy link
Collaborator

Why are these changes needed?

This PR introduces support for the newly released OpenAI Assistant API v2, incorporating significant changes outlined in the migration guide. We aim to ensure compatibility with the existing API v1 without disrupting current implementations. The key modifications include:

  1. Dual API Support: Refactored the assistant creation and update functions to support both API v1 and v2 seamlessly.
  2. Enhanced File Handling: When a user calls the GPT assistant agent with file_ids, the code now attempts to create a vector store and utilizes file_search. This enhancement maintains compatibility with the existing user codebase.
  3. Updated Testing Suite: Expanded the test suite to verify functionality against the API v2 specifications while preserving a subset of tests for API v1 to ensure ongoing compatibility.

By making these changes, it aim to leverage the advancements in API v2 while maintaining a smooth transition for existing applications still utilizing API v1.

Related issue number

Checks

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 10.14493% with 62 lines in your changes are missing coverage. Please review.

Project coverage is 33.20%. Comparing base (ded2d61) to head (d680d4f).
Report is 1 commits behind head on main.

Files Patch % Lines
autogen/oai/openai_utils.py 11.86% 52 Missing ⚠️
autogen/agentchat/contrib/gpt_assistant_agent.py 0.00% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2466      +/-   ##
==========================================
- Coverage   33.33%   33.20%   -0.14%     
==========================================
  Files          83       83              
  Lines        8636     8692      +56     
  Branches     1835     1852      +17     
==========================================
+ Hits         2879     2886       +7     
- Misses       5516     5565      +49     
  Partials      241      241              
Flag Coverage Δ
unittests 33.20% <10.14%> (-0.14%) ⬇️

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.

@ekzhu ekzhu requested review from gagb and jtrugman April 21, 2024 09:09
Copy link
Collaborator

@ekzhu ekzhu left a comment

Choose a reason for hiding this comment

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

Are the new changes compatible with older version of assistant API?

@ekzhu ekzhu enabled auto-merge April 23, 2024 01:06
@IANTHEREAL
Copy link
Collaborator Author

Are the new changes compatible with older version of assistant API?

Yes, it has been done with the maximum backward compatibility. If the user uses the old file_ids to create the assistant, the assistant can still be created successfully. However, if the old and new configurations are mixed, an error will be reported.

@ekzhu ekzhu added this pull request to the merge queue Apr 23, 2024
Merged via the queue into main with commit a41182a Apr 23, 2024
44 of 48 checks passed
@ekzhu ekzhu deleted the ian/gpt_assistant_v2 branch April 23, 2024 17:33
jayralencar pushed a commit to jayralencar/autogen that referenced this pull request May 28, 2024
* adapted to openai assistant v2 api

* fix comments

* format code

* fix ci

* Update autogen/agentchat/contrib/gpt_assistant_agent.py

Co-authored-by: Eric Zhu <[email protected]>

---------

Co-authored-by: Eric Zhu <[email protected]>
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.

3 participants