```from google.genai.types import Modality sessio...
# ask-ai
r
Copy code
from google.genai.types import Modality

session = AgentSession(
    llm=google.beta.realtime.RealtimeModel(modalities=[Modality.TEXT]),
    tts=cartesia.TTS(),
)
When I use Gemini Live API with a different TTS provider, I configure it with a text-only response modality and include a TTS plugin in the`AgentSession` configuration. However, the model is now too verbose
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.
Hey there! If you want to keep Gemini Live API responses nice and brief when using a TTS provider, here are a few friendly tips: 1. Use System Instructions: You can set up the
RealtimeModel
with clear, short response instructions. Like this:
Copy code
from livekit.plugins import google

session = AgentSession(
    llm=google.beta.realtime.RealtimeModel(
        model="gemini-2.0-flash-exp",
        modalities=["AUDIO"],
        instructions="Respond in short, concise sentences. Avoid repetition and unnecessary details.",
    ),
)
1. Use Text-Only Mode: Another way is to have the API output just text, then send that through a separate TTS provider. This gives you more control:
Copy code
from google.genai.types import Modality
from livekit.plugins import google, cartesia

session = AgentSession(
    llm=google.beta.realtime.RealtimeModel(modalities=[Modality.TEXT]),
    tts=cartesia.TTS()
)
1. Custom Truncation Logic: You can also create a custom
tts_node
to keep the response length in check during synthesis. For the best results, you might want to mix system instructions, text-only mode, and a customizable TTS provider. If you’d like, I’m here to help walk you through any of these steps! Sources: Azure OpenAI Realtime API and LiveKit | LiveKit Docs | pipeline-tts/short_replies_only.py | Gemini TTS integration guide | LiveKit Docs | livekit-plugins/livekit-plugins-google/livekit/plugins/google/beta/realtime... | Gemini Live API integration guide | LiveKit Docs