Repository navigation
feat(gemini): switch the Gemini provider to the Interactions API - #5132
Merged
Merged
Conversation
rumpl
force-pushed
the
gemini-interactions-api
branch
from
December 4, 2026 23:46
c689421 to
64fe119
Compare
rumpl
force-pushed
the
gemini-interactions-api
branch
from
December 4, 2026 23:55
64fe119 to
5a5905b
Compare
rumpl
force-pushed
the
gemini-interactions-api
branch
from
December 5, 2026 00:01
5a5905b to
3cbbb25
Compare
Replace the generateContent implementation with the Interactions API so function call arguments stream incrementally to the runtime and TUI. - Requests are stateless (store: false) and replay the full history as Interactions steps; thought signatures are replayed as thought steps. - Function tools enable stream_function_call_arguments; argument deltas are forwarded as tool call deltas. - Pin the Gemini Developer API to v1beta, the only version accepting streamed function call arguments. Vertex AI keeps v1beta1. - Map interaction statuses to finish reasons, sum usage across automatic continuation hops and report the actual service tier. - Classify Interactions HTTP errors with status and Retry-After; SDK retries are disabled so the runtime owns retries and fallbacks. - Drop Gemini 2.5 support: token thinking budgets are ignored with a warning, and unsupported sampling parameters (frequency/presence penalty, top_k) are ignored with a warning. - Update docs, schema descriptions and examples accordingly. Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
rumpl
force-pushed
the
gemini-interactions-api
branch
from
December 5, 2026 00:21
3cbbb25 to
3655a4b
Compare
dgageot
approved these changes
Dec 5, 2026
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.
Summary
Replaces the Gemini provider's
generateContentimplementation with the Interactions API, which streams function call arguments (arguments_delta). Tool calls now show up in the TUI as soon as Gemini starts writing them, with arguments filling in as they stream.Changes
request.go,input.go,thinking.go): stateless requests (store: false) that replay the full history as Interactions steps. Leading system messages become the system instruction; later ones are sent assystem_inputsteps. Thought signatures are replayed asthoughtsteps. Tool results are sorted into call order and matched by the call ID Gemini assigned.stream.go, replacesadapter.go): mapsstep.start/step.delta/step.stop/interaction.*events to chat deltas. Function calls send their name first, then argument fragments. Interaction statuses map to finish reasons. Usage is summed across the SDK's automatic continuation hops and includes the service tier Google actually used. The request is sent on the firstRecv, so the runtime's idle timeout still covers the wait for the first byte.v1beta. The Interactions API is GA onv1, butstream_function_call_argumentsis still beta-only:v1rejects it with a 400, so streaming tool-call arguments needsv1beta. Once the field reachesv1, thegeminiAPIVersionconstant can switch back. Vertex AI keepsv1beta1.wrap.go): Interactions client/server errors becomeStatusErrorwithRetry-After. 400s keep the rejection categories. Malformed or unexpected tool calls still map toErrInvalidFunctionCall. SDK retries are disabled so the runtime owns retries and fallbacks.frequency_penalty,presence_penaltyandtop_kdon't exist in this API and are ignored with a warning.modelinfo.GeminiRejectsThinkingBudgetis removed.agent-schema.jsondescriptions and examples are updated.Notes for reviewers
/v1beta/interactions.generateContentreplay their thought signatures as base64thoughtsteps. This still needs manual verification against the live API.DOCKER_AGENT_RUN_GEMINI_INTEGRATION_TESTS=1, exceptTestCreateBatchEmbedding_VertexPredict, which already fails onmain.TestACPRuntimeConfig_ModelSwitchingIsSessionOwned(pkg/acp) also fails onmain; nothing in this PR touches it.