This commit is contained in:
Ben Cherry
2025-10-28 14:11:31 -07:00
parent ee44116c42
commit d2f1e50a5c
+7 -4
View File
@@ -10,6 +10,7 @@ from livekit.agents import (
RoomInputOptions, RoomInputOptions,
WorkerOptions, WorkerOptions,
cli, cli,
inference,
metrics, metrics,
) )
from livekit.plugins import noise_cancellation, silero from livekit.plugins import noise_cancellation, silero
@@ -28,7 +29,7 @@ class Assistant(Agent):
Your responses are concise, to the point, and without any complex formatting or punctuation including emojis, asterisks, or other symbols. Your responses are concise, to the point, and without any complex formatting or punctuation including emojis, asterisks, or other symbols.
You are curious, friendly, and have a sense of humor.""", You are curious, friendly, and have a sense of humor.""",
) )
# To add tools, use the @function_tool decorator. # To add tools, use the @function_tool decorator.
# Here's an example that adds a simple weather tool. # Here's an example that adds a simple weather tool.
# You also have to add `from livekit.agents import function_tool, RunContext` to the top of this file # You also have to add `from livekit.agents import function_tool, RunContext` to the top of this file
@@ -62,13 +63,15 @@ async def entrypoint(ctx: JobContext):
session = AgentSession( session = AgentSession(
# Speech-to-text (STT) is your agent's ears, turning the user's speech into text that the LLM can understand # Speech-to-text (STT) is your agent's ears, turning the user's speech into text that the LLM can understand
# See all available models at https://docs.livekit.io/agents/models/stt/ # See all available models at https://docs.livekit.io/agents/models/stt/
stt="assemblyai/universal-streaming:en", stt=inference.STT(model="assemblyai/universal-streaming", language="en"),
# A Large Language Model (LLM) is your agent's brain, processing user input and generating a response # A Large Language Model (LLM) is your agent's brain, processing user input and generating a response
# See all available models at https://docs.livekit.io/agents/models/llm/ # See all available models at https://docs.livekit.io/agents/models/llm/
llm="openai/gpt-4.1-mini", llm=inference.LLM(model="openai/gpt-4.1-mini"),
# Text-to-speech (TTS) is your agent's voice, turning the LLM's text into speech that the user can hear # Text-to-speech (TTS) is your agent's voice, turning the LLM's text into speech that the user can hear
# See all available models as well as voice selections at https://docs.livekit.io/agents/models/tts/ # See all available models as well as voice selections at https://docs.livekit.io/agents/models/tts/
tts="cartesia/sonic-3:9626c31c-bec5-4cca-baa8-f8ba9e84c8bc", tts=inference.TTS(
model="cartesia/sonic-3", voice="9626c31c-bec5-4cca-baa8-f8ba9e84c8bc"
),
# VAD and turn detection are used to determine when the user is speaking and when the agent should respond # VAD and turn detection are used to determine when the user is speaking and when the agent should respond
# See more at https://docs.livekit.io/agents/build/turns # See more at https://docs.livekit.io/agents/build/turns
turn_detection=MultilingualModel(), turn_detection=MultilingualModel(),