Skip to content

feat(gemini): Phase 4 — SSE streaming tool use (functionCall chunks)#1767

Merged
bug-ops merged 3 commits intomainfrom
feat-gemini-phase-4-sse-stream
Mar 14, 2026
Merged

feat(gemini): Phase 4 — SSE streaming tool use (functionCall chunks)#1767
bug-ops merged 3 commits intomainfrom
feat-gemini-phase-4-sse-stream

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

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

Summary

Extends the Gemini SSE parser to handle functionCall parts streamed by the Gemini API, resolving the TODO added in #1639.

  • Add GeminiStreamFunctionCall { name, args } struct in sse.rs with cross-reference to GeminiFunctionCall in gemini.rs
  • Add function_call: Option<GeminiStreamFunctionCall> to GeminiStreamPart with #[serde(rename = "functionCall")]
  • Update parse_gemini_sse_event() to collect functionCall parts and emit StreamChunk::ToolUse(Vec<ToolUseRequest>) — single-pass, no accumulator needed (Gemini delivers each functionCall as a complete atomic object per SSE event)
  • Add StreamChunk::ToolUse(Vec<ToolUseRequest>) variant to provider.rs
  • Handle new variant in router/mod.rs (ignored in cascade stream) and legacy.rs (tracing::warn! with tool names — tool execution uses chat_with_tools, not the streaming path)
  • Add 8 unit tests covering: single call, multiple calls, no args, explicit null args, mixed text+call, thinking+call, empty name, text-only regression
  • Remove TODO comment from feat(gemini): SSE streaming path silently drops functionCall chunks #1639

Resolves #1659. Part of epic #1592.

Test plan

  • cargo nextest run -p zeph-llm — 713/713 pass (8 new tests)
  • cargo clippy --workspace --features full -- -D warnings — 0 warnings
  • cargo +nightly fmt --check — clean
  • cargo nextest run --config-file .github/nextest.toml --workspace --features full --lib --bins — 5516/5516 pass

bug-ops added 2 commits March 14, 2026 18:44
)

Extend the Gemini SSE parser to handle `functionCall` parts streamed by
the Gemini API, resolving the TODO added in #1639.

- Add `GeminiStreamFunctionCall { name, args }` struct to `sse.rs`
- Add `function_call: Option<GeminiStreamFunctionCall>` to `GeminiStreamPart`
- Update `parse_gemini_sse_event()` to collect functionCall parts and emit
  `StreamChunk::ToolUse(Vec<ToolUseRequest>)` — single-pass, no accumulator
  needed (Gemini delivers each functionCall as a complete atomic object)
- Add `StreamChunk::ToolUse(Vec<ToolUseRequest>)` variant to `provider.rs`
- Handle new variant in `router/mod.rs` (ignore in cascade stream) and
  `legacy.rs` (warn-log with tool names, not handled in streaming path)
- Add 8 unit tests covering single/multiple/no-args/null-args/mixed/
  thinking/empty-name/text-regression cases
- Remove TODO comment from #1639

Resolves #1659. Part of epic #1592.
@github-actions github-actions bot added enhancement New feature or request size/M Medium PR (51-200 lines) documentation Improvements or additions to documentation llm zeph-llm crate (Ollama, Claude) rust Rust code changes core zeph-core crate and removed size/M Medium PR (51-200 lines) labels Mar 14, 2026
@bug-ops bug-ops enabled auto-merge (squash) March 14, 2026 17:48
@github-actions github-actions bot added the size/M Medium PR (51-200 lines) label Mar 14, 2026
@bug-ops bug-ops merged commit 66c2528 into main Mar 14, 2026
15 checks passed
@bug-ops bug-ops deleted the feat-gemini-phase-4-sse-stream branch March 14, 2026 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core zeph-core crate documentation Improvements or additions to documentation enhancement New feature or request llm zeph-llm crate (Ollama, Claude) rust Rust code changes size/M Medium PR (51-200 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(gemini): Phase 4 — SSE streaming tool use (functionCall chunks)

1 participant