Part of #1592
Scope
Add SSE streaming support for Gemini's streamGenerateContent endpoint.
Files to Modify
crates/zeph-llm/src/gemini.rs -- implement chat_stream(), update supports_streaming()
crates/zeph-llm/src/sse.rs -- add gemini_sse_to_stream() parser
Key Implementation Details
- Streaming endpoint:
POST /v1beta/models/{model}:streamGenerateContent?key={API_KEY}&alt=sse
- Each SSE
data: event contains a partial JSON response with full candidate structure
- Text is delivered incrementally in
candidates[0].content.parts[0].text
- Gemini 2.5 models emit thinking content as parts with
thought: true flag -- map to StreamChunk::Thinking
- Need to handle both text-only and thinking+text streaming
Acceptance Criteria
Part of #1592
Scope
Add SSE streaming support for Gemini's
streamGenerateContentendpoint.Files to Modify
crates/zeph-llm/src/gemini.rs-- implementchat_stream(), updatesupports_streaming()crates/zeph-llm/src/sse.rs-- addgemini_sse_to_stream()parserKey Implementation Details
POST /v1beta/models/{model}:streamGenerateContent?key={API_KEY}&alt=ssedata:event contains a partial JSON response with full candidate structurecandidates[0].content.parts[0].textthought: trueflag -- map toStreamChunk::ThinkingAcceptance Criteria
supports_streaming()returnstruechat_stream()produces correctStreamChunk::ContentitemsStreamChunk::Thinkingfor 2.5 modelsstatus_txevents emitted on retry