-
Notifications
You must be signed in to change notification settings - Fork 2
feat(gemini): Phase 4 — SSE streaming tool use (functionCall chunks) #1659
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Part of epic #1592 (Gemini provider).
Follow-up from #1639 (SSE TODO). Currently chat_with_tools() uses the non-streaming Gemini endpoint (generateContent), so tool calls work correctly. However, GeminiStreamPart in crates/zeph-llm/src/sse.rs does not have a function_call field — if a future caller uses the SSE path while tools are active, functionCall chunks will be silently dropped.
Goal
Extend the Gemini SSE parser to handle functionCall parts streamed by the Gemini API.
Required Changes
- Add
function_call: Option<GeminiFunctionCall>field toGeminiStreamPartinsse.rs. - Define
GeminiFunctionCall { name: String, args: serde_json::Value }. - In
parse_gemini_sse_event(), accumulatefunctionCallparts across streaming chunks and emit them asStreamChunk::ToolCall(or equivalent) once complete. - Wire accumulated tool calls into
gemini_sse_to_stream()/chat_stream()output. - Update
chat_with_tools()to optionally use SSE for tool-use sessions. - Add unit tests covering streamed
functionCallchunks.
Acceptance Criteria
cargo nextest run -p zeph-llmpasses with new SSE tool-use tests.- A real Gemini session with tools via SSE produces correct
ToolUseresponses. - The TODO comment added in feat(gemini): SSE streaming path silently drops functionCall chunks #1639 is removed.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request