Skip to content

Commit 168d892

Browse files
committed
Update prewarm; fix issues with recent commits
1 parent 3eb2c81 commit 168d892

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/agent.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import logging
22

33
from dotenv import load_dotenv
4+
from livekit import rtc
45
from 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+
4953
def 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
)

0 commit comments

Comments
 (0)