File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import logging
22
33from dotenv import load_dotenv
4+ from livekit import rtc
45from livekit .agents import (
56 Agent ,
67 AgentServer ,
@@ -46,13 +47,14 @@ def __init__(self) -> None:
4647 # return "sunny with a temperature of 70 degrees."
4748
4849
50+ server = AgentServer ()
51+
52+
4953def prewarm (proc : JobProcess ):
5054 proc .userdata ["vad" ] = silero .VAD .load ()
5155
5256
53- server = AgentServer (
54- setup_fnc = prewarm ,
55- )
57+ server .setup_fnc = prewarm
5658
5759
5860@server .rtc_session ()
@@ -107,9 +109,11 @@ async def my_agent(ctx: JobContext):
107109 await session .start (
108110 agent = Assistant (),
109111 room = ctx .room ,
110- room_options = room_io .RoomOptions (
112+ room_options = room_io .RoomOptions (
111113 audio_input = room_io .AudioInputOptions (
112- noise_cancellation = lambda params : noise_cancellation .BVCTelephony () if params .participant .kind == rtc .ParticipantKind .PARTICIPANT_KIND_SIP else noise_cancellation .BVC (),
114+ noise_cancellation = lambda params : noise_cancellation .BVCTelephony ()
115+ if params .participant .kind == rtc .ParticipantKind .PARTICIPANT_KIND_SIP
116+ else noise_cancellation .BVC (),
113117 ),
114118 ),
115119 )
You can’t perform that action at this time.
0 commit comments