how to get stt_node, tts_node from session
# ask-ai
m
how to get stt_node, tts_node from session
t
Thanks for reaching out, Rajadurai. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To help you retrieve
stt_node
and
tts_node
from a session, here’s a friendly guide you can follow: 1. Accessing the STT and TTS Models: • You can use
session.stt
and
session.tts
to get the actual Speech-to-Text (STT) and Text-to-Speech (TTS) model instances that are being used in your session.
Copy code
# Python Example
stt_model = session.stt  # STT model instance
tts_model = session.tts  # TTS model instance
2. Accessing the Pipeline Node Methods: • The
stt_node
and
tts_node
are methods defined on the agent linked to your session. These represent the pipeline processing nodes you’ll work with.
Copy code
# Python Example
agent = session.current_agent  # Get the active agent
stt_node_func = agent.stt_node
tts_node_func = agent.tts_node
If anything feels unclear or if you’d like me to walk you through any part, please don’t hesitate to ask—I’m here to help! Sources: livekit-agents/livekit/agents/voice/agent_session.py | agents/src/voice/agent_activity.ts | Pipeline nodes and hooks | LiveKit Docs | Pipeline nodes and hooks | LiveKit Docs