-
Notifications
You must be signed in to change notification settings - Fork 518
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
adding tool_choice to ModelSettings #825
Open
webcoderz
wants to merge
16
commits into
pydantic:main
Choose a base branch
from
webcoderz:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+110
−24
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
3777d06
Update openai.py
webcoderz 6746781
Update pyproject.toml
webcoderz 7d2c2ef
adding to model settings , removing monkeypatch
webcoderz 2567bbc
Update openai.py
webcoderz 4bc72f9
Update settings.py
webcoderz ac10ee1
backing this out
webcoderz ce38756
Update pyproject.toml
webcoderz 12015c9
Update groq.py
webcoderz 6dd9987
removing fallback comment
webcoderz 3250aff
adding as per reccomendation
webcoderz a0b7454
removing tool_choice from ModelSettings and placing in each individu…
webcoderz 79acaf3
the conditional checking tool_choice was not evaluating when i added …
webcoderz 67e6ac3
adding _get_tool_choice to groq,cohere, openai
webcoderz 9aa905c
unsure if these are necessary since seem supported already in mistral…
webcoderz 9349412
fixing tool_choice across all models
webcoderz a03fcfe
moving to top level settings
webcoderz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The indication that it's supported by all of these models needs to be backed up with code changes - in all of the corresponding model files, we need to check
model_settings.tool_choice
like you've done forgroq
andopenai
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.
This could also use more documentation - we'll want to document what each of these specifically means.
Additionally, I'm concerned about having this on the top
ModelSettings
level - anthropic supports "auto", "any", or a specific tool name, which is different than the above. Thus, I think we should implementtool_choice
on individual model settings (likeAnthropicModelSettings
,OpenAIModelSettings
) with the appropriate options.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.
yea I agree, will rebase onto each individual one since they all seem to to something slightly different
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.
looks like mistral already supports the tool_choice where when is creating the chat completion, it has a method self._get_tool_choice() at L251 that does the conditional check i added inline in groq and openai already, should i refactor those to match this ? seems to be a cleaner pattern
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.
also mistral has tool_choice set already in MistralToolChoiceEnum which was generated by speakeasy , not sure i like this pattern , i feel your rationale makes the most sense to have it inside each specific providers model settings, this seems out of place in its current state
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.
also seems like anthropic already has it supported via ToolChoiceParam which was also generated by speakeasy, not sure how to proceed on that as its already on that and mistral insofar