This PR addresses a bug where a ChatMessage containing multiple ToolCall objects would result in a validation error due to Pydantic's tuple length constraint[0]. The tool_calls field's type annotation was updated to allow a variable-length tuple.
Before:
➜ python3 start.py
USER: get me the SEA weather in F and C
Traceback (most recent call last):
[truncated]
pydantic_core._pydantic_core.ValidationError: 1 validation error for ChatMessage
tool_calls
Tuple should have at most 1 item after validation, not 2 [type=too_long, input_value=[ToolCall(id='call_iQLAkv...unit": "fahrenheit"}'))], input_type=list]
For further information visit https://errors.pydantic.dev/2.5/v/too_long
After:
➜ python3 start.py
USER: get me the SEA weather in F and C
AI: Thinking (get_weather)...
AI: The current weather in Seattle, WA is sunny. It is 72 degrees Fahrenheit and 22 degrees Celsius.
[0] Tuple should have at most 1 item after validation, not 2 [type=too_long, input_value=[ToolCall(id='call_iQLAkv...unit": "fahrenheit"}'))], input_type=list]
This PR addresses a bug where a ChatMessage containing multiple ToolCall objects would result in a validation error due to Pydantic's tuple length constraint[0]. The
tool_calls
field's type annotation was updated to allow a variable-length tuple.Before:
After:
[0]
Tuple should have at most 1 item after validation, not 2 [type=too_long, input_value=[ToolCall(id='call_iQLAkv...unit": "fahrenheit"}'))], input_type=list]