for open ai realtime llm what properties are relev...
# ask-ai
w
for open ai realtime llm what properties are relevant to set in AgentSession?
t
Thanks for reaching out, Test. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m responding to your question about which properties to set in an
AgentSession
when using OpenAI’s Realtime LLM. Below are the key properties you’ll typically configure on the
llm
parameter using the OpenAI Realtime model plugin, plus a few recommended options and why you’d use them. Core properties to set • llm: pass an instance of
openai.realtime.RealtimeModel()
(or the equivalent TypeScript class). • model: Realtime model ID (default is
gpt-realtime
). Set if you need a different realtime model. • voice: Voice name for speech output (default
alloy
). Choose a voice like
"marin"
if you want a particular TTS voice. • temperature: Controls response randomness (common default 0.8). Adjust for more deterministic (lower) or more creative (higher) responses. • modalities: List of response modalities, e.g.
["text","audio"]
. Use
["text"]
if you want to use a separate TTS plugin instead of built-in audio. • turn_detection / turnDetection: Configure how the agent detects speaker turns. Modes include
semantic_vad
or
server_vad
. Turn detection often accepts sub-parameters such as
eagerness
,
threshold
,
silence_duration_ms
, etc. Optional / recommended settings and patterns • Use
modalities=["text"]
plus a separate
tts
config in
AgentSession
when you want to swap in a custom TTS model or plugin. • Prefer the Realtime API’s built-in turn detection by default for better context-aware behavior; tune
eagerness
or thresholds if you need faster or more conservative turn endings. • Keep
temperature
within typical safe ranges for realtime usage (commonly around 0.6–1.2 when supported) and test for the behavior you want. Example snippets • Python (conceptual):
Copy code
from livekit.plugins import openai

session = AgentSession(
    llm=openai.realtime.RealtimeModel(
        voice="marin",
        temperature=0.8,
        modalities=["text", "audio"],
        turn_detection=TurnDetection(type="semantic_vad", eagerness="medium")
    ),
)
• TypeScript (conceptual):
Copy code
import * as openai from '@livekit/agents-plugin-openai';

const session = new voice.AgentSession({
    llm: new openai.realtime.RealtimeModel({
        voice: "marin",
        temperature: 0.8,
        modalities: ["text", "audio"],
        turnDetection: { type: "semantic_vad", eagerness: "medium" }
    }),
});
If you’d like, tell me: • Whether you want built-in audio or a separate TTS plugin (modalities preference), and • Which turn detection behavior you prefer (faster cutoffs vs. more conservative listening). I can then give a tailored example and recommended parameter values for your use case. Sources: OpenAI Realtime API plugin guide | LiveKit Documentation | Realtime models overview | LiveKit Documentation