Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Addtool_choice toModelSettings#825

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
webcoderz wants to merge40 commits intopydantic:main
base:main
Choose a base branch
Loading
fromwebcoderz:main

Conversation

webcoderz
Copy link

building upon :#785

i added the tool_choice to ModelSettings

kernelzeroday, TensorTemplar, BeautyyuYanli, tomliptrot, WorldInnovationsDepartment, daavoo, ItzAmirreza, and okigan-crunchyroll reacted with thumbs up emojipedrocr83 reacted with eyes emoji
@github-actionsgithub-actionsbot temporarily deployed to deploy-previewJanuary 31, 2025 15:56 Inactive
@iabgcb
Copy link

pls pls see to it urgently that linting errors are solved.

@webcoderz
Copy link
Author

pls pls see to it urgently that linting errors are solved.

yea i dont think those failures are on what i added, i think therye elsewhere :)

After researching; it seems every single one of the major providers supports tool_choice
@github-actionsgithub-actionsbot temporarily deployed to deploy-previewFebruary 4, 2025 02:41 Inactive
@webcoderz
Copy link
Author

can we get this landed?

@silkspace
Copy link

This is a nice to have, and unblocks core functionality. Which runway will this land on?

webcoderz reacted with heart emoji

@webcoderz
Copy link
Author

since it's supported by the others will add to the other clients as well

@webcoderz
Copy link
Author

looks like mostof them already supprt / have it integrated, im not sure how it should look for gemini/cohere, cc@sydney-runkle

@kernelzeroday
Copy link

+1 request for review, are additional changes needed to get this functionality merged? Thank you!

webcoderz, iabgcb, maziyarpanahi, theobjectivedad, Finndersen, and okigan-crunchyroll reacted with rocket emoji

@webcoderz
Copy link
Author

confused on what more is needed here ?

Copy link
Contributor

@sydney-runklesydney-runkle left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution - this still needs some more support across other model files. Happy to help get this across the line, but we need impl for all supported models.

webcoderz reacted with heart emoji
@webcoderz
Copy link
Author

Thanks@sydney-runkle , will try to get these changes in tommorow; I don't have a cohere , groq, or anthropic sub so unsure how to test those ; I only have access to llama based models and openAI so I might need assist on those; anthropic looks pretty straightforward I can prob get that one in also, and groq is llama so can prob swing that one as well, never touched cohere before though

@sydney-runkle
Copy link
Contributor

@webcoderz, you can look at their API/sdk docs to figure out what values are accepted + supported.

Given the demand for this, I'm also happy to pick this up tomorrow and get this into our next release.

webcoderz reacted with rocket emoji

@ItzAmirreza
Copy link

Would be super-useful to my use case, too, to get this merged and released, anything I can help with?

As of when I checked this AM vLLM does support reasoning models + tool calls now but sadly tool_choice=required support hasn't been included yet.

IMO I do agree with folks that more flexibility over tool_choice mapping is desirable given current SoTA.@Kludex , what do you think? Can this be merged?

tool_choice: required in vLLM just got merged. Looking forward for a fix! Thank you all!

@TensorTemplar
Copy link

Would be super-useful to my use case, too, to get this merged and released, anything I can help with?

As of when I checked this AM vLLM does support reasoning models + tool calls now but sadly tool_choice=required support hasn't been included yet.
IMO I do agree with folks that more flexibility over tool_choice mapping is desirable given current SoTA.@Kludex , what do you think? Can this be merged?

tool_choice: required in vLLM just got merged. Looking forward for a fix! Thank you all!

Was merged to main in vLLM, no actual release yet - but i'll drop a post here once it finished compiling from source if it now works

@theobjectivedad
Copy link

Would be super-useful to my use case, too, to get this merged and released, anything I can help with?

As of when I checked this AM vLLM does support reasoning models + tool calls now but sadly tool_choice=required support hasn't been included yet.
IMO I do agree with folks that more flexibility over tool_choice mapping is desirable given current SoTA.@Kludex , what do you think? Can this be merged?

tool_choice: required in vLLM just got merged. Looking forward for a fix! Thank you all!

Was merged to main in vLLM, no actual release yet - but i'll drop a post here once it finished compiling from source if it now works

It doesn't work with reasoning models unfortunately, I add a fix to15627.

TensorTemplar reacted with confused emoji

@TensorTemplar
Copy link

TensorTemplar commentedApr 4, 2025
edited
Loading

Neither XGrammar nor Outlines seem to work out of the box with json subschema on some models, but at least thetool_choice="required" is working as intended with vLLM main and llama3 architectures in my tests

ItzAmirreza reacted with thumbs up emoji

@ItzAmirreza
Copy link

Neither XGrammar nor Outlines seem to work out of the box with json subschema on some models, but at least thetool_choice="required" is working as intended with vLLM main and llama3 architectures in my tests

