examples: update to use on_function_calls_started event

This commit is contained in:
Aleix Conchillo Flaqué
2025-05-30 10:10:57 -07:00
parent 297afdd126
commit d86343c38d
17 changed files with 68 additions and 17 deletions

View File

@@ -35,7 +35,6 @@ client_id = ""
async def get_weather(params: FunctionCallParams):
await params.llm.push_frame(TTSSpeakFrame("Let me check on that."))
location = params.arguments["location"]
await params.result_callback(f"The weather in {location} is currently 72 degrees and sunny.")
@@ -94,6 +93,10 @@ async def run_example(transport: BaseTransport, _: argparse.Namespace, handle_si
llm.register_function("get_weather", get_weather)
llm.register_function("get_image", get_image)
@llm.event_handler("on_function_calls_started")
async def on_function_calls_started(service, function_calls):
await tts.queue_frame(TTSSpeakFrame("Let me check on that."))
weather_function = FunctionSchema(
name="get_weather",
description="Get the current weather",