Closed sam-trost closed 2 weeks ago
@sam-trost thanks for looking into this and contributing a fix!
What's happening here is that we're auto-generating APIs on the agent side using FastAPI. FastAPI generates an API from a python function, and it does input validation based on the Pydantic types we use for the arguments to the function. Currently the Message type declares content as a non-nullable string
- hence the validation failures when content is null
I'm hesitant to mess around with the messages
array because I think it's confusing for the agent to have a different accounting of the message history than the orchestrator and the client. My preferred approach is to widen the Pydantic types to accommodate tool call messages and null content bodies. I'll open a separate PR with those changes
When the agent includes tool calls, the existing chat history mechanism is including the tool responses in subsequent calls to the LLM. The LLM is rejecting the request because the output message from the tool call is not properly formatted for use as an input message.
To reproduce, run the simple-app from the samples. First turn: Ask for today's date. ..Expect AI Response.. Second turn: Ask for the current time.
No response is played. See the below logs.
Note the assistant response is included in the second turn.
Specifically these two messages look like they should be omitted: