From 28f9203401424ca6687e1dc77fb8a9b7043ec66b Mon Sep 17 00:00:00 2001 From: Mark Backman Date: Thu, 21 May 2026 11:22:16 -0400 Subject: [PATCH] Code review fixes --- .../function-calling-inception.py | 36 ++++++++++++------- scripts/evals/run-release-evals.py | 1 + src/pipecat/services/inception/llm.py | 22 +++++------- uv.lock | 2 +- 4 files changed, 33 insertions(+), 28 deletions(-) diff --git a/examples/function-calling/function-calling-inception.py b/examples/function-calling/function-calling-inception.py index 556cad7e7..416e39a25 100644 --- a/examples/function-calling/function-calling-inception.py +++ b/examples/function-calling/function-calling-inception.py @@ -39,6 +39,10 @@ async def fetch_weather_from_api(params: FunctionCallParams): await params.result_callback({"conditions": "nice", "temperature": "75"}) +async def fetch_restaurant_recommendation(params: FunctionCallParams): + await params.result_callback({"name": "The Golden Dragon"}) + + # We use lambdas to defer transport parameter creation until the transport # type is selected at runtime. transport_params = { @@ -72,23 +76,14 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): llm = InceptionLLMService( api_key=os.environ["INCEPTION_API_KEY"], settings=InceptionLLMService.Settings( - reasoning_effort="medium", - system_instruction="""You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way. - -You have one functions available: - -1. get_current_weather is used to get current weather information. - -Infer whether to use Fahrenheit or Celsius automatically based on the location, unless the user specifies a preference. - -Start by asking me for my location. Then, use 'get_weather_current' to give me a forecast. - - Respond to what the user said in a creative and helpful way.""", + reasoning_effort="instant", + system_instruction="You are a helpful assistant in a voice conversation. Your responses will be spoken aloud, so avoid emojis, bullet points, or other formatting that can't be spoken. Respond to what the user said in a creative, helpful, and brief way.", ), ) # You can also register a function_name of None to get all functions # sent to the same callback with an additional function_name parameter. llm.register_function("get_current_weather", fetch_weather_from_api) + llm.register_function("get_restaurant_recommendation", fetch_restaurant_recommendation) @llm.event_handler("on_function_calls_started") async def on_function_calls_started(service, function_calls): @@ -110,7 +105,19 @@ Start by asking me for my location. Then, use 'get_weather_current' to give me a }, required=["location", "format"], ) - tools = ToolsSchema(standard_tools=[weather_function]) + + restaurant_function = FunctionSchema( + name="get_restaurant_recommendation", + description="Get a restaurant recommendation", + properties={ + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA", + }, + }, + required=["location"], + ) + tools = ToolsSchema(standard_tools=[weather_function, restaurant_function]) context = LLMContext(tools=tools) user_aggregator, assistant_aggregator = LLMContextAggregatorPair( @@ -143,6 +150,9 @@ Start by asking me for my location. Then, use 'get_weather_current' to give me a async def on_client_connected(transport, client): logger.info(f"Client connected") # Kick off the conversation. + context.add_message( + {"role": "developer", "content": "Please introduce yourself to the user."} + ) await task.queue_frames([LLMRunFrame()]) @transport.event_handler("on_client_disconnected") diff --git a/scripts/evals/run-release-evals.py b/scripts/evals/run-release-evals.py index c881d4432..96c89feb0 100644 --- a/scripts/evals/run-release-evals.py +++ b/scripts/evals/run-release-evals.py @@ -198,6 +198,7 @@ TESTS_FUNCTION_CALLING = [ ("function-calling/function-calling-sarvam.py", EVAL_WEATHER), ("function-calling/function-calling-novita.py", EVAL_WEATHER), ("function-calling/function-calling-deepseek.py", EVAL_WEATHER), + ("function-calling/function-calling-inception.py", EVAL_WEATHER), # Video ("function-calling/function-calling-anthropic-video.py", EVAL_VISION_CAMERA), ("function-calling/function-calling-aws-video.py", EVAL_VISION_CAMERA), diff --git a/src/pipecat/services/inception/llm.py b/src/pipecat/services/inception/llm.py index 72202cb7e..6a06810fa 100644 --- a/src/pipecat/services/inception/llm.py +++ b/src/pipecat/services/inception/llm.py @@ -24,7 +24,8 @@ class InceptionLLMSettings(BaseOpenAILLMService.Settings): Parameters: reasoning_effort: Controls how much reasoning the model applies. - One of "instant", "low", "medium", or "high". Defaults to "medium". + One of "instant", "low", "medium", or "high". When unset, the + parameter is omitted and Inception's server-side default applies. realtime: When True, reduces time to first diffusion block (TTFT). """ @@ -53,7 +54,6 @@ class InceptionLLMService(OpenAILLMService): *, api_key: str, base_url: str = "https://api.inceptionlabs.ai/v1", - model: str | None = None, settings: Settings | None = None, **kwargs, ): @@ -62,20 +62,14 @@ class InceptionLLMService(OpenAILLMService): Args: api_key: The API key for accessing Inception's API. base_url: The base URL for Inception API. Defaults to "https://api.inceptionlabs.ai/v1". - model: The model identifier to use. Defaults to "mercury-2". - - .. deprecated:: 0.0.105 - Use ``settings=InceptionLLMService.Settings(model=...)`` instead. - - settings: Runtime-updatable settings. When provided alongside deprecated - parameters, ``settings`` values take precedence. + settings: Runtime-updatable settings. **kwargs: Additional keyword arguments passed to OpenAILLMService. """ - default_settings = self.Settings(model="mercury-2", reasoning_effort=None, realtime=None) - - if model is not None: - self._warn_init_param_moved_to_settings("model", "model") - default_settings.model = model + default_settings = self.Settings( + model="mercury-2", + reasoning_effort=None, + realtime=None, + ) if settings is not None: default_settings.apply_update(settings) diff --git a/uv.lock b/uv.lock index de83cc67d..6972e2fae 100644 --- a/uv.lock +++ b/uv.lock @@ -4574,7 +4574,7 @@ requires-dist = [ { name = "wait-for2", marker = "python_full_version < '3.12'", specifier = ">=0.4.1,<1" }, { name = "websockets", marker = "extra == 'websockets-base'", specifier = ">=13.1,<16.0" }, ] -provides-extras = ["aic", "anthropic", "assemblyai", "asyncai", "aws", "aws-nova-sonic", "azure", "cartesia", "camb", "cerebras", "daily", "deepgram", "deepseek", "elevenlabs", "fal", "fireworks", "fish", "gladia", "google", "gradium", "grok", "groq", "gstreamer", "heygen", "hume", "inworld", "koala", "kokoro", "langchain", "lemonslice", "livekit", "lmnt", "local", "local-smart-turn", "mcp", "mem0", "mistral", "mlx-whisper", "moondream", "nebius", "neuphonic", "novita", "nvidia", "openai", "rnnoise", "openrouter", "perplexity", "piper", "qwen", "resembleai", "rime", "runner", "sagemaker", "sambanova", "sarvam", "sentry", "silero", "simli", "smallest", "soniox", "soundfile", "speechmatics", "strands", "tavus", "together", "tracing", "ultravox", "vonage-video-connector", "webrtc", "websocket", "websockets-base", "whisper", "xai"] +provides-extras = ["aic", "anthropic", "assemblyai", "asyncai", "aws", "aws-nova-sonic", "azure", "cartesia", "camb", "cerebras", "daily", "deepgram", "deepseek", "elevenlabs", "fal", "fireworks", "fish", "gladia", "google", "gradium", "grok", "groq", "gstreamer", "heygen", "hume", "inception", "inworld", "koala", "kokoro", "langchain", "lemonslice", "livekit", "lmnt", "local", "local-smart-turn", "mcp", "mem0", "mistral", "mlx-whisper", "moondream", "nebius", "neuphonic", "novita", "nvidia", "openai", "rnnoise", "openrouter", "perplexity", "piper", "qwen", "resembleai", "rime", "runner", "sagemaker", "sambanova", "sarvam", "sentry", "silero", "simli", "smallest", "soniox", "soundfile", "speechmatics", "strands", "tavus", "together", "tracing", "ultravox", "vonage-video-connector", "webrtc", "websocket", "websockets-base", "whisper", "xai"] [package.metadata.requires-dev] dev = [