Repository navigation
feat(core): add a google_interactions dialect for the Gemini Interactions API - #249
Closed
ethan-scitix wants to merge 1 commit into
Closed
ethan-scitix wants to merge 1 commit into
ethan-scitix wants to merge 1 commit into
Conversation
…ions API
Google made the Interactions API (`POST /{v1,v1beta}/interactions`) GA and
recommends it for new work; new Gemini models and features launch there. It
sits beside `google_genai` (generateContent), not in place of it: the
Interactions GenerationConfig has no candidate count, no top_k, no penalties
and no logprobs, so those requests are refused before any I/O and stay on
`google_genai`.
- Every request sends `store: false`. Google otherwise retains the prompt and
reply server-side by default (55 days paid). The flag is re-checked on the
final HTTP body, together with the bound model and the absence of
`background` / `previous_interaction_id` / `agent`, and recorded in
`request_params`.
- Multi-turn is stateless (store=false disables previous_interaction_id):
history is resent as `user_input` / `model_output` / `function_call` /
`function_result` steps, and signed `thought` steps round-trip verbatim
through `opaque_continuation`.
- Supported: text + image input, function tools and tool choice, JSON output
(`response_format`), `thinking_level`, `thinking_summaries`, temperature,
top_p, max_tokens, stop, seed, streaming (step.start/delta/stop events,
streamed function arguments reassembled).
- The interaction `status` is the finish reason, recorded verbatim.
`incomplete` counts toward `n_truncated`; it covers a budget and a policy
stop alike. `failed` fails the sample with Google's message.
- Usage: input = total_input_tokens + total_tool_use_tokens, output =
total_output_tokens + total_thought_tokens, the same split as google_genai.
- No model-family limits (#151) and no provider_enforced capabilities: none
was measured on this endpoint.
The wire shapes come from the Interactions API reference and the typed models
in google-genai 2.33.0. The scitix gateway does not proxy `/interactions` (404
on v1 and v1beta, while generateContent answers 200 on the same key), so this
is not live-verified.
Closes #152
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
7 tasks done
9 tasks done
Collaborator
Author
|
Superseded by #263, which covers everything here (same pre-I/O refusals, Note: this PR said |
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.
Type
Summary
dialect: google_interactionsfor Gemini's Interactions API (POST /{v1,v1beta}/interactions), besidegoogle_genai(generateContent), as [Feature]: google_interactions dialect for the Gemini Interactions API #152 proposes. Interactions has no candidate count,top_k, penalties or logprobs, so those requests are refused before any I/O and stay ongoogle_genai.store: falseon every request. Google otherwise retains prompt and reply server-side by default (55 days paid). The final HTTP body is re-checked forstore: false, the boundmodel, and the absence ofbackground/previous_interaction_id/agent.storeis recorded inrequest_params, and no dialect option may override it.store: falsedisablesprevious_interaction_id. History is resent asuser_input/model_output/function_call/function_resultsteps. Signedthoughtsteps round-trip verbatim throughopaque_continuation.response_format,thinking_level,thinking_summaries,temperature,top_p,max_tokens,stop,seed, and streaming (step.start/step.delta/step.stop, with streamed function arguments reassembled). Hosted tools are not lifted yet and are refused.statusis the finish reason, recorded verbatim.incompleteis added to then_truncatedspellings incore/utils/meta.py. As the issue notes, the record cannot tell a budget stop from a policy stop.requires_actionis a function call;failedfails the sample with Google's message.total_input_tokens + total_tool_use_tokensand output =total_output_tokens + total_thought_tokens, the same split asgoogle_genai.reasoning_tokensstays a breakdown ofoutput_tokens(cf. the feat(models): add native Google GenAI generateContent dialect #147 accounting fix).provider_enforced_capabilities, since none was measured on this endpoint.google-genai2.33.0 (_gaos/types/interactions):GenerationConfigdoes havetemperatureandtop_p, though both are marked deprecated there.Usage.total_output_tokensdocuments only "generated responses", withtotal_thought_tokensseparate. Folding thoughts in mirrors generateContent's verified behaviour but is not live-verified here.RESULT_SCHEMA_VERSIONandIDENTITY_SCHEMAare unchanged. No existing dialect emits a bareincompletefinish reason (openai_responsesrecordsincomplete_details.reason), so existing counts are unaffected.Risk: the dialect is not live-verified. The scitix gateway does not proxy
/interactions:POST .../v1beta/interactionsand.../v1/interactionsboth return 404, whilegenerateContenton the same key returns 200; probed 2026-10-27. Wire shapes come from the API reference and the SDK models. A first run againstgenerativelanguage.googleapis.comshould confirm the usage split and the streaming event order.Related Issues
Closes #152. Refs #147, #151.
Test Plan
Automated
ruff check && ruff format --check): all checks passed, 687 files formattedty check(sieval + tests), all checks passedpytest tests/unit tests/integration -n 8, 10127 passed, 1 skippedtests/unit/core/models/dialects/test_google_interactions.py: 153 tests; coverage ofgoogle_interactions.pyis 96%{"", /v1, /v1beta}; the CLIapi_key_envtest assertsx-goog-api-keyon the wirescripts/check_preflight.py,check_layer_imports.py,sync_package_stubs.py --check: all passManual
/interactions404 on both versions;generateContentcontrol 200generativelanguage.googleapis.comwith a Gemini key: not done, since no key is available in this environmentChecklist
Required (all PRs)
type(scope): description)AI-Generated Code - <model> (<provider>)in module docstringcore/🤖 Generated with Claude Code