1919
2020load_dotenv (".env.local" )
2121
22- AGENT_MODEL = "openai/gpt-5.2-chat-latest"
23-
2422
2523class Assistant (Agent ):
2624 def __init__ (self ) -> None :
2725 super ().__init__ (
26+ # A Large Language Model (LLM) is your agent's brain, processing user input and generating a response
27+ # See all available models at https://docs.livekit.io/agents/models/llm/
28+ llm = inference .LLM (model = "openai/gpt-5.2-chat-latest" ),
29+ # To use a realtime model instead of a voice pipeline, replace the LLM
30+ # with a RealtimeModel and remove the STT/TTS from the AgentSession
31+ # (Note: This is for the OpenAI Realtime API. For other providers, see https://docs.livekit.io/agents/models/realtime/)
32+ # 1. Install livekit-agents[openai]
33+ # 2. Set OPENAI_API_KEY in .env.local
34+ # 3. Add `from livekit.plugins import openai` to the top of this file
35+ # 4. Replace the llm argument with:
36+ # llm=openai.realtime.RealtimeModel(voice="marin")
2837 instructions = textwrap .dedent (
2938 """\
3039 You are a friendly, reliable voice assistant that answers questions, explains topics, and completes tasks with available tools.
@@ -103,9 +112,6 @@ async def my_agent(ctx: JobContext):
103112 # Speech-to-text (STT) is your agent's ears, turning the user's speech into text that the LLM can understand
104113 # See all available models at https://docs.livekit.io/agents/models/stt/
105114 stt = inference .STT (model = "deepgram/nova-3" , language = "multi" ),
106- # A Large Language Model (LLM) is your agent's brain, processing user input and generating a response
107- # See all available models at https://docs.livekit.io/agents/models/llm/
108- llm = inference .LLM (model = AGENT_MODEL ),
109115 # Text-to-speech (TTS) is your agent's voice, turning the LLM's text into speech that the user can hear
110116 # See all available models as well as voice selections at https://docs.livekit.io/agents/models/tts/
111117 tts = inference .TTS (
@@ -120,16 +126,6 @@ async def my_agent(ctx: JobContext):
120126 preemptive_generation = True ,
121127 )
122128
123- # To use a realtime model instead of a voice pipeline, use the following session setup instead.
124- # (Note: This is for the OpenAI Realtime API. For other providers, see https://docs.livekit.io/agents/models/realtime/))
125- # 1. Install livekit-agents[openai]
126- # 2. Set OPENAI_API_KEY in .env.local
127- # 3. Add `from livekit.plugins import openai` to the top of this file
128- # 4. Use the following session setup instead of the version above
129- # session = AgentSession(
130- # llm=openai.realtime.RealtimeModel(voice="marin")
131- # )
132-
133129 # Start the session, which initializes the voice pipeline and warms up the models
134130 await session .start (
135131 agent = Assistant (),
0 commit comments