-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Description
Sometimes it's useful to have an assistant message be the last message in the message history.
For example, you have a chat bot that sends another message after some time that the user doesn't respond:
User: Hi can I get help with X?
Agent: Sure, can you provide detail Y?
<some time passes>
Agent: If you don't have this detail I can do Z for you
Since Agent.run() (and Agent.iter()) only get a user prompt as an input, this is impossible.
Previously, it was possible to put some dummy prompt in there, and remove it in message history processing. Since v1.0.8 this is no longer possible due to a new validation in pydantic_ai._agent_graph._process_message_history that raises exceptions.UserError('Processed history must end with a ModelRequest.')
Is this validation mission critical, or is mostly for detecting probably-wrong history processing?
Maybe this validation can be opted out of? WDYT?
References
No response