Skip to content

feat(models): add native Google Interactions support - #263

Merged
ethan-scitix merged 5 commits into
scitix:mainfrom
jack-scitix-ai:feat/gemini-interactions-api
Oct 28, 2026
Merged

ethan-scitix merged 5 commits into
scitix:mainfrom
jack-scitix-ai:feat/gemini-interactions-api

Conversation

@jack-scitix-ai

@jack-scitix-ai jack-scitix-ai commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Type

  • feature — new capability

Summary

  • Add the native google_interactions dialect alongside google_genai, using the existing provider-neutral HTTP connection and dialect registry.
  • Support text, images, function tools, structured JSON output, Google Search, URL context, citations, and streaming.
  • Require Boolean store: false on every request. Support stateless, client-side opaque continuation through signed native-step history, system-instruction replay, and typed persistence.
  • Validate tool-result content and annotations before HTTP, infer function-result names from matching calls, and independently audit serialized input and opaque-history replay.
  • Preserve provider text and thought summaries verbatim. Accept signature-only thoughts without weakening content validation or terminal-step reconciliation.
  • Normalize usage accounting, preserve cumulative delta-usage fallback, and reject malformed provided counters rather than silently treating them as missing.
  • Normalize HTTP-envelope body.stream in shared request-definition hashing, distinguishing Interactions streaming from non-streaming requests while preserving existing GenerateContent path/query handling.
  • Keep model-profile capability gates intact and expose consistent legacy capability metadata for function calling, hosted tools, and structured output.
  • Introduce no new dependencies or result-directory layout changes. RESULT_SCHEMA_VERSION remains 1; upstream identity schema 5 is preserved.

Related Issues

Closes #152. Refs #25.

Related implementation: #249.

Test Plan

Automated

  • Lint/format clean (ruff check && ruff format --check)
  • Type check clean (ty check or mypy --strict)
  • Unit tests pass (pdm run pytest)

Manual

  • Complete the real-service validation matrix against generativelanguage.googleapis.com on October 28, 2026.

Tested model: gemini-3.6-flash, reported as 3.6-flash-07-2026 in model metadata. Both POST /v1beta/interactions and POST /v1/interactions returned successful responses.

The final matrix passed 30 verification scenarios, representing 33 generation requests, excluding earlier diagnostic/probe iterations. Guard-only scenarios deliberately made no provider request.

Area Verification
Text and streaming Non-streaming and streaming replies, completed and budget-limited incomplete responses, and explicit stop sequences
Sampling and reasoning Temperature, top-p, and seed accepted; minimal, low, medium, and high effort; summary none and auto; verbatim multi-item summaries and signature-only thoughts
Opaque continuation Two-turn non-streaming and streaming replay, exact native-history prefixes, and system-instruction preservation
Persistence Serialize a live reasoning result, reload it with type metadata, and use its opaque continuation in a subsequent real request
Function calling Auto, required, none, and named-function choices; multiple streamed calls with separate tool-result messages
Function results String, object, annotated text, type-only citation annotation, image content, and is_error: true
Structured output and images Schema-shaped JSON in both response modes; inline and URI image inputs; image content returned by a function
Hosted tools Google Search and URL context in both response modes, with actual call/result evidence and citations
Accounting Observed token arithmetic includes thoughts in IR output and tool-use tokens in IR input; cache counters remain breakdowns
Public binding and guards Ordinary YAML binding followed by Model.agenerate(ChatInput(...)) in both response modes, without injected capability outcomes; invalid storage/stateful/background settings rejected before HTTP

Every transmitted request was checked for Boolean store: false and the absence of previous_interaction_id, background, and agent.

Detailed evidence, accounting examples, and validation limits are recorded in tests/unit/core/models/dialects/fixtures/google_interactions/live_validation.md:1.

Rebase preserved the validated Interactions dialect source and captured JSON/SSE bytes. The automated checks above were rerun afterward; no additional live API requests were made for the rebase verification.

Live-test findings and validation scope

  • Live responses sometimes omit visible summaries under thinking_summaries: auto while providing a thought signature. This is accepted and covered by four live SSE fixtures, while contradictory content still fails.
  • One response after an errored tool result emitted a function call despite tool_choice: none. The client correctly rejected it; the sanitized response is retained as a negative regression fixture.
  • Live terminal events omitted steps. Optional terminal-step reconciliation and metadata-only usage fallback are covered by deterministic tests, not claimed as observed live behaviors.
  • Accepted sampling parameters do not establish statistical seed determinism. Live validation is specific to the tested model and service versions.
  • Capability-dependent public Model requests retain the existing model-profile requirements. Standalone dialect tests do not bypass those gates.

