You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I added a very descriptive title to this question.
I searched the LangChain documentation with the integrated search.
I used the GitHub search to find a similar question and didn't find it.
Commit to Help
I commit to help with one of those options 👆
Example Code
defmultiply(x: int, y: int) ->int:
"""Multiplies two integers and returns the result. Args: x: First number to multiply y: Second number to multiply """returnx*yollama_llm=ChatOllama(
model="qwen3:8b",
verbose=True,
disable_streaming="tool_calling",
)
messages= [
{"role": "user", "content": "What is 2 * 7?"},
]
tool_node=ToolNode([multiply])
ollama_llm.bind_tools([multiply])
response=ollama_llm.invoke(messages)
print(response)
print(tool_node.invoke({"messages": [response]}))
defmultiply(x: int, y: int) ->int:
"""Multiplies two integers and returns the result. Args: x: First number to multiply y: Second number to multiply """returnx*yollama_llm=ChatOllama(
model="qwen3:8b",
verbose=True,
disable_streaming="tool_calling",
)
messages= [
{"role": "user", "content": "What is 2 * 7?"},
]
tool_node=ToolNode([multiply])
# ollama_llm.bind_tools([multiply])response=ollama_llm.invoke(messages, tools=[multiply])
print(response)
print(tool_node.invoke({"messages": [response]}))
Description
Hello everyone,
I'm currently working with tool calls in a ChatOllama model and have encountered an issue. I provided two code snippets:
Using bind_tools (as per the documentation) - This snippet doesn't seem to work for some reason. (Model doesn't do any tool call)
Using tools in the invoke call - This snippet works perfectly fine. (Tool call works every time)
I'm wondering if I'm making a mistake with the bind_tools call or if there might be an issue with bind_tools in the ChatOllama model. Any insights or suggestions would be greatly appreciated!
Thank you!
System Info
System Information
OS: Linux
OS Version: #1 SMP Tue Nov 5 00:21:55 UTC 2024
Python Version: 3.12.3 (main, Feb 4 2025, 14:48:35) [GCC 13.3.0]
httpx: 0.28.1
jsonpatch<2.0,>=1.33: Installed. No version info available.
langchain-core<0.4.0,>=0.3.40: Installed. No version info available.
langchain-core<1.0.0,>=0.3.52: Installed. No version info available.
langchain-core<1.0.0,>=0.3.58: Installed. No version info available.
langgraph>=0.3.5: Installed. No version info available.
langsmith-pyo3: Installed. No version info available.
langsmith<0.4,>=0.1.125: Installed. No version info available.
ollama<1,>=0.4.4: Installed. No version info available.
openai-agents: Installed. No version info available.
openai<2.0.0,>=1.68.2: Installed. No version info available.
opentelemetry-api: Installed. No version info available.
opentelemetry-exporter-otlp-proto-http: Installed. No version info available.
opentelemetry-sdk: Installed. No version info available.
orjson: 3.10.18
packaging: 24.2
packaging<25,>=23.2: Installed. No version info available.
pydantic: 2.11.4
pydantic<3.0.0,>=2.5.2;: Installed. No version info available.
pydantic<3.0.0,>=2.7.4;: Installed. No version info available.
pytest: Installed. No version info available.
PyYAML>=5.3: Installed. No version info available.
requests: 2.32.3
requests-toolbelt: 1.0.0
rich: Installed. No version info available.
tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available.
tiktoken<1,>=0.7: Installed. No version info available.
typing-extensions>=4.7: Installed. No version info available.
zstandard: 0.23.0
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
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
Hello everyone,
I'm currently working with tool calls in a ChatOllama model and have encountered an issue. I provided two code snippets:
I'm wondering if I'm making a mistake with the bind_tools call or if there might be an issue with bind_tools in the ChatOllama model. Any insights or suggestions would be greatly appreciated!
Thank you!
System Info
System Information
Package Information
Optional packages not installed
Other Dependencies
Beta Was this translation helpful? Give feedback.
All reactions