Spaces:
Build error
Build error
Update kitt.py
Browse files
kitt.py
CHANGED
@@ -12,7 +12,7 @@ from livekit.agents.llm import (
|
|
12 |
ChatMessage,
|
13 |
ChatRole,
|
14 |
)
|
15 |
-
from livekit.agents.voice_assistant import
|
16 |
from livekit.plugins import deepgram, openai, silero
|
17 |
|
18 |
dotenv.load_dotenv()
|
@@ -35,7 +35,7 @@ class AssistantFnc(agents.llm.FunctionContext):
|
|
35 |
agents.llm.TypeInfo(desc="The user message that triggered this function"),
|
36 |
],
|
37 |
):
|
38 |
-
ctx =
|
39 |
ctx.store_metadata("user_msg", user_msg)
|
40 |
|
41 |
|
@@ -133,7 +133,7 @@ async def entrypoint(ctx: JobContext):
|
|
133 |
await assistant.say(stream, allow_interruptions=True)
|
134 |
|
135 |
@assistant.on("function_calls_finished")
|
136 |
-
def _function_calls_done(ctx:
|
137 |
user_msg = ctx.get_metadata("user_msg")
|
138 |
if not user_msg:
|
139 |
return
|
|
|
12 |
ChatMessage,
|
13 |
ChatRole,
|
14 |
)
|
15 |
+
from livekit.agents.voice_assistant import AssistantCallContext, VoiceAssistant
|
16 |
from livekit.plugins import deepgram, openai, silero
|
17 |
|
18 |
dotenv.load_dotenv()
|
|
|
35 |
agents.llm.TypeInfo(desc="The user message that triggered this function"),
|
36 |
],
|
37 |
):
|
38 |
+
ctx = AssistantCallContext.get_current()
|
39 |
ctx.store_metadata("user_msg", user_msg)
|
40 |
|
41 |
|
|
|
133 |
await assistant.say(stream, allow_interruptions=True)
|
134 |
|
135 |
@assistant.on("function_calls_finished")
|
136 |
+
def _function_calls_done(ctx: AssistantCallContext):
|
137 |
user_msg = ctx.get_metadata("user_msg")
|
138 |
if not user_msg:
|
139 |
return
|