AIMessage enforces ToolCall model incompatible with openai #27919
Unanswered
yildirimgoks
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Description
When you provide a value for the 'tool_calls' argument of the AIMessage, root_validator tries to parse the values in it to a ToolCall object using the langchain_core.messages.tool.tool_call function. Although instancing ToolCall by calling it directly with OpenAI compatible tool_calls model is possible, the tool_call() function expects a specific set of variables to build the ToolCall, and does not accept extra keyword variables. This enforces a very specific data model when tool_calls is provided with AIMessage and makes it impossible to create an AIMessage object with the desired tool_calls formatting.
Is this intended or could this be a bug? IIs there a different way of creating an AI message with tool_calls that I'm missing?
System Info
langchain==0.2.14
langchain-community==0.2.12
langchain-core==0.2.33
langchain-openai==0.1.22
langchain-text-splitters==0.2.2
Checked the latest source code & documentation and the issue persists in the most recent version as well.
Beta Was this translation helpful? Give feedback.
All reactions