Skip to content

Streaming responses with tool calling #2080

@Hansehart

Description

@Hansehart

Describe the bug
Hey, unfortunately when using Ollama with Haystack I get the error, that:

Error message
"Ollama does not support tools and streaming at the same time. Please choose one."

Expected behavior
However it should work since May 28, 2025 (See: Ollama Blog)

Additional context
I have a very complex pipeline that uses Agent as component with OllamaChatGenerator. In addition it uses tools and streaming

To Reproduce
Take a look at haystack_integrations > components > generators > ollama > chat > chat_generator.py (Line 319)

        stream = resolved_streaming_callback is not None
        tools = tools or self.tools
        _check_duplicate_tool_names(tools)

        if stream and tools:
            msg = "Ollama does not support tools and streaming at the same time. Please choose one."
            raise ValueError(msg)

So, am I right, reading the blog, thats an wrong assumption there?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions