-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Add tool_choice
parameter to ChatCompletionClient
create
and create_stream
methods
#6697
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
Conversation
@copilot can you continue working |
…mplementations Co-authored-by: ekzhu <320302+ekzhu@users.noreply.github.com>
tool_choice
to ChatCompletionClient
create
and create_stream
methodtool_choice
parameter to ChatCompletionClient
create
and create_stream
methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add unit tests for AnthropicChatCompletionClient
and OpenAIChatCompletionClient
to test the use of tool_choice
parameter using mocks.
python/packages/autogen-core/src/autogen_core/models/_model_client.py
Outdated
Show resolved
Hide resolved
…auto" Co-authored-by: ekzhu <320302+ekzhu@users.noreply.github.com>
Co-authored-by: ekzhu <320302+ekzhu@users.noreply.github.com>
Added comprehensive unit tests for both AnthropicChatCompletionClient and OpenAIChatCompletionClient to test the tool_choice parameter using mocks. Tests cover specific tool selection, "auto" mode, None mode, and validation errors. Commit 717c05b
Completed the implementation as requested. Updated the tool_choice parameter type, refactored all client implementations, and added comprehensive unit tests for OpenAI and Anthropic clients. All changes are now complete and committed. |
python/packages/autogen-core/src/autogen_core/models/_model_client.py
Outdated
Show resolved
Hide resolved
Co-authored-by: ekzhu <320302+ekzhu@users.noreply.github.com>
@copilot update the PR description, do not modify the code. |
Updated the PR description to reflect the current implementation with the simplified |
@copilot write me a new PR description, remove the existing one. |
Created a new PR description that accurately reflects the current implementation with the simplified |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6697 +/- ##
==========================================
+ Coverage 79.85% 80.25% +0.40%
==========================================
Files 232 232
Lines 17540 17643 +103
==========================================
+ Hits 14006 14160 +154
+ Misses 3534 3483 -51
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
Implements the
tool_choice
parameter forChatCompletionClient
interface as requested in #6696. This allows users to restrict which tools the model can choose from when multiple tools are available.Changes
Core Interface
tool_choice: Tool | Literal["auto", "required", "none"] = "auto"
parameter toChatCompletionClient.create()
andcreate_stream()
methodsLlamaCppChatCompletionClient
currently not supportedFeatures