Checklist

Required (all PRs)

  • PR title follows conventional format (type(scope): description)
  • No internal paths, credentials, or personal info in committed files
  • AI-generated code has AI-Generated Code - <model> (<provider>) in module docstring
  • No new upper-layer dependencies added to core/
  • Deleted code verified — no remaining call sites depend on it

Implement POST /v1beta/interactions and /v1/interactions through the
existing async_http_json connection without changing google_genai.
Keep the upstream SGLang/vLLM registrations and tests intact.

Lower chat messages and tool exchanges into native steps. Support text
and image input, function and hosted tools, structured JSON, reasoning
summaries, citations and streamed response lifting.

Enforce store=false and reject server-side continuation, background
execution and agent selection before HTTP. Audit input/output contracts
and fail on malformed or contradictory streamed evidence.

Recognize HTTP-envelope body.stream in shared request definitions and
classify native incomplete replies as truncation. Keep result schema
version 1 and the upstream identity schema unchanged.

Add versioned wire, dialect-contract and resume integration tests,
plus usage/digest regression coverage and user-facing documentation.

Refs: scitix#25, scitix#152
Round-trip native steps, thought signatures and system instructions
through ReasoningOutput.opaque_roundtrip. Audit replayed history and
serialized requests independently, and enforce instruction consistency.

Infer function-result names from matching calls, including opaque
history. Align legacy FunctionCalling, StructuredOutput and ServerTools
with capability decisions without bypassing model-profile gates.

Treat step.delta.metadata.total_usage as a cumulative fallback. Replace
rather than sum observations, prefer terminal usage and reject malformed
provided counters, including explicit null.

Accept signature-only thoughts when thinking_summaries=auto omits
visible summaries. Preserve content and snapshot-consistency guards,
including rejection of provider calls violating tool_choice=none.

Publish sanitized live captures for gemini-3.6-flash and document the
30-scenario matrix (33 generation requests). Validation is single-model;
optional terminal snapshots and metadata-only usage fallback remain
deterministic tests, not claimed as observed live responses.

Validate after rebase: 10897 unit/integration tests passed, 29 skipped;
repository Ruff checks and scoped type checks passed; quick preflight
reported 26 PASS and 1 SKIP (deep HTTP reachability).
Trace the shared HTTP-envelope body.stream request-definition change
in CHANGELOG, including preservation of GenerateContent path/query
stream detection.

Keep only post-rebase automated results in the live validation record.
Clarify that the validated dialect and JSON/SSE captures were preserved
during rebase, without claiming additional live calls or coverage runs.

Validate the documentation-only changes with 139 request-metadata unit
tests passed and 1 skipped, documentation consistency checks, quick
preflight (26 PASS, 1 SKIP), and git diff --check.
Exclude only Google Interactions SSE fixtures from EOF normalization, keeping all other hook selections unchanged.

Add six final-frame separator regressions and update fixture documentation and validation records. Production code and captured SSE bytes remain unchanged.

Validation: all CI-equivalent pre-commit hooks passed; unit/integration tests: 10903 passed, 29 skipped; quick preflight: 26 passed, 1 skipped.
@ethan-scitix

Copy link
Copy Markdown
Collaborator

#249 has been closed as superseded by this PR. It carried Closes #152; could you change Refs #25, #152. in the description to Closes #152. Refs #25. so #152 closes when this merges?

…ons docs

Move the strict JSON helpers that google_genai and google_interactions
both carried byte-for-byte into dialects/_google_json.py, so the two
Google dialects reject duplicate keys and non-finite constants through
one implementation.

Drop the [Unreleased] CHANGELOG block: entries are written at release
time, and most of its bullets described fixes to code this PR adds.

Trim the Interactions guide section, the fixtures README and verbose
docstrings, and drop live_validation.md; the PR description keeps the
live matrix. The guide now states that, through a YAML config, only
plain text, streaming and dialect_options work today, uses the
validated gemini-3.6-flash in its example, and no longer calls failed
or budget_exceeded non-terminal.

No behavior change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ethan-scitix
ethan-scitix merged commit 76722c5 into scitix:main Oct 28, 2026
9 checks passed
@ethan-scitix ethan-scitix mentioned this pull request Oct 28, 2026
7 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: google_interactions dialect for the Gemini Interactions API

2 participants