文件历史

提交图

2 次代码提交

作者 SHA1 备注 提交日期
Simon Willison 65b8e37c79 Ran Black 2026-04-21 21:10:13 -07:00
Simon Willison c629c133b7 Phase 5: CLI reasoning display
Add a display_stream_events() helper (plus async twin) that writes
text events to stdout and reasoning events to stderr in dim style,
with a newline inserted at reasoning→text transitions so the
assistant's final answer starts on a fresh visual line.

Add -R / --no-reasoning flag to both `llm prompt` and `llm chat` to
suppress the stderr reasoning stream. The sync and async streaming
paths in `llm prompt` and the streaming path in `llm chat` now
consume response.stream_events() / astream_events() through the
helper instead of plain iteration.

Conftest: MockModel and AsyncMockModel now set can_stream = True so
CLI tests exercising event-level behavior actually take the
streaming branch. This matches the fixtures' practical behavior —
they yield chunks, one at a time.

With only the built-in OpenAI plugin upgraded (Phase 4), no model
currently streams live reasoning text (OpenAI's reasoning is
redacted — just a token count). The machinery is ready for
llm-anthropic / llm-gemini upgrades to light up the experience.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 09:44:17 -07:00