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

[Core] Compatibility with function call style API (Azure OpenAI and Gemini) #1227

Merged
merged 9 commits into from
Jan 13, 2024

Conversation

ekzhu
Copy link
Collaborator

@ekzhu ekzhu commented Jan 13, 2024

Why are these changes needed?

Add an optional argument to register_for_llm to support functional call style APIs (Azure OpenAI up to 2023-10-01-preview)

e.g.

@agent2.register_for_llm(api_style="function")
def my_function(a: Annotated[str, "description of a parameter"] = "a", b: int, c=3.14) -> str:
  return a + str(b * c)

Related issue number

#1206
#1150
#1198

Checks

@codecov-commenter
Copy link

codecov-commenter commented Jan 13, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 41.31%. Comparing base (4426093) to head (9132abb).
Report is 709 commits behind head on main.

Files Patch % Lines
autogen/agentchat/conversable_agent.py 66.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1227      +/-   ##
==========================================
+ Coverage   31.43%   41.31%   +9.88%     
==========================================
  Files          32       32              
  Lines        4381     4393      +12     
  Branches     1022     1081      +59     
==========================================
+ Hits         1377     1815     +438     
+ Misses       2896     2437     -459     
- Partials      108      141      +33     
Flag Coverage Δ
unittests 41.24% <66.66%> (+9.86%) ⬆️

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
Copy link
Collaborator Author

ekzhu commented Jan 13, 2024

Can anyone test this with Azure OpenAI would be great! I patched this based only on their JSON schema.

@ekzhu ekzhu added the tool-usage suggestion and execution of function/tool call label Jan 13, 2024
@ekzhu ekzhu marked this pull request as ready for review January 13, 2024 04:10
@sonichi
Copy link
Contributor

sonichi commented Jan 13, 2024

Could you make one "openai" test that uses azure openai endpoints (use filter_dict on api_type)?

@ekzhu ekzhu added this pull request to the merge queue Jan 13, 2024
Merged via the queue into main with commit d6a3304 Jan 13, 2024
79 of 87 checks passed
@ekzhu ekzhu deleted the function-call-backward-compatible branch January 13, 2024 20:55
autogen/agentchat/conversable_agent.py Show resolved Hide resolved
Comment on lines +116 to +118
# NOTE: for Azure OpenAI, please use API version 2023-12-01-preview or later as
# support for earlier versions will be deprecated.
# For API versions 2023-10-01-preview or earlier you may
Copy link
Contributor

Choose a reason for hiding this comment

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

Update this part

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ekzhu ekzhu restored the function-call-backward-compatible branch January 14, 2024 00:53
joshkyh pushed a commit that referenced this pull request Jan 17, 2024
…emini) (#1227)

* #1206

* doc

* add test for azure openai

* prior to

* filter for versions

* up to

* literal type

* update doc
whiskyboy pushed a commit to whiskyboy/autogen that referenced this pull request Apr 17, 2024
…emini) (microsoft#1227)

* microsoft#1206

* doc

* add test for azure openai

* prior to

* filter for versions

* up to

* literal type

* update doc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tool-usage suggestion and execution of function/tool call
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants