Skip to content

ui-react, ui-server: add Gemini 3.5 Transcribe Live dictation #3708

Closed

Description

@schlessera

Part of #3705.

Blocked by #3706

Context

Google's dedicated live transcription model is gemini-3.5-transcribe-live; the epic links its protocol, model and ephemeral-token docs, checked 2026-11-08. Use the approved transport/SMART/event contract from #3706. Source pointers verified on main a63e564f02f9b1ab0462bb0ac02dbf8ea6eacee7 on 2026-11-08; verify named anchors again at pickup.

Server/client entry points are (SpeechProvider, packages/ui-sdk/src/server/speech.ts:26-43), (AsrClient, packages/ui-sdk/src/client/asr.ts:21-30) and (registerAsrClients, packages/ui-react/src/voice/asr-clients.ts:16-41). (AsrEvent, packages/ui-sdk/src/protocol.ts:2024-2024) distinguishes partial/final text; (const start, packages/ui-react/src/voice/use-dictation.ts:52-123) commits final words to the unsent capture. Existing PCM capture is (openConversationMicrophone, packages/ui-react/src/voice/conversation-pcm.ts:4-60); inspect/reuse the concrete audio code where appropriate without coupling dictation to live-conversation state. Deepgram's MediaRecorder/encoded-container path is not PCM.

Scope

Add a server Gemini dictation provider and matching root-registered browser ASR client using the dedicated text-only Live Transcribe API. Support the documented SMART/VERBATIM configuration under the approved design, bounded existing vocabulary hints and language behavior. Gemini may be supplied as one provider through the existing by-value seam while multi-provider selection is delivered separately; do not introduce a dependency on the entire live-conversation UI.

Keep the long-lived Google credential on the server; mint the documented constrained ephemeral session credential and use the exact vendor browser authentication/setup protocol. Stream correctly resampled mono PCM16 audio, map distinct interim/final messages, and implement bounded final drain, hard stop, cancellation, provider-close and expiry/error cleanup.

Out of scope

Conversational Gemini/TTS, function/tool calls, screen/chat-history context, paid benchmarks, new packages/frameworks, Gemini non-streaming saved-recording transcription and replaying recordings through a live session.

Acceptance criteria

  • The model is explicitly gemini-3.5-transcribe-live, with text transcription setup and approved SMART/VERBATIM behavior. Verify current model/API/installed dependency shapes at pickup; do not reuse the existing audio conversation adapter as if it were this API.
  • Browser material contains only the bounded ephemeral credential/config. The permanent key never reaches bundles, responses, logs or errors. Server constraints bind the actual model/modality/approved configuration; expiry and resumption behavior are documented accurately.
  • Real browser capture produces correctly framed mono PCM16 at the documented sample rate, including non-16kHz hardware contexts. Chunk/buffer/network-backpressure budgets are explicit and bounded; no encoded WebM/Ogg is mislabeled as PCM.
  • Revising interim text cannot append duplicates; each finalized segment commits once. SMART corrections/formatting affect unsent dictation only, never prior sent chat/provider history. Vocabulary uses existing bounded keyterms, not arbitrary corpus/context upload.
  • Graceful Done flushes input/end signaling and waits for the approved final condition within a bounded timeout. Hard stop/cancel/unmount/superseded start releases tracks, AudioContext/worklet, timers, queues and socket; late events cannot mutate a replacement capture.
  • Provider-ended or failed capture retains already heard text through existing review/failure semantics exactly once. Missing keys, token expiry, model errors or disconnect never trigger another provider automatically.
  • savedAudio remains false/absent unless a genuine separate transcribeRecording implementation exists. Existing offline recording and receipt paths remain unchanged.
  • Run published SpeechProvider/AsrClient conformance, actual mounted-session integration and local WebSocket/real-browser capture proof. Mutations of final mapping, resampling/framing, credential constraints and teardown fail named intended assertions then pass after restoration.
  • Update authoring/user/contract documentation, public schemas or API reports as needed, and the published-behavior changeset. Record keyless proof as protocol/resource evidence, not vendor accuracy/latency qualification.

Verification

Use deterministic Odysseus audio/transcript fixtures and a loopback vendor-transport double under the offline guard. Run the focused SDK/server/client conformance and actual browser capture suites, typecheck/lint, affected provider-history guard and PR preflight. Real Google calls belong to #3710 after separate authorization.

Contract impact

New built-in/provider-client behavior, credential/session/configuration and any additive capability/type surface require same-commit authoritative contract docs, CONTRACT: and a minor changeset. Reuse current public seams and preserve third-party compatibility; load release guidance before any proposed shipping/dependency change.

Approved design (folded 2026-11-08 from #3706)

Follow the selectable-dictation plan §2, §6 and §9, and the maintainer's decision D1–D4. Binding specifics:

  • Built-in createGeminiSpeechProvider(apiKey), id gemini, registered when GEMINI_API_KEY is set (D3; read into VoiceConfig and documented in the env descriptor) and accepted by VOICE_PROVIDER=gemini. A key never makes Gemini the default unless it is the only registered provider. This can land over the legacy single selection before ui-server: register and resolve selectable dictation providers #3707.
  • Capabilities: streaming, interimResults and keyterms true; endpointing false (manual Done); smartTranscription true; no transcribeRecording, so savedAudio is false.
  • createSession makes a single REST call, POST https://generativelanguage.googleapis.com/v1beta/auth_tokens (x-goog-api-key), with uses: 1, newSessionExpireTime now+60 s, expireTime now+11 min, and liveConnectConstraints locking models/gemini-3.5-transcribe-live, responseModalities: ["TEXT"] and inputAudioTranscription { mode, customVocabulary }. mode is SMART unless the session option asks for verbatim (D1 default on). Vocabulary uses the existing keyterms, ≤100 terms of ≤64 UTF-8 bytes. Language is auto-detected. There is no SDK dependency and no session resumption: a take ends at Google's 10-minute limit through provider-ended.
  • The session URL is the server-minted wss://generativelanguage.googleapis.com/ws/google.ai.generativelanguage.v1alpha.GenerativeService.BidiGenerateContentConstrained. This is the SDK 2.24.0-observed path; the docs say v1beta, and ui-react: qualify Gemini dictation and provider switching on real devices #3710 resolves which applies. The client appends ?access_token=<token>.
  • Client GeminiAsrClient, registered as gemini in registerAsrClients: an AudioWorklet resamples the hardware rate to 16 kHz PCM16 LE. Share the worklet extracted from openConversationMicrophone, not its conversation state. Frames are 100 ms (3,200 B) base64 realtimeInput.audio. Pre-setupComplete buffering is capped at 5 s, with a 10 s handshake timeout. bufferedAmount > 256 KiB fails the take with a network error; audio is never silently dropped.
  • Events: interimInputTranscription.text → partial (replace). inputTranscription.text → one final with endsTurn: finished ?? true, which clears the partial. Done sends audioStreamEnd and waits up to 3 s for finished/turnComplete. Hard stop releases tracks, context, worklet, timers, queue and socket.
  • Errors never echo the key or Google's text. Session failure gives 500 { error: "Gemini dictation session failed" }, and no other provider is tried.
  • Mutations (§9): final mapped as partial, resampler bypassed, constraint lock removed, teardown skipping context.close().

Readiness

The approved transport, event and mode contract is folded in above. Ready once #3706 closes. No unresolved ruling remains.

Activity

  1. added
    type: feat
    area: ui-sdk
    area: ui-server
    area: ui-react
    priority: p2
    blocked
    contract
    on Nov 8, 2026
  2. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    2026-11-08: Folded the approved #3706 design (maintainer rulings D1–D4, schemas, states and proof split) into this body under Approved design. Source pointers were re-verified at main a63e564f0. Design PR: #3713.

  3. self-assigned this
    on Nov 8, 2026
  4. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    Claiming (claim token wi-3708-d12e), branch feat/3708-gemini-dictation. The approved design is folded in from #3706 (PR #3713). This issue owns the optional SDK fields (smartTranscription, mode, label/destination); #3707 consumes them.

  5. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    Unblocked: #3706 is closed, so scripts/sync-project.ts is removing the blocked label.

  6. removed
    blocked
    on Nov 8, 2026
  7. added 2 commits that reference this issue on Nov 8, 2026
  8. added this to the 0.45.0 milestone on Nov 8, 2026
  9. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    Delivered by #3717, squash 723280e on main, milestone 0.45.0. It adds the built-in gemini dictation provider and its browser GeminiAsrClient:

    • Credentials: a single-use ephemeral token minted on the server, locked by bidiGenerateContentSetup + fieldMask to gemini-3.5-transcribe-live, TEXT output and the transcription config. The REST body is checked against @google/genai 2.24.0's own serializer.
    • Audio and text: 16 kHz PCM16 in 100 ms frames, resampled from the hardware rate. SMART or VERBATIM via the registry's mode. Interim text replaces the partial and each final commits once.
    • Done: flushes the worklet tail, then drains within a bounded time. An abnormal close during Done surfaces through the retained-text notice.
    • Registration: under the ui-server: register and resolve selectable dictation providers #3707 registry (ruling D3). Built-ins now disclose a label and destination.

    Proof: independent review by gpt-6-astra; three findings fixed with failing-first and mutation receipts (see PR). Candidate run 42509003401 passed. Whether Google accepts the token, which endpoint version applies, SMART output and device behaviour remain for #3710.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: ui-reactarea: ui-sdkarea: ui-servercontractpriority: p2type: feat

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions