Is it possible to also send text input when using ...
# ask-ai
r
Is it possible to also send text input when using gemini realtime models? Both audio and text at the same time? Where is relevant documentation?
t
Thanks for reaching out, Phanos. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Absolutely, you can send both text and audio input at the same time when using Gemini real-time models. To make this happen, just set the
modalities
parameter in the
RealtimeModel
to include both
"TEXT"
and
"AUDIO"
. By default, this is set to
["AUDIO"]
, but you have the flexibility to customize it to accept both. For instance, in the
gemini-playground
example, the
modalities
are configured through a mapping that turns UI settings into the right modality list. Text input is sent using the
sendText
method on the LiveKit SDK, which publishes messages to the
lk.chat
text stream topic. The agent listens to this topic and handles incoming text messages, even interrupting ongoing speech if needed. If you'd like, you can explore a full implementation and get more details in the gemini-playground repository. I hope this helps you get started smoothly! Sources: Text and transcriptions | LiveKit Docs | Gemini Live API plugin | LiveKit Docs | web/src/data/presets.ts
r
does this even work for the latest gemini native model that only has Audio modality?
t
I'm happy to share that the latest Gemini native model supports both text and audio modalities. By default, it’s set to
["AUDIO"]
, but you can easily enable both text and audio by setting the
modalities
parameter to
["TEXT", "AUDIO"]
. This way, the model can handle and respond with both modalities at the same time. If you’re running into any issues or have particular needs, please don’t hesitate to reach out—I’m here to help you through it! Sources: livekit-agents/livekit/agents/voice/agent_activity.py | agent/main.py | Gemini Live API plugin | LiveKit Docs | Real-time AI Models & Streaming | livekit/livekit_composite | DeepWiki