Do you also got same issue?

json.decoder.JSONDecodeError: Expecting ':' delimiter: line 2 column 39 (char 39)

@webcoderz
Copy link
Author

I think we should still get this pushed through if possible to standardize how to handle tool_choice , unless there’s some alternative methods@Kludex

p.s. thanks for your patience with this :)

@KludexKludex changed the titleadding tool_choice to ModelSettingsAddtool_choice toModelSettingsApr 15, 2025
@Kludex
Copy link
Member

Kludex commentedApr 15, 2025
edited
Loading

@webcoderz is there something missing here? I read somewhere above that my changes were not correct, is that the case?


I still need to add tests, but I'd like to add vllm to our test suite.

webcoderz reacted with thumbs up emoji

@TensorTemplar
Copy link

TensorTemplar commentedApr 15, 2025
edited
Loading

@webcoderz is there something missing here? I read somewhere above that my changes were not correct, is that the case?

I still need to add tests, but I'd like to add vllm to our test suite.

Your changes work, issues were with tool call json subschema parsing in outlines and xgrammar with vLLM if one adds mcp servers andresult_type at the same time to an Agent. If you decide to add vLLM to the test suite, i am happy to contribute my test cases, since we run these in prod anyway. See myexample above

Edit: to clarify, the tool_choice="required" works without this PR now - the examples above are still broken in tool parser libs but are unrelated to pydantic-ai or this PR

webcoderz reacted with thumbs up emoji

@webcoderz
Copy link
Author

@webcoderz is there something missing here? I read somewhere above that my changes were not correct, is that the case?

I still need to add tests, but I'd like to add vllm to our test suite.

that’s a great idea

@Kludex
Copy link
Member

@webcoderz is there something missing here? I read somewhere above that my changes were not correct, is that the case?
I still need to add tests, but I'd like to add vllm to our test suite.

that’s a great idea

So nothing missing? 😅

@webcoderz
Copy link
Author

webcoderz commentedApr 15, 2025
edited
Loading

@webcoderz is there something missing here? I read somewhere above that my changes were not correct, is that the case?
I still need to add tests, but I'd like to add vllm to our test suite.

that’s a great idea

So nothing missing? 😅

Haha sorry,was on a meeting and trying to multitask .. no it ended up working once vLLM merged their PR for tool_choice=“required” a couple weeks ago :) there’s so many comments here and that got lost, theres still a slight problem on their side with parsing nested pydantic models for structured output but I think that’s WIP by@theobjectivedad but if you have some suggestions on how to handle that would be helpful

silkspace reacted with thumbs up emoji

@webcoderz
Copy link
Author

@webcoderz is there something missing here? I read somewhere above that my changes were not correct, is that the case?
I still need to add tests, but I'd like to add vllm to our test suite.

Your changes work, issues were with tool call json subschema parsing in outlines and xgrammar with vLLM if one adds mcp servers andresult_type at the same time to an Agent. If you decide to add vLLM to the test suite, i am happy to contribute my test cases, since we run these in prod anyway. See myexample above

Edit: to clarify, the tool_choice="required" works without this PR now - the examples above are still broken in tool parser libs but are unrelated to pydantic-ai or this PR

just checked this and yea seems fine here, the main issue is in xgrammar vllm side now

@DouweM
Copy link
Contributor

@webcoderz Can you please rebase this on main?

@DouweMDouweM marked this pull request as draftApril 30, 2025 19:19
@webcoderz
Copy link
Author

@webcoderz Can you please rebase this on main?

Sure will work on this today/tommorow, it’s been a while :)

@okigan
Copy link

okigan commentedJun 17, 2025
edited
Loading

bump, this also blocking usage of AWS Bedrock llama4 models

so far I've appliedthis as a workaround, but not clear if it covers all use cases.

@webcoderz
Copy link
Author

bump, this also blocking usage of AWS Bedrock llama4 models

so far I've appliedthis as a workaround, but not clear if it covers all use cases.

Thanks for bumping this@okigan i got tied up doing other stuff , but will recircle back to this

okigan and DouweM reacted with thumbs up emoji

@DouweMDouweM assignedDouweM and unassignedKludexJul 7, 2025
@DouweM
Copy link
Contributor

@webcoderz Great, please let me know when it's ready for review again!

@github-actionsGitHub Actions
Copy link

This PR is stale, and will be closed in 3 days if no reply is received.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@sydney-runklesydney-runklesydney-runkle left review comments

Assignees

@DouweMDouweM

Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

14 participants
@webcoderz@iabgcb@silkspace@kernelzeroday@sydney-runkle@TensorTemplar@Kludex@WorldInnovationsDepartment@theobjectivedad@dlivxpr@vnlitvinov@ItzAmirreza@DouweM@okigan

[8]ページ先頭

©2009-2025 Movatter.jp