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

@@ -30,7 +30,6 @@ load_dotenv(override=True)
async def fetch_weather_from_api(params: FunctionCallParams):
await params.llm.push_frame(TTSSpeakFrame("Let me check on that."))
await params.result_callback({"conditions": "nice", "temperature": "75"})
@@ -72,6 +71,10 @@ async def run_example(transport: BaseTransport, _: argparse.Namespace, handle_si
# sent to the same callback with an additional function_name parameter.
llm.register_function("get_current_weather", fetch_weather_from_api)
@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_current_weather",
description="Get the current weather",