-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Response prefill support for anthropic, deepseek and openrouter #2825
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
base: main
Are you sure you want to change the base?
Conversation
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.
Thank you!
Sure, will get back to you in one or two days |
Hmmm, is this test failure relevant? |
@yf-yang The test failure indicate that
I have both keys so I can look at that today or tomorrow. Thanks for all your work here! |
@yf-yang I'll have a look here tomorrow, sorry for the delay! |
# Conflicts: # pydantic_ai_slim/pydantic_ai/_agent_graph.py # tests/test_agent.py
@yf-yang I played around with this for a bit and made some tweaks (and introduced a new issue 🙈 ), and while it works well for Anthropic I have a few doubts about the design. We could make this work for DeepSeek, OpenRouter and Mistral as well, but out of the major providers only Anthropic supports it (and they may drop it at some point as it makes it a lot easier to jailbreak models, which is presumably why OpenAI and Google don't have it), so I don't love having Ideally, the field could live on Would you mind refactoring in that direction? We can then drop the |
@DouweM What do you mean by "we really only want it on the initial request"? Is Also I'd say sometimes I would like to dynamically control the prefill during agent run. For example, it is a useful strategy to support multiple tool calls similar to PromptOutput by assistant: LLM generates tool call name So I think it is not a good idea to make it a model-wise concept. The lifetime of the prefill request should be similar to user prompt's |
@yf-yang I was referring to the first request made to the model in an agent run (which could have message history from a previous run), assuming that
Yeah that's reasonable, and similar to #1820 where we're discussing letting model settings be changed per-request in an agent run with a new
But the user prompt is only used on the first request generated in |
Closes #2778