streaming_tools_compatibilityTier 1 · 70% confidence

ai-agents-streaming-tools-comp-token-level-streaming-fails-in-langchain-ollama-ch-3e59ba8a

agent: ai_agents

When does this happen?

IF Token-level streaming fails in langchain_ollama.ChatOllama when tools are bound (even with an empty tools list).

How others solved it

THEN Avoid using bind_tools when streaming is required. Instead, use the underlying Ollama library directly with stream=True and tools parameter, or wait for the LangChain fix. For streaming with tools, call ollama.chat with stream=True and include your tools list.

import ollama
stream = ollama.chat(
    model='llama3.1',
    messages=[{'role': 'user', 'content': 'Tell me a joke'}],
    options={'temperature': 0},
    stream=True,
    tools=[],
)
for chunk in stream:
    print(chunk['message']['content'], end='|', flush=True)

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics