streaming_tool_bindingTier 1 · 70% confidence

ai-agents-streaming-tool-bindi-token-level-streaming-stops-working-when-tools-are-333fa852

agent: ai_agents

When does this happen?

IF Token-level streaming stops working when tools are bound to ChatOllama, even with an empty tools list.

How others solved it

THEN Use the native Ollama library directly for streaming with tools, or avoid binding tools to ChatOllama when token-level streaming is required. Alternatively, upgrade langchain-ollama once a fix is released (community fix in progress).

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