Updating the Anthropic stream example to allow cancel the location tracking.
This commit is contained in:
@@ -118,6 +118,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
|
|||||||
|
|
||||||
llm = AnthropicLLMService(
|
llm = AnthropicLLMService(
|
||||||
api_key=os.getenv("ANTHROPIC_API_KEY"),
|
api_key=os.getenv("ANTHROPIC_API_KEY"),
|
||||||
|
enable_async_tool_cancellation=True,
|
||||||
settings=AnthropicLLMService.Settings(
|
settings=AnthropicLLMService.Settings(
|
||||||
system_instruction=(
|
system_instruction=(
|
||||||
"You are a helpful assistant in a voice conversation. "
|
"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,
|
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(
|
location_function = FunctionSchema(
|
||||||
name="track_current_location",
|
name="track_current_location",
|
||||||
description="Start tracking the user's current GPS location, reporting position updates until the user reaches their destination.",
|
description="Start tracking the user's current GPS location, reporting position updates until the user reaches their destination.",
|
||||||
|
|||||||
Reference in New Issue
Block a user