diff --git a/examples/foundational/03-still-frame.py b/examples/foundational/03-still-frame.py index def125165..a98a53637 100644 --- a/examples/foundational/03-still-frame.py +++ b/examples/foundational/03-still-frame.py @@ -16,7 +16,7 @@ from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.task import PipelineTask from pipecat.runner.types import RunnerArguments from pipecat.runner.utils import create_transport -from pipecat.services.fal.image import FalImageGenService +from pipecat.services.fal.image import FalImageGenService, FalImageGenSettings from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.daily.transport import DailyParams @@ -45,7 +45,9 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): # Create an HTTP session async with aiohttp.ClientSession() as session: imagegen = FalImageGenService( - params=FalImageGenService.InputParams(image_size="square_hd"), + settings=FalImageGenSettings( + image_size="square_hd", + ), aiohttp_session=session, key=os.getenv("FAL_KEY"), ) diff --git a/examples/foundational/03a-local-still-frame.py b/examples/foundational/03a-local-still-frame.py index b25c51c4a..db67848e8 100644 --- a/examples/foundational/03a-local-still-frame.py +++ b/examples/foundational/03a-local-still-frame.py @@ -17,7 +17,7 @@ from pipecat.frames.frames import TextFrame from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.task import PipelineTask -from pipecat.services.fal.image import FalImageGenService +from pipecat.services.fal.image import FalImageGenService, FalImageGenSettings from pipecat.transports.local.tk import TkLocalTransport, TkTransportParams load_dotenv(override=True) @@ -37,7 +37,9 @@ async def main(): ) imagegen = FalImageGenService( - params=FalImageGenService.InputParams(image_size="square_hd"), + settings=FalImageGenSettings( + image_size="square_hd", + ), aiohttp_session=session, key=os.getenv("FAL_KEY"), ) diff --git a/examples/foundational/05-sync-speech-and-image.py b/examples/foundational/05-sync-speech-and-image.py index 95de1143b..b77ff1612 100644 --- a/examples/foundational/05-sync-speech-and-image.py +++ b/examples/foundational/05-sync-speech-and-image.py @@ -28,7 +28,7 @@ from pipecat.processors.frame_processor import FrameDirection, FrameProcessor from pipecat.runner.types import RunnerArguments from pipecat.runner.utils import create_transport from pipecat.services.cartesia.tts import CartesiaHttpTTSService, CartesiaTTSSettings -from pipecat.services.fal.image import FalImageGenService +from pipecat.services.fal.image import FalImageGenService, FalImageGenSettings from pipecat.services.openai.llm import OpenAILLMService from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.daily.transport import DailyParams @@ -104,7 +104,9 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): ) imagegen = FalImageGenService( - params=FalImageGenService.InputParams(image_size="square_hd"), + settings=FalImageGenSettings( + image_size="square_hd", + ), aiohttp_session=session, key=os.getenv("FAL_KEY"), ) diff --git a/examples/foundational/05a-local-sync-speech-and-image.py b/examples/foundational/05a-local-sync-speech-and-image.py index 03b690c11..993e8eb07 100644 --- a/examples/foundational/05a-local-sync-speech-and-image.py +++ b/examples/foundational/05a-local-sync-speech-and-image.py @@ -29,7 +29,7 @@ from pipecat.processors.aggregators.llm_context import LLMContext from pipecat.processors.aggregators.sentence import SentenceAggregator from pipecat.processors.frame_processor import FrameDirection, FrameProcessor from pipecat.services.cartesia.tts import CartesiaHttpTTSService, CartesiaTTSSettings -from pipecat.services.fal.image import FalImageGenService +from pipecat.services.fal.image import FalImageGenService, FalImageGenSettings from pipecat.services.openai.llm import OpenAILLMService from pipecat.transports.local.tk import TkLocalTransport, TkTransportParams @@ -104,7 +104,9 @@ async def main(): ) imagegen = FalImageGenService( - params=FalImageGenService.InputParams(image_size="square_hd"), + settings=FalImageGenSettings( + image_size="square_hd", + ), aiohttp_session=session, key=os.getenv("FAL_KEY"), ) diff --git a/examples/foundational/14o-function-calling-gemini-openai-format.py b/examples/foundational/14o-function-calling-gemini-openai-format.py index 4a752586f..5eb8ff89d 100644 --- a/examples/foundational/14o-function-calling-gemini-openai-format.py +++ b/examples/foundational/14o-function-calling-gemini-openai-format.py @@ -65,7 +65,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): tts = ElevenLabsTTSService( api_key=os.getenv("ELEVENLABS_API_KEY", ""), settings=ElevenLabsTTSSettings( - voice_id=os.getenv("ELEVENLABS_VOICE_ID", ""), + voice=os.getenv("ELEVENLABS_VOICE_ID", ""), ), ) diff --git a/examples/foundational/14p-function-calling-gemini-vertex-ai.py b/examples/foundational/14p-function-calling-gemini-vertex-ai.py index 3ff062201..bf7b9458d 100644 --- a/examples/foundational/14p-function-calling-gemini-vertex-ai.py +++ b/examples/foundational/14p-function-calling-gemini-vertex-ai.py @@ -65,7 +65,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): tts = ElevenLabsTTSService( api_key=os.getenv("ELEVENLABS_API_KEY", ""), settings=ElevenLabsTTSSettings( - voice_id=os.getenv("ELEVENLABS_VOICE_ID", ""), + voice=os.getenv("ELEVENLABS_VOICE_ID", ""), ), ) diff --git a/examples/foundational/14r-function-calling-aws.py b/examples/foundational/14r-function-calling-aws.py index 9e8e9836f..9d7e4e7a1 100644 --- a/examples/foundational/14r-function-calling-aws.py +++ b/examples/foundational/14r-function-calling-aws.py @@ -67,7 +67,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): tts = AWSPollyTTSService( region="us-west-2", # only specific regions support generative TTS settings=AWSPollyTTSSettings( - voice_id="Joanna", + voice="Joanna", engine="generative", rate="1.1", ), diff --git a/examples/foundational/36-user-email-gathering.py b/examples/foundational/36-user-email-gathering.py index 9c4bdd4ac..5bdb937d0 100644 --- a/examples/foundational/36-user-email-gathering.py +++ b/examples/foundational/36-user-email-gathering.py @@ -77,7 +77,9 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): # (see https://docs.rime.ai/api-reference/spell) # tts = RimeHttpTTSService( # api_key=os.getenv("RIME_API_KEY", ""), - # voice_id="eva", + # settings=RimeTTSSettings( + # voice="eva", + # ), # aiohttp_session=session, # ) diff --git a/examples/foundational/55d-update-settings-assemblyai-stt.py b/examples/foundational/55d-update-settings-assemblyai-stt.py index e6d10d04f..9cd5641fd 100644 --- a/examples/foundational/55d-update-settings-assemblyai-stt.py +++ b/examples/foundational/55d-update-settings-assemblyai-stt.py @@ -22,7 +22,6 @@ from pipecat.processors.aggregators.llm_response_universal import ( ) from pipecat.runner.types import RunnerArguments from pipecat.runner.utils import create_transport -from pipecat.services.assemblyai.models import AssemblyAIConnectionParams from pipecat.services.assemblyai.stt import AssemblyAISTTService, AssemblyAISTTSettings from pipecat.services.cartesia.tts import CartesiaTTSService, CartesiaTTSSettings from pipecat.services.openai.llm import OpenAILLMService @@ -53,8 +52,8 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): stt = AssemblyAISTTService( api_key=os.getenv("ASSEMBLYAI_API_KEY"), - connection_params=AssemblyAIConnectionParams( - speech_model="u3-rt-pro", + settings=AssemblyAISTTSettings( + model="u3-rt-pro", ), ) @@ -111,9 +110,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): await task.queue_frame( STTUpdateSettingsFrame( delta=AssemblyAISTTSettings( - connection_params=AssemblyAIConnectionParams( - keyterms_prompt=["Xiomara", "Saoirse", "Krzystof", "Nguyen", "Pipecat"] - ) + keyterms_prompt=["Xiomara", "Saoirse", "Krzystof", "Nguyen", "Pipecat"] ) ) ) diff --git a/examples/foundational/55h-update-settings-speechmatics-stt.py b/examples/foundational/55h-update-settings-speechmatics-stt.py index 1471f7ef2..7a0f493a8 100644 --- a/examples/foundational/55h-update-settings-speechmatics-stt.py +++ b/examples/foundational/55h-update-settings-speechmatics-stt.py @@ -53,7 +53,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): stt = SpeechmaticsSTTService( api_key=os.getenv("SPEECHMATICS_API_KEY"), - params=SpeechmaticsSTTService.InputParams( + settings=SpeechmaticsSTTSettings( enable_diarization=True, speaker_active_format="<{speaker_id}>{text}", speaker_passive_format="<{speaker_id}>{text}", diff --git a/examples/foundational/55o-update-settings-elevenlabs-http-tts.py b/examples/foundational/55o-update-settings-elevenlabs-http-tts.py index 7cdf97c25..c6160d1c2 100644 --- a/examples/foundational/55o-update-settings-elevenlabs-http-tts.py +++ b/examples/foundational/55o-update-settings-elevenlabs-http-tts.py @@ -58,7 +58,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): tts = ElevenLabsHttpTTSService( api_key=os.getenv("ELEVENLABS_API_KEY"), - voice_id=os.getenv("ELEVENLABS_VOICE_ID"), + settings=ElevenLabsHttpTTSSettings(voice=os.getenv("ELEVENLABS_VOICE_ID")), aiohttp_session=session, ) diff --git a/examples/foundational/55o-update-settings-elevenlabs-tts.py b/examples/foundational/55o-update-settings-elevenlabs-tts.py index 6d5d74a17..104dd314f 100644 --- a/examples/foundational/55o-update-settings-elevenlabs-tts.py +++ b/examples/foundational/55o-update-settings-elevenlabs-tts.py @@ -55,7 +55,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): tts = ElevenLabsTTSService( api_key=os.getenv("ELEVENLABS_API_KEY"), - voice_id=os.getenv("ELEVENLABS_VOICE_ID"), + settings=ElevenLabsTTSSettings(voice=os.getenv("ELEVENLABS_VOICE_ID")), ) llm = OpenAILLMService( diff --git a/examples/foundational/55u-update-settings-rime-http-tts.py b/examples/foundational/55u-update-settings-rime-http-tts.py index f57d2b83e..8515b796e 100644 --- a/examples/foundational/55u-update-settings-rime-http-tts.py +++ b/examples/foundational/55u-update-settings-rime-http-tts.py @@ -57,7 +57,9 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) tts = RimeHttpTTSService( - api_key=os.getenv("RIME_API_KEY"), voice_id="eva", aiohttp_session=session + api_key=os.getenv("RIME_API_KEY"), + settings=RimeTTSSettings(voice="eva"), + aiohttp_session=session, ) llm = OpenAILLMService( diff --git a/examples/foundational/55u-update-settings-rime-tts.py b/examples/foundational/55u-update-settings-rime-tts.py index 5c4cdee67..72c63af8c 100644 --- a/examples/foundational/55u-update-settings-rime-tts.py +++ b/examples/foundational/55u-update-settings-rime-tts.py @@ -54,7 +54,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): tts = RimeTTSService( api_key=os.getenv("RIME_API_KEY"), - voice_id="luna", + settings=RimeTTSSettings(voice="luna"), ) llm = OpenAILLMService( diff --git a/examples/foundational/55v-update-settings-lmnt-tts.py b/examples/foundational/55v-update-settings-lmnt-tts.py index 0a2c27401..d0651c84e 100644 --- a/examples/foundational/55v-update-settings-lmnt-tts.py +++ b/examples/foundational/55v-update-settings-lmnt-tts.py @@ -54,7 +54,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): tts = LmntTTSService( api_key=os.getenv("LMNT_API_KEY"), - voice_id="lily", + settings=LmntTTSSettings(voice="lily"), ) llm = OpenAILLMService( diff --git a/examples/foundational/55w-update-settings-fish-tts.py b/examples/foundational/55w-update-settings-fish-tts.py index 87a4a2072..ff95838f7 100644 --- a/examples/foundational/55w-update-settings-fish-tts.py +++ b/examples/foundational/55w-update-settings-fish-tts.py @@ -54,7 +54,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): tts = FishAudioTTSService( api_key=os.getenv("FISH_API_KEY"), - model="4ce7e917cedd4bc2bb2e6ff3a46acaa1", # Barack Obama + settings=FishAudioTTSSettings(voice="4ce7e917cedd4bc2bb2e6ff3a46acaa1"), # Barack Obama ) llm = OpenAILLMService( diff --git a/examples/foundational/55z-update-settings-hume-tts.py b/examples/foundational/55z-update-settings-hume-tts.py index f16745cad..d01dc78bf 100644 --- a/examples/foundational/55z-update-settings-hume-tts.py +++ b/examples/foundational/55z-update-settings-hume-tts.py @@ -54,7 +54,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): tts = HumeTTSService( api_key=os.getenv("HUME_API_KEY"), - voice_id="f898a92e-685f-43fa-985b-a46920f0650b", + settings=HumeTTSSettings(voice="f898a92e-685f-43fa-985b-a46920f0650b"), ) llm = OpenAILLMService( diff --git a/examples/foundational/55zc-update-settings-gemini-tts.py b/examples/foundational/55zc-update-settings-gemini-tts.py index 637ee65a7..99a91d176 100644 --- a/examples/foundational/55zc-update-settings-gemini-tts.py +++ b/examples/foundational/55zc-update-settings-gemini-tts.py @@ -55,9 +55,9 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): tts = GeminiTTSService( credentials=os.getenv("GOOGLE_TEST_CREDENTIALS"), - model="gemini-2.5-flash-tts", - voice_id="Charon", - params=GeminiTTSService.InputParams( + settings=GeminiTTSSettings( + model="gemini-2.5-flash-tts", + voice="Charon", language=Language.EN_US, prompt="You are a helpful AI assistant. Speak in a natural, conversational tone.", ), diff --git a/examples/foundational/55zh-update-settings-resembleai-tts.py b/examples/foundational/55zh-update-settings-resembleai-tts.py index 7aba67b1f..8428357b5 100644 --- a/examples/foundational/55zh-update-settings-resembleai-tts.py +++ b/examples/foundational/55zh-update-settings-resembleai-tts.py @@ -54,7 +54,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): tts = ResembleAITTSService( api_key=os.getenv("RESEMBLE_API_KEY"), - voice_id=os.getenv("RESEMBLE_VOICE_UUID"), + settings=ResembleAITTSSettings(voice=os.getenv("RESEMBLE_VOICE_UUID")), ) llm = OpenAILLMService( diff --git a/examples/foundational/55zi-update-settings-azure-llm.py b/examples/foundational/55zi-update-settings-azure-llm.py index 29748491b..b7fe5d745 100644 --- a/examples/foundational/55zi-update-settings-azure-llm.py +++ b/examples/foundational/55zi-update-settings-azure-llm.py @@ -22,7 +22,7 @@ from pipecat.processors.aggregators.llm_response_universal import ( ) from pipecat.runner.types import RunnerArguments from pipecat.runner.utils import create_transport -from pipecat.services.azure.llm import AzureLLMService +from pipecat.services.azure.llm import AzureLLMService, AzureLLMSettings from pipecat.services.cartesia.tts import CartesiaTTSService, CartesiaTTSSettings from pipecat.services.deepgram.stt import DeepgramSTTService from pipecat.services.openai.base_llm import OpenAILLMSettings @@ -63,7 +63,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): llm = AzureLLMService( api_key=os.getenv("AZURE_CHATGPT_API_KEY"), endpoint=os.getenv("AZURE_CHATGPT_ENDPOINT"), - model=os.getenv("AZURE_CHATGPT_MODEL"), + settings=AzureLLMSettings(model=os.getenv("AZURE_CHATGPT_MODEL")), system_instruction="You are a helpful LLM in a WebRTC call. Your goal is to demonstrate your capabilities in a succinct way. Your output will be spoken aloud, so avoid special characters that can't easily be spoken, such as emojis or bullet points. Respond to what the user said in a creative and helpful way.", ) diff --git a/examples/foundational/55zp-update-settings-aws-bedrock-llm.py b/examples/foundational/55zp-update-settings-aws-bedrock-llm.py index c543ef50c..3d5d93b6a 100644 --- a/examples/foundational/55zp-update-settings-aws-bedrock-llm.py +++ b/examples/foundational/55zp-update-settings-aws-bedrock-llm.py @@ -61,8 +61,10 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): llm = AWSBedrockLLMService( aws_region="us-west-2", - model="us.anthropic.claude-haiku-4-5-20251001-v1:0", - params=AWSBedrockLLMService.InputParams(temperature=0.8), + settings=AWSBedrockLLMSettings( + model="us.anthropic.claude-haiku-4-5-20251001-v1:0", + temperature=0.8, + ), system_instruction="You are a helpful LLM in a WebRTC call. Your goal is to demonstrate your capabilities in a succinct way. Your output will be spoken aloud, so avoid special characters that can't easily be spoken, such as emojis or bullet points. Respond to what the user said in a creative and helpful way.", ) diff --git a/examples/foundational/55zv-update-settings-asyncai-http-tts.py b/examples/foundational/55zv-update-settings-asyncai-http-tts.py index 79ca4382e..2063cda3a 100644 --- a/examples/foundational/55zv-update-settings-asyncai-http-tts.py +++ b/examples/foundational/55zv-update-settings-asyncai-http-tts.py @@ -59,7 +59,9 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): tts = AsyncAIHttpTTSService( api_key=os.getenv("ASYNCAI_API_KEY", ""), - voice_id=os.getenv("ASYNCAI_VOICE_ID", "e0f39dc4-f691-4e78-bba5-5c636692cc04"), + settings=AsyncAITTSSettings( + voice=os.getenv("ASYNCAI_VOICE_ID", "e0f39dc4-f691-4e78-bba5-5c636692cc04") + ), aiohttp_session=session, ) diff --git a/examples/foundational/55zv-update-settings-asyncai-tts.py b/examples/foundational/55zv-update-settings-asyncai-tts.py index 7e5463d2b..10cace018 100644 --- a/examples/foundational/55zv-update-settings-asyncai-tts.py +++ b/examples/foundational/55zv-update-settings-asyncai-tts.py @@ -55,7 +55,9 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): tts = AsyncAITTSService( api_key=os.getenv("ASYNCAI_API_KEY", ""), - voice_id=os.getenv("ASYNCAI_VOICE_ID", "e0f39dc4-f691-4e78-bba5-5c636692cc04"), + settings=AsyncAITTSSettings( + voice=os.getenv("ASYNCAI_VOICE_ID", "e0f39dc4-f691-4e78-bba5-5c636692cc04") + ), ) llm = OpenAILLMService( diff --git a/examples/foundational/55zw-update-settings-gradium-tts.py b/examples/foundational/55zw-update-settings-gradium-tts.py index e12d20dd2..5c33e090a 100644 --- a/examples/foundational/55zw-update-settings-gradium-tts.py +++ b/examples/foundational/55zw-update-settings-gradium-tts.py @@ -54,7 +54,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): tts = GradiumTTSService( api_key=os.getenv("GRADIUM_API_KEY"), - voice_id="YTpq7expH9539ERJ", + settings=GradiumTTSSettings(voice="YTpq7expH9539ERJ"), url="wss://us.api.gradium.ai/api/speech/tts", ) diff --git a/examples/foundational/55zz-update-settings-fireworks-llm.py b/examples/foundational/55zz-update-settings-fireworks-llm.py index 19b9276e6..56d29cfac 100644 --- a/examples/foundational/55zz-update-settings-fireworks-llm.py +++ b/examples/foundational/55zz-update-settings-fireworks-llm.py @@ -24,7 +24,7 @@ from pipecat.runner.types import RunnerArguments from pipecat.runner.utils import create_transport from pipecat.services.cartesia.tts import CartesiaTTSService, CartesiaTTSSettings from pipecat.services.deepgram.stt import DeepgramSTTService -from pipecat.services.fireworks.llm import FireworksLLMService +from pipecat.services.fireworks.llm import FireworksLLMService, FireworksLLMSettings from pipecat.services.openai.base_llm import OpenAILLMSettings from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.daily.transport import DailyParams @@ -62,7 +62,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): llm = FireworksLLMService( api_key=os.getenv("FIREWORKS_API_KEY"), - model="accounts/fireworks/models/gpt-oss-20b", + settings=FireworksLLMSettings(model="accounts/fireworks/models/gpt-oss-20b"), system_instruction="You are a helpful LLM in a WebRTC call. Your goal is to demonstrate your capabilities in a succinct way. Your output will be spoken aloud, so avoid special characters that can't easily be spoken, such as emojis or bullet points. Respond to what the user said in a creative and helpful way.", ) diff --git a/examples/foundational/55zzb-update-settings-groq-llm.py b/examples/foundational/55zzb-update-settings-groq-llm.py index be5467b8a..35cec306f 100644 --- a/examples/foundational/55zzb-update-settings-groq-llm.py +++ b/examples/foundational/55zzb-update-settings-groq-llm.py @@ -24,7 +24,7 @@ from pipecat.runner.types import RunnerArguments from pipecat.runner.utils import create_transport from pipecat.services.cartesia.tts import CartesiaTTSService, CartesiaTTSSettings from pipecat.services.deepgram.stt import DeepgramSTTService -from pipecat.services.groq.llm import GroqLLMService +from pipecat.services.groq.llm import GroqLLMService, GroqLLMSettings from pipecat.services.openai.base_llm import OpenAILLMSettings from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.daily.transport import DailyParams @@ -62,7 +62,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): llm = GroqLLMService( api_key=os.getenv("GROQ_API_KEY"), - model="meta-llama/llama-4-maverick-17b-128e-instruct", + settings=GroqLLMSettings(model="meta-llama/llama-4-maverick-17b-128e-instruct"), system_instruction="You are a helpful LLM in a WebRTC call. Your goal is to demonstrate your capabilities in a succinct way. Your output will be spoken aloud, so avoid special characters that can't easily be spoken, such as emojis or bullet points. Respond to what the user said in a creative and helpful way.", ) diff --git a/examples/foundational/55zzd-update-settings-nvidia-llm.py b/examples/foundational/55zzd-update-settings-nvidia-llm.py index 5e26e8213..68d168461 100644 --- a/examples/foundational/55zzd-update-settings-nvidia-llm.py +++ b/examples/foundational/55zzd-update-settings-nvidia-llm.py @@ -24,7 +24,7 @@ from pipecat.runner.types import RunnerArguments from pipecat.runner.utils import create_transport from pipecat.services.cartesia.tts import CartesiaTTSService, CartesiaTTSSettings from pipecat.services.deepgram.stt import DeepgramSTTService -from pipecat.services.nvidia.llm import NvidiaLLMService +from pipecat.services.nvidia.llm import NvidiaLLMService, NvidiaLLMSettings from pipecat.services.openai.base_llm import OpenAILLMSettings from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.daily.transport import DailyParams @@ -62,7 +62,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): llm = NvidiaLLMService( api_key=os.getenv("NVIDIA_API_KEY"), - model="meta/llama-3.1-405b-instruct", + settings=NvidiaLLMSettings(model="meta/llama-3.1-405b-instruct"), system_instruction="You are a helpful LLM in a WebRTC call. Your goal is to demonstrate your capabilities in a succinct way. Your output will be spoken aloud, so avoid special characters that can't easily be spoken, such as emojis or bullet points. Respond to what the user said in a creative and helpful way.", ) diff --git a/examples/foundational/55zze-update-settings-ollama-llm.py b/examples/foundational/55zze-update-settings-ollama-llm.py index 7e3fa02de..8a3a5f973 100644 --- a/examples/foundational/55zze-update-settings-ollama-llm.py +++ b/examples/foundational/55zze-update-settings-ollama-llm.py @@ -24,7 +24,7 @@ from pipecat.runner.types import RunnerArguments from pipecat.runner.utils import create_transport from pipecat.services.cartesia.tts import CartesiaTTSService, CartesiaTTSSettings from pipecat.services.deepgram.stt import DeepgramSTTService -from pipecat.services.ollama.llm import OLLamaLLMService +from pipecat.services.ollama.llm import OLLamaLLMService, OllamaLLMSettings from pipecat.services.openai.base_llm import OpenAILLMSettings from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.daily.transport import DailyParams @@ -61,7 +61,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): ) llm = OLLamaLLMService( - model="llama3.2", + settings=OllamaLLMSettings(model="llama3.2"), system_instruction="You are a helpful LLM in a WebRTC call. Your goal is to demonstrate your capabilities in a succinct way. Your output will be spoken aloud, so avoid special characters that can't easily be spoken, such as emojis or bullet points. Respond to what the user said in a creative and helpful way.", ) # Update to the model you're running locally diff --git a/examples/foundational/55zzh-update-settings-qwen-llm.py b/examples/foundational/55zzh-update-settings-qwen-llm.py index 5c6d17d1d..dd95308ec 100644 --- a/examples/foundational/55zzh-update-settings-qwen-llm.py +++ b/examples/foundational/55zzh-update-settings-qwen-llm.py @@ -25,7 +25,7 @@ from pipecat.runner.utils import create_transport from pipecat.services.cartesia.tts import CartesiaTTSService, CartesiaTTSSettings from pipecat.services.deepgram.stt import DeepgramSTTService from pipecat.services.openai.base_llm import OpenAILLMSettings -from pipecat.services.qwen.llm import QwenLLMService +from pipecat.services.qwen.llm import QwenLLMService, QwenLLMSettings from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.daily.transport import DailyParams from pipecat.transports.websocket.fastapi import FastAPIWebsocketParams @@ -62,7 +62,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): llm = QwenLLMService( api_key=os.getenv("QWEN_API_KEY"), - model="qwen2.5-72b-instruct", + settings=QwenLLMSettings(model="qwen2.5-72b-instruct"), system_instruction="You are a helpful LLM in a WebRTC call. Your goal is to demonstrate your capabilities in a succinct way. Your output will be spoken aloud, so avoid special characters that can't easily be spoken, such as emojis or bullet points. Respond to what the user said in a creative and helpful way.", ) diff --git a/examples/foundational/55zzj-update-settings-together-llm.py b/examples/foundational/55zzj-update-settings-together-llm.py index 4e1c9732f..c3cfafea2 100644 --- a/examples/foundational/55zzj-update-settings-together-llm.py +++ b/examples/foundational/55zzj-update-settings-together-llm.py @@ -25,7 +25,7 @@ from pipecat.runner.utils import create_transport from pipecat.services.cartesia.tts import CartesiaTTSService, CartesiaTTSSettings from pipecat.services.deepgram.stt import DeepgramSTTService from pipecat.services.openai.base_llm import OpenAILLMSettings -from pipecat.services.together.llm import TogetherLLMService +from pipecat.services.together.llm import TogetherLLMService, TogetherLLMSettings from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.daily.transport import DailyParams from pipecat.transports.websocket.fastapi import FastAPIWebsocketParams @@ -62,7 +62,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): llm = TogetherLLMService( api_key=os.getenv("TOGETHER_API_KEY"), - model="meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo", + settings=TogetherLLMSettings(model="meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo"), system_instruction="You are a helpful LLM in a WebRTC call. Your goal is to demonstrate your capabilities in a succinct way. Your output will be spoken aloud, so avoid special characters that can't easily be spoken, such as emojis or bullet points. Respond to what the user said in a creative and helpful way.", ) diff --git a/src/pipecat/services/azure/image.py b/src/pipecat/services/azure/image.py index 2a1286c78..28ac68bf9 100644 --- a/src/pipecat/services/azure/image.py +++ b/src/pipecat/services/azure/image.py @@ -12,7 +12,7 @@ using REST endpoints for creating images from text prompts. import asyncio import io -from dataclasses import dataclass +from dataclasses import dataclass, field from typing import AsyncGenerator, Optional import aiohttp @@ -20,7 +20,7 @@ from PIL import Image from pipecat.frames.frames import ErrorFrame, Frame, URLImageRawFrame from pipecat.services.image_service import ImageGenService -from pipecat.services.settings import ImageGenSettings, _warn_deprecated_param +from pipecat.services.settings import NOT_GIVEN, ImageGenSettings, _NotGiven, _warn_deprecated_param @dataclass @@ -29,8 +29,11 @@ class AzureImageGenSettings(ImageGenSettings): Parameters: model: Azure image generation model identifier. + image_size: Target size for generated images. """ + image_size: str | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + class AzureImageGenServiceREST(ImageGenService): """Azure OpenAI REST-based image generation service. @@ -40,10 +43,12 @@ class AzureImageGenServiceREST(ImageGenService): and automatic image download and processing. """ + _settings: AzureImageGenSettings + def __init__( self, *, - image_size: str, + image_size: Optional[str] = None, api_key: str, endpoint: str, model: Optional[str] = None, @@ -55,6 +60,10 @@ class AzureImageGenServiceREST(ImageGenService): Args: image_size: Size specification for generated images (e.g., "1024x1024"). + + .. deprecated:: 0.0.105 + Use ``settings=AzureImageGenSettings(image_size=...)`` instead. + api_key: Azure OpenAI API key for authentication. endpoint: Azure OpenAI endpoint URL. model: The image generation model to use. @@ -67,10 +76,22 @@ class AzureImageGenServiceREST(ImageGenService): settings: Runtime-updatable settings. When provided alongside deprecated parameters, ``settings`` values take precedence. """ + # 1. Initialize default_settings with hardcoded defaults + default_settings = AzureImageGenSettings( + model=None, + image_size=None, + ) + + # 2. Apply direct init arg overrides (deprecated) if model is not None: _warn_deprecated_param("model", AzureImageGenSettings, "model") + default_settings.model = model - default_settings = AzureImageGenSettings(model=model) + if image_size is not None: + _warn_deprecated_param("image_size", AzureImageGenSettings, "image_size") + default_settings.image_size = image_size + + # 4. Apply settings delta (canonical API, always wins) if settings is not None: default_settings.apply_update(settings) @@ -79,7 +100,6 @@ class AzureImageGenServiceREST(ImageGenService): self._api_key = api_key self._azure_endpoint = endpoint self._api_version = api_version - self._image_size = image_size self._aiohttp_session = aiohttp_session async def run_image_gen(self, prompt: str) -> AsyncGenerator[Frame, None]: @@ -97,12 +117,13 @@ class AzureImageGenServiceREST(ImageGenService): headers = {"api-key": self._api_key, "Content-Type": "application/json"} body = { - # Enter your prompt text here "prompt": prompt, - "size": self._image_size, "n": 1, } + if self._settings.image_size is not None: + body["size"] = self._settings.image_size + async with self._aiohttp_session.post(url, headers=headers, json=body) as submission: # We never get past this line, because this header isn't # defined on a 429 response, but something is eating our diff --git a/src/pipecat/services/fal/image.py b/src/pipecat/services/fal/image.py index bf3cec6ee..252e471f2 100644 --- a/src/pipecat/services/fal/image.py +++ b/src/pipecat/services/fal/image.py @@ -13,8 +13,8 @@ for creating images from text prompts using various AI models. import asyncio import io import os -from dataclasses import dataclass -from typing import AsyncGenerator, Dict, Optional, Union +from dataclasses import dataclass, field +from typing import Any, AsyncGenerator, Dict, Optional, Union import aiohttp from loguru import logger @@ -23,7 +23,7 @@ from pydantic import BaseModel from pipecat.frames.frames import ErrorFrame, Frame, URLImageRawFrame from pipecat.services.image_service import ImageGenService -from pipecat.services.settings import ImageGenSettings, _warn_deprecated_param +from pipecat.services.settings import NOT_GIVEN, ImageGenSettings, _NotGiven, _warn_deprecated_param try: import fal_client @@ -39,8 +39,36 @@ class FalImageGenSettings(ImageGenSettings): Parameters: model: Fal.ai model identifier. + seed: Random seed for reproducible generation. ``None`` uses a random seed. + num_inference_steps: Number of inference steps for generation. + num_images: Number of images to generate. + image_size: Image dimensions as a string preset or dict with width/height. + expand_prompt: Whether to automatically expand/enhance the prompt. + enable_safety_checker: Whether to enable content safety filtering. + format: Output image format. """ + seed: int | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + num_inference_steps: int | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + num_images: int | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + image_size: str | Dict[str, int] | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + expand_prompt: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + enable_safety_checker: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + format: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + + def to_api_arguments(self) -> Dict[str, Any]: + """Build the Fal API arguments dict from settings, excluding None values.""" + args: Dict[str, Any] = {} + if self.seed is not None: + args["seed"] = self.seed + args["num_inference_steps"] = self.num_inference_steps + args["num_images"] = self.num_images + args["image_size"] = self.image_size + args["expand_prompt"] = self.expand_prompt + args["enable_safety_checker"] = self.enable_safety_checker + args["format"] = self.format + return args + class FalImageGenService(ImageGenService): """Fal's image generation service. @@ -52,6 +80,9 @@ class FalImageGenService(ImageGenService): class InputParams(BaseModel): """Input parameters for Fal.ai image generation. + .. deprecated:: 0.0.105 + Use ``settings=FalImageGenSettings(...)`` instead. + Parameters: seed: Random seed for reproducible generation. If None, uses random seed. num_inference_steps: Number of inference steps for generation. Defaults to 8. @@ -70,10 +101,12 @@ class FalImageGenService(ImageGenService): enable_safety_checker: bool = True format: str = "png" + _settings: FalImageGenSettings + def __init__( self, *, - params: InputParams, + params: Optional[InputParams] = None, aiohttp_session: aiohttp.ClientSession, model: Optional[str] = None, key: Optional[str] = None, @@ -84,6 +117,10 @@ class FalImageGenService(ImageGenService): Args: params: Input parameters for image generation configuration. + + .. deprecated:: 0.0.105 + Use ``settings=FalImageGenSettings(...)`` instead. + aiohttp_session: HTTP client session for downloading generated images. model: The Fal.ai model to use for generation. Defaults to "fal-ai/fast-sdxl". @@ -96,19 +133,38 @@ class FalImageGenService(ImageGenService): **kwargs: Additional arguments passed to parent ImageGenService. """ # 1. Initialize default_settings with hardcoded defaults - default_settings = FalImageGenSettings(model="fal-ai/fast-sdxl") + default_settings = FalImageGenSettings( + model="fal-ai/fast-sdxl", + seed=None, + num_inference_steps=8, + num_images=1, + image_size="square_hd", + expand_prompt=False, + enable_safety_checker=True, + format="png", + ) # 2. Apply direct init arg overrides (deprecated) if model is not None: _warn_deprecated_param("model", FalImageGenSettings, "model") default_settings.model = model + if params is not None: + _warn_deprecated_param("params", FalImageGenSettings) + if not settings: + default_settings.seed = params.seed + default_settings.num_inference_steps = params.num_inference_steps + default_settings.num_images = params.num_images + default_settings.image_size = params.image_size + default_settings.expand_prompt = params.expand_prompt + default_settings.enable_safety_checker = params.enable_safety_checker + default_settings.format = params.format + # 4. Apply settings delta (canonical API, always wins) if settings is not None: default_settings.apply_update(settings) super().__init__(settings=default_settings, **kwargs) - self._params = params self._aiohttp_session = aiohttp_session if key: os.environ["FAL_KEY"] = key @@ -133,7 +189,7 @@ class FalImageGenService(ImageGenService): response = await fal_client.run_async( self._settings.model, - arguments={"prompt": prompt, **self._params.model_dump(exclude_none=True)}, + arguments={"prompt": prompt, **self._settings.to_api_arguments()}, ) image_url = response["images"][0]["url"] if response else None diff --git a/src/pipecat/services/google/image.py b/src/pipecat/services/google/image.py index d15d5d0ed..4c351cc6e 100644 --- a/src/pipecat/services/google/image.py +++ b/src/pipecat/services/google/image.py @@ -16,7 +16,7 @@ import os # Suppress gRPC fork warnings os.environ["GRPC_ENABLE_FORK_SUPPORT"] = "false" -from dataclasses import dataclass +from dataclasses import dataclass, field from typing import Any, AsyncGenerator, Optional from loguru import logger @@ -26,7 +26,7 @@ from pydantic import BaseModel, Field from pipecat.frames.frames import ErrorFrame, Frame, URLImageRawFrame from pipecat.services.google.utils import update_google_client_http_options from pipecat.services.image_service import ImageGenService -from pipecat.services.settings import ImageGenSettings, _warn_deprecated_param +from pipecat.services.settings import NOT_GIVEN, ImageGenSettings, _NotGiven, _warn_deprecated_param try: from google import genai @@ -43,8 +43,13 @@ class GoogleImageGenSettings(ImageGenSettings): Parameters: model: Google Imagen model identifier. + number_of_images: Number of images to generate per request. + negative_prompt: Text describing what not to include in generated images. """ + number_of_images: int | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + negative_prompt: str | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + class GoogleImageGenService(ImageGenService): """Google AI image generation service using Imagen models. @@ -57,6 +62,9 @@ class GoogleImageGenService(ImageGenService): class InputParams(BaseModel): """Configuration parameters for Google image generation. + .. deprecated:: 0.0.105 + Use ``settings=GoogleImageGenSettings(...)`` instead. + Parameters: number_of_images: Number of images to generate (1-8). Defaults to 1. model: Google Imagen model to use. Defaults to "imagen-3.0-generate-002". @@ -67,6 +75,8 @@ class GoogleImageGenService(ImageGenService): model: str = Field(default="imagen-3.0-generate-002") negative_prompt: Optional[str] = Field(default=None) + _settings: GoogleImageGenSettings + def __init__( self, *, @@ -83,7 +93,7 @@ class GoogleImageGenService(ImageGenService): params: Configuration parameters for image generation. .. deprecated:: 0.0.105 - Use ``settings=GoogleImageGenSettings(model=...)`` instead. + Use ``settings=GoogleImageGenSettings(...)`` instead. http_options: HTTP options for the client. settings: Runtime-updatable settings. When provided alongside deprecated @@ -91,20 +101,25 @@ class GoogleImageGenService(ImageGenService): **kwargs: Additional arguments passed to the parent ImageGenService. """ # 1. Initialize default_settings with hardcoded defaults - default_settings = GoogleImageGenSettings(model="imagen-3.0-generate-002") + default_settings = GoogleImageGenSettings( + model="imagen-3.0-generate-002", + number_of_images=1, + negative_prompt=None, + ) - # 3. Apply params overrides — only if settings not provided + # 2. Apply params overrides (deprecated) if params is not None: _warn_deprecated_param("params", GoogleImageGenSettings) if not settings: default_settings.model = params.model + default_settings.number_of_images = params.number_of_images + default_settings.negative_prompt = params.negative_prompt # 4. Apply settings delta (canonical API, always wins) if settings is not None: default_settings.apply_update(settings) super().__init__(settings=default_settings, **kwargs) - self._params = params or GoogleImageGenService.InputParams() # Add client header http_options = update_google_client_http_options(http_options) @@ -137,11 +152,11 @@ class GoogleImageGenService(ImageGenService): try: response = await self._client.aio.models.generate_images( - model=self._params.model, + model=self._settings.model, prompt=prompt, config=types.GenerateImagesConfig( - number_of_images=self._params.number_of_images, - negative_prompt=self._params.negative_prompt, + number_of_images=self._settings.number_of_images, + negative_prompt=self._settings.negative_prompt, ), ) await self.stop_ttfb_metrics() diff --git a/src/pipecat/services/heygen/video.py b/src/pipecat/services/heygen/video.py index 020ecdfcf..18df8ac60 100644 --- a/src/pipecat/services/heygen/video.py +++ b/src/pipecat/services/heygen/video.py @@ -12,6 +12,7 @@ audio/video streaming capabilities through the HeyGen API. """ import asyncio +from dataclasses import dataclass from typing import Optional, Union import aiohttp @@ -52,6 +53,13 @@ from pipecat.transports.base_transport import TransportParams AVATAR_VAD_STOP_SECS = 0.35 +@dataclass +class HeyGenVideoSettings(ServiceSettings): + """Settings for the HeyGen video service.""" + + pass + + class HeyGenVideoService(AIService): """A service that integrates HeyGen's interactive avatar capabilities into the pipeline. @@ -81,7 +89,7 @@ class HeyGenVideoService(AIService): session: aiohttp.ClientSession, session_request: Optional[Union[LiveAvatarNewSessionRequest, NewSessionRequest]] = None, service_type: Optional[ServiceType] = None, - settings: Optional[ServiceSettings] = None, + settings: Optional[HeyGenVideoSettings] = None, **kwargs, ) -> None: """Initialize the HeyGen video service. diff --git a/src/pipecat/services/openai/image.py b/src/pipecat/services/openai/image.py index 4120db8c6..397d8c3d2 100644 --- a/src/pipecat/services/openai/image.py +++ b/src/pipecat/services/openai/image.py @@ -11,7 +11,7 @@ for creating images from text prompts. """ import io -from dataclasses import dataclass +from dataclasses import dataclass, field from typing import AsyncGenerator, Literal, Optional import aiohttp @@ -25,7 +25,7 @@ from pipecat.frames.frames import ( URLImageRawFrame, ) from pipecat.services.image_service import ImageGenService -from pipecat.services.settings import ImageGenSettings, _warn_deprecated_param +from pipecat.services.settings import NOT_GIVEN, ImageGenSettings, _NotGiven, _warn_deprecated_param @dataclass @@ -34,8 +34,11 @@ class OpenAIImageGenSettings(ImageGenSettings): Parameters: model: DALL-E model identifier. + image_size: Target size for generated images. """ + image_size: str | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + class OpenAIImageGenService(ImageGenService): """OpenAI DALL-E image generation service. @@ -45,13 +48,17 @@ class OpenAIImageGenService(ImageGenService): with configurable quality and style parameters. """ + _settings: OpenAIImageGenSettings + def __init__( self, *, api_key: str, base_url: Optional[str] = None, aiohttp_session: aiohttp.ClientSession, - image_size: Literal["256x256", "512x512", "1024x1024", "1792x1024", "1024x1792"], + image_size: Optional[ + Literal["256x256", "512x512", "1024x1024", "1792x1024", "1024x1792"] + ] = None, model: Optional[str] = None, settings: Optional[OpenAIImageGenSettings] = None, ): @@ -61,7 +68,11 @@ class OpenAIImageGenService(ImageGenService): api_key: OpenAI API key for authentication. base_url: Custom base URL for OpenAI API. If None, uses default. aiohttp_session: HTTP session for downloading generated images. - image_size: Target size for generated images. + image_size: Target size for generated images. Defaults to "1024x1024". + + .. deprecated:: 0.0.105 + Use ``settings=OpenAIImageGenSettings(image_size=...)`` instead. + model: DALL-E model to use for generation. Defaults to "dall-e-3". .. deprecated:: 0.0.105 @@ -71,19 +82,25 @@ class OpenAIImageGenService(ImageGenService): parameters, ``settings`` values take precedence. """ # 1. Initialize default_settings with hardcoded defaults - default_settings = OpenAIImageGenSettings(model="dall-e-3") + default_settings = OpenAIImageGenSettings( + model="dall-e-3", + image_size=None, + ) # 2. Apply direct init arg overrides (deprecated) if model is not None: _warn_deprecated_param("model", OpenAIImageGenSettings, "model") default_settings.model = model + if image_size is not None: + _warn_deprecated_param("image_size", OpenAIImageGenSettings, "image_size") + default_settings.image_size = image_size + # 4. Apply settings delta (canonical API, always wins) if settings is not None: default_settings.apply_update(settings) super().__init__(settings=default_settings) - self._image_size = image_size self._client = AsyncOpenAI(api_key=api_key, base_url=base_url) self._aiohttp_session = aiohttp_session @@ -99,7 +116,7 @@ class OpenAIImageGenService(ImageGenService): logger.debug(f"Generating image from prompt: {prompt}") image = await self._client.images.generate( - prompt=prompt, model=self._settings.model, n=1, size=self._image_size + prompt=prompt, model=self._settings.model, n=1, size=self._settings.image_size ) image_url = image.data[0].url diff --git a/src/pipecat/services/tavus/video.py b/src/pipecat/services/tavus/video.py index e6725fac1..4a7211033 100644 --- a/src/pipecat/services/tavus/video.py +++ b/src/pipecat/services/tavus/video.py @@ -11,6 +11,7 @@ avatar functionality through Tavus's streaming API. """ import asyncio +from dataclasses import dataclass from typing import Optional import aiohttp @@ -38,6 +39,13 @@ from pipecat.services.settings import ServiceSettings from pipecat.transports.tavus.transport import TavusCallbacks, TavusParams, TavusTransportClient +@dataclass +class TavusVideoSettings(ServiceSettings): + """Settings for the Tavus video service.""" + + pass + + class TavusVideoService(AIService): """Service that proxies audio to Tavus and receives audio and video in return. @@ -58,7 +66,7 @@ class TavusVideoService(AIService): replica_id: str, persona_id: str = "pipecat-stream", session: aiohttp.ClientSession, - settings: Optional[ServiceSettings] = None, + settings: Optional[TavusVideoSettings] = None, **kwargs, ) -> None: """Initialize the Tavus video service.