how can i integrate gemini-2.5-flash-preview-tts i...
# ask-ai
b
how can i integrate gemini-2.5-flash-preview-tts in my pipeline
t
Thanks for reaching out, Harsh. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! To get
gemini-2.5-flash-preview-tts
up and running in your pipeline, just follow these simple steps: 1. Install the Plugin: Just run this command to add the plugin you need:
pip install "livekit-agents[google]~=1.2"
2. Authentication: You’ll need to provide your credentials: ◦ For Vertex AI: Set the
GOOGLE_APPLICATION_CREDENTIALS
environment variable to your service account key file. ◦ For Gemini API: Either set the
GOOGLE_API_KEY
environment variable or pass the
api_key
directly in your code. 1. Usage in AgentSession: Initialize
GeminiTTS
inside an
AgentSession
with your preferred settings. Here’s a quick example:
Copy code
from livekit.plugins import google

session = AgentSession(
    tts=google.beta.GeminiTTS(
        model="gemini-2.5-flash-preview-tts",
        voice_name="Zephyr",
        instructions="Speak in a friendly and engaging tone.",
    ),
    # ... include llm, stt, etc.
)
2. Key Parameters: ◦ `model`: Keep this set to
"gemini-2.5-flash-preview-tts"
(that’s the default!). ◦ `voice_name`: Pick from supported voices like
"Zephyr"
,
"Kore"
, and more. ◦ `instructions`: Feel free to use natural language prompts to tweak tone, style, and pace. ◦ `streaming`: Just a heads-up, streaming isn’t supported right now; it works in chunked mode. 1. Sample Rate and Format: The audio output is fixed at 24,000 Hz (mono) in PCM format. If you want to dive deeper, check out the Plugin Reference or the Voice AI Quickstart. Happy coding! Sources: Gemini TTS integration guide | LiveKit Docs | Gemini TTS integration guide | LiveKit Docs | livekit-plugins/livekit-plugins-google/livekit/plugins/google/beta/gemini_t... | plugins/google/src/llm.test.ts
b
how to use flash 2.0 stt google
t
Hey there! Just a quick heads-up: the term "flash 2.0 STT Google" isn’t actually a recognized Speech-to-Text (STT) model in LiveKit. No worries though! You can use Google Cloud STT models like
chirp
or
latest_long
for your transcription needs. Here’s a friendly guide on how to get Google STT working in your pipeline: 1. Install the Plugin: Just run this command:
pip install "livekit-agents[google]~=1.2"
2. Authentication: You’ll need to provide credentials, which you can do by: ◦ Setting the environment variable
GOOGLE_APPLICATION_CREDENTIALS
◦ Or by passing
credentials_info
or
credentials_file
directly in your code. 1. Initialize STT: Here’s a simple example to get you started:
Copy code
from livekit.plugins import google

stt = google.STT(
    model="chirp",
    languages="en-US",
    interim_results=True,
    punctuate=True,
    enable_word_time_offsets=True,
    keywords=[("emergency", 2.0)],
    location="us-central1"
)
2. Usage: You have two ways to use STT: ◦ Standalone Streaming: Use
stt.stream()
to handle audio frames in real-time. ◦ AgentSession: Or, plug STT into a full pipeline like this:
Copy code
from livekit.agents import AgentSession

session = AgentSession(stt=google.STT(model="chirp"))
If you want to dive deeper, check out the Google Cloud STT Documentation or take a peek at the Voice AI Quickstart. Hope this helps you get up and running smoothly! Sources: Google integration guide | LiveKit Docs | Google AI and LiveKit | LiveKit Docs | Google Cloud STT integration guide | LiveKit Docs | livekit-plugins/livekit-plugins-google/livekit/plugins/google/__init__.py