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

feat: support for customizing “tool_choice” in OpenAI #785

Closed
wants to merge 1 commit into from

Conversation

leseb
Copy link

@leseb leseb commented Jan 27, 2025

1016c92 feat: support for customizing “tool_choice” in OpenAI

commit 1016c92
Author: Sébastien Han [email protected]
Date: Mon Jan 27 16:52:45 2025 +0100

feat: support for customizing “tool_choice” in OpenAI

The ModelSettings class uses a TypedDict as its underlying type, providing
flexibility to add options beyond the predefined attributes.

Before generating chat completions, the code now checks if tool_choice is set
in ModelSettings and applies it accordingly.

Fixes: https://github.com/pydantic/pydantic-ai/issues/224
Signed-off-by: Sébastien Han <[email protected]>

Fixes: #224

The ModelSettings class uses a TypedDict as its underlying type, providing
flexibility to add options beyond the predefined attributes.

Before generating chat completions, the code now checks if tool_choice is set
in ModelSettings and applies it accordingly.

Fixes: pydantic#224
Signed-off-by: Sébastien Han <[email protected]>
@sydney-runkle
Copy link
Member

I think we'll want to customize this on OpenAIModelSettings, given that tool choice format is specific to different model providers.

@leseb
Copy link
Author

leseb commented Jan 28, 2025

I think we'll want to customize this on OpenAIModelSettings, given that tool choice format is specific to different model providers.

@sydney-runkle Thanks for looking into this. Are you referring to exposing a setting like ModelSettings? I’m curious about how frequently users would need to adjust this flag. Thanks!

@sydney-runkle
Copy link
Member

Yes, we'll want to expose a setting and document it. Specifically, we'll probably want to add this to OpenAIModelSettings.

@leseb
Copy link
Author

leseb commented Jan 29, 2025

I no longer have the time to continue working on this, so I’ll be closing it.

@leseb leseb closed this Jan 29, 2025
@leseb leseb deleted the fix-224 branch January 29, 2025 16:38
@webcoderz
Copy link

thanks @leseb this seems to work..

@webcoderz
Copy link

@sydney-runkle see: #825 i added tool_choice to ModelSettings as requested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tool calling issues with vllm
3 participants