using the google.beta.realtime.RealtimeModel how d...
# ask-ai
m
using the google.beta.realtime.RealtimeModel how do i send an intro message?
t
Thanks for reaching out, Jack. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To send an intro message using
google.beta.realtime.RealtimeModel
, use the
generate_reply()
method with an
instructions
parameter. Here is how you can do it:
Copy code
session.generate_reply(
    instructions="introduce yourself very briefly and ask about the user's day"
)
This method is asynchronous and returns a future event. It automatically manages the interaction turn and directly uses the RealtimeModel for speech (no separate TTS plugin needed). You can call this, for example, when a session starts or within an
on_enter
method if you are using an agent class. References: Sources: examples/voice_agents/realtime_turn_detector.py | agent/main.py | Agent speech and audio | LiveKit Docs
m
i need it to say an exact string
t
Hey there! Let me walk you through how you can have an agent say exactly what you want. I totally get how important precise communication can be. • First option: Use
generate_reply()
with a friendly hint:
You can tell the model to "Say exactly: '[Your message here]'". Here's a quick example:
Copy code
session.generate_reply(
    instructions="Say exactly: 'Hello, welcome to our service. How can I help you today?'"
)
Just a heads up though - realtime models can be a bit unpredictable. They might accidentally paraphrase or tweak the text a little because of how they naturally generate language . • Second option (and my recommendation): Add a TTS plugin for guaranteed exact speech: Pop in a TTS plugin to your
AgentSession
, and then use `session.say()`:
Copy code
await session.say("Welcome! This is my exact intro message.")
This method is super reliable and makes sure your message comes out word-for-word . Quick summary: Want total control? Go with
session.say()
and a TTS plugin. If you're using
generate_reply()
, just know the exact wording isn't a sure thing. Sources: Realtime model integrations | LiveKit Docs | Agent speech | LiveKit Docs | packages/sip--make-a-call/src/agent.ts