In realtime models can I send initial greeting?
# ask-ai
d
In realtime models can I send initial greeting?
t
Thanks for reaching out, Ibragim. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Yes, you can send an initial greeting in realtime models in LiveKit, but there are specific approaches to follow: • Using the
generate_reply()
method:
This is the primary way to send an initial greeting. You can provide specific instructions, such as:
Copy code
await session.generate_reply(
    instructions="Greet the user and offer your assistance."
)
• You can also call
generate_reply()
without specific instructions to let the agent initiate the conversation based on its general settings:
Copy code
# Generate initial greeting
self.session.generate_reply()
• Why not use
session.say()
?
Realtime models do not support the
session.say()
method directly. If you need to use it, you must configure a separate TTS plugin for your session. • Alternative with TTS: Configure your realtime model to use text-only output and include a TTS plugin for more control over the greeting text:
Copy code
session = AgentSession(
    llm=openai.realtime.RealtimeModel(modalities=["text"]),
    tts=cartesia.TTS()  # Or other TTS plugin
)
Note that when using
generate_reply()
with instructions, the output may not precisely follow the provided script, as the model interprets and responds to the instructions rather than reading them verbatim. Sources: Realtime model integrations | LiveKit Docs | livekit-agents/README.md | telephony/answer_call.py | Agent speech and audio | LiveKit Docs