Repository navigation
Fix/add id to toolcall - #712
SaiDevaHarshaR wants to merge 5 commits into
Conversation
ducanhnguyen223
left a comment
There was a problem hiding this comment.
I cross-checked this against the Client.chat path for a reported tool-correlation bug. This patch adds id to Message.ToolCall, which covers the assistant-call side, but the corresponding tool-result field still appears absent: Message has no tool_call_id, and _copy_messages() validates each incoming mapping through Message.model_validate(...), so a role=tool message carrying tool_call_id is dropped before request serialization. Could you confirm whether the Ollama API accepts/preserves that field? If it does, a transport-level regression for a tool result would cover the other half of the round trip. Related concrete reproduction: langchain-ai/langchain#41085. I did not execute this fork or run its tests.
What this fixes
Fixes #667 — ToolCall is missing
idfield required by OpenAI API spec.When using ollama-python responses with OpenAI-compatible tools,
tool_call_idis missing causing errors.Change
Added
id: Optional[str] = NonetoMessage.ToolCall:Why Optional
Making it optional preserves backward compatibility — existing code
that creates ToolCall without id continues to work.
Testing
Closes #667