fancy-kitchen-89125
05/27/2026, 7:06 AMtall-airline-16756
05/27/2026, 7:06 AMtall-airline-16756
05/27/2026, 7:06 AMsession.say() when using the Gemini realtime model. Here's the concise guidance and recommended options.
Key facts
• Gemini realtime does not support session.say() directly because realtime models generate audio natively and don't use the scripted TTS call.
• You can still have an initial spoken reply from Gemini by using generate_reply() with an instructions prompt or by setting session-level instructions that instruct the model to greet the user at session start.
Options
• Immediate spoken first message (no session.say()):
1. Start the session with instructions that cause an immediate greeting:
session = AgentSession(
llm=google.realtime.RealtimeModel(
instructions="You are a helpful assistant. Greet the user when the session starts."
)
)
# or
session.generate_reply(instructions="Greet the user with 'Hello, how can I help you today?'")
• Use session.say() behavior (text → TTS) — if you need scripted control over speech:
1. Configure Gemini in text-only mode and attach a separate TTS engine:
session = AgentSession(
llm=google.realtime.RealtimeModel(modalities=["TEXT"]),
tts="cartesia/sonic-3"
)
# Then:
session.say("Hello, how can I help you today?")
1. This keeps realtime understanding but uses the external TTS for deterministic/scripting needs.
Which should you use?
• If you want Gemini to start speaking naturally and react in realtime: use generate_reply() or session instructions.
• If you need exact scripted phrases (controlled TTS output) or want to call session.say() programmatically: use Gemini in TEXT modality + external TTS.
If you want, tell me which environment/language you’re using (Python, TypeScript, or other) and whether you need deterministic scripted phrases or adaptive realtime speech — I’ll provide exact code for that path.
Sources: Realtime models overview | LiveKit Documentation | Agent speech and audio | LiveKit Documentation | Gemini Live API plugin | LiveKit Documentation, with interactive elements