Skip to content

feat(gemini): Phase 2 -- SSE streaming support#1617

Merged
bug-ops merged 1 commit intomainfrom
feat-gemini-phase-2-streaming
Mar 13, 2026
Merged

feat(gemini): Phase 2 -- SSE streaming support#1617
bug-ops merged 1 commit intomainfrom
feat-gemini-phase-2-streaming

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 13, 2026

Part of #1592, closes #1594.

Summary

  • chat_stream() implemented using Gemini's streamGenerateContent?alt=sse endpoint
  • supports_streaming() returns true
  • Gemini 2.5 thinking parts (thought: true) emitted as StreamChunk::Thinking; text parts as StreamChunk::Content
  • GeminiProvider gains status_tx: Option<StatusTx> with with_status_tx() / set_status_tx() builders
  • AnyProvider::set_status_tx() Gemini arm no longer a no-op
  • Both streaming and non-streaming paths use status_tx for retry notifications
  • API key passed via x-goog-api-key header in all paths (never in URL query params)
  • 10 new unit tests covering text, thinking, empty, no-candidates, invalid JSON, multi-part, and HTTP error paths

Files Changed

  • crates/zeph-llm/src/sse.rsgemini_sse_to_stream(), parse_gemini_sse_event(), 4 Gemini SSE types, 7 unit tests
  • crates/zeph-llm/src/gemini.rsstatus_tx field, builders, send_stream_request(), chat_stream() and supports_streaming() updated, 3 tests updated/added
  • crates/zeph-llm/src/any.rs — Gemini arm in set_status_tx() now propagates sender
  • CHANGELOG.md — Phase 2 entry added to [Unreleased]

Test Plan

  • cargo +nightly fmt --check passes
  • cargo clippy --workspace --features full -- -D warnings passes (0 warnings)
  • cargo nextest run --config-file .github/nextest.toml --workspace --features full --lib --bins — 5169 passed, 11 skipped, 0 failed
  • All 5 acceptance criteria from feat(gemini): Phase 2 -- streaming support (SSE) #1594 verified

@github-actions github-actions bot added documentation Improvements or additions to documentation llm zeph-llm crate (Ollama, Claude) rust Rust code changes enhancement New feature or request size/L Large PR (201-500 lines) labels Mar 13, 2026
Implement chat_stream() for GeminiProvider using the
streamGenerateContent?alt=sse endpoint.

- Add gemini_sse_to_stream() and parse_gemini_sse_event() to sse.rs
  with four Gemini-specific SSE types
- Thinking parts (thought: true) mapped to StreamChunk::Thinking;
  plain text parts mapped to StreamChunk::Content
- GeminiProvider gains status_tx field with with_status_tx() /
  set_status_tx() builders; AnyProvider::set_status_tx() now
  propagates to the Gemini arm
- Both send_request() and send_stream_request() pass status_tx to
  send_with_retry() for consistent retry notifications
- API key passed via x-goog-api-key header in all paths
- supports_streaming() returns true
- 10 new unit tests in sse.rs and gemini.rs

Part of epic #1592, closes #1594
@bug-ops bug-ops force-pushed the feat-gemini-phase-2-streaming branch from 0b5a7a8 to aca86d4 Compare March 13, 2026 14:48
@bug-ops bug-ops enabled auto-merge (squash) March 13, 2026 14:48
@bug-ops bug-ops merged commit 82c206f into main Mar 13, 2026
15 checks passed
@bug-ops bug-ops deleted the feat-gemini-phase-2-streaming branch March 13, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request llm zeph-llm crate (Ollama, Claude) rust Rust code changes size/L Large PR (201-500 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(gemini): Phase 2 -- streaming support (SSE)

1 participant