feat(gemini): Phase 2 -- SSE streaming support#1617
Merged
Conversation
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
0b5a7a8 to
aca86d4
Compare
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.
Part of #1592, closes #1594.
Summary
chat_stream()implemented using Gemini'sstreamGenerateContent?alt=sseendpointsupports_streaming()returnstruethought: true) emitted asStreamChunk::Thinking; text parts asStreamChunk::ContentGeminiProvidergainsstatus_tx: Option<StatusTx>withwith_status_tx()/set_status_tx()buildersAnyProvider::set_status_tx()Gemini arm no longer a no-opstatus_txfor retry notificationsx-goog-api-keyheader in all paths (never in URL query params)Files Changed
crates/zeph-llm/src/sse.rs—gemini_sse_to_stream(),parse_gemini_sse_event(), 4 Gemini SSE types, 7 unit testscrates/zeph-llm/src/gemini.rs—status_txfield, builders,send_stream_request(),chat_stream()andsupports_streaming()updated, 3 tests updated/addedcrates/zeph-llm/src/any.rs— Gemini arm inset_status_tx()now propagates senderCHANGELOG.md— Phase 2 entry added to[Unreleased]Test Plan
cargo +nightly fmt --checkpassescargo clippy --workspace --features full -- -D warningspasses (0 warnings)cargo nextest run --config-file .github/nextest.toml --workspace --features full --lib --bins— 5169 passed, 11 skipped, 0 failed