-
My challenge is, that I have an idea of what tool-calling is, how it's supposed to work - but can't get it to work using LangGraph. I don't want a simple code-review, but I'd rather want to discuss where my thinking is wrong. Here's my concept:
Here's my simple setup:
Here's a LangSmith trace to an exemplary call: https://smith.langchain.com/public/9c7d0a6d-ab3d-47c1-8958-49bdfba2c32d/r Whatever prompts I try, I don't get the tool to be called. So what am I doing wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
So, with a bit of experimenting and further reading, I found, that using the prebuilt create_react_agent (https://langchain-ai.github.io/langgraph/reference/prebuilt/#langgraph.prebuilt.chat_agent_executor.create_react_agent) works as expected ... modifying the code like this creates tool_calls as expected:
So I assume there's a difference in how the model is used - maybe a different prompt template? |
Beta Was this translation helpful? Give feedback.
-
The issue is with the way I used .bind_tools() .bind_tools() returns a new Runnable, the result must be reassigned to the variable of the initial Runnable. Slightly modified code that runs perfectly:
|
Beta Was this translation helpful? Give feedback.
The issue is with the way I used .bind_tools()
.bind_tools() returns a new Runnable, the result must be reassigned to the variable of the initial Runnable.
Slightly modified code that runs perfectly: