Skip to content

Commit 4fe1b21

Browse files
committed
Restore Google Live invariant comments
1 parent a29361d commit 4fe1b21

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎extensions/google/realtime-voice-provider.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ function resolveEnvApiKey(): string | undefined {
261261
return trimToUndefined(process.env.GEMINI_API_KEY) ?? trimToUndefined(process.env.GOOGLE_API_KEY);
262262
}
263263

264+
// Gemini 3.1 Live replaces client-content text and async tools with realtime text
265+
// and sequential function responses; explicit older models keep their prior contract.
264266
function isGemini31LiveModel(model: string): boolean {
265267
const modelId = model.startsWith("models/") ? model.slice("models/".length) : model;
266268
return modelId.startsWith("gemini-3.1-") && modelId.includes("-live");
@@ -335,6 +337,8 @@ function buildFunctionDeclarations(
335337
omitted += 1;
336338
continue;
337339
}
340+
// Live preview models honor the OpenAPI `parameters` field; the SDK normalizes
341+
// our lowercase JSON Schema types before sending the mutually exclusive field.
338342
const declaration: FunctionDeclaration = {
339343
name,
340344
description: tool.description,
@@ -485,6 +489,8 @@ class GoogleRealtimeVoiceBridge implements RealtimeVoiceBridge {
485489
const canResumeSession =
486490
this.config.sessionResumption !== false && Boolean(this.resumptionHandle);
487491
if (this.hasConnectedSession && !canResumeSession) {
492+
// An unfinished recognition hypothesis cannot cross into a fresh server session.
493+
// Dropping it avoids treating a transport break as a completed user utterance.
488494
this.resetPendingTranscripts();
489495
}
490496
this.intentionallyClosed = false;

0 commit comments

Comments
 (0)