From 26000b616d7ca8f9ad2f97ff4ffaabde52505a4c Mon Sep 17 00:00:00 2001 From: Filipi Fuchter Date: Thu, 6 Mar 2025 10:15:04 -0300 Subject: [PATCH 1/6] Fixing the base_whisper services to implement set_language. --- src/pipecat/services/base_whisper.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/pipecat/services/base_whisper.py b/src/pipecat/services/base_whisper.py index 4de62f08c..146fd4f39 100644 --- a/src/pipecat/services/base_whisper.py +++ b/src/pipecat/services/base_whisper.py @@ -138,6 +138,15 @@ class BaseWhisperSTTService(SegmentedSTTService): def language_to_service_language(self, language: Language) -> Optional[str]: return language_to_whisper_language(language) + async def set_language(self, language: Language): + """Set the language for transcription. + + Args: + language: The Language enum value to use for transcription. + """ + logger.info(f"Switching STT language to: [{language}]") + self._language = language + async def run_stt(self, audio: bytes) -> AsyncGenerator[Frame, None]: try: await self.start_processing_metrics() From 2d114b15f9ff2787cb6eb4b0bea75ee762413f34 Mon Sep 17 00:00:00 2001 From: Filipi Fuchter Date: Thu, 6 Mar 2025 10:34:25 -0300 Subject: [PATCH 2/6] Adding missing flush_audio method to AzureTTSService. --- src/pipecat/services/azure.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pipecat/services/azure.py b/src/pipecat/services/azure.py index 83e5bbe6d..60a3b6a8b 100644 --- a/src/pipecat/services/azure.py +++ b/src/pipecat/services/azure.py @@ -577,6 +577,10 @@ class AzureTTSService(AzureBaseTTSService): logger.error(f"Speech synthesis canceled: {evt.result.cancellation_details.reason}") self._audio_queue.put_nowait(None) + async def flush_audio(self): + logger.trace(f"{self}: flushing audio") + # TODO: check what we need to implement here ? + async def run_tts(self, text: str) -> AsyncGenerator[Frame, None]: logger.debug(f"{self}: Generating TTS [{text}]") From 2df77430aa04e7e84d94b80f868ee73299818c2d Mon Sep 17 00:00:00 2001 From: Filipi Fuchter Date: Thu, 6 Mar 2025 10:35:26 -0300 Subject: [PATCH 3/6] Refactoring the 14 series examples to use the unified format for function calling. --- examples/foundational/14-function-calling.py | 43 +++++------- .../14a-function-calling-anthropic.py | 29 ++++---- .../14b-function-calling-anthropic-video.py | 50 ++++++------- .../14c-function-calling-together.py | 42 +++++------ .../14d-function-calling-video.py | 68 ++++++++---------- .../14e-function-calling-gemini.py | 70 ++++++++----------- .../foundational/14f-function-calling-groq.py | 42 +++++------ .../foundational/14g-function-calling-grok.py | 42 +++++------ .../14h-function-calling-azure.py | 42 +++++------ .../14i-function-calling-fireworks.py | 42 +++++------ .../foundational/14j-function-calling-nim.py | 42 +++++------ .../14k-function-calling-cerebras.py | 42 +++++------ .../14l-function-calling-deepseek.py | 42 +++++------ .../14m-function-calling-openrouter.py | 42 +++++------ ...o-function-calling-gemini-openai-format.py | 42 +++++------ 15 files changed, 295 insertions(+), 385 deletions(-) diff --git a/examples/foundational/14-function-calling.py b/examples/foundational/14-function-calling.py index 7c77378fc..707644f88 100644 --- a/examples/foundational/14-function-calling.py +++ b/examples/foundational/14-function-calling.py @@ -11,7 +11,8 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger -from openai.types.chat import ChatCompletionToolParam +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer @@ -65,30 +66,24 @@ async def main(): # sent to the same callback with an additional function_name parameter. llm.register_function(None, fetch_weather_from_api, start_callback=start_fetch_weather) - tools = [ - ChatCompletionToolParam( - type="function", - function={ - "name": "get_current_weather", - "description": "Get the current weather", - "parameters": { - "type": "object", - "properties": { - "location": { - "type": "string", - "description": "The city and state, e.g. San Francisco, CA", - }, - "format": { - "type": "string", - "enum": ["celsius", "fahrenheit"], - "description": "The temperature unit to use. Infer this from the users location.", - }, - }, - "required": ["location", "format"], - }, + weather_function = FunctionSchema( + name="get_current_weather", + description="Get the current weather", + properties={ + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA", }, - ) - ] + "format": { + "type": "string", + "enum": ["celsius", "fahrenheit"], + "description": "The temperature unit to use. Infer this from the user's location.", + }, + }, + required=["location", "format"], + ) + tools = ToolsSchema(standard_tools=[weather_function]) + messages = [ { "role": "system", diff --git a/examples/foundational/14a-function-calling-anthropic.py b/examples/foundational/14a-function-calling-anthropic.py index 4723de004..ba93a3be4 100644 --- a/examples/foundational/14a-function-calling-anthropic.py +++ b/examples/foundational/14a-function-calling-anthropic.py @@ -11,6 +11,9 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger + +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer @@ -59,22 +62,18 @@ async def main(): ) llm.register_function("get_weather", get_weather) - tools = [ - { - "name": "get_weather", - "description": "Get the current weather in a given location", - "input_schema": { - "type": "object", - "properties": { - "location": { - "type": "string", - "description": "The city and state, e.g. San Francisco, CA", - } - }, - "required": ["location"], + weather_function = FunctionSchema( + name="get_weather", + description="Get the current weather", + properties={ + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA", }, - } - ] + }, + required=["location"], + ) + tools = ToolsSchema(standard_tools=[weather_function]) # todo: test with very short initial user message diff --git a/examples/foundational/14b-function-calling-anthropic-video.py b/examples/foundational/14b-function-calling-anthropic-video.py index 69f1e5776..695278214 100644 --- a/examples/foundational/14b-function-calling-anthropic-video.py +++ b/examples/foundational/14b-function-calling-anthropic-video.py @@ -11,6 +11,9 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger + +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer @@ -72,36 +75,29 @@ async def main(): llm.register_function("get_weather", get_weather) llm.register_function("get_image", get_image) - tools = [ - { - "name": "get_weather", - "description": "Get the current weather in a given location", - "input_schema": { - "type": "object", - "properties": { - "location": { - "type": "string", - "description": "The city and state, e.g. San Francisco, CA", - } - }, - "required": ["location"], + weather_function = FunctionSchema( + name="get_weather", + description="Get the current weather", + properties={ + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA", }, }, - { - "name": "get_image", - "description": "Get an image from the video stream.", - "input_schema": { - "type": "object", - "properties": { - "question": { - "type": "string", - "description": "The question that the user is asking about the image.", - } - }, - "required": ["question"], - }, + required=["location"], + ) + get_image_function = FunctionSchema( + name="get_image", + description="Get an image from the video stream.", + properties= { + "question": { + "type": "string", + "description": "The question that the user is asking about the image.", + } }, - ] + required=["question"], + ) + tools = ToolsSchema(standard_tools=[weather_function, get_image_function]) # todo: test with very short initial user message diff --git a/examples/foundational/14c-function-calling-together.py b/examples/foundational/14c-function-calling-together.py index 9c981f7bc..4c4bec4da 100644 --- a/examples/foundational/14c-function-calling-together.py +++ b/examples/foundational/14c-function-calling-together.py @@ -11,7 +11,8 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger -from openai.types.chat import ChatCompletionToolParam +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer @@ -69,30 +70,23 @@ async def main(): # sent to the same callback with an additional function_name parameter. llm.register_function(None, fetch_weather_from_api, start_callback=start_fetch_weather) - tools = [ - ChatCompletionToolParam( - type="function", - function={ - "name": "get_current_weather", - "description": "Get the current weather", - "parameters": { - "type": "object", - "properties": { - "location": { - "type": "string", - "description": "The city and state, e.g. San Francisco, CA", - }, - "format": { - "type": "string", - "enum": ["celsius", "fahrenheit"], - "description": "The temperature unit to use. Infer this from the users location.", - }, - }, - "required": ["location", "format"], - }, + weather_function = FunctionSchema( + name="get_current_weather", + description="Get the current weather", + properties={ + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA", }, - ) - ] + "format": { + "type": "string", + "enum": ["celsius", "fahrenheit"], + "description": "The temperature unit to use. Infer this from the user's location.", + }, + }, + required=["location", "format"], + ) + tools = ToolsSchema(standard_tools=[weather_function]) messages = [ { "role": "system", diff --git a/examples/foundational/14d-function-calling-video.py b/examples/foundational/14d-function-calling-video.py index aa71d05ff..916606c50 100644 --- a/examples/foundational/14d-function-calling-video.py +++ b/examples/foundational/14d-function-calling-video.py @@ -11,7 +11,8 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger -from openai.types.chat import ChatCompletionToolParam +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer @@ -66,47 +67,34 @@ async def main(): llm.register_function("get_weather", get_weather) llm.register_function("get_image", get_image) - tools = [ - ChatCompletionToolParam( - type="function", - function={ - "name": "get_weather", - "description": "Get the current weather", - "parameters": { - "type": "object", - "properties": { - "location": { - "type": "string", - "description": "The city and state, e.g. San Francisco, CA", - }, - "format": { - "type": "string", - "enum": ["celsius", "fahrenheit"], - "description": "The temperature unit to use. Infer this from the users location.", - }, - }, - "required": ["location", "format"], - }, + weather_function = FunctionSchema( + name="get_weather", + description="Get the current weather", + properties={ + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA", }, - ), - ChatCompletionToolParam( - type="function", - function={ - "name": "get_image", - "description": "Get an image from the video stream.", - "parameters": { - "type": "object", - "properties": { - "question": { - "type": "string", - "description": "The question to ask the AI to generate an image of", - }, - }, - "required": ["question"], - }, + "format": { + "type": "string", + "enum": ["celsius", "fahrenheit"], + "description": "The temperature unit to use. Infer this from the user's location.", }, - ), - ] + }, + required=["location"], + ) + get_image_function = FunctionSchema( + name="get_image", + description="Get an image from the video stream.", + properties={ + "question": { + "type": "string", + "description": "The question that the user is asking about the image.", + } + }, + required=["question"], + ) + tools = ToolsSchema(standard_tools=[weather_function, get_image_function]) system_prompt = """\ You are a helpful assistant who converses with a user and answers questions. Respond concisely to general questions. diff --git a/examples/foundational/14e-function-calling-gemini.py b/examples/foundational/14e-function-calling-gemini.py index 477d6c5ca..30b74ba2c 100644 --- a/examples/foundational/14e-function-calling-gemini.py +++ b/examples/foundational/14e-function-calling-gemini.py @@ -11,6 +11,9 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger + +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer @@ -73,45 +76,34 @@ async def main(): llm.register_function("get_weather", get_weather, start_fetch_weather) llm.register_function("get_image", get_image) - tools = [ - { - "function_declarations": [ - { - "name": "get_weather", - "description": "Get the current weather", - "parameters": { - "type": "object", - "properties": { - "location": { - "type": "string", - "description": "The city and state, e.g. San Francisco, CA", - }, - "format": { - "type": "string", - "enum": ["celsius", "fahrenheit"], - "description": "The temperature unit to use. Infer this from the users location.", - }, - }, - "required": ["location", "format"], - }, - }, - { - "name": "get_image", - "description": "Get and image from the camera or video stream.", - "parameters": { - "type": "object", - "properties": { - "question": { - "type": "string", - "description": "The question to to use when running inference on the acquired image.", - }, - }, - "required": ["question"], - }, - }, - ] - } - ] + weather_function = FunctionSchema( + name="get_weather", + description="Get the current weather", + properties={ + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA", + }, + "format": { + "type": "string", + "enum": ["celsius", "fahrenheit"], + "description": "The temperature unit to use. Infer this from the user's location.", + }, + }, + required=["location", "format"], + ) + get_image_function = FunctionSchema( + name="get_image", + description="Get an image from the video stream.", + properties={ + "question": { + "type": "string", + "description": "The question that the user is asking about the image.", + } + }, + required=["question"], + ) + tools = ToolsSchema(standard_tools=[weather_function, get_image_function]) system_prompt = """\ You are a helpful assistant who converses with a user and answers questions. Respond concisely to general questions. diff --git a/examples/foundational/14f-function-calling-groq.py b/examples/foundational/14f-function-calling-groq.py index f2768a788..46caed370 100644 --- a/examples/foundational/14f-function-calling-groq.py +++ b/examples/foundational/14f-function-calling-groq.py @@ -11,7 +11,8 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger -from openai.types.chat import ChatCompletionToolParam +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer @@ -68,30 +69,23 @@ async def main(): # sent to the same callback with an additional function_name parameter. llm.register_function(None, fetch_weather_from_api, start_callback=start_fetch_weather) - tools = [ - ChatCompletionToolParam( - type="function", - function={ - "name": "get_current_weather", - "description": "Get the current weather", - "parameters": { - "type": "object", - "properties": { - "location": { - "type": "string", - "description": "The city and state, e.g. San Francisco, CA", - }, - "unit": { - "type": "string", - "enum": ["celsius", "fahrenheit"], - "description": "The temperature unit to use. Infer this from the users location.", - }, - }, - "required": ["location"], - }, + weather_function = FunctionSchema( + name="get_current_weather", + description="Get the current weather", + properties={ + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA", }, - ) - ] + "format": { + "type": "string", + "enum": ["celsius", "fahrenheit"], + "description": "The temperature unit to use. Infer this from the user's location.", + }, + }, + required=["location"], + ) + tools = ToolsSchema(standard_tools=[weather_function]) messages = [ { "role": "system", diff --git a/examples/foundational/14g-function-calling-grok.py b/examples/foundational/14g-function-calling-grok.py index 7318f455d..c2bbce221 100644 --- a/examples/foundational/14g-function-calling-grok.py +++ b/examples/foundational/14g-function-calling-grok.py @@ -11,7 +11,8 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger -from openai.types.chat import ChatCompletionToolParam +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer @@ -66,30 +67,23 @@ async def main(): # sent to the same callback with an additional function_name parameter. llm.register_function(None, fetch_weather_from_api, start_callback=start_fetch_weather) - tools = [ - ChatCompletionToolParam( - type="function", - function={ - "name": "get_current_weather", - "description": "Get the current weather", - "parameters": { - "type": "object", - "properties": { - "location": { - "type": "string", - "description": "The city and state, e.g. San Francisco, CA", - }, - "format": { - "type": "string", - "enum": ["celsius", "fahrenheit"], - "description": "The temperature unit to use. Infer this from the users location.", - }, - }, - "required": ["location", "format"], - }, + weather_function = FunctionSchema( + name="get_current_weather", + description="Get the current weather", + properties={ + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA", }, - ) - ] + "format": { + "type": "string", + "enum": ["celsius", "fahrenheit"], + "description": "The temperature unit to use. Infer this from the user's location.", + }, + }, + required=["location", "format"], + ) + tools = ToolsSchema(standard_tools=[weather_function]) messages = [ { "role": "system", diff --git a/examples/foundational/14h-function-calling-azure.py b/examples/foundational/14h-function-calling-azure.py index cfd56b59d..edd33b1f7 100644 --- a/examples/foundational/14h-function-calling-azure.py +++ b/examples/foundational/14h-function-calling-azure.py @@ -11,7 +11,8 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger -from openai.types.chat import ChatCompletionToolParam +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer @@ -70,30 +71,23 @@ async def main(): # sent to the same callback with an additional function_name parameter. llm.register_function(None, fetch_weather_from_api, start_callback=start_fetch_weather) - tools = [ - ChatCompletionToolParam( - type="function", - function={ - "name": "get_current_weather", - "description": "Get the current weather", - "parameters": { - "type": "object", - "properties": { - "location": { - "type": "string", - "description": "The city and state, e.g. San Francisco, CA", - }, - "format": { - "type": "string", - "enum": ["celsius", "fahrenheit"], - "description": "The temperature unit to use. Infer this from the users location.", - }, - }, - "required": ["location", "format"], - }, + weather_function = FunctionSchema( + name="get_current_weather", + description="Get the current weather", + properties={ + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA", }, - ) - ] + "format": { + "type": "string", + "enum": ["celsius", "fahrenheit"], + "description": "The temperature unit to use. Infer this from the user's location.", + }, + }, + required=["location", "format"], + ) + tools = ToolsSchema(standard_tools=[weather_function]) messages = [ { "role": "system", diff --git a/examples/foundational/14i-function-calling-fireworks.py b/examples/foundational/14i-function-calling-fireworks.py index 53346686f..54ef75b54 100644 --- a/examples/foundational/14i-function-calling-fireworks.py +++ b/examples/foundational/14i-function-calling-fireworks.py @@ -11,7 +11,8 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger -from openai.types.chat import ChatCompletionToolParam +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer @@ -69,30 +70,23 @@ async def main(): # sent to the same callback with an additional function_name parameter. llm.register_function(None, fetch_weather_from_api, start_callback=start_fetch_weather) - tools = [ - ChatCompletionToolParam( - type="function", - function={ - "name": "get_current_weather", - "description": "Get the current weather", - "parameters": { - "type": "object", - "properties": { - "location": { - "type": "string", - "description": "The city and state, e.g. San Francisco, CA", - }, - "format": { - "type": "string", - "enum": ["celsius", "fahrenheit"], - "description": "The temperature unit to use. Infer this from the users location.", - }, - }, - "required": ["location", "format"], - }, + weather_function = FunctionSchema( + name="get_current_weather", + description="Get the current weather", + properties={ + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA", }, - ) - ] + "format": { + "type": "string", + "enum": ["celsius", "fahrenheit"], + "description": "The temperature unit to use. Infer this from the user's location.", + }, + }, + required=["location", "format"], + ) + tools = ToolsSchema(standard_tools=[weather_function]) messages = [ { "role": "system", diff --git a/examples/foundational/14j-function-calling-nim.py b/examples/foundational/14j-function-calling-nim.py index 712ce0742..39c29f004 100644 --- a/examples/foundational/14j-function-calling-nim.py +++ b/examples/foundational/14j-function-calling-nim.py @@ -11,7 +11,8 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger -from openai.types.chat import ChatCompletionToolParam +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer @@ -69,30 +70,23 @@ async def main(): # sent to the same callback with an additional function_name parameter. llm.register_function(None, fetch_weather_from_api, start_callback=start_fetch_weather) - tools = [ - ChatCompletionToolParam( - type="function", - function={ - "name": "get_current_weather", - "description": "Returns the current weather at a location, if one is specified, and defaults to the user's location.", - "parameters": { - "type": "object", - "properties": { - "location": { - "type": "string", - "description": "The location to find the weather of, or if not provided, it's the default location.", - }, - "format": { - "type": "string", - "enum": ["celsius", "fahrenheit"], - "description": "Whether to use SI or USCS units (celsius or fahrenheit).", - }, - }, - "required": ["location", "format"], - }, + weather_function = FunctionSchema( + name="get_current_weather", + description="Get the current weather", + properties={ + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA", }, - ) - ] + "format": { + "type": "string", + "enum": ["celsius", "fahrenheit"], + "description": "The temperature unit to use. Infer this from the user's location.", + }, + }, + required=["location", "format"], + ) + tools = ToolsSchema(standard_tools=[weather_function]) messages = [ { "role": "system", diff --git a/examples/foundational/14k-function-calling-cerebras.py b/examples/foundational/14k-function-calling-cerebras.py index 4a65adbef..b0b3ffb1e 100644 --- a/examples/foundational/14k-function-calling-cerebras.py +++ b/examples/foundational/14k-function-calling-cerebras.py @@ -11,7 +11,8 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger -from openai.types.chat import ChatCompletionToolParam +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer @@ -66,30 +67,23 @@ async def main(): # sent to the same callback with an additional function_name parameter. llm.register_function(None, fetch_weather_from_api, start_callback=start_fetch_weather) - tools = [ - ChatCompletionToolParam( - type="function", - function={ - "name": "get_current_weather", - "description": "Get the current weather for a specific location. You MUST use this function whenever asked about weather.", - "parameters": { - "type": "object", - "properties": { - "location": { - "type": "string", - "description": "The city and state, e.g. San Francisco, CA", - }, - "format": { - "type": "string", - "enum": ["celsius", "fahrenheit"], - "description": "The temperature unit to use. Use fahrenheit for US locations, celsius for others.", - }, - }, - "required": ["location", "format"], - }, + weather_function = FunctionSchema( + name="get_current_weather", + description="Get the current weather", + properties={ + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA", }, - ) - ] + "format": { + "type": "string", + "enum": ["celsius", "fahrenheit"], + "description": "The temperature unit to use. Infer this from the user's location.", + }, + }, + required=["location", "format"], + ) + tools = ToolsSchema(standard_tools=[weather_function]) messages = [ { "role": "system", diff --git a/examples/foundational/14l-function-calling-deepseek.py b/examples/foundational/14l-function-calling-deepseek.py index f67d583ee..e96db3254 100644 --- a/examples/foundational/14l-function-calling-deepseek.py +++ b/examples/foundational/14l-function-calling-deepseek.py @@ -11,7 +11,8 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger -from openai.types.chat import ChatCompletionToolParam +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer @@ -66,30 +67,23 @@ async def main(): # sent to the same callback with an additional function_name parameter. llm.register_function(None, fetch_weather_from_api, start_callback=start_fetch_weather) - tools = [ - ChatCompletionToolParam( - type="function", - function={ - "name": "get_current_weather", - "description": "Get the current weather for a specific location. You MUST use this function whenever asked about weather.", - "parameters": { - "type": "object", - "properties": { - "location": { - "type": "string", - "description": "The city and state, e.g. San Francisco, CA", - }, - "format": { - "type": "string", - "enum": ["celsius", "fahrenheit"], - "description": "The temperature unit to use. Use fahrenheit for US locations, celsius for others.", - }, - }, - "required": ["location", "format"], - }, + weather_function = FunctionSchema( + name="get_current_weather", + description="Get the current weather", + properties={ + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA", }, - ) - ] + "format": { + "type": "string", + "enum": ["celsius", "fahrenheit"], + "description": "The temperature unit to use. Infer this from the user's location.", + }, + }, + required=["location", "format"], + ) + tools = ToolsSchema(standard_tools=[weather_function]) messages = [ { "role": "system", diff --git a/examples/foundational/14m-function-calling-openrouter.py b/examples/foundational/14m-function-calling-openrouter.py index 622337b07..745d130e7 100644 --- a/examples/foundational/14m-function-calling-openrouter.py +++ b/examples/foundational/14m-function-calling-openrouter.py @@ -11,7 +11,8 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger -from openai.types.chat import ChatCompletionToolParam +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer @@ -70,30 +71,23 @@ async def main(): # sent to the same callback with an additional function_name parameter. llm.register_function(None, fetch_weather_from_api, start_callback=start_fetch_weather) - tools = [ - ChatCompletionToolParam( - type="function", - function={ - "name": "get_current_weather", - "description": "Get the current weather", - "parameters": { - "type": "object", - "properties": { - "location": { - "type": "string", - "description": "The city and state, e.g. San Francisco, CA", - }, - "format": { - "type": "string", - "enum": ["celsius", "fahrenheit"], - "description": "The temperature unit to use. Infer this from the users location.", - }, - }, - "required": ["location", "format"], - }, + weather_function = FunctionSchema( + name="get_current_weather", + description="Get the current weather", + properties={ + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA", }, - ) - ] + "format": { + "type": "string", + "enum": ["celsius", "fahrenheit"], + "description": "The temperature unit to use. Infer this from the user's location.", + }, + }, + required=["location", "format"], + ) + tools = ToolsSchema(standard_tools=[weather_function]) messages = [ { "role": "system", diff --git a/examples/foundational/14o-function-calling-gemini-openai-format.py b/examples/foundational/14o-function-calling-gemini-openai-format.py index 4b04f9285..1434c9a77 100644 --- a/examples/foundational/14o-function-calling-gemini-openai-format.py +++ b/examples/foundational/14o-function-calling-gemini-openai-format.py @@ -11,7 +11,8 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger -from openai.types.chat import ChatCompletionToolParam +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure from pipecat.audio.vad.silero import SileroVADAnalyzer @@ -68,30 +69,23 @@ async def main(): "get_current_weather", fetch_weather_from_api, start_callback=start_fetch_weather ) - tools = [ - ChatCompletionToolParam( - type="function", - function={ - "name": "get_current_weather", - "description": "Get the current weather", - "parameters": { - "type": "object", - "properties": { - "location": { - "type": "string", - "description": "The city and state, e.g. San Francisco, CA", - }, - "format": { - "type": "string", - "enum": ["celsius", "fahrenheit"], - "description": "The temperature unit to use. Infer this from the users location.", - }, - }, - "required": ["location", "format"], - }, + weather_function = FunctionSchema( + name="get_current_weather", + description="Get the current weather", + properties={ + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA", }, - ) - ] + "format": { + "type": "string", + "enum": ["celsius", "fahrenheit"], + "description": "The temperature unit to use. Infer this from the user's location.", + }, + }, + required=["location", "format"], + ) + tools = ToolsSchema(standard_tools=[weather_function]) messages = [ { "role": "user", From 4b167a3c3defa5b59192e0682ff06fa79ffe9463 Mon Sep 17 00:00:00 2001 From: Filipi Fuchter Date: Thu, 6 Mar 2025 10:38:45 -0300 Subject: [PATCH 4/6] Fixing the ruff format. --- examples/foundational/14-function-calling.py | 4 ++-- examples/foundational/14a-function-calling-anthropic.py | 3 +-- .../foundational/14b-function-calling-anthropic-video.py | 5 ++--- examples/foundational/14c-function-calling-together.py | 4 ++-- examples/foundational/14d-function-calling-video.py | 4 ++-- examples/foundational/14e-function-calling-gemini.py | 3 +-- examples/foundational/14f-function-calling-groq.py | 4 ++-- examples/foundational/14g-function-calling-grok.py | 4 ++-- examples/foundational/14h-function-calling-azure.py | 4 ++-- examples/foundational/14i-function-calling-fireworks.py | 4 ++-- examples/foundational/14j-function-calling-nim.py | 4 ++-- examples/foundational/14k-function-calling-cerebras.py | 4 ++-- examples/foundational/14l-function-calling-deepseek.py | 4 ++-- examples/foundational/14m-function-calling-openrouter.py | 4 ++-- .../14o-function-calling-gemini-openai-format.py | 4 ++-- 15 files changed, 28 insertions(+), 31 deletions(-) diff --git a/examples/foundational/14-function-calling.py b/examples/foundational/14-function-calling.py index 707644f88..043f278e2 100644 --- a/examples/foundational/14-function-calling.py +++ b/examples/foundational/14-function-calling.py @@ -11,10 +11,10 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger -from pipecat.adapters.schemas.function_schema import FunctionSchema -from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import TTSSpeakFrame from pipecat.pipeline.pipeline import Pipeline diff --git a/examples/foundational/14a-function-calling-anthropic.py b/examples/foundational/14a-function-calling-anthropic.py index ba93a3be4..14e788f99 100644 --- a/examples/foundational/14a-function-calling-anthropic.py +++ b/examples/foundational/14a-function-calling-anthropic.py @@ -11,11 +11,10 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger +from runner import configure from pipecat.adapters.schemas.function_schema import FunctionSchema from pipecat.adapters.schemas.tools_schema import ToolsSchema -from runner import configure - from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner diff --git a/examples/foundational/14b-function-calling-anthropic-video.py b/examples/foundational/14b-function-calling-anthropic-video.py index 695278214..b31e59442 100644 --- a/examples/foundational/14b-function-calling-anthropic-video.py +++ b/examples/foundational/14b-function-calling-anthropic-video.py @@ -11,11 +11,10 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger +from runner import configure from pipecat.adapters.schemas.function_schema import FunctionSchema from pipecat.adapters.schemas.tools_schema import ToolsSchema -from runner import configure - from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner @@ -89,7 +88,7 @@ async def main(): get_image_function = FunctionSchema( name="get_image", description="Get an image from the video stream.", - properties= { + properties={ "question": { "type": "string", "description": "The question that the user is asking about the image.", diff --git a/examples/foundational/14c-function-calling-together.py b/examples/foundational/14c-function-calling-together.py index 4c4bec4da..7f47eb28e 100644 --- a/examples/foundational/14c-function-calling-together.py +++ b/examples/foundational/14c-function-calling-together.py @@ -11,10 +11,10 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger -from pipecat.adapters.schemas.function_schema import FunctionSchema -from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import TTSSpeakFrame from pipecat.pipeline.pipeline import Pipeline diff --git a/examples/foundational/14d-function-calling-video.py b/examples/foundational/14d-function-calling-video.py index 916606c50..15344b7ac 100644 --- a/examples/foundational/14d-function-calling-video.py +++ b/examples/foundational/14d-function-calling-video.py @@ -11,10 +11,10 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger -from pipecat.adapters.schemas.function_schema import FunctionSchema -from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner diff --git a/examples/foundational/14e-function-calling-gemini.py b/examples/foundational/14e-function-calling-gemini.py index 30b74ba2c..146ed77d7 100644 --- a/examples/foundational/14e-function-calling-gemini.py +++ b/examples/foundational/14e-function-calling-gemini.py @@ -11,11 +11,10 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger +from runner import configure from pipecat.adapters.schemas.function_schema import FunctionSchema from pipecat.adapters.schemas.tools_schema import ToolsSchema -from runner import configure - from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import TTSSpeakFrame from pipecat.pipeline.pipeline import Pipeline diff --git a/examples/foundational/14f-function-calling-groq.py b/examples/foundational/14f-function-calling-groq.py index 46caed370..5bbddcc4d 100644 --- a/examples/foundational/14f-function-calling-groq.py +++ b/examples/foundational/14f-function-calling-groq.py @@ -11,10 +11,10 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger -from pipecat.adapters.schemas.function_schema import FunctionSchema -from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import TTSSpeakFrame from pipecat.pipeline.pipeline import Pipeline diff --git a/examples/foundational/14g-function-calling-grok.py b/examples/foundational/14g-function-calling-grok.py index c2bbce221..423919772 100644 --- a/examples/foundational/14g-function-calling-grok.py +++ b/examples/foundational/14g-function-calling-grok.py @@ -11,10 +11,10 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger -from pipecat.adapters.schemas.function_schema import FunctionSchema -from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import TTSSpeakFrame from pipecat.pipeline.pipeline import Pipeline diff --git a/examples/foundational/14h-function-calling-azure.py b/examples/foundational/14h-function-calling-azure.py index edd33b1f7..669055a55 100644 --- a/examples/foundational/14h-function-calling-azure.py +++ b/examples/foundational/14h-function-calling-azure.py @@ -11,10 +11,10 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger -from pipecat.adapters.schemas.function_schema import FunctionSchema -from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import TTSSpeakFrame from pipecat.pipeline.pipeline import Pipeline diff --git a/examples/foundational/14i-function-calling-fireworks.py b/examples/foundational/14i-function-calling-fireworks.py index 54ef75b54..88168383f 100644 --- a/examples/foundational/14i-function-calling-fireworks.py +++ b/examples/foundational/14i-function-calling-fireworks.py @@ -11,10 +11,10 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger -from pipecat.adapters.schemas.function_schema import FunctionSchema -from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import TTSSpeakFrame from pipecat.pipeline.pipeline import Pipeline diff --git a/examples/foundational/14j-function-calling-nim.py b/examples/foundational/14j-function-calling-nim.py index 39c29f004..5d4b123d0 100644 --- a/examples/foundational/14j-function-calling-nim.py +++ b/examples/foundational/14j-function-calling-nim.py @@ -11,10 +11,10 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger -from pipecat.adapters.schemas.function_schema import FunctionSchema -from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import TTSSpeakFrame from pipecat.pipeline.pipeline import Pipeline diff --git a/examples/foundational/14k-function-calling-cerebras.py b/examples/foundational/14k-function-calling-cerebras.py index b0b3ffb1e..b9f1c6b18 100644 --- a/examples/foundational/14k-function-calling-cerebras.py +++ b/examples/foundational/14k-function-calling-cerebras.py @@ -11,10 +11,10 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger -from pipecat.adapters.schemas.function_schema import FunctionSchema -from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import TTSSpeakFrame from pipecat.pipeline.pipeline import Pipeline diff --git a/examples/foundational/14l-function-calling-deepseek.py b/examples/foundational/14l-function-calling-deepseek.py index e96db3254..6add663d5 100644 --- a/examples/foundational/14l-function-calling-deepseek.py +++ b/examples/foundational/14l-function-calling-deepseek.py @@ -11,10 +11,10 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger -from pipecat.adapters.schemas.function_schema import FunctionSchema -from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import TTSSpeakFrame from pipecat.pipeline.pipeline import Pipeline diff --git a/examples/foundational/14m-function-calling-openrouter.py b/examples/foundational/14m-function-calling-openrouter.py index 745d130e7..e816f6322 100644 --- a/examples/foundational/14m-function-calling-openrouter.py +++ b/examples/foundational/14m-function-calling-openrouter.py @@ -11,10 +11,10 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger -from pipecat.adapters.schemas.function_schema import FunctionSchema -from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import TTSSpeakFrame from pipecat.pipeline.pipeline import Pipeline diff --git a/examples/foundational/14o-function-calling-gemini-openai-format.py b/examples/foundational/14o-function-calling-gemini-openai-format.py index 1434c9a77..a1bb53b6b 100644 --- a/examples/foundational/14o-function-calling-gemini-openai-format.py +++ b/examples/foundational/14o-function-calling-gemini-openai-format.py @@ -11,10 +11,10 @@ import sys import aiohttp from dotenv import load_dotenv from loguru import logger -from pipecat.adapters.schemas.function_schema import FunctionSchema -from pipecat.adapters.schemas.tools_schema import ToolsSchema from runner import configure +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import ToolsSchema from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import TTSSpeakFrame from pipecat.pipeline.pipeline import Pipeline From 21443b9a08eecdb796a9629c9105d75cb2ed8888 Mon Sep 17 00:00:00 2001 From: Filipi Fuchter Date: Thu, 6 Mar 2025 11:59:08 -0300 Subject: [PATCH 5/6] Refactored gemini multimodal example to use the unified format for function calling. --- ...gemini-multimodal-live-function-calling.py | 49 +++++++++---------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/examples/foundational/26b-gemini-multimodal-live-function-calling.py b/examples/foundational/26b-gemini-multimodal-live-function-calling.py index 14f2d62c7..3aaad44ce 100644 --- a/examples/foundational/26b-gemini-multimodal-live-function-calling.py +++ b/examples/foundational/26b-gemini-multimodal-live-function-calling.py @@ -14,6 +14,8 @@ from dotenv import load_dotenv from loguru import logger from runner import configure +from pipecat.adapters.schemas.function_schema import FunctionSchema +from pipecat.adapters.schemas.tools_schema import AdapterType, ToolsSchema from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.audio.vad.vad_analyzer import VADParams from pipecat.pipeline.pipeline import Pipeline @@ -41,32 +43,6 @@ async def fetch_weather_from_api(function_name, tool_call_id, args, llm, context ) -tools = [ - { - "function_declarations": [ - { - "name": "get_current_weather", - "description": "Get the current weather", - "parameters": { - "type": "object", - "properties": { - "location": { - "type": "string", - "description": "The city and state, e.g. San Francisco, CA", - }, - "format": { - "type": "string", - "enum": ["celsius", "fahrenheit"], - "description": "The temperature unit to use. Infer this from the users location.", - }, - }, - "required": ["location", "format"], - }, - }, - ] - } -] - system_instruction = """ You are a helpful assistant who can answer questions and use tools. @@ -95,6 +71,27 @@ async def main(): ), ) + weather_function = FunctionSchema( + name="get_current_weather", + description="Get the current weather", + properties={ + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA", + }, + "format": { + "type": "string", + "enum": ["celsius", "fahrenheit"], + "description": "The temperature unit to use. Infer this from the user's location.", + }, + }, + required=["location", "format"], + ) + search_tool = {"google_search": {}} + tools = ToolsSchema( + standard_tools=[weather_function], custom_tools={AdapterType.GEMINI: [search_tool]} + ) + llm = GeminiMultimodalLiveLLMService( api_key=os.getenv("GOOGLE_API_KEY"), system_instruction=system_instruction, From 55b0797fd5cabaa791b2c144d0229353ce23f9d4 Mon Sep 17 00:00:00 2001 From: Filipi Fuchter Date: Thu, 6 Mar 2025 12:00:22 -0300 Subject: [PATCH 6/6] Removing the extra examples inside the unified-format-function-calling folder --- .../base_function_calling.py | 134 ------------------ .../multimodal_base_function_calling.py | 126 ---------------- .../unified-format-function-calling/runner.py | 64 --------- .../standard-function-calling-anthropic.py | 29 ---- .../standard-function-calling-azure.py | 31 ---- .../standard-function-calling-cerebras.py | 27 ---- .../standard-function-calling-deepseek.py | 27 ---- .../standard-function-calling-fireworks.py | 29 ---- ...dard-function-calling-gemini-multimodal.py | 38 ----- .../standard-function-calling-gemini.py | 27 ---- .../standard-function-calling-grok.py | 27 ---- .../standard-function-calling-groq.py | 27 ---- .../standard-function-calling-nim.py | 29 ---- ...andard-function-calling-openai-realtime.py | 43 ------ .../standard-function-calling-openai.py | 27 ---- .../standard-function-calling-openrouter.py | 29 ---- .../standard-function-calling-together.py | 30 ---- src/pipecat/services/azure.py | 1 - 18 files changed, 745 deletions(-) delete mode 100644 examples/unified-format-function-calling/base_function_calling.py delete mode 100644 examples/unified-format-function-calling/multimodal_base_function_calling.py delete mode 100644 examples/unified-format-function-calling/runner.py delete mode 100644 examples/unified-format-function-calling/standard-function-calling-anthropic.py delete mode 100644 examples/unified-format-function-calling/standard-function-calling-azure.py delete mode 100644 examples/unified-format-function-calling/standard-function-calling-cerebras.py delete mode 100644 examples/unified-format-function-calling/standard-function-calling-deepseek.py delete mode 100644 examples/unified-format-function-calling/standard-function-calling-fireworks.py delete mode 100644 examples/unified-format-function-calling/standard-function-calling-gemini-multimodal.py delete mode 100644 examples/unified-format-function-calling/standard-function-calling-gemini.py delete mode 100644 examples/unified-format-function-calling/standard-function-calling-grok.py delete mode 100644 examples/unified-format-function-calling/standard-function-calling-groq.py delete mode 100644 examples/unified-format-function-calling/standard-function-calling-nim.py delete mode 100644 examples/unified-format-function-calling/standard-function-calling-openai-realtime.py delete mode 100644 examples/unified-format-function-calling/standard-function-calling-openai.py delete mode 100644 examples/unified-format-function-calling/standard-function-calling-openrouter.py delete mode 100644 examples/unified-format-function-calling/standard-function-calling-together.py diff --git a/examples/unified-format-function-calling/base_function_calling.py b/examples/unified-format-function-calling/base_function_calling.py deleted file mode 100644 index 798d94465..000000000 --- a/examples/unified-format-function-calling/base_function_calling.py +++ /dev/null @@ -1,134 +0,0 @@ -# -# Copyright (c) 2024–2025, Daily -# -# SPDX-License-Identifier: BSD 2-Clause License -# - -import os -import sys - -import aiohttp -from dotenv import load_dotenv -from loguru import logger -from runner import configure - -from pipecat.adapters.schemas.function_schema import FunctionSchema -from pipecat.adapters.schemas.tools_schema import ToolsSchema -from pipecat.audio.vad.silero import SileroVADAnalyzer -from pipecat.frames.frames import TTSSpeakFrame -from pipecat.pipeline.pipeline import Pipeline -from pipecat.pipeline.runner import PipelineRunner -from pipecat.pipeline.task import PipelineParams, PipelineTask -from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext -from pipecat.services.ai_services import LLMService -from pipecat.services.cartesia import CartesiaTTSService -from pipecat.transports.services.daily import DailyParams, DailyTransport - -logger.remove(0) -logger.add(sys.stderr, level="DEBUG") - -load_dotenv(override=True) - - -async def start_fetch_weather(function_name, llm, context): - """Push a frame to the LLM; this is handy when the LLM response might take a while.""" - await llm.push_frame(TTSSpeakFrame("Let me check on that.")) - logger.debug(f"Starting fetch_weather_from_api with function_name: {function_name}") - - -async def fetch_weather_from_api(function_name, tool_call_id, args, llm, context, result_callback): - await result_callback({"conditions": "nice", "temperature": "75"}) - - -class WeatherBot: - """Generic base class for setting up and running an LLM-powered bot.""" - - def __init__(self, llm: LLMService): - """Initialize the base handler with a specific LLM.""" - self.llm = llm - - async def run(self): - """Set up and start the processing pipeline.""" - async with aiohttp.ClientSession() as session: - (room_url, token) = await configure(session) - - transport = DailyTransport( - room_url, - token, - "Respond bot", - DailyParams( - audio_out_enabled=True, - transcription_enabled=True, - vad_enabled=True, - vad_analyzer=SileroVADAnalyzer(), - ), - ) - - tts = CartesiaTTSService( - api_key=os.getenv("CARTESIA_API_KEY"), - voice_id="79a125e8-cd45-4c13-8a67-188112f4dd22", # British Lady - ) - - # Register a function_name of None to get all functions - # sent to the same callback with an additional function_name parameter. - self.llm.register_function( - None, fetch_weather_from_api, start_callback=start_fetch_weather - ) - - weather_function = FunctionSchema( - name="get_current_weather", - description="Get the current weather", - properties={ - "location": { - "type": "string", - "description": "The city and state, e.g. San Francisco, CA", - }, - "format": { - "type": "string", - "enum": ["celsius", "fahrenheit"], - "description": "The temperature unit to use. Infer this from the user's location.", - }, - }, - required=["location"], - ) - tools = ToolsSchema(standard_tools=[weather_function]) - - messages = [ - { - "role": "system", - "content": "You are a helpful assistant who can report the weather in any location in the universe. Respond concisely. Your response will be turned into speech so use only simple words and punctuation.", - }, - {"role": "user", "content": " Start the conversation by introducing yourself."}, - ] - - context = OpenAILLMContext(messages, tools) - context_aggregator = self.llm.create_context_aggregator(context) - - pipeline = Pipeline( - [ - transport.input(), - context_aggregator.user(), - self.llm, - tts, - transport.output(), - context_aggregator.assistant(), - ] - ) - - task = PipelineTask( - pipeline, - params=PipelineParams( - allow_interruptions=True, - enable_metrics=True, - enable_usage_metrics=True, - report_only_initial_ttfb=True, - ), - ) - - @transport.event_handler("on_first_participant_joined") - async def on_first_participant_joined(transport, participant): - await transport.capture_participant_transcription(participant["id"]) - await task.queue_frames([context_aggregator.user().get_context_frame()]) - - runner = PipelineRunner() - await runner.run(task) diff --git a/examples/unified-format-function-calling/multimodal_base_function_calling.py b/examples/unified-format-function-calling/multimodal_base_function_calling.py deleted file mode 100644 index 8f4a51b96..000000000 --- a/examples/unified-format-function-calling/multimodal_base_function_calling.py +++ /dev/null @@ -1,126 +0,0 @@ -# -# Copyright (c) 2024–2025, Daily -# -# SPDX-License-Identifier: BSD 2-Clause License -# - -import sys -from typing import List - -import aiohttp -from dotenv import load_dotenv -from loguru import logger -from runner import configure - -from pipecat.adapters.schemas.function_schema import FunctionSchema -from pipecat.adapters.schemas.tools_schema import ToolsSchema -from pipecat.audio.vad.silero import SileroVADAnalyzer -from pipecat.frames.frames import TTSSpeakFrame -from pipecat.pipeline.pipeline import Pipeline -from pipecat.pipeline.runner import PipelineRunner -from pipecat.pipeline.task import PipelineParams, PipelineTask -from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext -from pipecat.services.ai_services import LLMService -from pipecat.transports.services.daily import DailyParams, DailyTransport - -logger.remove(0) -logger.add(sys.stderr, level="DEBUG") - -load_dotenv(override=True) - - -async def start_fetch_weather(function_name, llm, context): - """Push a frame to the LLM; this is handy when the LLM response might take a while.""" - await llm.push_frame(TTSSpeakFrame("Let me check on that.")) - logger.debug(f"Starting fetch_weather_from_api with function_name: {function_name}") - - -async def fetch_weather_from_api(function_name, tool_call_id, args, llm, context, result_callback): - await result_callback({"conditions": "nice", "temperature": "75"}) - - -class MultimodalWeatherBot: - """Generic base class for setting up and running an LLM-powered bot.""" - - def __init__(self, llm: LLMService): - """Initialize the base handler with a specific LLM.""" - self.llm = llm - - @staticmethod - def tools() -> ToolsSchema: - weather_function = FunctionSchema( - name="get_current_weather", - description="Get the current weather", - properties={ - "location": { - "type": "string", - "description": "The city and state, e.g. San Francisco, CA", - }, - "format": { - "type": "string", - "enum": ["celsius", "fahrenheit"], - "description": "The temperature unit to use. Infer this from the user's location.", - }, - }, - required=["location"], - ) - return ToolsSchema(standard_tools=[weather_function]) - - async def run(self): - """Set up and start the processing pipeline.""" - async with aiohttp.ClientSession() as session: - (room_url, token) = await configure(session) - - transport = DailyTransport( - room_url, - token, - "Respond bot", - DailyParams( - audio_out_enabled=True, - vad_enabled=True, - vad_analyzer=SileroVADAnalyzer(), - vad_audio_passthrough=True, - ), - ) - - # Register a function_name of None to get all functions - # sent to the same callback with an additional function_name parameter. - self.llm.register_function( - None, fetch_weather_from_api, start_callback=start_fetch_weather - ) - - messages = [ - { - "role": "system", - "content": "You are a helpful assistant who can report the weather in any location in the universe. Respond concisely. Your response will be turned into speech so use only simple words and punctuation.", - }, - {"role": "user", "content": " Start the conversation by introducing yourself."}, - ] - - context = OpenAILLMContext(messages, MultimodalWeatherBot.tools()) - context_aggregator = self.llm.create_context_aggregator(context) - - pipeline = Pipeline( - [ - transport.input(), - context_aggregator.user(), - self.llm, - transport.output(), - context_aggregator.assistant(), - ] - ) - - task = PipelineTask( - pipeline, - params=PipelineParams( - allow_interruptions=True, - ), - ) - - @transport.event_handler("on_first_participant_joined") - async def on_first_participant_joined(transport, participant): - await transport.capture_participant_transcription(participant["id"]) - await task.queue_frames([context_aggregator.user().get_context_frame()]) - - runner = PipelineRunner() - await runner.run(task) diff --git a/examples/unified-format-function-calling/runner.py b/examples/unified-format-function-calling/runner.py deleted file mode 100644 index 04157d549..000000000 --- a/examples/unified-format-function-calling/runner.py +++ /dev/null @@ -1,64 +0,0 @@ -# -# Copyright (c) 2024–2025, Daily -# -# SPDX-License-Identifier: BSD 2-Clause License -# - -import argparse -import os -from typing import Optional - -import aiohttp - -from pipecat.transports.services.helpers.daily_rest import DailyRESTHelper - - -async def configure(aiohttp_session: aiohttp.ClientSession): - (url, token, _) = await configure_with_args(aiohttp_session) - return (url, token) - - -async def configure_with_args( - aiohttp_session: aiohttp.ClientSession, parser: Optional[argparse.ArgumentParser] = None -): - if not parser: - parser = argparse.ArgumentParser(description="Daily AI SDK Bot Sample") - parser.add_argument( - "-u", "--url", type=str, required=False, help="URL of the Daily room to join" - ) - parser.add_argument( - "-k", - "--apikey", - type=str, - required=False, - help="Daily API Key (needed to create an owner token for the room)", - ) - - args, unknown = parser.parse_known_args() - - url = args.url or os.getenv("DAILY_SAMPLE_ROOM_URL") - key = args.apikey or os.getenv("DAILY_API_KEY") - - if not url: - raise Exception( - "No Daily room specified. use the -u/--url option from the command line, or set DAILY_SAMPLE_ROOM_URL in your environment to specify a Daily room URL." - ) - - if not key: - raise Exception( - "No Daily API key specified. use the -k/--apikey option from the command line, or set DAILY_API_KEY in your environment to specify a Daily API key, available from https://dashboard.daily.co/developers." - ) - - daily_rest_helper = DailyRESTHelper( - daily_api_key=key, - daily_api_url=os.getenv("DAILY_API_URL", "https://api.daily.co/v1"), - aiohttp_session=aiohttp_session, - ) - - # Create a meeting token for the given room with an expiration 1 hour in - # the future. - expiry_time: float = 60 * 60 - - token = await daily_rest_helper.get_token(url, expiry_time) - - return (url, token, args) diff --git a/examples/unified-format-function-calling/standard-function-calling-anthropic.py b/examples/unified-format-function-calling/standard-function-calling-anthropic.py deleted file mode 100644 index 7ae39b99a..000000000 --- a/examples/unified-format-function-calling/standard-function-calling-anthropic.py +++ /dev/null @@ -1,29 +0,0 @@ -# -# Copyright (c) 2024–2025, Daily -# -# SPDX-License-Identifier: BSD 2-Clause License -# - -import asyncio -import os - -from base_function_calling import WeatherBot -from dotenv import load_dotenv - -from pipecat.services.anthropic import AnthropicLLMService - -load_dotenv(override=True) - - -class AnthropicWeatherBot(WeatherBot): - """Main class defining the LLM and passing it to the base handler.""" - - def __init__(self): - llm = AnthropicLLMService( - api_key=os.getenv("ANTHROPIC_API_KEY"), model="claude-3-5-sonnet-20240620" - ) - super().__init__(llm) - - -if __name__ == "__main__": - asyncio.run(AnthropicWeatherBot().run()) diff --git a/examples/unified-format-function-calling/standard-function-calling-azure.py b/examples/unified-format-function-calling/standard-function-calling-azure.py deleted file mode 100644 index c1b24ca2a..000000000 --- a/examples/unified-format-function-calling/standard-function-calling-azure.py +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright (c) 2024–2025, Daily -# -# SPDX-License-Identifier: BSD 2-Clause License -# - -import asyncio -import os - -from base_function_calling import WeatherBot -from dotenv import load_dotenv - -from pipecat.services.azure import AzureLLMService - -load_dotenv(override=True) - - -class AzureWeatherBot(WeatherBot): - """Main class defining the LLM and passing it to the base handler.""" - - def __init__(self): - llm = AzureLLMService( - api_key=os.getenv("AZURE_CHATGPT_API_KEY"), - endpoint=os.getenv("AZURE_CHATGPT_ENDPOINT"), - model=os.getenv("AZURE_CHATGPT_MODEL"), - ) - super().__init__(llm) - - -if __name__ == "__main__": - asyncio.run(AzureWeatherBot().run()) diff --git a/examples/unified-format-function-calling/standard-function-calling-cerebras.py b/examples/unified-format-function-calling/standard-function-calling-cerebras.py deleted file mode 100644 index 6888268aa..000000000 --- a/examples/unified-format-function-calling/standard-function-calling-cerebras.py +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright (c) 2024–2025, Daily -# -# SPDX-License-Identifier: BSD 2-Clause License -# - -import asyncio -import os - -from base_function_calling import WeatherBot -from dotenv import load_dotenv - -from pipecat.services.cerebras import CerebrasLLMService - -load_dotenv(override=True) - - -class CerebrasWeatherBot(WeatherBot): - """Main class defining the LLM and passing it to the base handler.""" - - def __init__(self): - llm = CerebrasLLMService(api_key=os.getenv("CEREBRAS_API_KEY"), model="llama-3.3-70b") - super().__init__(llm) - - -if __name__ == "__main__": - asyncio.run(CerebrasWeatherBot().run()) diff --git a/examples/unified-format-function-calling/standard-function-calling-deepseek.py b/examples/unified-format-function-calling/standard-function-calling-deepseek.py deleted file mode 100644 index 7c8cd6ebb..000000000 --- a/examples/unified-format-function-calling/standard-function-calling-deepseek.py +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright (c) 2024–2025, Daily -# -# SPDX-License-Identifier: BSD 2-Clause License -# - -import asyncio -import os - -from base_function_calling import WeatherBot -from dotenv import load_dotenv - -from pipecat.services.deepseek import DeepSeekLLMService - -load_dotenv(override=True) - - -class DeepSeekWeatherBot(WeatherBot): - """Main class defining the LLM and passing it to the base handler.""" - - def __init__(self): - llm = DeepSeekLLMService(api_key=os.getenv("DEEPSEEK_API_KEY"), model="deepseek-chat") - super().__init__(llm) - - -if __name__ == "__main__": - asyncio.run(DeepSeekWeatherBot().run()) diff --git a/examples/unified-format-function-calling/standard-function-calling-fireworks.py b/examples/unified-format-function-calling/standard-function-calling-fireworks.py deleted file mode 100644 index 1128c1ada..000000000 --- a/examples/unified-format-function-calling/standard-function-calling-fireworks.py +++ /dev/null @@ -1,29 +0,0 @@ -# -# Copyright (c) 2024–2025, Daily -# -# SPDX-License-Identifier: BSD 2-Clause License -# - -import asyncio -import os - -from base_function_calling import WeatherBot -from dotenv import load_dotenv - -from pipecat.services.fireworks import FireworksLLMService - -load_dotenv(override=True) - - -class FireworksWeatherBot(WeatherBot): - """Main class defining the LLM and passing it to the base handler.""" - - def __init__(self): - llm = FireworksLLMService( - api_key=os.getenv("FIREWORKS_API_KEY"), - ) - super().__init__(llm) - - -if __name__ == "__main__": - asyncio.run(FireworksWeatherBot().run()) diff --git a/examples/unified-format-function-calling/standard-function-calling-gemini-multimodal.py b/examples/unified-format-function-calling/standard-function-calling-gemini-multimodal.py deleted file mode 100644 index 7a479b6b3..000000000 --- a/examples/unified-format-function-calling/standard-function-calling-gemini-multimodal.py +++ /dev/null @@ -1,38 +0,0 @@ -# -# Copyright (c) 2024–2025, Daily -# -# SPDX-License-Identifier: BSD 2-Clause License -# - -import asyncio -import os - -from dotenv import load_dotenv -from multimodal_base_function_calling import MultimodalWeatherBot - -from pipecat.adapters.schemas.tools_schema import AdapterType -from pipecat.services.gemini_multimodal_live import GeminiMultimodalLiveLLMService - -load_dotenv(override=True) - - -class GeminiMultimodalWeatherBot(MultimodalWeatherBot): - """Main class defining the LLM and passing it to the base handler.""" - - def __init__(self): - search_tool = {"google_search": {}} - tools_def = MultimodalWeatherBot.tools() - tools_def.custom_tools = {AdapterType.GEMINI: [search_tool]} - - llm = GeminiMultimodalLiveLLMService( - api_key=os.getenv("GOOGLE_API_KEY"), - voice_id="Puck", - transcribe_user_audio=True, - transcribe_model_audio=True, - tools=tools_def, - ) - super().__init__(llm) - - -if __name__ == "__main__": - asyncio.run(GeminiMultimodalWeatherBot().run()) diff --git a/examples/unified-format-function-calling/standard-function-calling-gemini.py b/examples/unified-format-function-calling/standard-function-calling-gemini.py deleted file mode 100644 index d164c9e67..000000000 --- a/examples/unified-format-function-calling/standard-function-calling-gemini.py +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright (c) 2024–2025, Daily -# -# SPDX-License-Identifier: BSD 2-Clause License -# - -import asyncio -import os - -from base_function_calling import WeatherBot -from dotenv import load_dotenv - -from pipecat.services.google import GoogleLLMService - -load_dotenv(override=True) - - -class GeminiWeatherBot(WeatherBot): - """Main class defining the LLM and passing it to the base handler.""" - - def __init__(self): - llm = GoogleLLMService(api_key=os.getenv("GOOGLE_API_KEY"), model="gemini-2.0-flash-001") - super().__init__(llm) - - -if __name__ == "__main__": - asyncio.run(GeminiWeatherBot().run()) diff --git a/examples/unified-format-function-calling/standard-function-calling-grok.py b/examples/unified-format-function-calling/standard-function-calling-grok.py deleted file mode 100644 index 3c2570d8a..000000000 --- a/examples/unified-format-function-calling/standard-function-calling-grok.py +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright (c) 2024–2025, Daily -# -# SPDX-License-Identifier: BSD 2-Clause License -# - -import asyncio -import os - -from base_function_calling import WeatherBot -from dotenv import load_dotenv - -from pipecat.services.grok import GrokLLMService - -load_dotenv(override=True) - - -class GrokWeatherBot(WeatherBot): - """Main class defining the LLM and passing it to the base handler.""" - - def __init__(self): - llm = GrokLLMService(api_key=os.getenv("GROK_API_KEY")) - super().__init__(llm) - - -if __name__ == "__main__": - asyncio.run(GrokWeatherBot().run()) diff --git a/examples/unified-format-function-calling/standard-function-calling-groq.py b/examples/unified-format-function-calling/standard-function-calling-groq.py deleted file mode 100644 index 70a6cef47..000000000 --- a/examples/unified-format-function-calling/standard-function-calling-groq.py +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright (c) 2024–2025, Daily -# -# SPDX-License-Identifier: BSD 2-Clause License -# - -import asyncio -import os - -from base_function_calling import WeatherBot -from dotenv import load_dotenv - -from pipecat.services.groq import GroqLLMService - -load_dotenv(override=True) - - -class GroqWeatherBot(WeatherBot): - """Main class defining the LLM and passing it to the base handler.""" - - def __init__(self): - llm = GroqLLMService(api_key=os.getenv("GROQ_API_KEY"), model="llama-3.3-70b-versatile") - super().__init__(llm) - - -if __name__ == "__main__": - asyncio.run(GroqWeatherBot().run()) diff --git a/examples/unified-format-function-calling/standard-function-calling-nim.py b/examples/unified-format-function-calling/standard-function-calling-nim.py deleted file mode 100644 index f0d1e892b..000000000 --- a/examples/unified-format-function-calling/standard-function-calling-nim.py +++ /dev/null @@ -1,29 +0,0 @@ -# -# Copyright (c) 2024–2025, Daily -# -# SPDX-License-Identifier: BSD 2-Clause License -# - -import asyncio -import os - -from base_function_calling import WeatherBot -from dotenv import load_dotenv - -from pipecat.services.nim import NimLLMService - -load_dotenv(override=True) - - -class NimWeatherBot(WeatherBot): - """Main class defining the LLM and passing it to the base handler.""" - - def __init__(self): - llm = NimLLMService( - api_key=os.getenv("NVIDIA_API_KEY"), model="meta/llama-3.3-70b-instruct" - ) - super().__init__(llm) - - -if __name__ == "__main__": - asyncio.run(NimWeatherBot().run()) diff --git a/examples/unified-format-function-calling/standard-function-calling-openai-realtime.py b/examples/unified-format-function-calling/standard-function-calling-openai-realtime.py deleted file mode 100644 index 203d0abc3..000000000 --- a/examples/unified-format-function-calling/standard-function-calling-openai-realtime.py +++ /dev/null @@ -1,43 +0,0 @@ -# -# Copyright (c) 2024–2025, Daily -# -# SPDX-License-Identifier: BSD 2-Clause License -# - -import asyncio -import os - -from dotenv import load_dotenv -from multimodal_base_function_calling import MultimodalWeatherBot - -from pipecat.services.openai_realtime_beta import ( - InputAudioTranscription, - OpenAIRealtimeBetaLLMService, - SessionProperties, - TurnDetection, -) - -load_dotenv(override=True) - - -class OpenAiRealTimeWeatherBot(MultimodalWeatherBot): - """Main class defining the LLM and passing it to the base handler.""" - - def __init__(self): - session_properties = SessionProperties( - input_audio_transcription=InputAudioTranscription(), - # Set openai TurnDetection parameters. Not setting this at all will turn it - # on by default - turn_detection=TurnDetection(silence_duration_ms=1000), - ) - - llm = OpenAIRealtimeBetaLLMService( - api_key=os.getenv("OPENAI_API_KEY"), - session_properties=session_properties, - start_audio_paused=False, - ) - super().__init__(llm) - - -if __name__ == "__main__": - asyncio.run(OpenAiRealTimeWeatherBot().run()) diff --git a/examples/unified-format-function-calling/standard-function-calling-openai.py b/examples/unified-format-function-calling/standard-function-calling-openai.py deleted file mode 100644 index 7763ee505..000000000 --- a/examples/unified-format-function-calling/standard-function-calling-openai.py +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright (c) 2024–2025, Daily -# -# SPDX-License-Identifier: BSD 2-Clause License -# - -import asyncio -import os - -from base_function_calling import WeatherBot -from dotenv import load_dotenv - -from pipecat.services.openai import OpenAILLMService - -load_dotenv(override=True) - - -class OpenAiWeatherBot(WeatherBot): - """Main class defining the LLM and passing it to the base handler.""" - - def __init__(self): - llm = OpenAILLMService(api_key=os.getenv("OPENAI_API_KEY"), model="gpt-4o") - super().__init__(llm) - - -if __name__ == "__main__": - asyncio.run(OpenAiWeatherBot().run()) diff --git a/examples/unified-format-function-calling/standard-function-calling-openrouter.py b/examples/unified-format-function-calling/standard-function-calling-openrouter.py deleted file mode 100644 index cb1ad3964..000000000 --- a/examples/unified-format-function-calling/standard-function-calling-openrouter.py +++ /dev/null @@ -1,29 +0,0 @@ -# -# Copyright (c) 2024–2025, Daily -# -# SPDX-License-Identifier: BSD 2-Clause License -# - -import asyncio -import os - -from base_function_calling import WeatherBot -from dotenv import load_dotenv - -from pipecat.services.openrouter import OpenRouterLLMService - -load_dotenv(override=True) - - -class OpenRouterWeatherBot(WeatherBot): - """Main class defining the LLM and passing it to the base handler.""" - - def __init__(self): - llm = OpenRouterLLMService( - api_key=os.getenv("OPENROUTER_API_KEY"), model="openai/gpt-4o-2024-11-20" - ) - super().__init__(llm) - - -if __name__ == "__main__": - asyncio.run(OpenRouterWeatherBot().run()) diff --git a/examples/unified-format-function-calling/standard-function-calling-together.py b/examples/unified-format-function-calling/standard-function-calling-together.py deleted file mode 100644 index fe100c95c..000000000 --- a/examples/unified-format-function-calling/standard-function-calling-together.py +++ /dev/null @@ -1,30 +0,0 @@ -# -# Copyright (c) 2024–2025, Daily -# -# SPDX-License-Identifier: BSD 2-Clause License -# - -import asyncio -import os - -from base_function_calling import WeatherBot -from dotenv import load_dotenv - -from pipecat.services.together import TogetherLLMService - -load_dotenv(override=True) - - -class TogetherWeatherBot(WeatherBot): - """Main class defining the LLM and passing it to the base handler.""" - - def __init__(self): - llm = TogetherLLMService( - api_key=os.getenv("TOGETHER_API_KEY"), - model="meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo", - ) - super().__init__(llm) - - -if __name__ == "__main__": - asyncio.run(TogetherWeatherBot().run()) diff --git a/src/pipecat/services/azure.py b/src/pipecat/services/azure.py index 60a3b6a8b..c59cd29c2 100644 --- a/src/pipecat/services/azure.py +++ b/src/pipecat/services/azure.py @@ -579,7 +579,6 @@ class AzureTTSService(AzureBaseTTSService): async def flush_audio(self): logger.trace(f"{self}: flushing audio") - # TODO: check what we need to implement here ? async def run_tts(self, text: str) -> AsyncGenerator[Frame, None]: logger.debug(f"{self}: Generating TTS [{text}]")