Skip to content

Commit c773698

Browse files
authored
docs(google): clarify Gemini 3.1 realtime limitations (#1198)
1 parent 94f2795 commit c773698

3 files changed

Lines changed: 22 additions & 6 deletions

File tree

plugins/google/README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ To use the Gemini realtime model or TTS (Beta)
4141
```typescript
4242
import * as google from '@livekit/agents-plugin-google';
4343

44-
const realtimeModel = new google.beta.realtime.RealtimeModel()
44+
const realtimeModel = new google.beta.realtime.RealtimeModel({
45+
model: 'gemini-2.5-flash-native-audio-preview-12-2025',
46+
})
4547
const geminiTTS = new google.beta.TTS(),
4648
```
4749

@@ -60,6 +62,18 @@ const geminiTTS = new google.beta.TTS(),
6062
- `gemini-2.0-flash-exp` - Latest experimental model
6163
- And more (see models.ts for full list)
6264

65+
### Realtime Model Notes
66+
67+
- `gemini-3.1-flash-live-preview` is supported as a realtime model, but `generateReply()` is not currently compatible with it.
68+
- This matters for `voice.AgentSession` flows that rely on programmatic reply generation, such as explicit post-tool continuation, greetings, reconnect replies, and other server-triggered follow-up turns.
69+
- If your voice-agent flow depends on `generateReply()`, prefer a Gemini 2.5 native-audio live model for now.
70+
71+
### Thinking Configuration
72+
73+
- `thinkingConfig` is model-specific.
74+
- Gemini 3.1 live models use `thinkingLevel` such as `minimal`, `low`, `medium`, and `high`.
75+
- Gemini 2.5 live models use `thinkingBudget`.
76+
6377
### Advanced Configuration
6478

6579
```typescript

plugins/google/src/beta/realtime/realtime_api.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ export class RealtimeModel extends llm.RealtimeModel {
288288
/**
289289
* Thinking configuration for native audio models.
290290
* If not set, the model's default thinking behavior is used.
291-
* Use `\{ thinkingBudget: 0 \}` to disable thinking.
292-
* Use `\{ thinkingBudget: -1 \}` for automatic/dynamic thinking.
291+
* Gemini 3.1 live models use `thinkingLevel`.
292+
* Gemini 2.5 live models use `thinkingBudget`.
293293
*/
294294
thinkingConfig?: types.ThinkingConfig;
295295
} = {},
@@ -698,9 +698,11 @@ export class RealtimeSession extends llm.RealtimeSession {
698698
async generateReply(instructions?: string): Promise<llm.GenerationCreatedEvent> {
699699
if (this.options.model === 'gemini-3.1-flash-live-preview') {
700700
this.#logger.warn(
701-
'generateReply is not compatible with gemini-3.1-flash-live-preview and will be ignored.',
701+
'generateReply is not compatible with gemini-3.1-flash-live-preview. Use a Gemini 2.5 live model for voice-agent flows that require programmatic reply generation.',
702+
);
703+
throw new Error(
704+
"generateReply is not compatible with 'gemini-3.1-flash-live-preview'; use a Gemini 2.5 live model for voice-agent flows that require programmatic reply generation.",
702705
);
703-
throw new Error("generateReply is not compatible with 'gemini-3.1-flash-live-preview'");
704706
}
705707

706708
if (this.pendingGenerationFut && !this.pendingGenerationFut.done) {

plugins/google/src/llm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export class LLM extends llm.LLM {
8080
* @param presencePenalty - Penalizes the model for generating previously mentioned concepts. Defaults to undefined.
8181
* @param frequencyPenalty - Penalizes the model for repeating words. Defaults to undefined.
8282
* @param toolChoice - Specifies whether to use tools during response generation. Defaults to "auto".
83-
* @param thinkingConfig - The thinking configuration for response generation. Defaults to undefined.
83+
* @param thinkingConfig - The thinking configuration for response generation. Gemini 3.1 models use `thinkingLevel`; Gemini 2.5 models use `thinkingBudget`. Defaults to undefined.
8484
* @param automaticFunctionCallingConfig - The automatic function calling configuration for response generation. Defaults to undefined.
8585
* @param geminiTools - The Gemini-specific tools to use for the session.
8686
* @param httpOptions - The HTTP options to use for the session.

0 commit comments

Comments
 (0)