docs(ollama): add streaming-with-tools example to OllamaChatGenerator reference#11268
Merged
anakin87 merged 3 commits intodeepset-ai:mainfrom May 8, 2026
Conversation
… reference Closes deepset-ai/haystack-core-integrations#3263 (follow-up). The component reference page already covers Tool Support and Streaming in separate sections, but no example shows them combined. Adds a Streaming with Tools section between the two, with an executable example verified empirically against llama3.1:8b on Ollama. Notable behavior captured in the doc: when the model invokes a tool, streamed chunks carry tool_calls deltas and chunk.content is empty; the final ChatMessage has text=None and tool_calls populated.
|
@albertodiazdurana is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
Per CONTRIBUTING.md, every PR requires a release note under releasenotes/notes/. Categorized as `enhancements` to match the shape of prior docs-only release notes (e.g., docs-cleaner-markdown-ocr-examples-...yaml).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
anakin87
requested changes
May 7, 2026
Member
anakin87
left a comment
There was a problem hiding this comment.
Thank you!
I left some comments.
In addition, please also copy this change to 2.28 versioned docs (latest stable) in docs-website/versioned_docs/version-2.28/pipeline-components/generators/ollamachatgenerator.mdx.
- Remove releasenotes/notes/streaming-with-tools-ollamachatgenerator-docs-8e339d62f38ebd06.yaml: docs-only change does not need a release note. - Remove the :::tip[What to expect when tools fire] admonition from docs-website/docs/pipeline-components/generators/ollamachatgenerator.mdx: the inline comments in the streaming-with-tools example already convey the same information. - Add the Streaming with Tools section to docs-website/versioned_docs/version-2.28/pipeline-components/generators/ollamachatgenerator.mdx (latest stable), byte-identical to the v3 docs section.
Contributor
Author
|
Thanks for the review @anakin87! Addressed all three comments:
Ready for another look when you have a moment. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issues
Proposed Changes:
Adds a
### Streaming with Toolssection to theOllamaChatGeneratorreference page (docs-website/docs/pipeline-components/generators/ollamachatgenerator.mdx), between the existing### Streamingsection and the## Usageheading.The section includes:
streaming_callbackandtoolsonOllamaChatGenerator.chunk.contentis empty in the streamed chunks, and the finalreplies[0].textisNonewhilereplies[0].tool_callscarries the reconstructed call list.How did you test it?
Manually verified against
OllamaChatGenerator + llama3.1:8bon Ollama, with two spike scripts:Primary spike (directive prompt invoking
get_weather): 2 chunks fired (1 carrying the tool-call delta, 1 closing).replies[0].tool_calls = [ToolCall(tool_name='get_weather', arguments={'city': 'Berlin'}, ...)].replies[0].textisNone.meta.finish_reason: stop.Backfill spike (mutual-exclusivity check): six prompts spanning directive / ambiguous / arithmetic / unrelated-topic / literary. Across all six, never observed text content and tool-call deltas in the same chunk, nor text and
tool_callstogether in the finalChatMessage. The arithmetic prompt ("What is 2+2?") produced 99 chunks of pure text (98 text-chunks, 0 tool-chunks), confirming text streaming works as expected when the model elects not to use a tool.The change is documentation-only and does not introduce code changes; no unit-test additions apply.
Notes for the reviewer
docs(ollama): ....releasenotes/notes/streaming-with-tools-ollamachatgenerator-docs-8e339d62f38ebd06.yaml(single-entryenhancements, RST inline code, matches the shape of prior docs-only release notes).Checklist
docs:.docs-website/docs/.../*.mdxandreleasenotes/notes/*.yaml. Happy to run pre-commit if a maintainer flags anything.