Skip to content

Stream chat replies as they are generated - #3

Merged
isaiahagi merged 6 commits into
mainfrom
feat/stream-replies
Nov 29, 2026
Merged

isaiahagi merged 6 commits into
mainfrom
feat/stream-replies

Conversation

@isaiahagi

Copy link
Copy Markdown
Owner

What

  • Chat replies are shown as the model generates them, for Ollama and for OpenAI-compatible servers
  • Fragmented tool calls are joined back together, with or without an index
  • <think> blocks stay hidden even when a tag is split between pieces
  • A reply that stops early is reported as an error instead of being treated as complete
  • --no-stream restores the old behavior

Why

Without a GPU a reply can take minutes, and the terminal looked frozen.

Testing

Unit tests for both stream formats, plus a real run of qwen3:4b-instruct through Ollama's native API and its OpenAI-compatible API, each streaming a tool call and an answer. The OpenAI run stands in for LM Studio, which has not been tested directly.

🤖 Generated with Claude Code

isaiahagi and others added 6 commits November 29, 2026 14:56
Run the Python tests on three operating systems with Python 3.10 and 3.13,
build and install the package, and check that every file in the Unity
package has a .meta file.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Ask Ollama for each model's capabilities. The model picker hides models
that cannot call tools, naming one with --model explains the problem and
suggests others, and doctor lists both groups.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Read Ollama's line-delimited chunks and OpenAI-style server-sent events,
join fragmented tool calls, hide <think> blocks, and report a reply that
stops early. --no-stream restores the old behavior.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
# Conflicts:
#	src/unity_local_mcp/providers.py
#	tests/test_chat.py
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@isaiahagi
isaiahagi merged commit ddc204a into main Nov 29, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant