Updating the Anthropic stream example to allow cancel the location tracking.

This commit is contained in:
filipi87
2026-04-09 17:26:51 -03:00
parent 5cf90cba98
commit 2dd1170229

View File

@@ -118,6 +118,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
llm = AnthropicLLMService(
api_key=os.getenv("ANTHROPIC_API_KEY"),
enable_async_tool_cancellation=True,
settings=AnthropicLLMService.Settings(
system_instruction=(
"You are a helpful assistant in a voice conversation. "
@@ -139,10 +140,6 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
timeout_secs=30,
)
@llm.event_handler("on_function_calls_started")
async def on_function_calls_started(service, function_calls):
await tts.queue_frame(TTSSpeakFrame("Sure, tracking your location now."))
location_function = FunctionSchema(
name="track_current_location",
description="Start tracking the user's current GPS location, reporting position updates until the user reaches their destination.",