Merge pull request #3996 from pipecat-ai/pk/prefer-nested-settings-alias

Prefer nested settings alias
This commit is contained in:
kompfner
2026-03-11 13:41:29 -04:00
committed by GitHub
94 changed files with 975 additions and 1007 deletions

View File

@@ -280,17 +280,17 @@ from typing import Optional
class MyTTSService(TTSService):
Settings = MyTTSSettings
_settings: MyTTSSettings
_settings: Settings
def __init__(
self,
*,
api_key: str,
settings: Optional[MyTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
# 1. Defaults — every field has a real value (store mode).
default_settings = MyTTSSettings(
default_settings = self.Settings(
model="my-model-v1",
voice="default-voice",
language="en",

View File

@@ -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.anthropic.llm import AnthropicLLMService, AnthropicThinkingConfig
from pipecat.services.anthropic.llm import AnthropicLLMService
from pipecat.services.cartesia.tts import CartesiaTTSService
from pipecat.services.deepgram.stt import DeepgramSTTService
from pipecat.transports.base_transport import BaseTransport, TransportParams
@@ -64,7 +64,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
llm = AnthropicLLMService(
api_key=os.getenv("ANTHROPIC_API_KEY"),
settings=AnthropicLLMService.Settings(
thinking=AnthropicThinkingConfig(
thinking=AnthropicLLMService.ThinkingConfig(
type="enabled",
budget_tokens=2048,
),

View File

@@ -24,7 +24,7 @@ from pipecat.runner.types import RunnerArguments
from pipecat.runner.utils import create_transport
from pipecat.services.cartesia.tts import CartesiaTTSService
from pipecat.services.deepgram.stt import DeepgramSTTService
from pipecat.services.google.llm import GoogleLLMService, GoogleThinkingConfig
from pipecat.services.google.llm import GoogleLLMService
from pipecat.transports.base_transport import BaseTransport, TransportParams
from pipecat.transports.daily.transport import DailyParams
from pipecat.transports.websocket.fastapi import FastAPIWebsocketParams
@@ -65,7 +65,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
api_key=os.getenv("GOOGLE_API_KEY"),
# model="gemini-3-pro-preview", # A more powerful reasoning model, but slower
settings=GoogleLLMService.Settings(
thinking=GoogleThinkingConfig(
thinking=GoogleLLMService.ThinkingConfig(
thinking_budget=-1, # Dynamic thinking
include_thoughts=True,
),

View File

@@ -23,7 +23,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.anthropic.llm import AnthropicLLMService, AnthropicThinkingConfig
from pipecat.services.anthropic.llm import AnthropicLLMService
from pipecat.services.cartesia.tts import CartesiaTTSService
from pipecat.services.deepgram.stt import DeepgramSTTService
from pipecat.services.llm_service import FunctionCallParams
@@ -85,7 +85,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
llm = AnthropicLLMService(
api_key=os.getenv("ANTHROPIC_API_KEY"),
settings=AnthropicLLMService.Settings(
thinking=AnthropicThinkingConfig(
thinking=AnthropicLLMService.ThinkingConfig(
type="enabled",
budget_tokens=2048,
),

View File

@@ -25,7 +25,7 @@ from pipecat.runner.types import RunnerArguments
from pipecat.runner.utils import create_transport
from pipecat.services.cartesia.tts import CartesiaTTSService
from pipecat.services.deepgram.stt import DeepgramSTTService
from pipecat.services.google.llm import GoogleLLMService, GoogleThinkingConfig
from pipecat.services.google.llm import GoogleLLMService
from pipecat.services.llm_service import FunctionCallParams
from pipecat.transports.base_transport import BaseTransport, TransportParams
from pipecat.transports.daily.transport import DailyParams
@@ -86,7 +86,7 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
api_key=os.getenv("GOOGLE_API_KEY"),
# model="gemini-3-pro-preview", # A more powerful reasoning model, but slower
settings=GoogleLLMService.Settings(
thinking=GoogleThinkingConfig(
thinking=GoogleLLMService.ThinkingConfig(
thinking_budget=-1, # Dynamic thinking
include_thoughts=True,
),

View File

@@ -10,6 +10,7 @@ Provides the foundation for all AI services in the Pipecat framework, including
model management, settings handling, and frame processing lifecycle methods.
"""
import warnings
from typing import Any, AsyncGenerator, Dict
from loguru import logger
@@ -130,6 +131,43 @@ class AIService(FrameProcessor):
return changed
def _warn_init_param_moved_to_settings(
self,
param_name: str,
settings_field: str | None = None,
stacklevel: int = 3,
):
"""Warn that an ``__init__`` param has moved to ``Settings``.
Emits a ``DeprecationWarning`` directing users to the canonical
``settings=ServiceClass.Settings(field=...)`` API.
Args:
param_name: Name of the deprecated ``__init__`` parameter.
settings_field: The corresponding field on the ``Settings``
dataclass, if different from *param_name*. When ``None``
the message omits the field hint.
stacklevel: Stack depth for the warning. Default ``3`` targets
the caller's caller (i.e. user code that instantiated the
service).
"""
label = f"{type(self).__name__}.Settings"
if settings_field:
msg = (
f"The `{param_name}` parameter is deprecated. "
f"Use `settings={label}({settings_field}=...)` instead. "
f"If both are provided, `settings` takes precedence."
)
else:
msg = (
f"The `{param_name}` parameter is deprecated. "
f"Use `settings={label}(...)` instead. "
f"If both are provided, `settings` takes precedence."
)
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn(msg, DeprecationWarning, stacklevel=stacklevel)
def _warn_unhandled_updated_settings(self, unhandled):
"""Log a warning for settings changes that won't take effect at runtime.

View File

@@ -58,7 +58,7 @@ from pipecat.processors.aggregators.openai_llm_context import (
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.llm_service import FunctionCallFromLLM, LLMService
from pipecat.services.settings import NOT_GIVEN as _NOT_GIVEN
from pipecat.services.settings import LLMSettings, _NotGiven, _warn_deprecated_param, is_given
from pipecat.services.settings import LLMSettings, _NotGiven, is_given
from pipecat.utils.tracing.service_decorators import traced_llm
try:
@@ -98,18 +98,20 @@ class AnthropicLLMSettings(LLMSettings):
"""
enable_prompt_caching: bool | _NotGiven = field(default_factory=lambda: _NOT_GIVEN)
thinking: AnthropicThinkingConfig | _NotGiven = field(default_factory=lambda: _NOT_GIVEN)
thinking: Union["AnthropicLLMService.ThinkingConfig", _NotGiven] = field(
default_factory=lambda: _NOT_GIVEN
)
@classmethod
def from_mapping(cls, settings):
"""Convert a plain dict to settings, coercing thinking dicts.
For backward compatibility, a ``thinking`` value that is a plain dict
is converted to a :class:`AnthropicThinkingConfig`.
is converted to a :class:`AnthropicLLMService.ThinkingConfig`.
"""
instance = super().from_mapping(settings)
if is_given(instance.thinking) and isinstance(instance.thinking, dict):
instance.thinking = AnthropicThinkingConfig(**instance.thinking)
instance.thinking = AnthropicLLMService.ThinkingConfig(**instance.thinking)
return instance
@@ -160,7 +162,7 @@ class AnthropicLLMService(LLMService):
"""
Settings = AnthropicLLMSettings
_settings: AnthropicLLMSettings
_settings: Settings
# Overriding the default adapter to use the Anthropic one.
adapter_class = AnthropicLLMAdapter
@@ -172,7 +174,7 @@ class AnthropicLLMService(LLMService):
"""Input parameters for Anthropic model inference.
.. deprecated:: 0.0.105
Use ``AnthropicLLMSettings`` instead. Pass settings directly via the
Use ``AnthropicLLMService.Settings`` instead. Pass settings directly via the
``settings`` parameter of :class:`AnthropicLLMService`.
Parameters:
@@ -199,7 +201,9 @@ class AnthropicLLMService(LLMService):
temperature: Optional[float] = Field(default_factory=lambda: NOT_GIVEN, ge=0.0, le=1.0)
top_k: Optional[int] = Field(default_factory=lambda: NOT_GIVEN, ge=0)
top_p: Optional[float] = Field(default_factory=lambda: NOT_GIVEN, ge=0.0, le=1.0)
thinking: Optional[AnthropicThinkingConfig] = Field(default_factory=lambda: NOT_GIVEN)
thinking: Optional["AnthropicLLMService.ThinkingConfig"] = Field(
default_factory=lambda: NOT_GIVEN
)
extra: Optional[Dict[str, Any]] = Field(default_factory=dict)
def model_post_init(self, __context):
@@ -220,7 +224,7 @@ class AnthropicLLMService(LLMService):
api_key: str,
model: Optional[str] = None,
params: Optional[InputParams] = None,
settings: Optional[AnthropicLLMSettings] = None,
settings: Optional[Settings] = None,
client=None,
retry_timeout_secs: Optional[float] = 5.0,
retry_on_timeout: Optional[bool] = False,
@@ -233,12 +237,12 @@ class AnthropicLLMService(LLMService):
model: Model name to use.
.. deprecated:: 0.0.105
Use ``settings=AnthropicLLMSettings(model=...)`` instead.
Use ``settings=AnthropicLLMService.Settings(model=...)`` instead.
params: Optional model parameters for inference.
.. deprecated:: 0.0.105
Use ``settings=AnthropicLLMSettings(...)`` instead.
Use ``settings=AnthropicLLMService.Settings(...)`` instead.
settings: Runtime-updatable settings for this service. When both
deprecated parameters and *settings* are provided, *settings*
@@ -249,7 +253,7 @@ class AnthropicLLMService(LLMService):
**kwargs: Additional arguments passed to parent LLMService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = AnthropicLLMSettings(
default_settings = self.Settings(
model="claude-sonnet-4-6",
system_instruction=None,
max_tokens=4096,
@@ -268,12 +272,12 @@ class AnthropicLLMService(LLMService):
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", AnthropicLLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", AnthropicLLMSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.max_tokens = params.max_tokens
default_settings.temperature = params.temperature

View File

@@ -125,7 +125,7 @@ class AssemblyAIConnectionParams(BaseModel):
"""Configuration parameters for AssemblyAI WebSocket connection.
.. deprecated:: 0.0.105
Use ``settings=AssemblyAISTTSettings(foo=...)`` instead.
Use ``settings=AssemblyAISTTService.Settings(foo=...)`` instead.
Parameters:
sample_rate: Audio sample rate in Hz. Defaults to 16000.

View File

@@ -32,7 +32,7 @@ from pipecat.frames.frames import (
VADUserStoppedSpeakingFrame,
)
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven
from pipecat.services.stt_latency import ASSEMBLYAI_TTFS_P99
from pipecat.services.stt_service import WebsocketSTTService
from pipecat.transcriptions.language import Language
@@ -129,7 +129,7 @@ class AssemblyAISTTService(WebsocketSTTService):
"""
Settings = AssemblyAISTTSettings
_settings: AssemblyAISTTSettings
_settings: Settings
def __init__(
self,
@@ -143,7 +143,7 @@ class AssemblyAISTTService(WebsocketSTTService):
vad_force_turn_endpoint: bool = True,
should_interrupt: bool = True,
speaker_format: Optional[str] = None,
settings: Optional[AssemblyAISTTSettings] = None,
settings: Optional[Settings] = None,
ttfs_p99_latency: Optional[float] = ASSEMBLYAI_TTFS_P99,
**kwargs,
):
@@ -154,7 +154,7 @@ class AssemblyAISTTService(WebsocketSTTService):
language: Language code for transcription. Defaults to English (Language.EN).
.. deprecated:: 0.0.105
Use ``settings=AssemblyAISTTSettings(language=...)`` instead.
Use ``settings=AssemblyAISTTService.Settings(language=...)`` instead.
api_endpoint_base_url: WebSocket endpoint URL. Defaults to AssemblyAI's streaming endpoint.
sample_rate: Audio sample rate in Hz. Defaults to 16000.
@@ -162,7 +162,7 @@ class AssemblyAISTTService(WebsocketSTTService):
connection_params: Connection configuration parameters.
.. deprecated:: 0.0.105
Use ``settings=AssemblyAISTTSettings(...)`` instead.
Use ``settings=AssemblyAISTTService.Settings(...)`` instead.
vad_force_turn_endpoint: Controls turn detection mode.
When True (Pipecat mode, default): Forces AssemblyAI to return finals ASAP
@@ -190,7 +190,7 @@ class AssemblyAISTTService(WebsocketSTTService):
**kwargs: Additional arguments passed to parent STTService class.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = AssemblyAISTTSettings(
default_settings = self.Settings(
model="u3-rt-pro",
language=Language.EN,
formatted_finals=True,
@@ -208,12 +208,12 @@ class AssemblyAISTTService(WebsocketSTTService):
# 2. Apply direct init arg overrides (deprecated)
if language is not None:
_warn_deprecated_param("language", AssemblyAISTTSettings, "language")
self._warn_init_param_moved_to_settings("language", "language")
default_settings.language = language
# 3. Apply connection_params overrides (deprecated) — only if settings not provided
if connection_params is not None:
_warn_deprecated_param("connection_params", AssemblyAISTTSettings)
self._warn_init_param_moved_to_settings("connection_params")
if not settings:
sample_rate = connection_params.sample_rate
encoding = connection_params.encoding
@@ -299,7 +299,7 @@ class AssemblyAISTTService(WebsocketSTTService):
self._user_speaking = False
def _configure_pipecat_turn_mode(self, settings: AssemblyAISTTSettings, is_u3_pro: bool):
def _configure_pipecat_turn_mode(self, settings: Settings, is_u3_pro: bool):
"""Configure settings for Pipecat turn detection mode.
When vad_force_turn_endpoint is enabled, force AssemblyAI to return
@@ -353,7 +353,7 @@ class AssemblyAISTTService(WebsocketSTTService):
"""
return True
async def _update_settings(self, delta: AssemblyAISTTSettings) -> dict[str, Any]:
async def _update_settings(self, delta: Settings) -> dict[str, Any]:
"""Apply a settings delta and reconnect to apply changes.
Args:

View File

@@ -26,7 +26,7 @@ from pipecat.frames.frames import (
TTSStoppedFrame,
)
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.settings import TTSSettings, _warn_deprecated_param
from pipecat.services.settings import TTSSettings
from pipecat.services.tts_service import TextAggregationMode, TTSService, WebsocketTTSService
from pipecat.transcriptions.language import Language, resolve_language
from pipecat.utils.tracing.service_decorators import traced_tts
@@ -86,13 +86,13 @@ class AsyncAITTSService(WebsocketTTSService):
"""
Settings = AsyncAITTSSettings
_settings: AsyncAITTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Input parameters for Async TTS configuration.
.. deprecated:: 0.0.105
Use ``AsyncAITTSSettings`` directly via the ``settings`` parameter instead.
Use ``AsyncAITTSService.Settings`` directly via the ``settings`` parameter instead.
Parameters:
language: Language to use for synthesis.
@@ -112,7 +112,7 @@ class AsyncAITTSService(WebsocketTTSService):
encoding: str = "pcm_s16le",
container: str = "raw",
params: Optional[InputParams] = None,
settings: Optional[AsyncAITTSSettings] = None,
settings: Optional[Settings] = None,
aggregate_sentences: Optional[bool] = None,
text_aggregation_mode: Optional[TextAggregationMode] = None,
**kwargs,
@@ -125,14 +125,14 @@ class AsyncAITTSService(WebsocketTTSService):
https://docs.async.com/list-voices-16699698e0
.. deprecated:: 0.0.105
Use ``settings=AsyncAITTSSettings(voice=...)`` instead.
Use ``settings=AsyncAITTSService.Settings(voice=...)`` instead.
version: Async API version.
url: WebSocket URL for Async TTS API.
model: TTS model to use (e.g., "async_flash_v1.0").
.. deprecated:: 0.0.105
Use ``settings=AsyncAITTSSettings(model=...)`` instead.
Use ``settings=AsyncAITTSService.Settings(model=...)`` instead.
sample_rate: Audio sample rate.
encoding: Audio encoding format.
@@ -140,7 +140,7 @@ class AsyncAITTSService(WebsocketTTSService):
params: Additional input parameters for voice customization.
.. deprecated:: 0.0.105
Use ``settings=AsyncAITTSSettings(...)`` instead.
Use ``settings=AsyncAITTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
@@ -153,7 +153,7 @@ class AsyncAITTSService(WebsocketTTSService):
**kwargs: Additional arguments passed to the parent service.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = AsyncAITTSSettings(
default_settings = self.Settings(
model="async_flash_v1.0",
voice=None,
language=None,
@@ -161,15 +161,15 @@ class AsyncAITTSService(WebsocketTTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice_id is not None:
_warn_deprecated_param("voice_id", AsyncAITTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
if model is not None:
_warn_deprecated_param("model", AsyncAITTSSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", AsyncAITTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.language = (
self.language_to_service_language(params.language) if params.language else None
@@ -487,13 +487,13 @@ class AsyncAIHttpTTSService(TTSService):
"""
Settings = AsyncAITTSSettings
_settings: AsyncAITTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Input parameters for Async API.
.. deprecated:: 0.0.105
Use ``AsyncAITTSSettings`` directly via the ``settings`` parameter instead.
Use ``AsyncAIHttpTTSService.Settings`` directly via the ``settings`` parameter instead.
Parameters:
language: Language to use for synthesis.
@@ -514,7 +514,7 @@ class AsyncAIHttpTTSService(TTSService):
encoding: str = "pcm_s16le",
container: str = "raw",
params: Optional[InputParams] = None,
settings: Optional[AsyncAITTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Async TTS service.
@@ -524,13 +524,13 @@ class AsyncAIHttpTTSService(TTSService):
voice_id: ID of the voice to use for synthesis.
.. deprecated:: 0.0.105
Use ``settings=AsyncAITTSSettings(voice=...)`` instead.
Use ``settings=AsyncAIHttpTTSService.Settings(voice=...)`` instead.
aiohttp_session: An aiohttp session for making HTTP requests.
model: TTS model to use (e.g., "async_flash_v1.0").
.. deprecated:: 0.0.105
Use ``settings=AsyncAITTSSettings(model=...)`` instead.
Use ``settings=AsyncAIHttpTTSService.Settings(model=...)`` instead.
url: Base URL for Async API.
version: API version string for Async API.
@@ -540,14 +540,14 @@ class AsyncAIHttpTTSService(TTSService):
params: Additional input parameters for voice customization.
.. deprecated:: 0.0.105
Use ``settings=AsyncAITTSSettings(...)`` instead.
Use ``settings=AsyncAIHttpTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional arguments passed to the parent TTSService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = AsyncAITTSSettings(
default_settings = self.Settings(
model="async_flash_v1.0",
voice=None,
language=None,
@@ -555,15 +555,15 @@ class AsyncAIHttpTTSService(TTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice_id is not None:
_warn_deprecated_param("voice_id", AsyncAITTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
if model is not None:
_warn_deprecated_param("model", AsyncAITTSSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", AsyncAITTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.language = (
self.language_to_service_language(params.language) if params.language else None

View File

@@ -55,7 +55,7 @@ from pipecat.processors.aggregators.openai_llm_context import (
)
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.llm_service import LLMService
from pipecat.services.settings import NOT_GIVEN, LLMSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, LLMSettings, _NotGiven
from pipecat.utils.tracing.service_decorators import traced_llm
try:
@@ -747,7 +747,7 @@ class AWSBedrockLLMService(LLMService):
"""
Settings = AWSBedrockLLMSettings
_settings: AWSBedrockLLMSettings
_settings: Settings
# Overriding the default adapter to use the Anthropic one.
adapter_class = AWSBedrockLLMAdapter
@@ -756,7 +756,7 @@ class AWSBedrockLLMService(LLMService):
"""Input parameters for AWS Bedrock LLM service.
.. deprecated:: 0.0.105
Use ``AWSBedrockLLMSettings`` instead. Pass settings directly via the
Use ``AWSBedrockLLMService.Settings`` instead. Pass settings directly via the
``settings`` parameter of :class:`AWSBedrockLLMService`.
Parameters:
@@ -784,7 +784,7 @@ class AWSBedrockLLMService(LLMService):
aws_session_token: Optional[str] = None,
aws_region: Optional[str] = None,
params: Optional[InputParams] = None,
settings: Optional[AWSBedrockLLMSettings] = None,
settings: Optional[Settings] = None,
stop_sequences: Optional[List[str]] = None,
client_config: Optional[Config] = None,
retry_timeout_secs: Optional[float] = 5.0,
@@ -797,7 +797,7 @@ class AWSBedrockLLMService(LLMService):
model: The AWS Bedrock model identifier to use.
.. deprecated:: 0.0.105
Use ``settings=AWSBedrockLLMSettings(model=...)`` instead.
Use ``settings=AWSBedrockLLMService.Settings(model=...)`` instead.
aws_access_key: AWS access key ID. If None, uses default credentials.
aws_secret_key: AWS secret access key. If None, uses default credentials.
@@ -806,7 +806,7 @@ class AWSBedrockLLMService(LLMService):
params: Model parameters and configuration.
.. deprecated:: 0.0.105
Use ``settings=AWSBedrockLLMSettings(...)`` instead.
Use ``settings=AWSBedrockLLMService.Settings(...)`` instead.
settings: Runtime-updatable settings for this service. When both
deprecated parameters and *settings* are provided, *settings*
@@ -814,7 +814,7 @@ class AWSBedrockLLMService(LLMService):
stop_sequences: List of strings that stop generation.
.. deprecated:: 0.0.105
Use ``settings=AWSBedrockLLMSettings(stop_sequences=...)`` instead.
Use ``settings=AWSBedrockLLMService.Settings(stop_sequences=...)`` instead.
client_config: Custom boto3 client configuration.
retry_timeout_secs: Request timeout in seconds for retry logic.
@@ -822,7 +822,7 @@ class AWSBedrockLLMService(LLMService):
**kwargs: Additional arguments passed to parent LLMService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = AWSBedrockLLMSettings(
default_settings = self.Settings(
model="us.amazon.nova-lite-v1:0",
system_instruction=None,
max_tokens=None,
@@ -841,15 +841,15 @@ class AWSBedrockLLMService(LLMService):
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", AWSBedrockLLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
if stop_sequences is not None:
_warn_deprecated_param("stop_sequences", AWSBedrockLLMSettings, "stop_sequences")
self._warn_init_param_moved_to_settings("stop_sequences", "stop_sequences")
default_settings.stop_sequences = stop_sequences
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", AWSBedrockLLMSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.max_tokens = params.max_tokens
default_settings.temperature = params.temperature

View File

@@ -60,7 +60,7 @@ from pipecat.processors.aggregators.openai_llm_context import (
)
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.llm_service import LLMService
from pipecat.services.settings import NOT_GIVEN, LLMSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, LLMSettings, _NotGiven
from pipecat.utils.time import time_now_iso8601
try:
@@ -150,7 +150,7 @@ class Params(BaseModel):
"""Configuration parameters for AWS Nova Sonic.
.. deprecated:: 0.0.105
Use ``settings=AWSNovaSonicLLMSettings(...)`` for inference settings
Use ``settings=AWSNovaSonicLLMService.Settings(...)`` for inference settings
and ``audio_config=AudioConfig(...)`` for audio configuration.
Parameters:
@@ -247,7 +247,7 @@ class AWSNovaSonicLLMService(LLMService):
"""
Settings = AWSNovaSonicLLMSettings
_settings: AWSNovaSonicLLMSettings
_settings: Settings
# Override the default adapter to use the AWSNovaSonicLLMAdapter one
adapter_class = AWSNovaSonicLLMAdapter
@@ -263,7 +263,7 @@ class AWSNovaSonicLLMService(LLMService):
voice_id: str = "matthew",
params: Optional[Params] = None,
audio_config: Optional[AudioConfig] = None,
settings: Optional[AWSNovaSonicLLMSettings] = None,
settings: Optional[Settings] = None,
system_instruction: Optional[str] = None,
tools: Optional[ToolsSchema] = None,
send_transcription_frames: bool = True,
@@ -282,7 +282,7 @@ class AWSNovaSonicLLMService(LLMService):
model: Model identifier. Defaults to "amazon.nova-2-sonic-v1:0".
.. deprecated:: 0.0.105
Use ``settings=AWSNovaSonicLLMSettings(model=...)`` instead.
Use ``settings=AWSNovaSonicLLMService.Settings(model=...)`` instead.
voice_id: Voice ID for speech synthesis.
Note that some voices are designed for use with a specific language.
@@ -291,12 +291,12 @@ class AWSNovaSonicLLMService(LLMService):
- Nova Sonic (the older model): see https://docs.aws.amazon.com/nova/latest/userguide/available-voices.html.
.. deprecated:: 0.0.105
Use ``settings=AWSNovaSonicLLMSettings(voice=...)`` instead.
Use ``settings=AWSNovaSonicLLMService.Settings(voice=...)`` instead.
params: Model parameters for audio configuration and inference.
.. deprecated:: 0.0.105
Use ``settings=AWSNovaSonicLLMSettings(...)`` for inference
Use ``settings=AWSNovaSonicLLMService.Settings(...)`` for inference
settings and ``audio_config=AudioConfig(...)`` for audio
configuration.
@@ -308,7 +308,7 @@ class AWSNovaSonicLLMService(LLMService):
system_instruction: System-level instruction for the model.
.. deprecated:: 0.0.105
Use ``settings=AWSNovaSonicLLMSettings(system_instruction=...)`` instead.
Use ``settings=AWSNovaSonicLLMService.Settings(system_instruction=...)`` instead.
tools: Available tools/functions for the model to use.
send_transcription_frames: Whether to emit transcription frames.
@@ -319,7 +319,7 @@ class AWSNovaSonicLLMService(LLMService):
**kwargs: Additional arguments passed to the parent LLMService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = AWSNovaSonicLLMSettings(
default_settings = self.Settings(
model="amazon.nova-2-sonic-v1:0",
system_instruction=None,
voice="matthew",
@@ -337,15 +337,13 @@ class AWSNovaSonicLLMService(LLMService):
# 2. Apply direct init arg overrides (deprecated)
if model != "amazon.nova-2-sonic-v1:0":
_warn_deprecated_param("model", AWSNovaSonicLLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
if voice_id != "matthew":
_warn_deprecated_param("voice_id", AWSNovaSonicLLMSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
if system_instruction is not None:
_warn_deprecated_param(
"system_instruction", AWSNovaSonicLLMSettings, "system_instruction"
)
self._warn_init_param_moved_to_settings("system_instruction", "system_instruction")
default_settings.system_instruction = system_instruction
# 3. Apply params overrides — only if settings not provided
@@ -356,7 +354,7 @@ class AWSNovaSonicLLMService(LLMService):
warnings.simplefilter("always")
warnings.warn(
"The `params` parameter is deprecated. "
"Use `settings=AWSNovaSonicLLMSettings(...)` for inference settings "
"Use `settings=self.Settings(...)` for inference settings "
"(temperature, max_tokens, top_p, endpointing_sensitivity) "
"and `audio_config=AudioConfig(...)` for audio configuration "
"(sample rates, sample sizes, channel counts).",
@@ -447,7 +445,7 @@ class AWSNovaSonicLLMService(LLMService):
# settings
#
async def _update_settings(self, delta: AWSNovaSonicLLMSettings) -> dict[str, Any]:
async def _update_settings(self, delta: Settings) -> dict[str, Any]:
"""Apply a settings delta.
Settings are stored but not applied to the active connection.

View File

@@ -29,7 +29,7 @@ from pipecat.frames.frames import (
TranscriptionFrame,
)
from pipecat.services.aws.utils import build_event_message, decode_event, get_presigned_url
from pipecat.services.settings import STTSettings, _warn_deprecated_param
from pipecat.services.settings import STTSettings
from pipecat.services.stt_latency import AWS_TRANSCRIBE_TTFS_P99
from pipecat.services.stt_service import WebsocketSTTService
from pipecat.transcriptions.language import Language, resolve_language
@@ -61,7 +61,7 @@ class AWSTranscribeSTTService(WebsocketSTTService):
"""
Settings = AWSTranscribeSTTSettings
_settings: AWSTranscribeSTTSettings
_settings: Settings
def __init__(
self,
@@ -72,7 +72,7 @@ class AWSTranscribeSTTService(WebsocketSTTService):
region: Optional[str] = None,
sample_rate: Optional[int] = None,
language: Optional[Language] = None,
settings: Optional[AWSTranscribeSTTSettings] = None,
settings: Optional[Settings] = None,
ttfs_p99_latency: Optional[float] = AWS_TRANSCRIBE_TTFS_P99,
**kwargs,
):
@@ -89,7 +89,7 @@ class AWSTranscribeSTTService(WebsocketSTTService):
language: Language for transcription.
.. deprecated:: 0.0.105
Use ``settings=AWSTranscribeSTTSettings(language=...)`` instead.
Use ``settings=AWSTranscribeSTTService.Settings(language=...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
@@ -98,14 +98,14 @@ class AWSTranscribeSTTService(WebsocketSTTService):
**kwargs: Additional arguments passed to parent STTService class.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = AWSTranscribeSTTSettings(
default_settings = self.Settings(
model=None,
language=self.language_to_service_language(Language.EN),
)
# 2. Apply direct init arg overrides (deprecated)
if language is not None:
_warn_deprecated_param("language", AWSTranscribeSTTSettings, "language")
self._warn_init_param_moved_to_settings("language", "language")
default_settings.language = self.language_to_service_language(language)
# 3. (No step 3, as there's no params object to apply)

View File

@@ -23,7 +23,7 @@ from pipecat.frames.frames import (
Frame,
TTSAudioRawFrame,
)
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven
from pipecat.services.tts_service import TTSService
from pipecat.transcriptions.language import Language, resolve_language
from pipecat.utils.tracing.service_decorators import traced_tts
@@ -149,13 +149,13 @@ class AWSPollyTTSService(TTSService):
"""
Settings = AWSPollyTTSSettings
_settings: AWSPollyTTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Input parameters for AWS Polly TTS configuration.
.. deprecated:: 0.0.105
Use ``AWSPollyTTSSettings`` directly via the ``settings`` parameter instead.
Use ``AWSPollyTTSService.Settings`` directly via the ``settings`` parameter instead.
Parameters:
engine: TTS engine to use ('standard', 'neural', etc.).
@@ -183,7 +183,7 @@ class AWSPollyTTSService(TTSService):
voice_id: Optional[str] = None,
sample_rate: Optional[int] = None,
params: Optional[InputParams] = None,
settings: Optional[AWSPollyTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initializes the AWS Polly TTS service.
@@ -196,20 +196,20 @@ class AWSPollyTTSService(TTSService):
voice_id: Voice ID to use for synthesis. Defaults to 'Joanna'.
.. deprecated:: 0.0.105
Use ``settings=AWSPollyTTSSettings(voice=...)`` instead.
Use ``settings=AWSPollyTTSService.Settings(voice=...)`` instead.
sample_rate: Audio sample rate. If None, uses service default.
params: Additional input parameters for voice customization.
.. deprecated:: 0.0.105
Use ``settings=AWSPollyTTSSettings(...)`` instead.
Use ``settings=AWSPollyTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional arguments passed to parent TTSService class.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = AWSPollyTTSSettings(
default_settings = self.Settings(
model=None,
voice="Joanna",
language="en-US",
@@ -222,12 +222,12 @@ class AWSPollyTTSService(TTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice_id is not None:
_warn_deprecated_param("voice_id", AWSPollyTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", AWSPollyTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.engine = params.engine
default_settings.language = (

View File

@@ -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 NOT_GIVEN, ImageGenSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, ImageGenSettings, _NotGiven
@dataclass
@@ -44,7 +44,7 @@ class AzureImageGenServiceREST(ImageGenService):
"""
Settings = AzureImageGenSettings
_settings: AzureImageGenSettings
_settings: Settings
def __init__(
self,
@@ -55,7 +55,7 @@ class AzureImageGenServiceREST(ImageGenService):
model: Optional[str] = None,
aiohttp_session: aiohttp.ClientSession,
api_version="2023-06-01-preview",
settings: Optional[AzureImageGenSettings] = None,
settings: Optional[Settings] = None,
):
"""Initialize the AzureImageGenServiceREST.
@@ -63,14 +63,14 @@ class AzureImageGenServiceREST(ImageGenService):
image_size: Size specification for generated images (e.g., "1024x1024").
.. deprecated:: 0.0.105
Use ``settings=AzureImageGenSettings(image_size=...)`` instead.
Use ``settings=AzureImageGenServiceREST.Settings(image_size=...)`` instead.
api_key: Azure OpenAI API key for authentication.
endpoint: Azure OpenAI endpoint URL.
model: The image generation model to use.
.. deprecated:: 0.0.105
Use ``settings=AzureImageGenSettings(model=...)`` instead.
Use ``settings=AzureImageGenServiceREST.Settings(model=...)`` instead.
aiohttp_session: Shared aiohttp session for HTTP requests.
api_version: Azure API version string. Defaults to "2023-06-01-preview".
@@ -78,18 +78,18 @@ class AzureImageGenServiceREST(ImageGenService):
parameters, ``settings`` values take precedence.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = AzureImageGenSettings(
default_settings = self.Settings(
model=None,
image_size=None,
)
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", AzureImageGenSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
if image_size is not None:
_warn_deprecated_param("image_size", AzureImageGenSettings, "image_size")
self._warn_init_param_moved_to_settings("image_size", "image_size")
default_settings.image_size = image_size
# 4. Apply settings delta (canonical API, always wins)

View File

@@ -12,13 +12,12 @@ from typing import Optional
from loguru import logger
from openai import AsyncAzureOpenAI
from pipecat.services.openai.base_llm import OpenAILLMSettings
from pipecat.services.openai.base_llm import BaseOpenAILLMService
from pipecat.services.openai.llm import OpenAILLMService
from pipecat.services.settings import _warn_deprecated_param
@dataclass
class AzureLLMSettings(OpenAILLMSettings):
class AzureLLMSettings(BaseOpenAILLMService.Settings):
"""Settings for AzureLLMService."""
pass
@@ -40,7 +39,7 @@ class AzureLLMService(OpenAILLMService):
endpoint: str,
model: Optional[str] = None,
api_version: str = "2024-09-01-preview",
settings: Optional[AzureLLMSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Azure LLM service.
@@ -51,7 +50,7 @@ class AzureLLMService(OpenAILLMService):
model: The model identifier to use. Defaults to "gpt-4o".
.. deprecated:: 0.0.105
Use ``settings=OpenAILLMSettings(model=...)`` instead.
Use ``settings=AzureLLMService.Settings(model=...)`` instead.
api_version: Azure API version. Defaults to "2024-09-01-preview".
settings: Runtime-updatable settings. When provided alongside deprecated
@@ -59,11 +58,11 @@ class AzureLLMService(OpenAILLMService):
**kwargs: Additional keyword arguments passed to OpenAILLMService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = AzureLLMSettings(model="gpt-4o")
default_settings = self.Settings(model="gpt-4o")
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", AzureLLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. (No step 3, as there's no params object to apply)

View File

@@ -10,7 +10,7 @@ from dataclasses import dataclass
from loguru import logger
from pipecat.services.openai.realtime.llm import OpenAIRealtimeLLMService, OpenAIRealtimeLLMSettings
from pipecat.services.openai.realtime.llm import OpenAIRealtimeLLMService
try:
from websockets.asyncio.client import connect as websocket_connect
@@ -21,7 +21,7 @@ except ModuleNotFoundError as e:
@dataclass
class AzureRealtimeLLMSettings(OpenAIRealtimeLLMSettings):
class AzureRealtimeLLMSettings(OpenAIRealtimeLLMService.Settings):
"""Settings for AzureRealtimeLLMService."""
pass
@@ -36,7 +36,7 @@ class AzureRealtimeLLMService(OpenAIRealtimeLLMService):
"""
Settings = AzureRealtimeLLMSettings
_settings: AzureRealtimeLLMSettings
_settings: Settings
def __init__(
self,

View File

@@ -26,7 +26,7 @@ from pipecat.frames.frames import (
TranscriptionFrame,
)
from pipecat.services.azure.common import language_to_azure_language
from pipecat.services.settings import STTSettings, _warn_deprecated_param
from pipecat.services.settings import STTSettings
from pipecat.services.stt_latency import AZURE_TTFS_P99
from pipecat.services.stt_service import STTService
from pipecat.transcriptions.language import Language
@@ -67,7 +67,7 @@ class AzureSTTService(STTService):
"""
Settings = AzureSTTSettings
_settings: AzureSTTSettings
_settings: Settings
def __init__(
self,
@@ -78,7 +78,7 @@ class AzureSTTService(STTService):
sample_rate: Optional[int] = None,
private_endpoint: Optional[str] = None,
endpoint_id: Optional[str] = None,
settings: Optional[AzureSTTSettings] = None,
settings: Optional[Settings] = None,
ttfs_p99_latency: Optional[float] = AZURE_TTFS_P99,
**kwargs,
):
@@ -91,7 +91,7 @@ class AzureSTTService(STTService):
language: Language for speech recognition. Defaults to English (US).
.. deprecated:: 0.0.105
Use ``settings=AzureSTTSettings(language=...)`` instead.
Use ``settings=AzureSTTService.Settings(language=...)`` instead.
sample_rate: Audio sample rate in Hz. If None, uses service default.
private_endpoint: Private endpoint for STT behind firewall.
@@ -104,14 +104,14 @@ class AzureSTTService(STTService):
**kwargs: Additional arguments passed to parent STTService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = AzureSTTSettings(
default_settings = self.Settings(
model=None,
language=language_to_azure_language(Language.EN_US),
)
# 2. Apply direct init arg overrides (deprecated)
if language is not None and language != Language.EN_US:
_warn_deprecated_param("language", AzureSTTSettings, "language")
self._warn_init_param_moved_to_settings("language", "language")
default_settings.language = language_to_azure_language(language)
# 3. (No step 3, as there's no params object to apply)

View File

@@ -25,7 +25,7 @@ from pipecat.frames.frames import (
)
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.azure.common import language_to_azure_language
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven
from pipecat.services.tts_service import TextAggregationMode, TTSService
from pipecat.transcriptions.language import Language
from pipecat.utils.tracing.service_decorators import traced_tts
@@ -97,7 +97,8 @@ class AzureBaseTTSService:
This is a mixin class and should be used alongside TTSService or its subclasses.
"""
_settings: AzureTTSSettings
Settings = AzureTTSSettings
_settings: Settings
# Define SSML escape mappings based on SSML reserved characters
# See - https://learn.microsoft.com/en-us/azure/ai-services/speech-service/speech-synthesis-markup-structure
@@ -113,7 +114,7 @@ class AzureBaseTTSService:
"""Input parameters for Azure TTS voice configuration.
.. deprecated:: 0.0.105
Use ``settings=AzureTTSSettings(...)`` instead.
Use ``settings=AzureBaseTTSService.Settings(...)`` instead.
Parameters:
emphasis: Emphasis level for speech ("strong", "moderate", "reduced").
@@ -256,7 +257,7 @@ class AzureTTSService(TTSService, AzureBaseTTSService):
voice: Optional[str] = None,
sample_rate: Optional[int] = None,
params: Optional[AzureBaseTTSService.InputParams] = None,
settings: Optional[AzureTTSSettings] = None,
settings: Optional[Settings] = None,
aggregate_sentences: Optional[bool] = None,
text_aggregation_mode: Optional[TextAggregationMode] = None,
**kwargs,
@@ -269,13 +270,13 @@ class AzureTTSService(TTSService, AzureBaseTTSService):
voice: Voice name to use for synthesis.
.. deprecated:: 0.0.105
Use ``settings=AzureTTSSettings(voice=...)`` instead.
Use ``settings=AzureTTSService.Settings(voice=...)`` instead.
sample_rate: Audio sample rate in Hz. If None, uses service default.
params: Voice and synthesis parameters configuration.
.. deprecated:: 0.0.105
Use ``settings=AzureTTSSettings(...)`` instead.
Use ``settings=AzureTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
@@ -288,7 +289,7 @@ class AzureTTSService(TTSService, AzureBaseTTSService):
**kwargs: Additional arguments passed to parent WordTTSService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = AzureTTSSettings(
default_settings = self.Settings(
model=None,
voice="en-US-SaraNeural",
language="en-US",
@@ -303,12 +304,12 @@ class AzureTTSService(TTSService, AzureBaseTTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice is not None:
_warn_deprecated_param("voice", AzureTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice", "voice")
default_settings.voice = voice
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", AzureTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.emphasis = params.emphasis
default_settings.language = (
@@ -761,7 +762,7 @@ class AzureHttpTTSService(TTSService, AzureBaseTTSService):
voice: Optional[str] = None,
sample_rate: Optional[int] = None,
params: Optional[AzureBaseTTSService.InputParams] = None,
settings: Optional[AzureTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Azure HTTP TTS service.
@@ -772,20 +773,20 @@ class AzureHttpTTSService(TTSService, AzureBaseTTSService):
voice: Voice name to use for synthesis.
.. deprecated:: 0.0.105
Use ``settings=AzureTTSSettings(voice=...)`` instead.
Use ``settings=AzureHttpTTSService.Settings(voice=...)`` instead.
sample_rate: Audio sample rate in Hz. If None, uses service default.
params: Voice and synthesis parameters configuration.
.. deprecated:: 0.0.105
Use ``settings=AzureTTSSettings(...)`` instead.
Use ``settings=AzureHttpTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional arguments passed to parent TTSService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = AzureTTSSettings(
default_settings = self.Settings(
model=None,
voice="en-US-SaraNeural",
language="en-US",
@@ -800,12 +801,12 @@ class AzureHttpTTSService(TTSService, AzureBaseTTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice is not None:
_warn_deprecated_param("voice", AzureTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice", "voice")
default_settings.voice = voice
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", AzureTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.emphasis = params.emphasis
default_settings.language = (

View File

@@ -30,7 +30,7 @@ from pipecat.frames.frames import (
StartFrame,
TTSAudioRawFrame,
)
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven
from pipecat.services.tts_service import TTSService
from pipecat.transcriptions.language import Language, resolve_language
from pipecat.utils.tracing.service_decorators import traced_tts
@@ -176,13 +176,13 @@ class CambTTSService(TTSService):
"""
Settings = CambTTSSettings
_settings: CambTTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Input parameters for Camb.ai TTS configuration.
.. deprecated:: 0.0.105
Use ``settings=CambTTSSettings(...)`` instead.
Use ``settings=CambTTSService.Settings(...)`` instead.
Parameters:
language: Language for synthesis (BCP-47 format). Defaults to English.
@@ -207,7 +207,7 @@ class CambTTSService(TTSService):
timeout: float = 60.0,
sample_rate: Optional[int] = None,
params: Optional[InputParams] = None,
settings: Optional[CambTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Camb.ai TTS service.
@@ -217,12 +217,12 @@ class CambTTSService(TTSService):
voice_id: Voice ID to use.
.. deprecated:: 0.0.105
Use ``settings=CambTTSSettings(voice=...)`` instead.
Use ``settings=CambTTSService.Settings(voice=...)`` instead.
model: TTS model to use. Options: "mars-flash" (fast), "mars-pro" (high quality).
.. deprecated:: 0.0.105
Use ``settings=CambTTSSettings(model=...)`` instead.
Use ``settings=CambTTSService.Settings(model=...)`` instead.
timeout: Request timeout in seconds. Defaults to 60.0 (minimum recommended
by Camb.ai).
@@ -230,14 +230,14 @@ class CambTTSService(TTSService):
params: Additional voice parameters. If None, uses defaults.
.. deprecated:: 0.0.105
Use ``settings=CambTTSSettings(...)`` instead.
Use ``settings=CambTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional arguments passed to parent TTSService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = CambTTSSettings(
default_settings = self.Settings(
model="mars-flash",
voice=147320,
language="en-us",
@@ -246,15 +246,15 @@ class CambTTSService(TTSService):
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", CambTTSSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
if voice_id is not None:
_warn_deprecated_param("voice_id", CambTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", CambTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
if params.language is not None:
default_settings.language = (

View File

@@ -28,7 +28,7 @@ from pipecat.frames.frames import (
VADUserStoppedSpeakingFrame,
)
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.settings import STTSettings, _warn_deprecated_param
from pipecat.services.settings import STTSettings
from pipecat.services.stt_latency import CARTESIA_TTFS_P99
from pipecat.services.stt_service import WebsocketSTTService
from pipecat.transcriptions.language import Language
@@ -55,7 +55,7 @@ class CartesiaLiveOptions:
"""Configuration options for Cartesia Live STT service.
.. deprecated:: 0.0.105
Use ``settings=CartesiaSTTSettings(...)`` for model/language and
Use ``settings=CartesiaSTTService.Settings(...)`` for model/language and
direct ``__init__`` parameters for encoding/sample_rate instead.
"""
@@ -147,7 +147,7 @@ class CartesiaSTTService(WebsocketSTTService):
"""
Settings = CartesiaSTTSettings
_settings: CartesiaSTTSettings
_settings: Settings
def __init__(
self,
@@ -157,7 +157,7 @@ class CartesiaSTTService(WebsocketSTTService):
encoding: str = "pcm_s16le",
sample_rate: Optional[int] = None,
live_options: Optional[CartesiaLiveOptions] = None,
settings: Optional[CartesiaSTTSettings] = None,
settings: Optional[Settings] = None,
ttfs_p99_latency: Optional[float] = CARTESIA_TTFS_P99,
**kwargs,
):
@@ -172,7 +172,7 @@ class CartesiaSTTService(WebsocketSTTService):
live_options: Configuration options for transcription service.
.. deprecated:: 0.0.105
Use ``settings=CartesiaSTTSettings(...)`` for model/language
Use ``settings=CartesiaSTTService.Settings(...)`` for model/language
and direct init parameters for encoding/sample_rate instead.
settings: Runtime-updatable settings. When provided alongside deprecated
@@ -182,14 +182,14 @@ class CartesiaSTTService(WebsocketSTTService):
**kwargs: Additional arguments passed to parent STTService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = CartesiaSTTSettings(
default_settings = self.Settings(
model="ink-whisper",
language=Language.EN.value,
)
# 2. Apply live_options overrides — only if settings not provided
if live_options is not None:
_warn_deprecated_param("live_options", CartesiaSTTSettings)
self._warn_init_param_moved_to_settings("live_options")
if not settings:
if live_options.sample_rate and sample_rate is None:
sample_rate = live_options.sample_rate
@@ -313,7 +313,7 @@ class CartesiaSTTService(WebsocketSTTService):
"""Apply a settings delta.
Args:
delta: A :class:`STTSettings` (or ``CartesiaSTTSettings``) delta.
delta: A :class:`STTSettings` (or ``CartesiaSTTService.Settings``) delta.
Returns:
Dict mapping changed field names to their previous values.

View File

@@ -25,7 +25,7 @@ from pipecat.frames.frames import (
TTSAudioRawFrame,
TTSStoppedFrame,
)
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven
from pipecat.services.tts_service import TextAggregationMode, TTSService, WebsocketTTSService
from pipecat.transcriptions.language import Language, resolve_language
from pipecat.utils.text.base_text_aggregator import BaseTextAggregator
@@ -211,7 +211,7 @@ class CartesiaTTSService(WebsocketTTSService):
"""
Settings = CartesiaTTSSettings
_settings: CartesiaTTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Input parameters for Cartesia TTS configuration.
@@ -239,7 +239,7 @@ class CartesiaTTSService(WebsocketTTSService):
encoding: str = "pcm_s16le",
container: str = "raw",
params: Optional[InputParams] = None,
settings: Optional[CartesiaTTSSettings] = None,
settings: Optional[Settings] = None,
text_aggregator: Optional[BaseTextAggregator] = None,
text_aggregation_mode: Optional[TextAggregationMode] = None,
aggregate_sentences: Optional[bool] = None,
@@ -252,14 +252,14 @@ class CartesiaTTSService(WebsocketTTSService):
voice_id: ID of the voice to use for synthesis.
.. deprecated:: 0.0.105
Use ``settings=CartesiaTTSSettings(voice=...)`` instead.
Use ``settings=CartesiaTTSService.Settings(voice=...)`` instead.
cartesia_version: API version string for Cartesia service.
url: WebSocket URL for Cartesia TTS API.
model: TTS model to use (e.g., "sonic-3").
.. deprecated:: 0.0.105
Use ``settings=CartesiaTTSSettings(model=...)`` instead.
Use ``settings=CartesiaTTSService.Settings(model=...)`` instead.
sample_rate: Audio sample rate. If None, uses default.
encoding: Audio encoding format.
@@ -267,7 +267,7 @@ class CartesiaTTSService(WebsocketTTSService):
params: Additional input parameters for voice customization.
.. deprecated:: 0.0.105
Use ``settings=CartesiaTTSSettings(...)`` instead.
Use ``settings=CartesiaTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
@@ -299,7 +299,7 @@ class CartesiaTTSService(WebsocketTTSService):
# playout timing of the audio!
# 1. Initialize default_settings with hardcoded defaults
default_settings = CartesiaTTSSettings(
default_settings = self.Settings(
model="sonic-3",
voice=None,
language=language_to_cartesia_language(Language.EN),
@@ -309,15 +309,15 @@ class CartesiaTTSService(WebsocketTTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice_id is not None:
_warn_deprecated_param("voice_id", CartesiaTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
if model is not None:
_warn_deprecated_param("model", CartesiaTTSSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", CartesiaTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
if params.language is not None:
default_settings.language = self.language_to_service_language(params.language)
@@ -683,7 +683,7 @@ class CartesiaHttpTTSService(TTSService):
"""
Settings = CartesiaTTSSettings
_settings: CartesiaTTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Input parameters for Cartesia HTTP TTS configuration.
@@ -712,7 +712,7 @@ class CartesiaHttpTTSService(TTSService):
encoding: str = "pcm_s16le",
container: str = "raw",
params: Optional[InputParams] = None,
settings: Optional[CartesiaTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Cartesia HTTP TTS service.
@@ -722,12 +722,12 @@ class CartesiaHttpTTSService(TTSService):
voice_id: ID of the voice to use for synthesis.
.. deprecated:: 0.0.105
Use ``settings=CartesiaTTSSettings(voice=...)`` instead.
Use ``settings=CartesiaHttpTTSService.Settings(voice=...)`` instead.
model: TTS model to use (e.g., "sonic-3").
.. deprecated:: 0.0.105
Use ``settings=CartesiaTTSSettings(model=...)`` instead.
Use ``settings=CartesiaHttpTTSService.Settings(model=...)`` instead.
base_url: Base URL for Cartesia HTTP API.
cartesia_version: API version string for Cartesia service.
@@ -739,14 +739,14 @@ class CartesiaHttpTTSService(TTSService):
params: Additional input parameters for voice customization.
.. deprecated:: 0.0.105
Use ``settings=CartesiaTTSSettings(...)`` instead.
Use ``settings=CartesiaHttpTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional arguments passed to the parent TTSService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = CartesiaTTSSettings(
default_settings = self.Settings(
model="sonic-3",
voice=None,
language=language_to_cartesia_language(Language.EN),
@@ -756,15 +756,15 @@ class CartesiaHttpTTSService(TTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice_id is not None:
_warn_deprecated_param("voice_id", CartesiaTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
if model is not None:
_warn_deprecated_param("model", CartesiaTTSSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", CartesiaTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
if params.language is not None:
default_settings.language = self.language_to_service_language(params.language)

View File

@@ -12,13 +12,12 @@ from typing import Optional
from loguru import logger
from pipecat.adapters.services.open_ai_adapter import OpenAILLMInvocationParams
from pipecat.services.openai.base_llm import OpenAILLMSettings
from pipecat.services.openai.base_llm import BaseOpenAILLMService
from pipecat.services.openai.llm import OpenAILLMService
from pipecat.services.settings import _warn_deprecated_param
@dataclass
class CerebrasLLMSettings(OpenAILLMSettings):
class CerebrasLLMSettings(BaseOpenAILLMService.Settings):
"""Settings for CerebrasLLMService."""
pass
@@ -32,7 +31,7 @@ class CerebrasLLMService(OpenAILLMService):
"""
Settings = CerebrasLLMSettings
_settings: CerebrasLLMSettings
_settings: Settings
def __init__(
self,
@@ -40,7 +39,7 @@ class CerebrasLLMService(OpenAILLMService):
api_key: str,
base_url: str = "https://api.cerebras.ai/v1",
model: Optional[str] = None,
settings: Optional[CerebrasLLMSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Cerebras LLM service.
@@ -51,18 +50,18 @@ class CerebrasLLMService(OpenAILLMService):
model: The model identifier to use. Defaults to "gpt-oss-120b".
.. deprecated:: 0.0.105
Use ``settings=OpenAILLMSettings(model=...)`` instead.
Use ``settings=CerebrasLLMService.Settings(model=...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional keyword arguments passed to OpenAILLMService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = CerebrasLLMSettings(model="gpt-oss-120b")
default_settings = self.Settings(model="gpt-oss-120b")
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", CerebrasLLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. (No step 3, as there's no params object to apply)

View File

@@ -28,7 +28,7 @@ from pipecat.frames.frames import (
UserStartedSpeakingFrame,
UserStoppedSpeakingFrame,
)
from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven
from pipecat.services.stt_service import WebsocketSTTService
from pipecat.transcriptions.language import Language
from pipecat.utils.time import time_now_iso8601
@@ -116,14 +116,14 @@ class DeepgramFluxSTTService(WebsocketSTTService):
"""
Settings = DeepgramFluxSTTSettings
_settings: DeepgramFluxSTTSettings
_settings: Settings
_CONFIGURE_FIELDS = {"keyterm", "eot_threshold", "eager_eot_threshold", "eot_timeout_ms"}
class InputParams(BaseModel):
"""Configuration parameters for Deepgram Flux API.
.. deprecated:: 0.0.105
Use ``settings=DeepgramFluxSTTSettings(...)`` instead.
Use ``settings=DeepgramFluxSTTService.Settings(...)`` instead.
Parameters:
eager_eot_threshold: Optional. EagerEndOfTurn/TurnResumed are off by default.
@@ -162,7 +162,7 @@ class DeepgramFluxSTTService(WebsocketSTTService):
tag: Optional[list] = None,
params: Optional[InputParams] = None,
should_interrupt: bool = True,
settings: Optional[DeepgramFluxSTTSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Deepgram Flux STT service.
@@ -176,7 +176,7 @@ class DeepgramFluxSTTService(WebsocketSTTService):
model: Deepgram Flux model to use for transcription.
.. deprecated:: 0.0.105
Use ``settings=DeepgramFluxSTTSettings(model=...)`` instead.
Use ``settings=DeepgramFluxSTTService.Settings(model=...)`` instead.
flux_encoding: Audio encoding format required by Flux API. Must be "linear16".
Raw signed little-endian 16-bit PCM encoding.
@@ -184,7 +184,7 @@ class DeepgramFluxSTTService(WebsocketSTTService):
params: InputParams instance containing detailed API configuration options.
.. deprecated:: 0.0.105
Use ``settings=DeepgramFluxSTTSettings(...)`` instead.
Use ``settings=DeepgramFluxSTTService.Settings(...)`` instead.
should_interrupt: Determine whether the bot should be interrupted when Flux detects that the user is speaking.
settings: Runtime-updatable settings. When provided alongside deprecated
@@ -200,7 +200,7 @@ class DeepgramFluxSTTService(WebsocketSTTService):
stt = DeepgramFluxSTTService(
api_key="your-api-key",
settings=DeepgramFluxSTTSettings(
settings=DeepgramFluxSTTService.Settings(
model="flux-general-en",
eager_eot_threshold=0.5,
eot_threshold=0.8,
@@ -221,7 +221,7 @@ class DeepgramFluxSTTService(WebsocketSTTService):
# already try to reconnect if needed.
# 1. Initialize default_settings with hardcoded defaults
default_settings = DeepgramFluxSTTSettings(
default_settings = self.Settings(
model="flux-general-en",
language=Language.EN,
eager_eot_threshold=None,
@@ -233,12 +233,12 @@ class DeepgramFluxSTTService(WebsocketSTTService):
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", DeepgramFluxSTTSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", DeepgramFluxSTTSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.eager_eot_threshold = params.eager_eot_threshold
default_settings.eot_threshold = params.eot_threshold
@@ -448,7 +448,7 @@ class DeepgramFluxSTTService(WebsocketSTTService):
"""
return True
async def _update_settings(self, delta: DeepgramFluxSTTSettings) -> dict[str, Any]:
async def _update_settings(self, delta: Settings) -> dict[str, Any]:
"""Apply a settings delta.
Configure-able fields (keyterm, eot_threshold, eager_eot_threshold,

View File

@@ -32,8 +32,8 @@ from pipecat.frames.frames import (
)
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.aws.sagemaker.bidi_client import SageMakerBidiClient
from pipecat.services.deepgram.stt import DeepgramSTTSettings, LiveOptions
from pipecat.services.settings import STTSettings, _warn_deprecated_param, is_given
from pipecat.services.deepgram.stt import DeepgramSTTService, LiveOptions
from pipecat.services.settings import STTSettings, is_given
from pipecat.services.stt_latency import DEEPGRAM_SAGEMAKER_TTFS_P99
from pipecat.services.stt_service import STTService
from pipecat.transcriptions.language import Language
@@ -42,10 +42,10 @@ from pipecat.utils.tracing.service_decorators import traced_stt
@dataclass
class DeepgramSageMakerSTTSettings(DeepgramSTTSettings):
class DeepgramSageMakerSTTSettings(DeepgramSTTService.Settings):
"""Settings for the Deepgram SageMaker STT service.
Inherits all fields from :class:`DeepgramSTTSettings`.
Inherits all fields from :class:`DeepgramSTTService.Settings`.
"""
pass
@@ -79,7 +79,7 @@ class DeepgramSageMakerSTTService(STTService):
"""
Settings = DeepgramSageMakerSTTSettings
_settings: DeepgramSageMakerSTTSettings
_settings: Settings
def __init__(
self,
@@ -92,7 +92,7 @@ class DeepgramSageMakerSTTService(STTService):
sample_rate: Optional[int] = None,
mip_opt_out: Optional[bool] = None,
live_options: Optional[LiveOptions] = None,
settings: Optional[DeepgramSageMakerSTTSettings] = None,
settings: Optional[Settings] = None,
ttfs_p99_latency: Optional[float] = DEEPGRAM_SAGEMAKER_TTFS_P99,
**kwargs,
):
@@ -112,7 +112,7 @@ class DeepgramSageMakerSTTService(STTService):
live_options: Legacy configuration options.
.. deprecated:: 0.0.105
Use ``settings=DeepgramSageMakerSTTSettings(...)`` for
Use ``settings=DeepgramSageMakerSTTService.Settings(...)`` for
runtime-updatable fields and direct init parameters for
connection-level config.
@@ -124,7 +124,7 @@ class DeepgramSageMakerSTTService(STTService):
**kwargs: Additional arguments passed to the parent STTService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = DeepgramSageMakerSTTSettings(
default_settings = self.Settings(
model="nova-3",
language=Language.EN,
detect_entities=False,
@@ -147,7 +147,7 @@ class DeepgramSageMakerSTTService(STTService):
# 2. Apply live_options overrides — only if settings not provided
if live_options is not None:
_warn_deprecated_param("live_options", DeepgramSageMakerSTTSettings)
self._warn_init_param_moved_to_settings("live_options")
if not settings:
# Extract init-only fields from live_options
if live_options.sample_rate is not None and sample_rate is None:
@@ -170,7 +170,7 @@ class DeepgramSageMakerSTTService(STTService):
"mip_opt_out",
}
lo_dict = {k: v for k, v in live_options.to_dict().items() if k not in init_only}
delta = DeepgramSageMakerSTTSettings.from_mapping(lo_dict)
delta = self.Settings.from_mapping(lo_dict)
default_settings.apply_update(delta)
# 3. Apply settings delta (canonical API, always wins)
@@ -216,7 +216,7 @@ class DeepgramSageMakerSTTService(STTService):
return changed
# Sync extra to fields after the update so self._settings stays unambiguous
if isinstance(self._settings, DeepgramSTTSettings):
if isinstance(self._settings, self.Settings):
self._settings._sync_extra_to_fields()
# TODO: someday we could reconnect here to apply updated settings.

View File

@@ -33,7 +33,7 @@ from pipecat.frames.frames import (
)
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.aws.sagemaker.bidi_client import SageMakerBidiClient
from pipecat.services.settings import TTSSettings, _warn_deprecated_param
from pipecat.services.settings import TTSSettings
from pipecat.services.tts_service import TTSService
from pipecat.utils.tracing.service_decorators import traced_tts
@@ -70,7 +70,7 @@ class DeepgramSageMakerTTSService(TTSService):
"""
Settings = DeepgramSageMakerTTSSettings
_settings: DeepgramSageMakerTTSSettings
_settings: Settings
def __init__(
self,
@@ -80,7 +80,7 @@ class DeepgramSageMakerTTSService(TTSService):
voice: Optional[str] = None,
sample_rate: Optional[int] = None,
encoding: str = "linear16",
settings: Optional[DeepgramSageMakerTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Deepgram SageMaker TTS service.
@@ -92,7 +92,7 @@ class DeepgramSageMakerTTSService(TTSService):
voice: Voice model to use for synthesis. Defaults to "aura-2-helena-en".
.. deprecated:: 0.0.105
Use ``settings=DeepgramSageMakerTTSSettings(voice=...)`` instead.
Use ``settings=DeepgramSageMakerTTSService.Settings(voice=...)`` instead.
sample_rate: Audio sample rate in Hz. If None, uses the value from StartFrame.
encoding: Audio encoding format. Defaults to "linear16".
@@ -101,11 +101,11 @@ class DeepgramSageMakerTTSService(TTSService):
**kwargs: Additional arguments passed to the parent TTSService.
"""
if voice is not None:
_warn_deprecated_param("voice", DeepgramSageMakerTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice", "voice")
voice = voice or "aura-2-helena-en"
default_settings = DeepgramSageMakerTTSSettings(
default_settings = self.Settings(
model=None,
voice=voice,
language=None,

View File

@@ -29,7 +29,6 @@ from pipecat.services.settings import (
NOT_GIVEN,
STTSettings,
_NotGiven,
_warn_deprecated_param,
is_given,
)
from pipecat.services.stt_latency import DEEPGRAM_TTFS_P99
@@ -59,7 +58,7 @@ class LiveOptions:
deepgram-sdk v6.
.. deprecated:: 0.0.105
Use ``settings=DeepgramSTTSettings(...)`` for runtime-updatable fields
Use ``settings=DeepgramSTTService.Settings(...)`` for runtime-updatable fields
and direct ``__init__`` parameters for connection-level config instead.
"""
@@ -267,7 +266,7 @@ class DeepgramSTTService(STTService):
"""
Settings = DeepgramSTTSettings
_settings: DeepgramSTTSettings
_settings: Settings
def __init__(
self,
@@ -286,7 +285,7 @@ class DeepgramSTTService(STTService):
live_options: Optional[LiveOptions] = None,
addons: Optional[dict] = None,
should_interrupt: bool = True,
settings: Optional[DeepgramSTTSettings] = None,
settings: Optional[Settings] = None,
ttfs_p99_latency: Optional[float] = DEEPGRAM_TTFS_P99,
**kwargs,
):
@@ -313,7 +312,7 @@ class DeepgramSTTService(STTService):
live_options: Legacy configuration options.
.. deprecated:: 0.0.105
Use ``settings=DeepgramSTTSettings(...)`` for runtime-updatable
Use ``settings=DeepgramSTTService.Settings(...)`` for runtime-updatable
fields and direct init parameters for connection-level config.
addons: Additional Deepgram features to enable.
@@ -345,7 +344,7 @@ class DeepgramSTTService(STTService):
base_url = url
# 1. Initialize default_settings with hardcoded defaults
default_settings = DeepgramSTTSettings(
default_settings = self.Settings(
model="nova-3-general",
language=Language.EN,
detect_entities=False,
@@ -370,7 +369,7 @@ class DeepgramSTTService(STTService):
# 3. Apply live_options overrides — only if settings not provided
if live_options is not None:
_warn_deprecated_param("live_options", DeepgramSTTSettings)
self._warn_init_param_moved_to_settings("live_options")
if not settings:
# Extract init-only fields from live_options
if live_options.sample_rate is not None and sample_rate is None:
@@ -402,7 +401,7 @@ class DeepgramSTTService(STTService):
"mip_opt_out",
}
lo_dict = {k: v for k, v in live_options.to_dict().items() if k not in init_only}
delta = DeepgramSTTSettings.from_mapping(lo_dict)
delta = self.Settings.from_mapping(lo_dict)
default_settings.apply_update(delta)
# 4. Apply settings delta (canonical API, always wins)
@@ -494,7 +493,7 @@ class DeepgramSTTService(STTService):
return changed
# Sync extra to fields after the update so self._settings stays unambiguous
if isinstance(self._settings, DeepgramSTTSettings):
if isinstance(self._settings, self.Settings):
self._settings._sync_extra_to_fields()
if self._connection:

View File

@@ -26,7 +26,7 @@ from pipecat.frames.frames import (
TTSAudioRawFrame,
TTSStoppedFrame,
)
from pipecat.services.settings import TTSSettings, _warn_deprecated_param
from pipecat.services.settings import TTSSettings
from pipecat.services.tts_service import TTSService, WebsocketTTSService
from pipecat.utils.tracing.service_decorators import traced_tts
@@ -57,7 +57,7 @@ class DeepgramTTSService(WebsocketTTSService):
"""
Settings = DeepgramTTSSettings
_settings: DeepgramTTSSettings
_settings: Settings
SUPPORTED_ENCODINGS = ("linear16", "mulaw", "alaw")
@@ -69,7 +69,7 @@ class DeepgramTTSService(WebsocketTTSService):
base_url: str = "wss://api.deepgram.com",
sample_rate: Optional[int] = None,
encoding: str = "linear16",
settings: Optional[DeepgramTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Deepgram WebSocket TTS service.
@@ -79,7 +79,7 @@ class DeepgramTTSService(WebsocketTTSService):
voice: Voice model to use for synthesis.
.. deprecated:: 0.0.105
Use ``settings=DeepgramTTSSettings(voice=...)`` instead.
Use ``settings=DeepgramTTSService.Settings(voice=...)`` instead.
base_url: WebSocket base URL for Deepgram API. Defaults to "wss://api.deepgram.com".
sample_rate: Audio sample rate in Hz. If None, uses service default.
@@ -97,7 +97,7 @@ class DeepgramTTSService(WebsocketTTSService):
)
# 1. Initialize default_settings with hardcoded defaults
default_settings = DeepgramTTSSettings(
default_settings = self.Settings(
model=None,
voice="aura-2-helena-en",
language=None,
@@ -105,7 +105,7 @@ class DeepgramTTSService(WebsocketTTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice is not None:
_warn_deprecated_param("voice", DeepgramTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice", "voice")
default_settings.model = voice
default_settings.voice = voice
@@ -189,7 +189,7 @@ class DeepgramTTSService(WebsocketTTSService):
"""Apply a settings delta.
Args:
delta: A :class:`TTSSettings` (or ``DeepgramTTSSettings``) delta.
delta: A :class:`TTSSettings` (or ``DeepgramTTSService.Settings``) delta.
Returns:
Dict mapping changed field names to their previous values.
@@ -367,7 +367,7 @@ class DeepgramHttpTTSService(TTSService):
"""
Settings = DeepgramTTSSettings
_settings: DeepgramTTSSettings
_settings: Settings
def __init__(
self,
@@ -378,7 +378,7 @@ class DeepgramHttpTTSService(TTSService):
base_url: str = "https://api.deepgram.com",
sample_rate: Optional[int] = None,
encoding: str = "linear16",
settings: Optional[DeepgramTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Deepgram TTS service.
@@ -388,7 +388,7 @@ class DeepgramHttpTTSService(TTSService):
voice: Voice model to use for synthesis.
.. deprecated:: 0.0.105
Use ``settings=DeepgramTTSSettings(voice=...)`` instead.
Use ``settings=DeepgramHttpTTSService.Settings(voice=...)`` instead.
aiohttp_session: Shared aiohttp session for HTTP requests with connection pooling.
base_url: Custom base URL for Deepgram API. Defaults to "https://api.deepgram.com".
@@ -399,7 +399,7 @@ class DeepgramHttpTTSService(TTSService):
**kwargs: Additional arguments passed to parent TTSService class.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = DeepgramTTSSettings(
default_settings = self.Settings(
model=None,
voice="aura-2-helena-en",
language=None,
@@ -407,7 +407,7 @@ class DeepgramHttpTTSService(TTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice is not None:
_warn_deprecated_param("voice", DeepgramTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice", "voice")
default_settings.model = voice
default_settings.voice = voice

View File

@@ -12,13 +12,12 @@ from typing import Optional
from loguru import logger
from pipecat.adapters.services.open_ai_adapter import OpenAILLMInvocationParams
from pipecat.services.openai.base_llm import OpenAILLMSettings
from pipecat.services.openai.base_llm import BaseOpenAILLMService
from pipecat.services.openai.llm import OpenAILLMService
from pipecat.services.settings import _warn_deprecated_param
@dataclass
class DeepSeekLLMSettings(OpenAILLMSettings):
class DeepSeekLLMSettings(BaseOpenAILLMService.Settings):
"""Settings for DeepSeekLLMService."""
pass
@@ -32,7 +31,7 @@ class DeepSeekLLMService(OpenAILLMService):
"""
Settings = DeepSeekLLMSettings
_settings: DeepSeekLLMSettings
_settings: Settings
def __init__(
self,
@@ -40,7 +39,7 @@ class DeepSeekLLMService(OpenAILLMService):
api_key: str,
base_url: str = "https://api.deepseek.com/v1",
model: Optional[str] = None,
settings: Optional[DeepSeekLLMSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the DeepSeek LLM service.
@@ -51,18 +50,18 @@ class DeepSeekLLMService(OpenAILLMService):
model: The model identifier to use. Defaults to "deepseek-chat".
.. deprecated:: 0.0.105
Use ``settings=OpenAILLMSettings(model=...)`` instead.
Use ``settings=DeepSeekLLMService.Settings(model=...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional keyword arguments passed to OpenAILLMService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = DeepSeekLLMSettings(model="deepseek-chat")
default_settings = self.Settings(model="deepseek-chat")
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", DeepSeekLLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. (No step 3, as there's no params object to apply)

View File

@@ -35,7 +35,7 @@ from pipecat.frames.frames import (
VADUserStoppedSpeakingFrame,
)
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven
from pipecat.services.stt_latency import ELEVENLABS_REALTIME_TTFS_P99, ELEVENLABS_TTFS_P99
from pipecat.services.stt_service import SegmentedSTTService, WebsocketSTTService
from pipecat.transcriptions.language import Language, resolve_language
@@ -217,13 +217,13 @@ class ElevenLabsSTTService(SegmentedSTTService):
"""
Settings = ElevenLabsSTTSettings
_settings: ElevenLabsSTTSettings
_settings: Settings
class InputParams(BaseModel):
"""Configuration parameters for ElevenLabs STT API.
.. deprecated:: 0.0.105
Use ``settings=ElevenLabsSTTSettings(...)`` instead.
Use ``settings=ElevenLabsSTTService.Settings(...)`` instead.
Parameters:
language: Target language for transcription.
@@ -242,7 +242,7 @@ class ElevenLabsSTTService(SegmentedSTTService):
model: Optional[str] = None,
sample_rate: Optional[int] = None,
params: Optional[InputParams] = None,
settings: Optional[ElevenLabsSTTSettings] = None,
settings: Optional[Settings] = None,
ttfs_p99_latency: Optional[float] = ELEVENLABS_TTFS_P99,
**kwargs,
):
@@ -255,13 +255,13 @@ class ElevenLabsSTTService(SegmentedSTTService):
model: Model ID for transcription.
.. deprecated:: 0.0.105
Use ``settings=ElevenLabsSTTSettings(model=...)`` instead.
Use ``settings=ElevenLabsSTTService.Settings(model=...)`` instead.
sample_rate: Audio sample rate in Hz. If not provided, uses the pipeline's rate.
params: Configuration parameters for the STT service.
.. deprecated:: 0.0.105
Use ``settings=ElevenLabsSTTSettings(...)`` instead.
Use ``settings=ElevenLabsSTTService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
@@ -270,7 +270,7 @@ class ElevenLabsSTTService(SegmentedSTTService):
**kwargs: Additional arguments passed to SegmentedSTTService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = ElevenLabsSTTSettings(
default_settings = self.Settings(
model="scribe_v2",
language=language_to_elevenlabs_language(Language.EN),
tag_audio_events=None,
@@ -278,12 +278,12 @@ class ElevenLabsSTTService(SegmentedSTTService):
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", ElevenLabsSTTSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", ElevenLabsSTTSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
if params.language is not None:
default_settings.language = language_to_elevenlabs_language(params.language)
@@ -450,13 +450,13 @@ class ElevenLabsRealtimeSTTService(WebsocketSTTService):
"""
Settings = ElevenLabsRealtimeSTTSettings
_settings: ElevenLabsRealtimeSTTSettings
_settings: Settings
class InputParams(BaseModel):
"""Configuration parameters for ElevenLabs Realtime STT API.
.. deprecated:: 0.0.105
Use ``settings=ElevenLabsRealtimeSTTSettings(...)`` instead.
Use ``settings=ElevenLabsRealtimeSTTService.Settings(...)`` instead.
Parameters:
language_code: ISO-639-1 or ISO-639-3 language code. Leave None for auto-detection.
@@ -496,7 +496,7 @@ class ElevenLabsRealtimeSTTService(WebsocketSTTService):
enable_logging: bool = False,
include_language_detection: bool = False,
params: Optional[InputParams] = None,
settings: Optional[ElevenLabsRealtimeSTTSettings] = None,
settings: Optional[Settings] = None,
ttfs_p99_latency: Optional[float] = ELEVENLABS_REALTIME_TTFS_P99,
**kwargs,
):
@@ -511,7 +511,7 @@ class ElevenLabsRealtimeSTTService(WebsocketSTTService):
model: Model ID for transcription.
.. deprecated:: 0.0.105
Use ``settings=ElevenLabsRealtimeSTTSettings(model=...)`` instead.
Use ``settings=ElevenLabsRealtimeSTTService.Settings(model=...)`` instead.
sample_rate: Audio sample rate in Hz. If not provided, uses the pipeline's rate.
include_timestamps: Whether to include word-level timestamps in transcripts.
@@ -520,7 +520,7 @@ class ElevenLabsRealtimeSTTService(WebsocketSTTService):
params: Configuration parameters for the STT service.
.. deprecated:: 0.0.105
Use ``settings=ElevenLabsRealtimeSTTSettings(...)`` instead.
Use ``settings=ElevenLabsRealtimeSTTService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
@@ -529,7 +529,7 @@ class ElevenLabsRealtimeSTTService(WebsocketSTTService):
**kwargs: Additional arguments passed to WebsocketSTTService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = ElevenLabsRealtimeSTTSettings(
default_settings = self.Settings(
model="scribe_v2_realtime",
language=None,
vad_silence_threshold_secs=None,
@@ -540,12 +540,12 @@ class ElevenLabsRealtimeSTTService(WebsocketSTTService):
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", ElevenLabsRealtimeSTTSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", ElevenLabsRealtimeSTTSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.language = params.language_code
if params.commit_strategy != CommitStrategy.MANUAL:
@@ -597,7 +597,7 @@ class ElevenLabsRealtimeSTTService(WebsocketSTTService):
"""Apply a settings delta and reconnect if anything changed.
Args:
delta: A :class:`STTSettings` (or ``ElevenLabsRealtimeSTTSettings``) delta.
delta: A :class:`STTSettings` (or ``ElevenLabsRealtimeSTTService.Settings``) delta.
Returns:
Dict mapping changed field names to their previous values.

View File

@@ -44,7 +44,7 @@ from pipecat.frames.frames import (
TTSStoppedFrame,
)
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven
from pipecat.services.tts_service import (
TextAggregationMode,
TTSService,
@@ -317,13 +317,13 @@ class ElevenLabsTTSService(WebsocketTTSService):
"""
Settings = ElevenLabsTTSSettings
_settings: ElevenLabsTTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Input parameters for ElevenLabs TTS configuration.
.. deprecated:: 0.0.105
Use ``settings=ElevenLabsTTSSettings(...)`` instead.
Use ``settings=ElevenLabsTTSService.Settings(...)`` instead.
Parameters:
language: Language to use for synthesis.
@@ -364,7 +364,7 @@ class ElevenLabsTTSService(WebsocketTTSService):
enable_logging: Optional[bool] = None,
pronunciation_dictionary_locators: Optional[List[PronunciationDictionaryLocator]] = None,
params: Optional[InputParams] = None,
settings: Optional[ElevenLabsTTSSettings] = None,
settings: Optional[Settings] = None,
text_aggregation_mode: Optional[TextAggregationMode] = None,
aggregate_sentences: Optional[bool] = None,
**kwargs,
@@ -376,12 +376,12 @@ class ElevenLabsTTSService(WebsocketTTSService):
voice_id: ID of the voice to use for synthesis.
.. deprecated:: 0.0.105
Use ``settings=ElevenLabsTTSSettings(voice=...)`` instead.
Use ``settings=ElevenLabsTTSService.Settings(voice=...)`` instead.
model: TTS model to use (e.g., "eleven_turbo_v2_5").
.. deprecated:: 0.0.105
Use ``settings=ElevenLabsTTSSettings(model=...)`` instead.
Use ``settings=ElevenLabsTTSService.Settings(model=...)`` instead.
url: WebSocket URL for ElevenLabs TTS API.
sample_rate: Audio sample rate. If None, uses default.
@@ -393,7 +393,7 @@ class ElevenLabsTTSService(WebsocketTTSService):
params: Additional input parameters for voice customization.
.. deprecated:: 0.0.105
Use ``settings=ElevenLabsTTSSettings(...)`` instead.
Use ``settings=ElevenLabsTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
@@ -423,7 +423,7 @@ class ElevenLabsTTSService(WebsocketTTSService):
# after a short period not receiving any audio.
# 1. Initialize default_settings with hardcoded defaults
default_settings = ElevenLabsTTSSettings(
default_settings = self.Settings(
model="eleven_turbo_v2_5",
voice=None,
language=None,
@@ -437,16 +437,16 @@ class ElevenLabsTTSService(WebsocketTTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice_id is not None:
_warn_deprecated_param("voice_id", ElevenLabsTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
if model is not None:
_warn_deprecated_param("model", ElevenLabsTTSSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. Apply params overrides — only if settings not provided
_pronunciation_dictionary_locators = pronunciation_dictionary_locators
if params is not None:
_warn_deprecated_param("params", ElevenLabsTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
if params.language is not None:
default_settings.language = self.language_to_service_language(params.language)
@@ -533,11 +533,11 @@ class ElevenLabsTTSService(WebsocketTTSService):
"""Apply a settings delta, reconnecting as needed.
Uses the declarative ``URL_FIELDS`` and ``VOICE_SETTINGS_FIELDS``
sets on :class:`ElevenLabsTTSSettings` to decide whether to
sets on :class:`ElevenLabsTTSService.Settings` to decide whether to
reconnect the WebSocket or close the current audio context.
Args:
delta: A :class:`TTSSettings` (or ``ElevenLabsTTSSettings``) delta.
delta: A :class:`TTSSettings` (or ``ElevenLabsTTSService.Settings``) delta.
Returns:
Dict mapping changed field names to their previous values.
@@ -550,19 +550,19 @@ class ElevenLabsTTSService(WebsocketTTSService):
# Rebuild voice settings for next context
self._voice_settings = self._set_voice_settings()
url_changed = bool(changed.keys() & ElevenLabsTTSSettings.URL_FIELDS)
voice_settings_changed = bool(changed.keys() & ElevenLabsTTSSettings.VOICE_SETTINGS_FIELDS)
url_changed = bool(changed.keys() & self.Settings.URL_FIELDS)
voice_settings_changed = bool(changed.keys() & self.Settings.VOICE_SETTINGS_FIELDS)
if url_changed:
logger.debug(
f"URL-level setting changed ({changed.keys() & ElevenLabsTTSSettings.URL_FIELDS}), "
f"URL-level setting changed ({changed.keys() & self.Settings.URL_FIELDS}), "
f"reconnecting WebSocket"
)
await self._disconnect()
await self._connect()
elif voice_settings_changed:
logger.debug(
f"Voice settings changed ({changed.keys() & ElevenLabsTTSSettings.VOICE_SETTINGS_FIELDS}), "
f"Voice settings changed ({changed.keys() & self.Settings.VOICE_SETTINGS_FIELDS}), "
f"closing current context to apply changes"
)
audio_contexts = self.get_audio_contexts()
@@ -573,7 +573,7 @@ class ElevenLabsTTSService(WebsocketTTSService):
if not url_changed:
# Reconnect applies all settings; only warn about fields not handled
# by voice settings or URL changes.
handled = ElevenLabsTTSSettings.URL_FIELDS | ElevenLabsTTSSettings.VOICE_SETTINGS_FIELDS
handled = self.Settings.URL_FIELDS | self.Settings.VOICE_SETTINGS_FIELDS
self._warn_unhandled_updated_settings(changed.keys() - handled)
return changed
@@ -906,13 +906,13 @@ class ElevenLabsHttpTTSService(TTSService):
"""
Settings = ElevenLabsHttpTTSSettings
_settings: ElevenLabsHttpTTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Input parameters for ElevenLabs HTTP TTS configuration.
.. deprecated:: 0.0.105
Use ``settings=ElevenLabsHttpTTSSettings(...)`` instead.
Use ``settings=ElevenLabsHttpTTSService.Settings(...)`` instead.
Parameters:
language: Language to use for synthesis.
@@ -947,7 +947,7 @@ class ElevenLabsHttpTTSService(TTSService):
sample_rate: Optional[int] = None,
pronunciation_dictionary_locators: Optional[List[PronunciationDictionaryLocator]] = None,
params: Optional[InputParams] = None,
settings: Optional[ElevenLabsHttpTTSSettings] = None,
settings: Optional[Settings] = None,
text_aggregation_mode: Optional[TextAggregationMode] = None,
aggregate_sentences: Optional[bool] = None,
**kwargs,
@@ -959,13 +959,13 @@ class ElevenLabsHttpTTSService(TTSService):
voice_id: ID of the voice to use for synthesis.
.. deprecated:: 0.0.105
Use ``settings=ElevenLabsHttpTTSSettings(voice=...)`` instead.
Use ``settings=ElevenLabsHttpTTSService.Settings(voice=...)`` instead.
aiohttp_session: aiohttp ClientSession for HTTP requests.
model: TTS model to use (e.g., "eleven_turbo_v2_5").
.. deprecated:: 0.0.105
Use ``settings=ElevenLabsHttpTTSSettings(model=...)`` instead.
Use ``settings=ElevenLabsHttpTTSService.Settings(model=...)`` instead.
base_url: Base URL for ElevenLabs HTTP API.
sample_rate: Audio sample rate. If None, uses default.
@@ -974,7 +974,7 @@ class ElevenLabsHttpTTSService(TTSService):
params: Additional input parameters for voice customization.
.. deprecated:: 0.0.105
Use ``settings=ElevenLabsHttpTTSSettings(...)`` instead.
Use ``settings=ElevenLabsHttpTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
@@ -987,7 +987,7 @@ class ElevenLabsHttpTTSService(TTSService):
**kwargs: Additional arguments passed to the parent service.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = ElevenLabsHttpTTSSettings(
default_settings = self.Settings(
model="eleven_turbo_v2_5",
voice=None,
language=None,
@@ -1002,16 +1002,16 @@ class ElevenLabsHttpTTSService(TTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice_id is not None:
_warn_deprecated_param("voice_id", ElevenLabsHttpTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
if model is not None:
_warn_deprecated_param("model", ElevenLabsHttpTTSSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. Apply params overrides — only if settings not provided
_pronunciation_dictionary_locators = pronunciation_dictionary_locators
if params is not None:
_warn_deprecated_param("params", ElevenLabsHttpTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
if params.language is not None:
default_settings.language = self.language_to_service_language(params.language)
@@ -1091,7 +1091,7 @@ class ElevenLabsHttpTTSService(TTSService):
"""Apply a settings delta and rebuild voice settings.
Args:
delta: A :class:`TTSSettings` (or ``ElevenLabsHttpTTSSettings``) delta.
delta: A :class:`TTSSettings` (or ``ElevenLabsHttpTTSService.Settings``) delta.
Returns:
Dict mapping changed field names to their previous values.

View File

@@ -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 NOT_GIVEN, ImageGenSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, ImageGenSettings, _NotGiven
@dataclass
@@ -71,13 +71,13 @@ class FalImageGenService(ImageGenService):
"""
Settings = FalImageGenSettings
_settings: FalImageGenSettings
_settings: Settings
class InputParams(BaseModel):
"""Input parameters for Fal.ai image generation.
.. deprecated:: 0.0.105
Use ``settings=FalImageGenSettings(...)`` instead.
Use ``settings=FalImageGenService.Settings(...)`` instead.
Parameters:
seed: Random seed for reproducible generation. If None, uses random seed.
@@ -97,7 +97,7 @@ class FalImageGenService(ImageGenService):
enable_safety_checker: bool = True
format: str = "png"
_settings: FalImageGenSettings
_settings: Settings
def __init__(
self,
@@ -106,7 +106,7 @@ class FalImageGenService(ImageGenService):
aiohttp_session: aiohttp.ClientSession,
model: Optional[str] = None,
key: Optional[str] = None,
settings: Optional[FalImageGenSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the FalImageGenService.
@@ -115,13 +115,13 @@ class FalImageGenService(ImageGenService):
params: Input parameters for image generation configuration.
.. deprecated:: 0.0.105
Use ``settings=FalImageGenSettings(...)`` instead.
Use ``settings=FalImageGenService.Settings(...)`` 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".
.. deprecated:: 0.0.105
Use ``settings=FalImageGenSettings(model=...)`` instead.
Use ``settings=FalImageGenService.Settings(model=...)`` instead.
key: Optional API key for Fal.ai. If provided, sets FAL_KEY environment variable.
settings: Runtime-updatable settings. When provided alongside deprecated
@@ -129,7 +129,7 @@ class FalImageGenService(ImageGenService):
**kwargs: Additional arguments passed to parent ImageGenService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = FalImageGenSettings(
default_settings = self.Settings(
model="fal-ai/fast-sdxl",
seed=None,
num_inference_steps=8,
@@ -142,11 +142,11 @@ class FalImageGenService(ImageGenService):
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", FalImageGenSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
if params is not None:
_warn_deprecated_param("params", FalImageGenSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.seed = params.seed
default_settings.num_inference_steps = params.num_inference_steps

View File

@@ -20,7 +20,7 @@ from loguru import logger
from pydantic import BaseModel
from pipecat.frames.frames import ErrorFrame, Frame, TranscriptionFrame
from pipecat.services.settings import STTSettings, _warn_deprecated_param
from pipecat.services.settings import STTSettings
from pipecat.services.stt_latency import FAL_TTFS_P99
from pipecat.services.stt_service import SegmentedSTTService
from pipecat.transcriptions.language import Language, resolve_language
@@ -156,13 +156,13 @@ class FalSTTService(SegmentedSTTService):
"""
Settings = FalSTTSettings
_settings: FalSTTSettings
_settings: Settings
class InputParams(BaseModel):
"""Configuration parameters for Fal's Wizper API.
.. deprecated:: 0.0.105
Use ``settings=FalSTTSettings(...)`` instead.
Use ``settings=FalSTTService.Settings(...)`` instead.
Parameters:
language: Language of the audio input. Defaults to English.
@@ -186,7 +186,7 @@ class FalSTTService(SegmentedSTTService):
version: str = "3",
sample_rate: Optional[int] = None,
params: Optional[InputParams] = None,
settings: Optional[FalSTTSettings] = None,
settings: Optional[Settings] = None,
ttfs_p99_latency: Optional[float] = FAL_TTFS_P99,
**kwargs,
):
@@ -204,7 +204,7 @@ class FalSTTService(SegmentedSTTService):
params: Configuration parameters for the Wizper API.
.. deprecated:: 0.0.105
Use ``settings=FalSTTSettings(...)`` for model/language and
Use ``settings=FalSTTService.Settings(...)`` for model/language and
direct init parameters for task/chunk_level/version instead.
settings: Runtime-updatable settings. When provided alongside deprecated
@@ -214,7 +214,7 @@ class FalSTTService(SegmentedSTTService):
**kwargs: Additional arguments passed to SegmentedSTTService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = FalSTTSettings(
default_settings = self.Settings(
model=None,
language=language_to_fal_language(Language.EN),
)
@@ -223,7 +223,7 @@ class FalSTTService(SegmentedSTTService):
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", FalSTTSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
if params.language is not None:
default_settings.language = language_to_fal_language(params.language)

View File

@@ -12,13 +12,12 @@ from typing import Optional
from loguru import logger
from pipecat.adapters.services.open_ai_adapter import OpenAILLMInvocationParams
from pipecat.services.openai.base_llm import OpenAILLMSettings
from pipecat.services.openai.base_llm import BaseOpenAILLMService
from pipecat.services.openai.llm import OpenAILLMService
from pipecat.services.settings import _warn_deprecated_param
@dataclass
class FireworksLLMSettings(OpenAILLMSettings):
class FireworksLLMSettings(BaseOpenAILLMService.Settings):
"""Settings for FireworksLLMService."""
pass
@@ -32,7 +31,7 @@ class FireworksLLMService(OpenAILLMService):
"""
Settings = FireworksLLMSettings
_settings: FireworksLLMSettings
_settings: Settings
def __init__(
self,
@@ -40,7 +39,7 @@ class FireworksLLMService(OpenAILLMService):
api_key: str,
model: Optional[str] = None,
base_url: str = "https://api.fireworks.ai/inference/v1",
settings: Optional[FireworksLLMSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Fireworks LLM service.
@@ -50,7 +49,7 @@ class FireworksLLMService(OpenAILLMService):
model: The model identifier to use. Defaults to "accounts/fireworks/models/firefunction-v2".
.. deprecated:: 0.0.105
Use ``settings=OpenAILLMSettings(model=...)`` instead.
Use ``settings=FireworksLLMService.Settings(model=...)`` instead.
base_url: The base URL for Fireworks API. Defaults to "https://api.fireworks.ai/inference/v1".
settings: Runtime-updatable settings. When provided alongside deprecated
@@ -58,11 +57,11 @@ class FireworksLLMService(OpenAILLMService):
**kwargs: Additional keyword arguments passed to OpenAILLMService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = FireworksLLMSettings(model="accounts/fireworks/models/firefunction-v2")
default_settings = self.Settings(model="accounts/fireworks/models/firefunction-v2")
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", FireworksLLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. (No step 3, as there's no params object to apply)

View File

@@ -27,7 +27,7 @@ from pipecat.frames.frames import (
TTSStoppedFrame,
)
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven
from pipecat.services.tts_service import InterruptibleTTSService
from pipecat.transcriptions.language import Language
from pipecat.utils.tracing.service_decorators import traced_tts
@@ -85,13 +85,13 @@ class FishAudioTTSService(InterruptibleTTSService):
"""
Settings = FishAudioTTSSettings
_settings: FishAudioTTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Input parameters for Fish Audio TTS configuration.
.. deprecated:: 0.0.105
Use ``settings=FishAudioTTSSettings(...)`` instead.
Use ``settings=FishAudioTTSService.Settings(...)`` instead.
Parameters:
language: Language for synthesis. Defaults to English.
@@ -117,7 +117,7 @@ class FishAudioTTSService(InterruptibleTTSService):
output_format: FishAudioOutputFormat = "pcm",
sample_rate: Optional[int] = None,
params: Optional[InputParams] = None,
settings: Optional[FishAudioTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Fish Audio TTS service.
@@ -127,7 +127,7 @@ class FishAudioTTSService(InterruptibleTTSService):
reference_id: Reference ID of the voice model to use for synthesis.
.. deprecated:: 0.0.105
Use ``settings=FishAudioTTSSettings(voice=...)`` instead.
Use ``settings=FishAudioTTSService.Settings(voice=...)`` instead.
model: Deprecated. Reference ID of the voice model to use for synthesis.
@@ -138,14 +138,14 @@ class FishAudioTTSService(InterruptibleTTSService):
model_id: Specify which Fish Audio TTS model to use (e.g. "s1").
.. deprecated:: 0.0.105
Use ``settings=FishAudioTTSSettings(model=...)`` instead.
Use ``settings=FishAudioTTSService.Settings(model=...)`` instead.
output_format: Audio output format. Defaults to "pcm".
sample_rate: Audio sample rate. If None, uses default.
params: Additional input parameters for voice customization.
.. deprecated:: 0.0.105
Use ``settings=FishAudioTTSSettings(...)`` instead.
Use ``settings=FishAudioTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
@@ -171,7 +171,7 @@ class FishAudioTTSService(InterruptibleTTSService):
reference_id = model
# 1. Initialize default_settings with hardcoded defaults
default_settings = FishAudioTTSSettings(
default_settings = self.Settings(
model="s2-pro",
voice=None,
language=None,
@@ -185,15 +185,15 @@ class FishAudioTTSService(InterruptibleTTSService):
# 2. Apply direct init arg overrides (deprecated)
if reference_id is not None:
_warn_deprecated_param("reference_id", FishAudioTTSSettings, "voice")
self._warn_init_param_moved_to_settings("reference_id", "voice")
default_settings.voice = reference_id
if model_id is not None:
_warn_deprecated_param("model_id", FishAudioTTSSettings, "model")
self._warn_init_param_moved_to_settings("model_id", "model")
default_settings.model = model_id
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", FishAudioTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
if params.latency is not None:
default_settings.latency = params.latency
@@ -240,7 +240,7 @@ class FishAudioTTSService(InterruptibleTTSService):
Any change to voice or model triggers a WebSocket reconnect.
Args:
delta: A :class:`TTSSettings` (or ``FishAudioTTSSettings``) delta.
delta: A :class:`TTSSettings` (or ``FishAudioTTSService.Settings``) delta.
Returns:
Dict mapping changed field names to their previous values.

View File

@@ -153,7 +153,7 @@ class GladiaInputParams(BaseModel):
"""Configuration parameters for the Gladia STT service.
.. deprecated:: 0.0.105
Use ``settings=GladiaSTTSettings(...)`` for runtime-updatable
Use ``settings=GladiaSTTService.Settings(...)`` for runtime-updatable
fields and direct init parameters for encoding/bit_depth/channels.
Parameters:

View File

@@ -39,7 +39,7 @@ from pipecat.services.gladia.config import (
PreProcessingConfig,
RealtimeProcessingConfig,
)
from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven
from pipecat.services.stt_latency import GLADIA_TTFS_P99
from pipecat.services.stt_service import WebsocketSTTService
from pipecat.transcriptions.language import Language, resolve_language
@@ -231,7 +231,7 @@ class GladiaSTTService(WebsocketSTTService):
"""
Settings = GladiaSTTSettings
_settings: GladiaSTTSettings
_settings: Settings
# Maintain backward compatibility
InputParams = _InputParamsDescriptor()
@@ -251,7 +251,7 @@ class GladiaSTTService(WebsocketSTTService):
params: Optional[GladiaInputParams] = None,
max_buffer_size: int = 1024 * 1024 * 20, # 20MB default buffer
should_interrupt: bool = True,
settings: Optional[GladiaSTTSettings] = None,
settings: Optional[Settings] = None,
ttfs_p99_latency: Optional[float] = GLADIA_TTFS_P99,
**kwargs,
):
@@ -274,12 +274,12 @@ class GladiaSTTService(WebsocketSTTService):
model: Model to use for transcription.
.. deprecated:: 0.0.105
Use ``settings=GladiaSTTSettings(model=...)`` instead.
Use ``settings=GladiaSTTService.Settings(model=...)`` instead.
params: Additional configuration parameters for Gladia service.
.. deprecated:: 0.0.105
Use ``settings=GladiaSTTSettings(...)`` for runtime-updatable
Use ``settings=GladiaSTTService.Settings(...)`` for runtime-updatable
fields and direct init parameters for encoding/bit_depth/channels.
max_buffer_size: Maximum size of audio buffer in bytes. Defaults to 20MB.
@@ -302,7 +302,7 @@ class GladiaSTTService(WebsocketSTTService):
)
# 1. Initialize default_settings with hardcoded defaults
default_settings = GladiaSTTSettings(
default_settings = self.Settings(
model="solaria-1",
language=None,
language_config=None,
@@ -317,12 +317,12 @@ class GladiaSTTService(WebsocketSTTService):
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", GladiaSTTSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", GladiaSTTSettings)
self._warn_init_param_moved_to_settings("params")
if params.language is not None:
with warnings.catch_warnings():
warnings.simplefilter("always")
@@ -469,7 +469,7 @@ class GladiaSTTService(WebsocketSTTService):
await super().start(frame)
await self._connect()
async def _update_settings(self, delta: GladiaSTTSettings) -> dict[str, Any]:
async def _update_settings(self, delta: Settings) -> dict[str, Any]:
"""Apply settings delta.
Settings are stored but not applied to the active session.

View File

@@ -76,7 +76,7 @@ from pipecat.services.openai.llm import (
OpenAIAssistantContextAggregator,
OpenAIUserContextAggregator,
)
from pipecat.services.settings import NOT_GIVEN, LLMSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, LLMSettings, _NotGiven
from pipecat.transcriptions.language import Language, resolve_language
from pipecat.utils.string import match_endofsentence
from pipecat.utils.time import time_now_iso8601
@@ -553,7 +553,7 @@ class InputParams(BaseModel):
"""Input parameters for Gemini Live generation.
.. deprecated:: 0.0.105
Use ``GeminiLiveLLMSettings`` instead.
Use ``GeminiLiveLLMService.Settings`` instead.
Parameters:
frequency_penalty: Frequency penalty for generation (0.0-2.0). Defaults to None.
@@ -643,7 +643,7 @@ class GeminiLiveLLMService(LLMService):
"""
Settings = GeminiLiveLLMSettings
_settings: GeminiLiveLLMSettings
_settings: Settings
# Overriding the default adapter to use the Gemini one.
adapter_class = GeminiLLMAdapter
@@ -660,7 +660,7 @@ class GeminiLiveLLMService(LLMService):
system_instruction: Optional[str] = None,
tools: Optional[Union[List[dict], ToolsSchema]] = None,
params: Optional[InputParams] = None,
settings: Optional[GeminiLiveLLMSettings] = None,
settings: Optional[Settings] = None,
inference_on_context_initialization: bool = True,
file_api_base_url: str = "https://generativelanguage.googleapis.com/v1beta/files",
http_options: Optional[HttpOptions] = None,
@@ -680,12 +680,12 @@ class GeminiLiveLLMService(LLMService):
model: Model identifier to use.
.. deprecated:: 0.0.105
Use ``settings=GeminiLiveLLMSettings(model=...)`` instead.
Use ``settings=GeminiLiveLLMService.Settings(model=...)`` instead.
voice_id: TTS voice identifier. Defaults to "Charon".
.. deprecated:: 0.0.105
Use ``settings=GeminiLiveLLMSettings(voice=...)`` instead.
Use ``settings=GeminiLiveLLMService.Settings(voice=...)`` instead.
start_audio_paused: Whether to start with audio input paused. Defaults to False.
start_video_paused: Whether to start with video input paused. Defaults to False.
system_instruction: System prompt for the model. Defaults to None.
@@ -693,7 +693,7 @@ class GeminiLiveLLMService(LLMService):
params: Configuration parameters for the model.
.. deprecated:: 0.0.105
Use ``settings=GeminiLiveLLMSettings(...)`` instead.
Use ``settings=GeminiLiveLLMService.Settings(...)`` instead.
settings: Gemini Live LLM settings. If provided together with deprecated
top-level parameters, the ``settings`` values take precedence.
@@ -716,7 +716,7 @@ class GeminiLiveLLMService(LLMService):
)
# 1. Initialize default_settings with hardcoded defaults
default_settings = GeminiLiveLLMSettings(
default_settings = self.Settings(
model="models/gemini-2.5-flash-native-audio-preview-12-2025",
system_instruction=system_instruction,
voice="Charon",
@@ -742,15 +742,15 @@ class GeminiLiveLLMService(LLMService):
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", GeminiLiveLLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
if voice_id != "Charon":
_warn_deprecated_param("voice_id", GeminiLiveLLMSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", GeminiLiveLLMSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.frequency_penalty = params.frequency_penalty
default_settings.max_tokens = params.max_tokens

View File

@@ -20,14 +20,12 @@ from loguru import logger
from pipecat.adapters.schemas.tools_schema import ToolsSchema
from pipecat.services.google.gemini_live.llm import (
GeminiLiveLLMService,
GeminiLiveLLMSettings,
GeminiMediaResolution,
GeminiModalities,
HttpOptions,
InputParams,
language_to_gemini_language,
)
from pipecat.services.settings import _warn_deprecated_param
try:
from google.auth import default
@@ -43,7 +41,7 @@ except ModuleNotFoundError as e:
@dataclass
class GeminiLiveVertexLLMSettings(GeminiLiveLLMSettings):
class GeminiLiveVertexLLMSettings(GeminiLiveLLMService.Settings):
"""Settings for GeminiLiveVertexLLMService."""
pass
@@ -58,7 +56,7 @@ class GeminiLiveVertexLLMService(GeminiLiveLLMService):
"""
Settings = GeminiLiveVertexLLMSettings
_settings: GeminiLiveVertexLLMSettings
_settings: Settings
def __init__(
self,
@@ -74,7 +72,7 @@ class GeminiLiveVertexLLMService(GeminiLiveLLMService):
system_instruction: Optional[str] = None,
tools: Optional[Union[List[dict], ToolsSchema]] = None,
params: Optional[InputParams] = None,
settings: Optional[GeminiLiveVertexLLMSettings] = None,
settings: Optional[Settings] = None,
inference_on_context_initialization: bool = True,
file_api_base_url: str = "https://generativelanguage.googleapis.com/v1beta/files",
http_options: Optional[HttpOptions] = None,
@@ -90,12 +88,12 @@ class GeminiLiveVertexLLMService(GeminiLiveLLMService):
model: Model identifier to use.
.. deprecated:: 0.0.105
Use ``settings=GeminiLiveLLMSettings(model=...)`` instead.
Use ``settings=GeminiLiveVertexLLMService.Settings(model=...)`` instead.
voice_id: TTS voice identifier. Defaults to "Charon".
.. deprecated:: 0.0.105
Use ``settings=GeminiLiveVertexLLMSettings(voice=...)`` instead.
Use ``settings=GeminiLiveVertexLLMService.Settings(voice=...)`` instead.
start_audio_paused: Whether to start with audio input paused. Defaults to False.
start_video_paused: Whether to start with video input paused. Defaults to False.
system_instruction: System prompt for the model. Defaults to None.
@@ -104,7 +102,7 @@ class GeminiLiveVertexLLMService(GeminiLiveLLMService):
location and project ID.
.. deprecated:: 0.0.105
Use ``settings=GeminiLiveLLMSettings(...)`` instead.
Use ``settings=GeminiLiveVertexLLMService.Settings(...)`` instead.
settings: Gemini Live LLM settings. If provided together with deprecated
top-level parameters, the ``settings`` values take precedence.
@@ -136,7 +134,7 @@ class GeminiLiveVertexLLMService(GeminiLiveLLMService):
# double deprecation warnings from the parent.
# 1. Initialize default_settings with hardcoded defaults
default_settings = GeminiLiveVertexLLMSettings(
default_settings = self.Settings(
model="google/gemini-live-2.5-flash-native-audio",
voice="Charon",
frequency_penalty=None,
@@ -161,15 +159,15 @@ class GeminiLiveVertexLLMService(GeminiLiveLLMService):
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", GeminiLiveVertexLLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
if voice_id != "Charon":
_warn_deprecated_param("voice_id", GeminiLiveVertexLLMSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", GeminiLiveVertexLLMSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.frequency_penalty = params.frequency_penalty
default_settings.max_tokens = params.max_tokens

View File

@@ -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 NOT_GIVEN, ImageGenSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, ImageGenSettings, _NotGiven
try:
from google import genai
@@ -60,13 +60,13 @@ class GoogleImageGenService(ImageGenService):
"""
Settings = GoogleImageGenSettings
_settings: GoogleImageGenSettings
_settings: Settings
class InputParams(BaseModel):
"""Configuration parameters for Google image generation.
.. deprecated:: 0.0.105
Use ``settings=GoogleImageGenSettings(...)`` instead.
Use ``settings=GoogleImageGenService.Settings(...)`` instead.
Parameters:
number_of_images: Number of images to generate (1-8). Defaults to 1.
@@ -84,7 +84,7 @@ class GoogleImageGenService(ImageGenService):
api_key: str,
params: Optional[InputParams] = None,
http_options: Optional[Any] = None,
settings: Optional[GoogleImageGenSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the GoogleImageGenService with API key and parameters.
@@ -94,7 +94,7 @@ class GoogleImageGenService(ImageGenService):
params: Configuration parameters for image generation.
.. deprecated:: 0.0.105
Use ``settings=GoogleImageGenSettings(...)`` instead.
Use ``settings=GoogleImageGenService.Settings(...)`` instead.
http_options: HTTP options for the client.
settings: Runtime-updatable settings. When provided alongside deprecated
@@ -102,7 +102,7 @@ class GoogleImageGenService(ImageGenService):
**kwargs: Additional arguments passed to the parent ImageGenService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = GoogleImageGenSettings(
default_settings = self.Settings(
model="imagen-3.0-generate-002",
number_of_images=1,
negative_prompt=None,
@@ -110,7 +110,7 @@ class GoogleImageGenService(ImageGenService):
# 2. Apply params overrides (deprecated)
if params is not None:
_warn_deprecated_param("params", GoogleImageGenSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.model = params.model
default_settings.number_of_images = params.number_of_images

View File

@@ -16,7 +16,7 @@ import json
import os
import uuid
from dataclasses import dataclass, field
from typing import Any, AsyncIterator, Dict, List, Literal, Optional
from typing import Any, AsyncIterator, Dict, List, Literal, Optional, Union
from loguru import logger
from PIL import Image
@@ -61,7 +61,6 @@ from pipecat.services.settings import (
NOT_GIVEN,
LLMSettings,
_NotGiven,
_warn_deprecated_param,
is_given,
)
from pipecat.utils.tracing.service_decorators import traced_llm
@@ -719,18 +718,20 @@ class GoogleLLMSettings(LLMSettings):
thinking: Thinking configuration.
"""
thinking: GoogleThinkingConfig | _NotGiven = field(default_factory=lambda: NOT_GIVEN)
thinking: Union["GoogleLLMService.ThinkingConfig", _NotGiven] = field(
default_factory=lambda: NOT_GIVEN
)
@classmethod
def from_mapping(cls, settings):
"""Convert a plain dict to settings, coercing thinking dicts.
For backward compatibility, a ``thinking`` value that is a plain dict
is converted to a :class:`GoogleThinkingConfig`.
is converted to a :class:`GoogleLLMService.ThinkingConfig`.
"""
instance = super().from_mapping(settings)
if is_given(instance.thinking) and isinstance(instance.thinking, dict):
instance.thinking = GoogleThinkingConfig(**instance.thinking)
instance.thinking = GoogleLLMService.ThinkingConfig(**instance.thinking)
return instance
@@ -743,7 +744,7 @@ class GoogleLLMService(LLMService):
"""
Settings = GoogleLLMSettings
_settings: GoogleLLMSettings
_settings: Settings
# Overriding the default adapter to use the Gemini one.
adapter_class = GeminiLLMAdapter
@@ -755,7 +756,7 @@ class GoogleLLMService(LLMService):
"""Input parameters for Google AI models.
.. deprecated:: 0.0.105
Use ``settings=GoogleLLMSettings(...)`` instead.
Use ``settings=GoogleLLMService.Settings(...)`` instead.
Parameters:
max_tokens: Maximum number of tokens to generate.
@@ -775,7 +776,7 @@ class GoogleLLMService(LLMService):
temperature: Optional[float] = Field(default=None, ge=0.0, le=2.0)
top_k: Optional[int] = Field(default=None, ge=0)
top_p: Optional[float] = Field(default=None, ge=0.0, le=1.0)
thinking: Optional[GoogleThinkingConfig] = Field(default=None)
thinking: Optional["GoogleLLMService.ThinkingConfig"] = Field(default=None)
extra: Optional[Dict[str, Any]] = Field(default_factory=dict)
def __init__(
@@ -784,7 +785,7 @@ class GoogleLLMService(LLMService):
api_key: str,
model: Optional[str] = None,
params: Optional[InputParams] = None,
settings: Optional[GoogleLLMSettings] = None,
settings: Optional[Settings] = None,
system_instruction: Optional[str] = None,
tools: Optional[List[Dict[str, Any]]] = None,
tool_config: Optional[Dict[str, Any]] = None,
@@ -798,12 +799,12 @@ class GoogleLLMService(LLMService):
model: Model name to use.
.. deprecated:: 0.0.105
Use ``settings=GoogleLLMSettings(model=...)`` instead.
Use ``settings=GoogleLLMService.Settings(model=...)`` instead.
params: Optional model parameters for inference.
.. deprecated:: 0.0.105
Use ``settings=GoogleLLMSettings(...)`` instead.
Use ``settings=GoogleLLMService.Settings(...)`` instead.
settings: Runtime-updatable settings for this service. When both
deprecated parameters and *settings* are provided, *settings*
@@ -811,14 +812,14 @@ class GoogleLLMService(LLMService):
system_instruction: System instruction/prompt for the model.
.. deprecated:: 0.0.105
Use ``settings=GoogleLLMSettings(system_instruction=...)`` instead.
Use ``settings=GoogleLLMService.Settings(system_instruction=...)`` instead.
tools: List of available tools/functions.
tool_config: Configuration for tool usage.
http_options: HTTP options for the client.
**kwargs: Additional arguments passed to parent class.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = GoogleLLMSettings(
default_settings = self.Settings(
model="gemini-2.5-flash",
system_instruction=None,
max_tokens=4096,
@@ -836,15 +837,15 @@ class GoogleLLMService(LLMService):
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", GoogleLLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
if system_instruction is not None:
_warn_deprecated_param("system_instruction", GoogleLLMSettings, "system_instruction")
self._warn_init_param_moved_to_settings("system_instruction", "system_instruction")
default_settings.system_instruction = system_instruction
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", GoogleLLMSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.max_tokens = params.max_tokens
default_settings.temperature = params.temperature

View File

@@ -28,13 +28,12 @@ from loguru import logger
from pipecat.frames.frames import LLMTextFrame
from pipecat.metrics.metrics import LLMTokenUsage
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
from pipecat.services.openai.base_llm import OpenAILLMSettings
from pipecat.services.openai.base_llm import BaseOpenAILLMService
from pipecat.services.openai.llm import OpenAILLMService
from pipecat.services.settings import _warn_deprecated_param
@dataclass
class GoogleOpenAILLMSettings(OpenAILLMSettings):
class GoogleOpenAILLMSettings(BaseOpenAILLMService.Settings):
"""Settings for GoogleLLMOpenAIBetaService."""
pass
@@ -59,7 +58,7 @@ class GoogleLLMOpenAIBetaService(OpenAILLMService):
"""
Settings = GoogleOpenAILLMSettings
_settings: GoogleOpenAILLMSettings
_settings: Settings
def __init__(
self,
@@ -67,7 +66,7 @@ class GoogleLLMOpenAIBetaService(OpenAILLMService):
api_key: str,
base_url: str = "https://generativelanguage.googleapis.com/v1beta/openai/",
model: Optional[str] = None,
settings: Optional[GoogleOpenAILLMSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Google LLM service.
@@ -78,7 +77,7 @@ class GoogleLLMOpenAIBetaService(OpenAILLMService):
model: Google model name to use (e.g., "gemini-2.0-flash").
.. deprecated:: 0.0.105
Use ``settings=OpenAILLMSettings(model=...)`` instead.
Use ``settings=GoogleLLMOpenAIBetaService.Settings(model=...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
@@ -96,11 +95,11 @@ class GoogleLLMOpenAIBetaService(OpenAILLMService):
)
# 1. Initialize default_settings with hardcoded defaults
default_settings = GoogleOpenAILLMSettings(model="gemini-2.0-flash")
default_settings = self.Settings(model="gemini-2.0-flash")
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", GoogleOpenAILLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. (No step 3, as there's no params object to apply)

View File

@@ -36,7 +36,7 @@ from pipecat.frames.frames import (
StartFrame,
TranscriptionFrame,
)
from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven
from pipecat.services.stt_latency import GOOGLE_TTFS_P99
from pipecat.services.stt_service import STTService
from pipecat.transcriptions.language import Language, resolve_language
@@ -415,7 +415,7 @@ class GoogleSTTService(STTService):
"""
Settings = GoogleSTTSettings
_settings: GoogleSTTSettings
_settings: Settings
# Google Cloud's STT service has a connection time limit of 5 minutes per stream.
# They've shared an "endless streaming" example that guided this implementation:
@@ -427,7 +427,7 @@ class GoogleSTTService(STTService):
"""Configuration parameters for Google Speech-to-Text.
.. deprecated:: 0.0.105
Use ``settings=GoogleSTTSettings(...)`` instead.
Use ``settings=GoogleSTTService.Settings(...)`` instead.
Parameters:
languages: Single language or list of recognition languages. First language is primary.
@@ -488,7 +488,7 @@ class GoogleSTTService(STTService):
location: str = "global",
sample_rate: Optional[int] = None,
params: Optional[InputParams] = None,
settings: Optional[GoogleSTTSettings] = None,
settings: Optional[Settings] = None,
ttfs_p99_latency: Optional[float] = GOOGLE_TTFS_P99,
**kwargs,
):
@@ -502,7 +502,7 @@ class GoogleSTTService(STTService):
params: Configuration parameters for the service.
.. deprecated:: 0.0.105
Use ``settings=GoogleSTTSettings(...)`` instead.
Use ``settings=GoogleSTTService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
``params``, ``settings`` values take precedence.
@@ -511,7 +511,7 @@ class GoogleSTTService(STTService):
**kwargs: Additional arguments passed to STTService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = GoogleSTTSettings(
default_settings = self.Settings(
language=None,
languages=[Language.EN_US],
language_codes=None,
@@ -531,7 +531,7 @@ class GoogleSTTService(STTService):
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", GoogleSTTSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.languages = list(params.language_list)
default_settings.model = params.model
@@ -655,7 +655,7 @@ class GoogleSTTService(STTService):
"""Update the service's recognition languages.
.. deprecated:: 0.0.104
Use ``STTUpdateSettingsFrame`` with ``GoogleSTTSettings(languages=...)``
Use ``STTUpdateSettingsFrame`` with ``GoogleSTTService.Settings(languages=...)``
instead.
Args:
@@ -665,13 +665,13 @@ class GoogleSTTService(STTService):
warnings.simplefilter("always")
warnings.warn(
"set_languages() is deprecated. Use STTUpdateSettingsFrame with "
"GoogleSTTSettings(languages=...) instead.",
"self.Settings(languages=...) instead.",
DeprecationWarning,
)
logger.debug(f"Switching STT languages to: {languages}")
await self._update_settings(GoogleSTTSettings(languages=list(languages)))
await self._update_settings(self.Settings(languages=list(languages)))
async def _update_settings(self, delta: GoogleSTTSettings) -> dict[str, Any]:
async def _update_settings(self, delta: Settings) -> dict[str, Any]:
"""Apply settings delta and reconnect if anything changed.
Handles ``language`` from base ``set_language`` by converting it to
@@ -698,8 +698,8 @@ class GoogleSTTService(STTService):
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn(
"GoogleSTTSettings.language_codes is deprecated. "
"Use GoogleSTTSettings.languages (List[Language]) instead.",
"self.Settings.language_codes is deprecated. "
"Use self.Settings.languages (List[Language]) instead.",
DeprecationWarning,
stacklevel=2,
)
@@ -756,7 +756,7 @@ class GoogleSTTService(STTService):
"""Update service options dynamically.
.. deprecated::
Use ``STTUpdateSettingsFrame`` with ``GoogleSTTSettings(...)``
Use ``STTUpdateSettingsFrame`` with ``GoogleSTTService.Settings(...)``
instead.
Args:
@@ -780,11 +780,11 @@ class GoogleSTTService(STTService):
warnings.simplefilter("always")
warnings.warn(
"update_options() is deprecated. Use STTUpdateSettingsFrame with "
"GoogleSTTSettings(...) instead.",
"self.Settings(...) instead.",
DeprecationWarning,
)
# Build a settings delta from the provided options
delta = GoogleSTTSettings()
delta = self.Settings()
if languages is not None:
delta.languages = list(languages)

View File

@@ -39,7 +39,6 @@ from pipecat.services.settings import (
NOT_GIVEN,
TTSSettings,
_NotGiven,
_warn_deprecated_param,
is_given,
)
from pipecat.services.tts_service import TTSService
@@ -523,7 +522,7 @@ class GoogleTTSSettings(TTSSettings):
#: .. deprecated:: 0.0.105
#: Use ``GoogleTTSSettings`` instead.
#: Use ``GoogleTTSService.Settings`` instead.
GoogleStreamTTSSettings = GoogleTTSSettings
@@ -559,13 +558,13 @@ class GoogleHttpTTSService(TTSService):
"""
Settings = GoogleHttpTTSSettings
_settings: GoogleHttpTTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Input parameters for Google HTTP TTS voice customization.
.. deprecated:: 0.0.105
Use ``GoogleHttpTTSSettings`` directly via the ``settings`` parameter instead.
Use ``GoogleHttpTTSService.Settings`` directly via the ``settings`` parameter instead.
Parameters:
pitch: Voice pitch adjustment (e.g., "+2st", "-50%").
@@ -596,7 +595,7 @@ class GoogleHttpTTSService(TTSService):
voice_id: Optional[str] = None,
sample_rate: Optional[int] = None,
params: Optional[InputParams] = None,
settings: Optional[GoogleHttpTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initializes the Google HTTP TTS service.
@@ -608,20 +607,20 @@ class GoogleHttpTTSService(TTSService):
voice_id: Google TTS voice identifier (e.g., "en-US-Standard-A").
.. deprecated:: 0.0.105
Use ``settings=GoogleHttpTTSSettings(voice=...)`` instead.
Use ``settings=GoogleHttpTTSService.Settings(voice=...)`` instead.
sample_rate: Audio sample rate in Hz. If None, uses default.
params: Voice customization parameters including pitch, rate, volume, etc.
.. deprecated:: 0.0.105
Use ``settings=GoogleHttpTTSSettings(...)`` instead.
Use ``settings=GoogleHttpTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional arguments passed to parent TTSService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = GoogleHttpTTSSettings(
default_settings = self.Settings(
model=None,
voice="en-US-Chirp3-HD-Charon",
language="en-US",
@@ -636,12 +635,12 @@ class GoogleHttpTTSService(TTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice_id is not None:
_warn_deprecated_param("voice_id", GoogleHttpTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", GoogleHttpTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
if params.pitch is not None:
default_settings.pitch = params.pitch
@@ -747,7 +746,7 @@ class GoogleHttpTTSService(TTSService):
Args:
delta: Settings delta. Can include 'speaking_rate' (float).
"""
if isinstance(delta, GoogleHttpTTSSettings) and is_given(delta.speaking_rate):
if isinstance(delta, self.Settings) and is_given(delta.speaking_rate):
rate_value = float(delta.speaking_rate)
if not (0.25 <= rate_value <= 2.0):
logger.warning(
@@ -1022,13 +1021,13 @@ class GoogleTTSService(GoogleBaseTTSService):
"""
Settings = GoogleTTSSettings
_settings: GoogleTTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Input parameters for Google streaming TTS configuration.
.. deprecated:: 0.0.105
Use ``GoogleTTSSettings`` directly via the ``settings`` parameter instead.
Use ``GoogleTTSService.Settings`` directly via the ``settings`` parameter instead.
Parameters:
language: Language for synthesis. Defaults to English.
@@ -1048,7 +1047,7 @@ class GoogleTTSService(GoogleBaseTTSService):
voice_cloning_key: Optional[str] = None,
sample_rate: Optional[int] = None,
params: Optional[InputParams] = None,
settings: Optional[GoogleTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initializes the Google streaming TTS service.
@@ -1060,21 +1059,21 @@ class GoogleTTSService(GoogleBaseTTSService):
voice_id: Google TTS voice identifier (e.g., "en-US-Chirp3-HD-Charon").
.. deprecated:: 0.0.105
Use ``settings=GoogleTTSSettings(voice=...)`` instead.
Use ``settings=GoogleTTSService.Settings(voice=...)`` instead.
voice_cloning_key: The voice cloning key for Chirp 3 custom voices.
sample_rate: Audio sample rate in Hz. If None, uses default.
params: Language configuration parameters.
.. deprecated:: 0.0.105
Use ``settings=GoogleTTSSettings(...)`` instead.
Use ``settings=GoogleTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional arguments passed to parent TTSService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = GoogleTTSSettings(
default_settings = self.Settings(
model=None,
voice="en-US-Chirp3-HD-Charon",
language="en-US",
@@ -1083,12 +1082,12 @@ class GoogleTTSService(GoogleBaseTTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice_id is not None:
_warn_deprecated_param("voice_id", GoogleTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", GoogleTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
if params.language is not None:
default_settings.language = self.language_to_service_language(params.language)
@@ -1119,7 +1118,7 @@ class GoogleTTSService(GoogleBaseTTSService):
Args:
delta: Settings delta. Can include 'speaking_rate' (float).
"""
if isinstance(delta, GoogleTTSSettings) and is_given(delta.speaking_rate):
if isinstance(delta, self.Settings) and is_given(delta.speaking_rate):
rate_value = float(delta.speaking_rate)
if not (0.25 <= rate_value <= 2.0):
logger.warning(
@@ -1201,7 +1200,7 @@ class GeminiTTSService(GoogleBaseTTSService):
"""
Settings = GeminiTTSSettings
_settings: GeminiTTSSettings
_settings: Settings
GOOGLE_SAMPLE_RATE = 24000 # Google TTS always outputs at 24kHz
@@ -1243,7 +1242,7 @@ class GeminiTTSService(GoogleBaseTTSService):
"""Input parameters for Gemini TTS configuration.
.. deprecated:: 0.0.105
Use ``GeminiTTSSettings`` directly via the ``settings`` parameter instead.
Use ``GeminiTTSService.Settings`` directly via the ``settings`` parameter instead.
Parameters:
language: Language for synthesis. Defaults to English.
@@ -1268,7 +1267,7 @@ class GeminiTTSService(GoogleBaseTTSService):
voice_id: Optional[str] = None,
sample_rate: Optional[int] = None,
params: Optional[InputParams] = None,
settings: Optional[GeminiTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initializes the Gemini TTS service.
@@ -1284,7 +1283,7 @@ class GeminiTTSService(GoogleBaseTTSService):
"gemini-2.5-flash-tts" or "gemini-2.5-pro-tts".
.. deprecated:: 0.0.105
Use ``settings=GeminiTTSSettings(model=...)`` instead.
Use ``settings=GeminiTTSService.Settings(model=...)`` instead.
credentials: JSON string containing Google Cloud service account credentials.
credentials_path: Path to Google Cloud service account JSON file.
@@ -1292,13 +1291,13 @@ class GeminiTTSService(GoogleBaseTTSService):
voice_id: Voice name from the available Gemini voices.
.. deprecated:: 0.0.105
Use ``settings=GeminiTTSSettings(voice=...)`` instead.
Use ``settings=GeminiTTSService.Settings(voice=...)`` instead.
sample_rate: Audio sample rate in Hz. If None, uses Google's default 24kHz.
params: TTS configuration parameters.
.. deprecated:: 0.0.105
Use ``settings=GeminiTTSSettings(...)`` instead.
Use ``settings=GeminiTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
@@ -1320,7 +1319,7 @@ class GeminiTTSService(GoogleBaseTTSService):
)
# 1. Initialize default_settings with hardcoded defaults
default_settings = GeminiTTSSettings(
default_settings = self.Settings(
model="gemini-2.5-flash-tts",
voice="Kore",
language="en-US",
@@ -1331,10 +1330,10 @@ class GeminiTTSService(GoogleBaseTTSService):
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", GeminiTTSSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
if voice_id is not None:
_warn_deprecated_param("voice_id", GeminiTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
if default_settings.voice not in self.AVAILABLE_VOICES:
@@ -1344,7 +1343,7 @@ class GeminiTTSService(GoogleBaseTTSService):
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", GeminiTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
if params.language is not None:
default_settings.language = self.language_to_service_language(params.language)

View File

@@ -21,8 +21,7 @@ from typing import Optional
from loguru import logger
from pipecat.services.google.llm import GoogleLLMService, GoogleLLMSettings
from pipecat.services.settings import _warn_deprecated_param
from pipecat.services.google.llm import GoogleLLMService
try:
from google.auth import default
@@ -41,7 +40,7 @@ except ModuleNotFoundError as e:
@dataclass
class GoogleVertexLLMSettings(GoogleLLMSettings):
class GoogleVertexLLMSettings(GoogleLLMService.Settings):
"""Settings for GoogleVertexLLMService."""
pass
@@ -60,7 +59,7 @@ class GoogleVertexLLMService(GoogleLLMService):
"""
Settings = GoogleVertexLLMSettings
_settings: GoogleVertexLLMSettings
_settings: Settings
class InputParams(GoogleLLMService.InputParams):
"""Input parameters specific to Vertex AI.
@@ -115,7 +114,7 @@ class GoogleVertexLLMService(GoogleLLMService):
location: Optional[str] = None,
project_id: Optional[str] = None,
params: Optional[GoogleLLMService.InputParams] = None,
settings: Optional[GoogleVertexLLMSettings] = None,
settings: Optional[Settings] = None,
system_instruction: Optional[str] = None,
tools: Optional[list] = None,
tool_config: Optional[dict] = None,
@@ -130,14 +129,14 @@ class GoogleVertexLLMService(GoogleLLMService):
model: Model identifier (e.g., "gemini-2.5-flash").
.. deprecated:: 0.0.105
Use ``settings=GoogleLLMSettings(model=...)`` instead.
Use ``settings=GoogleVertexLLMService.Settings(model=...)`` instead.
location: GCP region for Vertex AI endpoint (e.g., "us-east4").
project_id: Google Cloud project ID.
params: Input parameters for the model.
.. deprecated:: 0.0.105
Use ``settings=GoogleLLMSettings(...)`` instead.
Use ``settings=GoogleVertexLLMService.Settings(...)`` instead.
settings: Runtime-updatable settings for this service. When both
deprecated parameters and *settings* are provided, *settings*
@@ -145,7 +144,7 @@ class GoogleVertexLLMService(GoogleLLMService):
system_instruction: System instruction/prompt for the model.
.. deprecated:: 0.0.105
Use ``settings=GoogleVertexLLMSettings(system_instruction=...)`` instead.
Use ``settings=GoogleVertexLLMService.Settings(system_instruction=...)`` instead.
tools: List of available tools/functions.
tool_config: Configuration for tool usage.
http_options: HTTP options for the client.
@@ -197,7 +196,7 @@ class GoogleVertexLLMService(GoogleLLMService):
self._location = location
# 1. Initialize default_settings with hardcoded defaults
default_settings = GoogleVertexLLMSettings(
default_settings = self.Settings(
model="gemini-2.5-flash",
system_instruction=None,
max_tokens=4096,
@@ -215,17 +214,15 @@ class GoogleVertexLLMService(GoogleLLMService):
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", GoogleVertexLLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
if system_instruction is not None:
_warn_deprecated_param(
"system_instruction", GoogleVertexLLMSettings, "system_instruction"
)
self._warn_init_param_moved_to_settings("system_instruction", "system_instruction")
default_settings.system_instruction = system_instruction
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", GoogleVertexLLMSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.max_tokens = params.max_tokens
default_settings.temperature = params.temperature

View File

@@ -28,7 +28,7 @@ from pipecat.frames.frames import (
VADUserStoppedSpeakingFrame,
)
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven
from pipecat.services.stt_latency import GRADIUM_TTFS_P99
from pipecat.services.stt_service import WebsocketSTTService
from pipecat.transcriptions.language import Language, resolve_language
@@ -89,13 +89,13 @@ class GradiumSTTService(WebsocketSTTService):
"""
Settings = GradiumSTTSettings
_settings: GradiumSTTSettings
_settings: Settings
class InputParams(BaseModel):
"""Configuration parameters for Gradium STT API.
.. deprecated:: 0.0.105
Use ``settings=GradiumSTTSettings(...)`` instead.
Use ``settings=GradiumSTTService.Settings(...)`` instead.
Parameters:
language: Expected language of the audio (e.g., "en", "es", "fr").
@@ -117,7 +117,7 @@ class GradiumSTTService(WebsocketSTTService):
api_endpoint_base_url: str = "wss://eu.api.gradium.ai/api/speech/asr",
params: Optional[InputParams] = None,
json_config: Optional[str] = None,
settings: Optional[GradiumSTTSettings] = None,
settings: Optional[Settings] = None,
ttfs_p99_latency: Optional[float] = GRADIUM_TTFS_P99,
**kwargs,
):
@@ -129,7 +129,7 @@ class GradiumSTTService(WebsocketSTTService):
params: Configuration parameters for language and delay settings.
.. deprecated:: 0.0.105
Use ``settings=GradiumSTTSettings(...)`` instead.
Use ``settings=GradiumSTTService.Settings(...)`` instead.
json_config: Optional JSON configuration string for additional model settings.
@@ -152,7 +152,7 @@ class GradiumSTTService(WebsocketSTTService):
)
# 1. Initialize default_settings with hardcoded defaults
default_settings = GradiumSTTSettings(
default_settings = self.Settings(
model=None,
language=None,
delay_in_frames=None,
@@ -162,7 +162,7 @@ class GradiumSTTService(WebsocketSTTService):
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", GradiumSTTSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.language = params.language
if params.delay_in_frames is not None:
@@ -207,7 +207,7 @@ class GradiumSTTService(WebsocketSTTService):
"""Apply a settings delta, sync params, and reconnect.
Args:
delta: A :class:`STTSettings` (or ``GradiumSTTSettings``) delta.
delta: A :class:`STTSettings` (or ``GradiumSTTService.Settings``) delta.
Returns:
Dict mapping changed field names to their previous values.

View File

@@ -21,7 +21,7 @@ from pipecat.frames.frames import (
TTSAudioRawFrame,
TTSStoppedFrame,
)
from pipecat.services.settings import TTSSettings, _warn_deprecated_param
from pipecat.services.settings import TTSSettings
from pipecat.services.tts_service import WebsocketTTSService
from pipecat.utils.tracing.service_decorators import traced_tts
@@ -48,13 +48,13 @@ class GradiumTTSService(WebsocketTTSService):
"""Text-to-Speech service using Gradium's websocket API."""
Settings = GradiumTTSSettings
_settings: GradiumTTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Configuration parameters for Gradium TTS service.
.. deprecated:: 0.0.105
Use ``GradiumTTSSettings`` directly via the ``settings`` parameter instead.
Use ``GradiumTTSService.Settings`` directly via the ``settings`` parameter instead.
Parameters:
temp: Temperature to be used for generation, defaults to 0.6.
@@ -71,7 +71,7 @@ class GradiumTTSService(WebsocketTTSService):
model: Optional[str] = None,
json_config: Optional[str] = None,
params: Optional[InputParams] = None,
settings: Optional[GradiumTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Gradium TTS service.
@@ -81,26 +81,26 @@ class GradiumTTSService(WebsocketTTSService):
voice_id: the voice identifier.
.. deprecated:: 0.0.105
Use ``settings=GradiumTTSSettings(voice=...)`` instead.
Use ``settings=GradiumTTSService.Settings(voice=...)`` instead.
url: Gradium websocket API endpoint.
model: Model ID to use for synthesis.
.. deprecated:: 0.0.105
Use ``settings=GradiumTTSSettings(model=...)`` instead.
Use ``settings=GradiumTTSService.Settings(model=...)`` instead.
json_config: Optional JSON configuration string for additional model settings.
params: Additional configuration parameters.
.. deprecated:: 0.0.105
Use ``settings=GradiumTTSSettings(...)`` instead.
Use ``settings=GradiumTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional arguments passed to parent class.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = GradiumTTSSettings(
default_settings = self.Settings(
model="default",
voice="YTpq7expH9539ERJ",
language=None,
@@ -108,15 +108,15 @@ class GradiumTTSService(WebsocketTTSService):
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", GradiumTTSSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
if voice_id is not None:
_warn_deprecated_param("voice_id", GradiumTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", GradiumTTSSettings)
self._warn_init_param_moved_to_settings("params")
# Note: params.temp has no corresponding settings field
# 4. Apply settings delta (canonical API, always wins)
@@ -153,7 +153,7 @@ class GradiumTTSService(WebsocketTTSService):
"""Apply a settings delta and reconnect if voice changed.
Args:
delta: A :class:`TTSSettings` (or ``GradiumTTSSettings``) delta.
delta: A :class:`TTSSettings` (or ``GradiumTTSService.Settings``) delta.
Returns:
Dict mapping changed field names to their previous values.

View File

@@ -23,13 +23,12 @@ from pipecat.processors.aggregators.llm_response import (
LLMUserAggregatorParams,
)
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
from pipecat.services.openai.base_llm import OpenAILLMSettings
from pipecat.services.openai.base_llm import BaseOpenAILLMService
from pipecat.services.openai.llm import (
OpenAIAssistantContextAggregator,
OpenAILLMService,
OpenAIUserContextAggregator,
)
from pipecat.services.settings import _warn_deprecated_param
@dataclass
@@ -71,7 +70,7 @@ class GrokContextAggregatorPair:
@dataclass
class GrokLLMSettings(OpenAILLMSettings):
class GrokLLMSettings(BaseOpenAILLMService.Settings):
"""Settings for GrokLLMService."""
pass
@@ -87,7 +86,7 @@ class GrokLLMService(OpenAILLMService):
"""
Settings = GrokLLMSettings
_settings: GrokLLMSettings
_settings: Settings
def __init__(
self,
@@ -95,7 +94,7 @@ class GrokLLMService(OpenAILLMService):
api_key: str,
base_url: str = "https://api.x.ai/v1",
model: Optional[str] = None,
settings: Optional[GrokLLMSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the GrokLLMService with API key and model.
@@ -106,18 +105,18 @@ class GrokLLMService(OpenAILLMService):
model: The model identifier to use. Defaults to "grok-3-beta".
.. deprecated:: 0.0.105
Use ``settings=OpenAILLMSettings(model=...)`` instead.
Use ``settings=GrokLLMService.Settings(model=...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional keyword arguments passed to OpenAILLMService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = GrokLLMSettings(model="grok-3-beta")
default_settings = self.Settings(model="grok-3-beta")
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", GrokLLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. (No step 3, as there's no params object to apply)

View File

@@ -60,7 +60,6 @@ from pipecat.services.settings import (
NOT_GIVEN,
LLMSettings,
_NotGiven,
_warn_deprecated_param,
is_given,
)
from pipecat.utils.time import time_now_iso8601
@@ -109,7 +108,7 @@ class GrokRealtimeLLMSettings(LLMSettings):
# -- Bidirectional sync helpers ------------------------------------------
@staticmethod
def _sync_top_level_to_sp(settings: "GrokRealtimeLLMSettings"):
def _sync_top_level_to_sp(settings: "GrokRealtimeLLMService.Settings"):
"""Push top-level ``system_instruction`` into ``session_properties``."""
if not is_given(settings.session_properties):
return
@@ -119,7 +118,7 @@ class GrokRealtimeLLMSettings(LLMSettings):
# -- apply_update override -----------------------------------------------
def apply_update(self, delta: "GrokRealtimeLLMSettings") -> Dict[str, Any]:
def apply_update(self, delta: "GrokRealtimeLLMService.Settings") -> Dict[str, Any]:
"""Merge a delta, keeping ``system_instruction`` in sync with SP.
When the delta contains ``session_properties``, it **replaces** the
@@ -151,8 +150,8 @@ class GrokRealtimeLLMSettings(LLMSettings):
@classmethod
def from_mapping(
cls: Type["GrokRealtimeLLMSettings"], settings: Mapping[str, Any]
) -> "GrokRealtimeLLMSettings":
cls: Type["GrokRealtimeLLMService.Settings"], settings: Mapping[str, Any]
) -> "GrokRealtimeLLMService.Settings":
"""Build a delta from a plain dict, routing SP keys into ``session_properties``.
Keys that correspond to ``SessionProperties`` fields are collected into
@@ -203,7 +202,7 @@ class GrokRealtimeLLMService(LLMService):
"""
Settings = GrokRealtimeLLMSettings
_settings: GrokRealtimeLLMSettings
_settings: Settings
# Use the Grok-specific adapter
adapter_class = GrokRealtimeLLMAdapter
@@ -214,7 +213,7 @@ class GrokRealtimeLLMService(LLMService):
api_key: str,
base_url: str = "wss://api.x.ai/v1/realtime",
session_properties: Optional[events.SessionProperties] = None,
settings: Optional[GrokRealtimeLLMSettings] = None,
settings: Optional[Settings] = None,
start_audio_paused: bool = False,
**kwargs,
):
@@ -228,7 +227,7 @@ class GrokRealtimeLLMService(LLMService):
If None, uses default SessionProperties with voice "Ara".
.. deprecated:: 0.0.105
Use ``settings=GrokRealtimeLLMSettings(session_properties=...)``
Use ``settings=GrokRealtimeLLMService.Settings(session_properties=...)``
instead.
To set a different voice, configure it in session_properties:
@@ -241,7 +240,7 @@ class GrokRealtimeLLMService(LLMService):
**kwargs: Additional arguments passed to parent LLMService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = GrokRealtimeLLMSettings(
default_settings = self.Settings(
model=None,
system_instruction=None,
temperature=None,
@@ -260,7 +259,7 @@ class GrokRealtimeLLMService(LLMService):
if session_properties is not None:
_warn_deprecated_param(
"session_properties",
GrokRealtimeLLMSettings,
self.Settings,
"session_properties",
)
default_settings.session_properties = session_properties
@@ -269,7 +268,7 @@ class GrokRealtimeLLMService(LLMService):
default_settings.system_instruction = session_properties.instructions
# Sync top-level system_instruction back into session_properties
GrokRealtimeLLMSettings._sync_top_level_to_sp(default_settings)
self.Settings._sync_top_level_to_sp(default_settings)
# 3. Apply settings delta (canonical API, always wins)
if settings is not None:

View File

@@ -11,13 +11,12 @@ from typing import Optional
from loguru import logger
from pipecat.services.openai.base_llm import OpenAILLMSettings
from pipecat.services.openai.base_llm import BaseOpenAILLMService
from pipecat.services.openai.llm import OpenAILLMService
from pipecat.services.settings import _warn_deprecated_param
@dataclass
class GroqLLMSettings(OpenAILLMSettings):
class GroqLLMSettings(BaseOpenAILLMService.Settings):
"""Settings for GroqLLMService."""
pass
@@ -31,7 +30,7 @@ class GroqLLMService(OpenAILLMService):
"""
Settings = GroqLLMSettings
_settings: GroqLLMSettings
_settings: Settings
def __init__(
self,
@@ -39,7 +38,7 @@ class GroqLLMService(OpenAILLMService):
api_key: str,
base_url: str = "https://api.groq.com/openai/v1",
model: Optional[str] = None,
settings: Optional[GroqLLMSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize Groq LLM service.
@@ -50,18 +49,18 @@ class GroqLLMService(OpenAILLMService):
model: The model identifier to use. Defaults to "llama-3.3-70b-versatile".
.. deprecated:: 0.0.105
Use ``settings=OpenAILLMSettings(model=...)`` instead.
Use ``settings=GroqLLMService.Settings(model=...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional keyword arguments passed to OpenAILLMService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = GroqLLMSettings(model="llama-3.3-70b-versatile")
default_settings = self.Settings(model="llama-3.3-70b-versatile")
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", GroqLLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. (No step 3, as there's no params object to apply)

View File

@@ -9,18 +9,16 @@
from dataclasses import dataclass
from typing import Optional
from pipecat.services.settings import _warn_deprecated_param
from pipecat.services.stt_latency import GROQ_TTFS_P99
from pipecat.services.whisper.base_stt import (
BaseWhisperSTTService,
BaseWhisperSTTSettings,
Transcription,
)
from pipecat.transcriptions.language import Language
@dataclass
class GroqSTTSettings(BaseWhisperSTTSettings):
class GroqSTTSettings(BaseWhisperSTTService.Settings):
"""Settings for the Groq STT service.
Parameters:
@@ -38,7 +36,7 @@ class GroqSTTService(BaseWhisperSTTService):
"""
Settings = GroqSTTSettings
_settings: GroqSTTSettings
_settings: Settings
def __init__(
self,
@@ -49,7 +47,7 @@ class GroqSTTService(BaseWhisperSTTService):
language: Optional[Language] = None,
prompt: Optional[str] = None,
temperature: Optional[float] = None,
settings: Optional[GroqSTTSettings] = None,
settings: Optional[Settings] = None,
ttfs_p99_latency: Optional[float] = GROQ_TTFS_P99,
**kwargs,
):
@@ -59,24 +57,24 @@ class GroqSTTService(BaseWhisperSTTService):
model: Whisper model to use.
.. deprecated:: 0.0.105
Use ``settings=GroqSTTSettings(model=...)`` instead.
Use ``settings=GroqSTTService.Settings(model=...)`` instead.
api_key: Groq API key. Defaults to None.
base_url: API base URL. Defaults to "https://api.groq.com/openai/v1".
language: Language of the audio input.
.. deprecated:: 0.0.105
Use ``settings=GroqSTTSettings(language=...)`` instead.
Use ``settings=GroqSTTService.Settings(language=...)`` instead.
prompt: Optional text to guide the model's style or continue a previous segment.
.. deprecated:: 0.0.105
Use ``settings=GroqSTTSettings(prompt=...)`` instead.
Use ``settings=GroqSTTService.Settings(prompt=...)`` instead.
temperature: Optional sampling temperature between 0 and 1.
.. deprecated:: 0.0.105
Use ``settings=GroqSTTSettings(temperature=...)`` instead.
Use ``settings=GroqSTTService.Settings(temperature=...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
@@ -85,7 +83,7 @@ class GroqSTTService(BaseWhisperSTTService):
**kwargs: Additional arguments passed to BaseWhisperSTTService.
"""
# --- 1. Hardcoded defaults ---
default_settings = GroqSTTSettings(
default_settings = self.Settings(
model="whisper-large-v3-turbo",
language=self.language_to_service_language(Language.EN),
prompt=None,
@@ -94,16 +92,16 @@ class GroqSTTService(BaseWhisperSTTService):
# --- 2. Deprecated direct-arg overrides ---
if model is not None:
_warn_deprecated_param("model", GroqSTTSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
if language is not None:
_warn_deprecated_param("language", GroqSTTSettings, "language")
self._warn_init_param_moved_to_settings("language", "language")
default_settings.language = self.language_to_service_language(language)
if prompt is not None:
_warn_deprecated_param("prompt", GroqSTTSettings, "prompt")
self._warn_init_param_moved_to_settings("prompt", "prompt")
default_settings.prompt = prompt
if temperature is not None:
_warn_deprecated_param("temperature", GroqSTTSettings, "temperature")
self._warn_init_param_moved_to_settings("temperature", "temperature")
default_settings.temperature = temperature
# --- 3. (no params object for this service) ---

View File

@@ -19,7 +19,7 @@ from pipecat.frames.frames import (
Frame,
TTSAudioRawFrame,
)
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven
from pipecat.services.tts_service import TTSService
from pipecat.transcriptions.language import Language
from pipecat.utils.tracing.service_decorators import traced_tts
@@ -52,13 +52,13 @@ class GroqTTSService(TTSService):
"""
Settings = GroqTTSSettings
_settings: GroqTTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Input parameters for Groq TTS configuration.
.. deprecated:: 0.0.105
Use ``settings=GroqTTSSettings(...)`` instead.
Use ``settings=GroqTTSService.Settings(...)`` instead.
Parameters:
language: Language for speech synthesis. Defaults to English.
@@ -79,7 +79,7 @@ class GroqTTSService(TTSService):
model_name: Optional[str] = None,
voice_id: Optional[str] = None,
sample_rate: Optional[int] = GROQ_SAMPLE_RATE,
settings: Optional[GroqTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize Groq TTS service.
@@ -90,17 +90,17 @@ class GroqTTSService(TTSService):
params: Additional input parameters for voice customization.
.. deprecated:: 0.0.105
Use ``settings=GroqTTSSettings(...)`` instead.
Use ``settings=GroqTTSService.Settings(...)`` instead.
model_name: TTS model to use.
.. deprecated:: 0.0.105
Use ``settings=GroqTTSSettings(model=...)`` instead.
Use ``settings=GroqTTSService.Settings(model=...)`` instead.
voice_id: Voice identifier to use.
.. deprecated:: 0.0.105
Use ``settings=GroqTTSSettings(voice=...)`` instead.
Use ``settings=GroqTTSService.Settings(voice=...)`` instead.
sample_rate: Audio sample rate. Must be 48000 Hz for Groq TTS.
settings: Runtime-updatable settings. When provided alongside deprecated
@@ -111,7 +111,7 @@ class GroqTTSService(TTSService):
logger.warning(f"Groq TTS only supports {self.GROQ_SAMPLE_RATE}Hz sample rate. ")
# 1. Initialize default_settings with hardcoded defaults
default_settings = GroqTTSSettings(
default_settings = self.Settings(
model="canopylabs/orpheus-v1-english",
voice="autumn",
language="en",
@@ -120,15 +120,15 @@ class GroqTTSService(TTSService):
# 2. Apply direct init arg overrides (deprecated)
if model_name is not None:
_warn_deprecated_param("model_name", GroqTTSSettings, "model")
self._warn_init_param_moved_to_settings("model_name", "model")
default_settings.model = model_name
if voice_id is not None:
_warn_deprecated_param("voice_id", GroqTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", GroqTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.language = str(params.language) if params.language else "en"
default_settings.speed = params.speed

View File

@@ -83,7 +83,7 @@ class HeyGenVideoService(AIService):
"""
Settings = HeyGenVideoSettings
_settings: HeyGenVideoSettings
_settings: Settings
def __init__(
self,
@@ -92,7 +92,7 @@ class HeyGenVideoService(AIService):
session: aiohttp.ClientSession,
session_request: Optional[Union[LiveAvatarNewSessionRequest, NewSessionRequest]] = None,
service_type: Optional[ServiceType] = None,
settings: Optional[HeyGenVideoSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
) -> None:
"""Initialize the HeyGen video service.

View File

@@ -25,7 +25,7 @@ from pipecat.frames.frames import (
TTSStoppedFrame,
)
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven
from pipecat.services.tts_service import TTSService
from pipecat.utils.tracing.service_decorators import traced_tts
@@ -79,13 +79,13 @@ class HumeTTSService(TTSService):
"""
Settings = HumeTTSSettings
_settings: HumeTTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Optional synthesis parameters for Hume TTS.
.. deprecated:: 0.0.105
Use ``settings=HumeTTSSettings(...)`` instead.
Use ``settings=HumeTTSService.Settings(...)`` instead.
Parameters:
description: Natural-language acting directions (up to 100 characters).
@@ -104,7 +104,7 @@ class HumeTTSService(TTSService):
voice_id: Optional[str] = None,
params: Optional[InputParams] = None,
sample_rate: Optional[int] = HUME_SAMPLE_RATE,
settings: Optional[HumeTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
) -> None:
"""Initialize the HumeTTSService.
@@ -114,12 +114,12 @@ class HumeTTSService(TTSService):
voice_id: ID of the voice to use. Only voice IDs are supported; voice names are not.
.. deprecated:: 0.0.105
Use ``settings=HumeTTSSettings(voice=...)`` instead.
Use ``settings=HumeTTSService.Settings(voice=...)`` instead.
params: Optional synthesis controls (acting instructions, speed, trailing silence).
.. deprecated:: 0.0.105
Use ``settings=HumeTTSSettings(...)`` instead.
Use ``settings=HumeTTSService.Settings(...)`` instead.
sample_rate: Output sample rate for emitted PCM frames. Defaults to 48_000 (Hume).
settings: Runtime-updatable settings. When provided alongside deprecated
@@ -136,7 +136,7 @@ class HumeTTSService(TTSService):
)
# 1. Initialize default_settings with hardcoded defaults
default_settings = HumeTTSSettings(
default_settings = self.Settings(
model=None,
voice=None,
language=None, # Not applicable here
@@ -147,12 +147,12 @@ class HumeTTSService(TTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice_id is not None:
_warn_deprecated_param("voice_id", HumeTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", HumeTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.description = params.description
default_settings.speed = params.speed
@@ -242,7 +242,7 @@ class HumeTTSService(TTSService):
"""Runtime updates via key/value pair.
.. deprecated:: 0.0.104
Use ``TTSUpdateSettingsFrame(delta=HumeTTSSettings(...))`` instead.
Use ``TTSUpdateSettingsFrame(delta=HumeTTSService.Settings(...))`` instead.
Args:
key: The name of the setting to update. Recognized keys are:
@@ -256,7 +256,7 @@ class HumeTTSService(TTSService):
warnings.simplefilter("always")
warnings.warn(
"'update_setting' is deprecated, use "
"'TTSUpdateSettingsFrame(delta=HumeTTSSettings(...))' instead.",
"'TTSUpdateSettingsFrame(delta=self.Settings(...))' instead.",
DeprecationWarning,
stacklevel=2,
)
@@ -274,7 +274,7 @@ class HumeTTSService(TTSService):
kwargs["speed"] = None if value is None else float(value)
elif key_l == "trailing_silence":
kwargs["trailing_silence"] = None if value is None else float(value)
await self._update_settings(HumeTTSSettings(**kwargs))
await self._update_settings(self.Settings(**kwargs))
@traced_tts
async def run_tts(self, text: str, context_id: str) -> AsyncGenerator[Frame, None]:

View File

@@ -40,7 +40,7 @@ from pipecat import version as pipecat_version
USER_AGENT = f"pipecat/{pipecat_version()}"
from pydantic import BaseModel
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven
try:
from websockets.asyncio.client import connect as websocket_connect
@@ -101,13 +101,13 @@ class InworldHttpTTSService(TTSService):
"""
Settings = InworldTTSSettings
_settings: InworldTTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Input parameters for Inworld TTS configuration.
.. deprecated:: 0.0.105
Use ``InworldTTSSettings`` directly via the ``settings`` parameter instead.
Use ``InworldHttpTTSService.Settings`` directly via the ``settings`` parameter instead.
Parameters:
temperature: Temperature for speech synthesis.
@@ -131,7 +131,7 @@ class InworldHttpTTSService(TTSService):
encoding: str = "LINEAR16",
timestamp_transport_strategy: Optional[Literal["ASYNC", "SYNC"]] = "ASYNC",
params: Optional[InputParams] = None,
settings: Optional[InworldTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Inworld TTS service.
@@ -142,12 +142,12 @@ class InworldHttpTTSService(TTSService):
voice_id: ID of the voice to use for synthesis.
.. deprecated:: 0.0.105
Use ``settings=InworldTTSSettings(voice=...)`` instead.
Use ``settings=InworldHttpTTSService.Settings(voice=...)`` instead.
model: ID of the model to use for synthesis.
.. deprecated:: 0.0.105
Use ``settings=InworldTTSSettings(model=...)`` instead.
Use ``settings=InworldHttpTTSService.Settings(model=...)`` instead.
streaming: Whether to use streaming mode.
sample_rate: Audio sample rate in Hz.
@@ -157,14 +157,14 @@ class InworldHttpTTSService(TTSService):
params: Input parameters for Inworld TTS configuration.
.. deprecated:: 0.0.105
Use ``settings=InworldTTSSettings(...)`` instead.
Use ``settings=InworldHttpTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional arguments passed to the parent class.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = InworldTTSSettings(
default_settings = self.Settings(
model="inworld-tts-1.5-max",
voice="Ashley",
language=None,
@@ -174,15 +174,15 @@ class InworldHttpTTSService(TTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice_id is not None:
_warn_deprecated_param("voice_id", InworldTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
if model is not None:
_warn_deprecated_param("model", InworldTTSSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", InworldTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
if params.speaking_rate is not None:
default_settings.speaking_rate = params.speaking_rate
@@ -489,13 +489,13 @@ class InworldTTSService(WebsocketTTSService):
"""
Settings = InworldTTSSettings
_settings: InworldTTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Input parameters for Inworld WebSocket TTS configuration.
.. deprecated:: 0.0.105
Use ``InworldTTSSettings`` directly via the ``settings`` parameter instead.
Use ``InworldTTSService.Settings`` directly via the ``settings`` parameter instead.
Parameters:
temperature: Temperature for speech synthesis.
@@ -532,7 +532,7 @@ class InworldTTSService(WebsocketTTSService):
apply_text_normalization: Optional[str] = None,
timestamp_transport_strategy: Optional[Literal["ASYNC", "SYNC"]] = "ASYNC",
params: Optional[InputParams] = None,
settings: Optional[InworldTTSSettings] = None,
settings: Optional[Settings] = None,
aggregate_sentences: Optional[bool] = None,
text_aggregation_mode: Optional[TextAggregationMode] = None,
append_trailing_space: bool = True,
@@ -545,12 +545,12 @@ class InworldTTSService(WebsocketTTSService):
voice_id: ID of the voice to use for synthesis.
.. deprecated:: 0.0.105
Use ``settings=InworldTTSSettings(voice=...)`` instead.
Use ``settings=InworldTTSService.Settings(voice=...)`` instead.
model: ID of the model to use for synthesis.
.. deprecated:: 0.0.105
Use ``settings=InworldTTSSettings(model=...)`` instead.
Use ``settings=InworldTTSService.Settings(model=...)`` instead.
url: URL of the Inworld WebSocket API.
sample_rate: Audio sample rate in Hz.
@@ -564,7 +564,7 @@ class InworldTTSService(WebsocketTTSService):
params: Input parameters for Inworld WebSocket TTS configuration.
.. deprecated:: 0.0.105
Use ``settings=InworldTTSSettings(...)`` instead.
Use ``settings=InworldTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
@@ -582,7 +582,7 @@ class InworldTTSService(WebsocketTTSService):
auto_mode = True if aggregate_sentences is None else aggregate_sentences
# 1. Initialize default_settings with hardcoded defaults
default_settings = InworldTTSSettings(
default_settings = self.Settings(
model="inworld-tts-1.5-max",
voice="Ashley",
language=None,
@@ -592,17 +592,17 @@ class InworldTTSService(WebsocketTTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice_id is not None:
_warn_deprecated_param("voice_id", InworldTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
if model is not None:
_warn_deprecated_param("model", InworldTTSSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. Apply params overrides — only if settings not provided
_buffer_max_delay_ms = None
_buffer_char_threshold = None
if params is not None:
_warn_deprecated_param("params", InworldTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
if params.speaking_rate is not None:
default_settings.speaking_rate = params.speaking_rate

View File

@@ -21,7 +21,7 @@ from pipecat.frames.frames import (
Frame,
TTSAudioRawFrame,
)
from pipecat.services.settings import TTSSettings, _warn_deprecated_param
from pipecat.services.settings import TTSSettings
from pipecat.services.tts_service import TTSService
from pipecat.transcriptions.language import Language, resolve_language
from pipecat.utils.tracing.service_decorators import traced_tts
@@ -102,13 +102,13 @@ class KokoroTTSService(TTSService):
"""
Settings = KokoroTTSSettings
_settings: KokoroTTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Input parameters for Kokoro TTS configuration.
.. deprecated:: 0.0.105
Use ``KokoroTTSSettings`` directly via the ``settings`` parameter instead.
Use ``KokoroTTSService.Settings`` directly via the ``settings`` parameter instead.
Parameters:
language: Language to use for synthesis.
@@ -123,7 +123,7 @@ class KokoroTTSService(TTSService):
model_path: Optional[str] = None,
voices_path: Optional[str] = None,
params: Optional[InputParams] = None,
settings: Optional[KokoroTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Kokoro TTS service.
@@ -132,14 +132,14 @@ class KokoroTTSService(TTSService):
voice_id: Voice identifier to use for synthesis.
.. deprecated:: 0.0.105
Use ``settings=KokoroTTSSettings(voice=...)`` instead.
Use ``settings=KokoroTTSService.Settings(voice=...)`` instead.
model_path: Path to the kokoro ONNX model file. Defaults to auto-downloaded file.
voices_path: Path to the voices binary file. Defaults to auto-downloaded file.
params: Configuration parameters for synthesis.
.. deprecated:: 0.0.105
Use ``settings=KokoroTTSSettings(...)`` instead.
Use ``settings=KokoroTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
@@ -147,7 +147,7 @@ class KokoroTTSService(TTSService):
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = KokoroTTSSettings(
default_settings = self.Settings(
model=None,
voice=None,
language=language_to_kokoro_language(Language.EN),
@@ -155,12 +155,12 @@ class KokoroTTSService(TTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice_id is not None:
_warn_deprecated_param("voice_id", KokoroTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", KokoroTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.language = language_to_kokoro_language(params.language)

View File

@@ -22,7 +22,7 @@ from pipecat.frames.frames import (
TTSStoppedFrame,
)
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.settings import TTSSettings, _warn_deprecated_param
from pipecat.services.settings import TTSSettings
from pipecat.services.tts_service import InterruptibleTTSService
from pipecat.transcriptions.language import Language, resolve_language
from pipecat.utils.tracing.service_decorators import traced_tts
@@ -89,7 +89,7 @@ class LmntTTSService(InterruptibleTTSService):
"""
Settings = LmntTTSSettings
_settings: LmntTTSSettings
_settings: Settings
def __init__(
self,
@@ -100,7 +100,7 @@ class LmntTTSService(InterruptibleTTSService):
language: Language = Language.EN,
output_format: str = "pcm_s16le",
model: Optional[str] = None,
settings: Optional[LmntTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the LMNT TTS service.
@@ -110,7 +110,7 @@ class LmntTTSService(InterruptibleTTSService):
voice_id: ID of the voice to use for synthesis.
.. deprecated:: 0.0.105
Use ``settings=LmntTTSSettings(voice=...)`` instead.
Use ``settings=LmntTTSService.Settings(voice=...)`` instead.
sample_rate: Audio sample rate. If None, uses default.
language: Language for synthesis. Defaults to English.
@@ -119,14 +119,14 @@ class LmntTTSService(InterruptibleTTSService):
model: TTS model to use.
.. deprecated:: 0.0.105
Use ``settings=LmntTTSSettings(model=...)`` instead.
Use ``settings=LmntTTSService.Settings(model=...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional arguments passed to parent InterruptibleTTSService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = LmntTTSSettings(
default_settings = self.Settings(
model="aurora",
voice=None,
language=self.language_to_service_language(language),
@@ -134,10 +134,10 @@ class LmntTTSService(InterruptibleTTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice_id is not None:
_warn_deprecated_param("voice_id", LmntTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
if model is not None:
_warn_deprecated_param("model", LmntTTSSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. (No step 3, as there's no params object to apply)
@@ -237,7 +237,7 @@ class LmntTTSService(InterruptibleTTSService):
"""Apply a settings delta.
Args:
delta: A :class:`TTSSettings` (or ``LmntTTSSettings``) delta.
delta: A :class:`TTSSettings` (or ``LmntTTSService.Settings``) delta.
Returns:
Dict mapping changed field names to their previous values.

View File

@@ -24,7 +24,7 @@ from pipecat.frames.frames import (
StartFrame,
TTSAudioRawFrame,
)
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven
from pipecat.services.tts_service import TTSService
from pipecat.transcriptions.language import Language, resolve_language
from pipecat.utils.tracing.service_decorators import traced_tts
@@ -141,13 +141,13 @@ class MiniMaxHttpTTSService(TTSService):
"""
Settings = MiniMaxTTSSettings
_settings: MiniMaxTTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Configuration parameters for MiniMax TTS.
.. deprecated:: 0.0.105
Use ``MiniMaxTTSSettings`` directly via the ``settings`` parameter instead.
Use ``MiniMaxHttpTTSService.Settings`` directly via the ``settings`` parameter instead.
Parameters:
language: Language for TTS generation. Supports 40 languages.
@@ -190,7 +190,7 @@ class MiniMaxHttpTTSService(TTSService):
sample_rate: Optional[int] = None,
stream: bool = True,
params: Optional[InputParams] = None,
settings: Optional[MiniMaxTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the MiniMax TTS service.
@@ -208,12 +208,12 @@ class MiniMaxHttpTTSService(TTSService):
"speech-01-hd", "speech-01-turbo".
.. deprecated:: 0.0.105
Use ``settings=MiniMaxTTSSettings(model=...)`` instead.
Use ``settings=MiniMaxHttpTTSService.Settings(model=...)`` instead.
voice_id: Voice identifier. Defaults to "Calm_Woman".
.. deprecated:: 0.0.105
Use ``settings=MiniMaxTTSSettings(voice=...)`` instead.
Use ``settings=MiniMaxHttpTTSService.Settings(voice=...)`` instead.
aiohttp_session: aiohttp.ClientSession for API communication.
sample_rate: Output audio sample rate in Hz. If None, uses pipeline default.
@@ -221,14 +221,14 @@ class MiniMaxHttpTTSService(TTSService):
params: Additional configuration parameters.
.. deprecated:: 0.0.105
Use ``settings=MiniMaxTTSSettings(...)`` instead.
Use ``settings=MiniMaxHttpTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional arguments passed to parent TTSService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = MiniMaxTTSSettings(
default_settings = self.Settings(
model="speech-02-turbo",
voice="Calm_Woman",
language=None,
@@ -243,15 +243,15 @@ class MiniMaxHttpTTSService(TTSService):
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", MiniMaxTTSSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
if voice_id is not None:
_warn_deprecated_param("voice_id", MiniMaxTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", MiniMaxTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.speed = params.speed
default_settings.volume = params.volume

View File

@@ -14,13 +14,12 @@ from openai.types.chat import ChatCompletionMessageParam
from pipecat.adapters.services.open_ai_adapter import OpenAILLMInvocationParams
from pipecat.frames.frames import FunctionCallFromLLM
from pipecat.services.openai.base_llm import OpenAILLMSettings
from pipecat.services.openai.base_llm import BaseOpenAILLMService
from pipecat.services.openai.llm import OpenAILLMService
from pipecat.services.settings import _warn_deprecated_param
@dataclass
class MistralLLMSettings(OpenAILLMSettings):
class MistralLLMSettings(BaseOpenAILLMService.Settings):
"""Settings for MistralLLMService."""
pass
@@ -34,7 +33,7 @@ class MistralLLMService(OpenAILLMService):
"""
Settings = MistralLLMSettings
_settings: MistralLLMSettings
_settings: Settings
def __init__(
self,
@@ -42,7 +41,7 @@ class MistralLLMService(OpenAILLMService):
api_key: str,
base_url: str = "https://api.mistral.ai/v1",
model: Optional[str] = None,
settings: Optional[MistralLLMSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Mistral LLM service.
@@ -53,18 +52,18 @@ class MistralLLMService(OpenAILLMService):
model: The model identifier to use. Defaults to "mistral-small-latest".
.. deprecated:: 0.0.105
Use ``settings=OpenAILLMSettings(model=...)`` instead.
Use ``settings=MistralLLMService.Settings(model=...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional keyword arguments passed to OpenAILLMService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = MistralLLMSettings(model="mistral-small-latest")
default_settings = self.Settings(model="mistral-small-latest")
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", MistralLLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. (No step 3, as there's no params object to apply)

View File

@@ -25,7 +25,7 @@ from pipecat.frames.frames import (
VisionFullResponseStartFrame,
VisionTextFrame,
)
from pipecat.services.settings import VisionSettings, _warn_deprecated_param
from pipecat.services.settings import VisionSettings
from pipecat.services.vision_service import VisionService
try:
@@ -80,7 +80,7 @@ class MoondreamService(VisionService):
"""
Settings = MoondreamSettings
_settings: MoondreamSettings
_settings: Settings
def __init__(
self,
@@ -88,7 +88,7 @@ class MoondreamService(VisionService):
model: Optional[str] = None,
revision="2025-01-09",
use_cpu=False,
settings: Optional[MoondreamSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Moondream service.
@@ -97,7 +97,7 @@ class MoondreamService(VisionService):
model: Hugging Face model identifier for the Moondream model.
.. deprecated:: 0.0.105
Use ``settings=MoondreamSettings(model=...)`` instead.
Use ``settings=MoondreamService.Settings(model=...)`` instead.
revision: Specific model revision to use.
use_cpu: Whether to force CPU usage instead of hardware acceleration.
@@ -106,11 +106,11 @@ class MoondreamService(VisionService):
**kwargs: Additional arguments passed to the parent VisionService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = MoondreamSettings(model="vikhyatk/moondream2")
default_settings = self.Settings(model="vikhyatk/moondream2")
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", MoondreamSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 4. Apply settings delta (canonical API, always wins)

View File

@@ -33,7 +33,7 @@ from pipecat.frames.frames import (
TTSStoppedFrame,
)
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven
from pipecat.services.tts_service import InterruptibleTTSService, TextAggregationMode, TTSService
from pipecat.transcriptions.language import Language, resolve_language
from pipecat.utils.tracing.service_decorators import traced_tts
@@ -92,13 +92,13 @@ class NeuphonicTTSService(InterruptibleTTSService):
"""
Settings = NeuphonicTTSSettings
_settings: NeuphonicTTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Input parameters for Neuphonic TTS configuration.
.. deprecated:: 0.0.105
Use ``settings=NeuphonicTTSSettings(...)`` instead.
Use ``settings=NeuphonicTTSService.Settings(...)`` instead.
Parameters:
language: Language for synthesis. Defaults to English.
@@ -117,7 +117,7 @@ class NeuphonicTTSService(InterruptibleTTSService):
sample_rate: Optional[int] = 22050,
encoding: str = "pcm_linear",
params: Optional[InputParams] = None,
settings: Optional[NeuphonicTTSSettings] = None,
settings: Optional[Settings] = None,
aggregate_sentences: Optional[bool] = None,
text_aggregation_mode: Optional[TextAggregationMode] = None,
**kwargs,
@@ -129,7 +129,7 @@ class NeuphonicTTSService(InterruptibleTTSService):
voice_id: ID of the voice to use for synthesis.
.. deprecated:: 0.0.105
Use ``settings=NeuphonicTTSSettings(voice=...)`` instead.
Use ``settings=NeuphonicTTSService.Settings(voice=...)`` instead.
url: WebSocket URL for the Neuphonic API.
sample_rate: Audio sample rate in Hz. Defaults to 22050.
@@ -137,7 +137,7 @@ class NeuphonicTTSService(InterruptibleTTSService):
params: Additional input parameters for TTS configuration.
.. deprecated:: 0.0.105
Use ``settings=NeuphonicTTSSettings(...)`` instead.
Use ``settings=NeuphonicTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
@@ -150,7 +150,7 @@ class NeuphonicTTSService(InterruptibleTTSService):
**kwargs: Additional arguments passed to parent InterruptibleTTSService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = NeuphonicTTSSettings(
default_settings = self.Settings(
model=None,
voice=None,
language=self.language_to_service_language(Language.EN),
@@ -159,12 +159,12 @@ class NeuphonicTTSService(InterruptibleTTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice_id is not None:
_warn_deprecated_param("voice_id", NeuphonicTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", NeuphonicTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
if params.language is not None:
default_settings.language = self.language_to_service_language(params.language)
@@ -432,13 +432,13 @@ class NeuphonicHttpTTSService(TTSService):
"""
Settings = NeuphonicTTSSettings
_settings: NeuphonicTTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Input parameters for Neuphonic HTTP TTS configuration.
.. deprecated:: 0.0.105
Use ``settings=NeuphonicTTSSettings(...)`` instead.
Use ``settings=NeuphonicHttpTTSService.Settings(...)`` instead.
Parameters:
language: Language for synthesis. Defaults to English.
@@ -458,7 +458,7 @@ class NeuphonicHttpTTSService(TTSService):
sample_rate: Optional[int] = 22050,
encoding: Optional[str] = "pcm_linear",
params: Optional[InputParams] = None,
settings: Optional[NeuphonicTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Neuphonic HTTP TTS service.
@@ -468,7 +468,7 @@ class NeuphonicHttpTTSService(TTSService):
voice_id: ID of the voice to use for synthesis.
.. deprecated:: 0.0.105
Use ``settings=NeuphonicTTSSettings(voice=...)`` instead.
Use ``settings=NeuphonicHttpTTSService.Settings(voice=...)`` instead.
aiohttp_session: Shared aiohttp session for HTTP requests.
url: Base URL for the Neuphonic HTTP API.
@@ -477,14 +477,14 @@ class NeuphonicHttpTTSService(TTSService):
params: Additional input parameters for TTS configuration.
.. deprecated:: 0.0.105
Use ``settings=NeuphonicTTSSettings(...)`` instead.
Use ``settings=NeuphonicHttpTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional arguments passed to parent TTSService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = NeuphonicTTSSettings(
default_settings = self.Settings(
model=None,
voice=None,
language=self.language_to_service_language(Language.EN),
@@ -493,12 +493,12 @@ class NeuphonicHttpTTSService(TTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice_id is not None:
_warn_deprecated_param("voice_id", NeuphonicTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", NeuphonicTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
if params.language is not None:
default_settings.language = self.language_to_service_language(params.language)

View File

@@ -16,13 +16,12 @@ from typing import Optional
from pipecat.metrics.metrics import LLMTokenUsage
from pipecat.processors.aggregators.llm_context import LLMContext
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
from pipecat.services.openai.base_llm import OpenAILLMSettings
from pipecat.services.openai.base_llm import BaseOpenAILLMService
from pipecat.services.openai.llm import OpenAILLMService
from pipecat.services.settings import _warn_deprecated_param
@dataclass
class NvidiaLLMSettings(OpenAILLMSettings):
class NvidiaLLMSettings(BaseOpenAILLMService.Settings):
"""Settings for NvidiaLLMService."""
pass
@@ -37,7 +36,7 @@ class NvidiaLLMService(OpenAILLMService):
"""
Settings = NvidiaLLMSettings
_settings: NvidiaLLMSettings
_settings: Settings
def __init__(
self,
@@ -45,7 +44,7 @@ class NvidiaLLMService(OpenAILLMService):
api_key: str,
base_url: str = "https://integrate.api.nvidia.com/v1",
model: Optional[str] = None,
settings: Optional[NvidiaLLMSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the NvidiaLLMService.
@@ -57,18 +56,18 @@ class NvidiaLLMService(OpenAILLMService):
"nvidia/llama-3.1-nemotron-70b-instruct".
.. deprecated:: 0.0.105
Use ``settings=OpenAILLMSettings(model=...)`` instead.
Use ``settings=NvidiaLLMService.Settings(model=...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional keyword arguments passed to OpenAILLMService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = NvidiaLLMSettings(model="nvidia/llama-3.1-nemotron-70b-instruct")
default_settings = self.Settings(model="nvidia/llama-3.1-nemotron-70b-instruct")
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", NvidiaLLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. (No step 3, as there's no params object to apply)

View File

@@ -23,7 +23,7 @@ from pipecat.frames.frames import (
StartFrame,
TranscriptionFrame,
)
from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven
from pipecat.services.stt_latency import NVIDIA_TTFS_P99
from pipecat.services.stt_service import SegmentedSTTService, STTService
from pipecat.transcriptions.language import Language, resolve_language
@@ -126,13 +126,13 @@ class NvidiaSTTService(STTService):
"""
Settings = NvidiaSTTSettings
_settings: NvidiaSTTSettings
_settings: Settings
class InputParams(BaseModel):
"""Configuration parameters for NVIDIA Riva STT service.
.. deprecated:: 0.0.105
Use ``settings=NvidiaSTTSettings(...)`` instead.
Use ``settings=NvidiaSTTService.Settings(...)`` instead.
Parameters:
language: Target language for transcription. Defaults to EN_US.
@@ -152,7 +152,7 @@ class NvidiaSTTService(STTService):
sample_rate: Optional[int] = None,
params: Optional[InputParams] = None,
use_ssl: bool = True,
settings: Optional[NvidiaSTTSettings] = None,
settings: Optional[Settings] = None,
ttfs_p99_latency: Optional[float] = NVIDIA_TTFS_P99,
**kwargs,
):
@@ -166,7 +166,7 @@ class NvidiaSTTService(STTService):
params: Additional configuration parameters for NVIDIA Riva.
.. deprecated:: 0.0.105
Use ``settings=NvidiaSTTSettings(...)`` instead.
Use ``settings=NvidiaSTTService.Settings(...)`` instead.
use_ssl: Whether to use SSL for the NVIDIA Riva server. Defaults to True.
settings: Runtime-updatable settings. When provided alongside deprecated
@@ -176,7 +176,7 @@ class NvidiaSTTService(STTService):
**kwargs: Additional arguments passed to STTService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = NvidiaSTTSettings(
default_settings = self.Settings(
model=model_function_map.get("model_name"),
language=Language.EN_US,
)
@@ -185,7 +185,7 @@ class NvidiaSTTService(STTService):
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", NvidiaSTTSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.language = params.language
@@ -441,13 +441,13 @@ class NvidiaSegmentedSTTService(SegmentedSTTService):
"""
Settings = NvidiaSegmentedSTTSettings
_settings: NvidiaSegmentedSTTSettings
_settings: Settings
class InputParams(BaseModel):
"""Configuration parameters for NVIDIA Riva segmented STT service.
.. deprecated:: 0.0.105
Use ``settings=NvidiaSegmentedSTTSettings(...)`` instead.
Use ``settings=NvidiaSegmentedSTTService.Settings(...)`` instead.
Parameters:
language: Target language for transcription. Defaults to EN_US.
@@ -477,7 +477,7 @@ class NvidiaSegmentedSTTService(SegmentedSTTService):
sample_rate: Optional[int] = None,
params: Optional[InputParams] = None,
use_ssl: bool = True,
settings: Optional[NvidiaSegmentedSTTSettings] = None,
settings: Optional[Settings] = None,
ttfs_p99_latency: Optional[float] = NVIDIA_TTFS_P99,
**kwargs,
):
@@ -491,7 +491,7 @@ class NvidiaSegmentedSTTService(SegmentedSTTService):
params: Additional configuration parameters for NVIDIA Riva
.. deprecated:: 0.0.105
Use ``settings=NvidiaSegmentedSTTSettings(...)`` instead.
Use ``settings=NvidiaSegmentedSTTService.Settings(...)`` instead.
use_ssl: Whether to use SSL for the NVIDIA Riva server. Defaults to True.
settings: Runtime-updatable settings. When provided alongside deprecated
@@ -501,7 +501,7 @@ class NvidiaSegmentedSTTService(SegmentedSTTService):
**kwargs: Additional arguments passed to SegmentedSTTService
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = NvidiaSegmentedSTTSettings(
default_settings = self.Settings(
model=model_function_map.get("model_name"),
language=language_to_nvidia_riva_language(Language.EN_US) or "en-US",
profanity_filter=False,
@@ -515,7 +515,7 @@ class NvidiaSegmentedSTTService(SegmentedSTTService):
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", NvidiaSegmentedSTTSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.language = (
language_to_nvidia_riva_language(params.language or Language.EN_US) or "en-US"
@@ -641,7 +641,7 @@ class NvidiaSegmentedSTTService(SegmentedSTTService):
"""Apply a settings delta and sync internal state.
Args:
delta: A :class:`STTSettings` (or ``NvidiaSegmentedSTTSettings``) delta.
delta: A :class:`STTSettings` (or ``NvidiaSegmentedSTTService.Settings``) delta.
Returns:
Dict mapping changed field names to their previous values.

View File

@@ -29,7 +29,7 @@ from pipecat.frames.frames import (
StartFrame,
TTSAudioRawFrame,
)
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven
from pipecat.services.tts_service import TTSService
from pipecat.transcriptions.language import Language
@@ -62,13 +62,13 @@ class NvidiaTTSService(TTSService):
"""
Settings = NvidiaTTSSettings
_settings: NvidiaTTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Input parameters for Riva TTS configuration.
.. deprecated:: 0.0.105
Use ``NvidiaTTSSettings`` directly via the ``settings`` parameter instead.
Use ``NvidiaTTSService.Settings`` directly via the ``settings`` parameter instead.
Parameters:
language: Language code for synthesis. Defaults to US English.
@@ -90,7 +90,7 @@ class NvidiaTTSService(TTSService):
"model_name": "magpie-tts-multilingual",
},
params: Optional[InputParams] = None,
settings: Optional[NvidiaTTSSettings] = None,
settings: Optional[Settings] = None,
use_ssl: bool = True,
**kwargs,
):
@@ -102,14 +102,14 @@ class NvidiaTTSService(TTSService):
voice_id: Voice model identifier. Defaults to multilingual Aria voice.
.. deprecated:: 0.0.105
Use ``settings=NvidiaTTSSettings(voice=...)`` instead.
Use ``settings=NvidiaTTSService.Settings(voice=...)`` instead.
sample_rate: Audio sample rate. If None, uses service default.
model_function_map: Dictionary containing function_id and model_name for the TTS model.
params: Additional configuration parameters for TTS synthesis.
.. deprecated:: 0.0.105
Use ``settings=NvidiaTTSSettings(...)`` instead.
Use ``settings=NvidiaTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
@@ -117,7 +117,7 @@ class NvidiaTTSService(TTSService):
**kwargs: Additional arguments passed to parent TTSService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = NvidiaTTSSettings(
default_settings = self.Settings(
model=model_function_map.get("model_name"),
voice="Magpie-Multilingual.EN-US.Aria",
language=Language.EN_US,
@@ -126,12 +126,12 @@ class NvidiaTTSService(TTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice_id is not None:
_warn_deprecated_param("voice_id", NvidiaTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", NvidiaTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
if params.language is not None:
default_settings.language = params.language
@@ -186,7 +186,7 @@ class NvidiaTTSService(TTSService):
stacklevel=2,
)
async def _update_settings(self, delta: NvidiaTTSSettings) -> dict[str, Any]:
async def _update_settings(self, delta: Settings) -> dict[str, Any]:
"""Apply a settings delta.
Settings are stored but not applied to the active connection.

View File

@@ -11,13 +11,12 @@ from typing import Optional
from loguru import logger
from pipecat.services.openai.base_llm import OpenAILLMSettings
from pipecat.services.openai.base_llm import BaseOpenAILLMService
from pipecat.services.openai.llm import OpenAILLMService
from pipecat.services.settings import _warn_deprecated_param
@dataclass
class OllamaLLMSettings(OpenAILLMSettings):
class OllamaLLMSettings(BaseOpenAILLMService.Settings):
"""Settings for OLLamaLLMService."""
pass
@@ -31,14 +30,14 @@ class OLLamaLLMService(OpenAILLMService):
"""
Settings = OllamaLLMSettings
_settings: OllamaLLMSettings
_settings: Settings
def __init__(
self,
*,
model: Optional[str] = None,
base_url: str = "http://localhost:11434/v1",
settings: Optional[OllamaLLMSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize OLLama LLM service.
@@ -47,7 +46,7 @@ class OLLamaLLMService(OpenAILLMService):
model: The OLLama model to use. Defaults to "llama2".
.. deprecated:: 0.0.105
Use ``settings=OpenAILLMSettings(model=...)`` instead.
Use ``settings=OLLamaLLMService.Settings(model=...)`` instead.
base_url: The base URL for the OLLama API endpoint.
Defaults to "http://localhost:11434/v1".
@@ -56,11 +55,11 @@ class OLLamaLLMService(OpenAILLMService):
**kwargs: Additional keyword arguments passed to OpenAILLMService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = OllamaLLMSettings(model="llama2")
default_settings = self.Settings(model="llama2")
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", OllamaLLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. (No step 3, as there's no params object to apply)

View File

@@ -69,13 +69,13 @@ class BaseOpenAILLMService(LLMService):
"""
Settings = OpenAILLMSettings
_settings: OpenAILLMSettings
_settings: Settings
class InputParams(BaseModel):
"""Input parameters for OpenAI model configuration.
.. deprecated:: 0.0.105
Use ``settings=OpenAILLMSettings(...)`` instead of
Use ``settings=BaseOpenAILLMService.Settings(...)`` instead of
``params=InputParams(...)``.
Parameters:
@@ -119,7 +119,7 @@ class BaseOpenAILLMService(LLMService):
default_headers: Optional[Mapping[str, str]] = None,
service_tier: Optional[str] = None,
params: Optional[InputParams] = None,
settings: Optional[OpenAILLMSettings] = None,
settings: Optional[Settings] = None,
retry_timeout_secs: Optional[float] = 5.0,
retry_on_timeout: Optional[bool] = False,
**kwargs,
@@ -130,7 +130,7 @@ class BaseOpenAILLMService(LLMService):
model: The OpenAI model name to use (e.g., "gpt-4.1", "gpt-4o").
.. deprecated:: 0.0.105
Use ``settings=OpenAILLMSettings(model=...)`` instead.
Use ``settings=BaseOpenAILLMService.Settings(model=...)`` instead.
api_key: OpenAI API key. If None, uses environment variable.
base_url: Custom base URL for OpenAI API. If None, uses default.
@@ -141,7 +141,7 @@ class BaseOpenAILLMService(LLMService):
params: Input parameters for model configuration and behavior.
.. deprecated:: 0.0.105
Use ``settings=OpenAILLMSettings(...)`` instead.
Use ``settings=BaseOpenAILLMService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
@@ -150,7 +150,7 @@ class BaseOpenAILLMService(LLMService):
**kwargs: Additional arguments passed to the parent LLMService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = OpenAILLMSettings(
default_settings = self.Settings(
model="gpt-4o",
system_instruction=None,
frequency_penalty=NOT_GIVEN,

View File

@@ -25,7 +25,7 @@ from pipecat.frames.frames import (
URLImageRawFrame,
)
from pipecat.services.image_service import ImageGenService
from pipecat.services.settings import NOT_GIVEN, ImageGenSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, ImageGenSettings, _NotGiven
@dataclass
@@ -49,7 +49,7 @@ class OpenAIImageGenService(ImageGenService):
"""
Settings = OpenAIImageGenSettings
_settings: OpenAIImageGenSettings
_settings: Settings
def __init__(
self,
@@ -61,7 +61,7 @@ class OpenAIImageGenService(ImageGenService):
Literal["256x256", "512x512", "1024x1024", "1792x1024", "1024x1792"]
] = None,
model: Optional[str] = None,
settings: Optional[OpenAIImageGenSettings] = None,
settings: Optional[Settings] = None,
):
"""Initialize the OpenAI image generation service.
@@ -72,29 +72,29 @@ class OpenAIImageGenService(ImageGenService):
image_size: Target size for generated images. Defaults to "1024x1024".
.. deprecated:: 0.0.105
Use ``settings=OpenAIImageGenSettings(image_size=...)`` instead.
Use ``settings=OpenAIImageGenService.Settings(image_size=...)`` instead.
model: DALL-E model to use for generation. Defaults to "dall-e-3".
.. deprecated:: 0.0.105
Use ``settings=OpenAIImageGenSettings(model=...)`` instead.
Use ``settings=OpenAIImageGenService.Settings(model=...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = OpenAIImageGenSettings(
default_settings = self.Settings(
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")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
if image_size is not None:
_warn_deprecated_param("image_size", OpenAIImageGenSettings, "image_size")
self._warn_init_param_moved_to_settings("image_size", "image_size")
default_settings.image_size = image_size
# 4. Apply settings delta (canonical API, always wins)

View File

@@ -25,8 +25,7 @@ from pipecat.processors.aggregators.llm_response import (
LLMUserContextAggregator,
)
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
from pipecat.services.openai.base_llm import BaseOpenAILLMService, OpenAILLMSettings
from pipecat.services.settings import _warn_deprecated_param
from pipecat.services.openai.base_llm import BaseOpenAILLMService
@dataclass
@@ -72,13 +71,15 @@ class OpenAILLMService(BaseOpenAILLMService):
context aggregator creation.
"""
Settings = BaseOpenAILLMService.Settings
def __init__(
self,
*,
model: Optional[str] = None,
service_tier: Optional[str] = None,
params: Optional[BaseOpenAILLMService.InputParams] = None,
settings: Optional[OpenAILLMSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize OpenAI LLM service.
@@ -87,20 +88,20 @@ class OpenAILLMService(BaseOpenAILLMService):
model: The OpenAI model name to use. Defaults to "gpt-4.1".
.. deprecated:: 0.0.105
Use ``settings=OpenAILLMSettings(model=...)`` instead.
Use ``settings=OpenAILLMService.Settings(model=...)`` instead.
service_tier: Service tier to use (e.g., "auto", "flex", "priority").
params: Input parameters for model configuration.
.. deprecated:: 0.0.105
Use ``settings=OpenAILLMSettings(...)`` instead.
Use ``settings=OpenAILLMService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional arguments passed to the parent BaseOpenAILLMService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = OpenAILLMSettings(
default_settings = self.Settings(
model="gpt-4.1",
system_instruction=None,
frequency_penalty=NOT_GIVEN,
@@ -118,7 +119,7 @@ class OpenAILLMService(BaseOpenAILLMService):
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", OpenAILLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# Handle service_tier from deprecated params
@@ -127,7 +128,7 @@ class OpenAILLMService(BaseOpenAILLMService):
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", OpenAILLMSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.frequency_penalty = params.frequency_penalty
default_settings.presence_penalty = params.presence_penalty

View File

@@ -63,7 +63,6 @@ from pipecat.services.settings import (
NOT_GIVEN,
LLMSettings,
_NotGiven,
_warn_deprecated_param,
is_given,
)
from pipecat.transcriptions.language import Language
@@ -115,7 +114,7 @@ class OpenAIRealtimeLLMSettings(LLMSettings):
# -- Bidirectional sync helpers ------------------------------------------
@staticmethod
def _sync_top_level_to_sp(settings: "OpenAIRealtimeLLMSettings"):
def _sync_top_level_to_sp(settings: "OpenAIRealtimeLLMService.Settings"):
"""Push top-level ``model``/``system_instruction`` into ``session_properties``."""
if not is_given(settings.session_properties):
return
@@ -127,7 +126,7 @@ class OpenAIRealtimeLLMSettings(LLMSettings):
# -- apply_update override -----------------------------------------------
def apply_update(self, delta: "OpenAIRealtimeLLMSettings") -> Dict[str, Any]:
def apply_update(self, delta: "OpenAIRealtimeLLMService.Settings") -> Dict[str, Any]:
"""Merge a delta, keeping ``model``/``system_instruction`` in sync with SP.
When the delta contains ``session_properties``, it **replaces** the
@@ -165,8 +164,8 @@ class OpenAIRealtimeLLMSettings(LLMSettings):
@classmethod
def from_mapping(
cls: Type["OpenAIRealtimeLLMSettings"], settings: Mapping[str, Any]
) -> "OpenAIRealtimeLLMSettings":
cls: Type["OpenAIRealtimeLLMService.Settings"], settings: Mapping[str, Any]
) -> "OpenAIRealtimeLLMService.Settings":
"""Build a delta from a plain dict, routing SP keys into ``session_properties``.
Keys that correspond to ``SessionProperties`` fields (except ``model``)
@@ -211,7 +210,7 @@ class OpenAIRealtimeLLMService(LLMService):
"""
Settings = OpenAIRealtimeLLMSettings
_settings: OpenAIRealtimeLLMSettings
_settings: Settings
# Overriding the default adapter to use the OpenAIRealtimeLLMAdapter one.
adapter_class = OpenAIRealtimeLLMAdapter
@@ -223,7 +222,7 @@ class OpenAIRealtimeLLMService(LLMService):
model: Optional[str] = None,
base_url: str = "wss://api.openai.com/v1/realtime",
session_properties: Optional[events.SessionProperties] = None,
settings: Optional[OpenAIRealtimeLLMSettings] = None,
settings: Optional[Settings] = None,
start_audio_paused: bool = False,
start_video_paused: bool = False,
video_frame_detail: str = "auto",
@@ -237,7 +236,7 @@ class OpenAIRealtimeLLMService(LLMService):
model: OpenAI model name.
.. deprecated:: 0.0.105
Use ``settings=OpenAIRealtimeLLMSettings(model=...)`` instead.
Use ``settings=OpenAIRealtimeLLMService.Settings(model=...)`` instead.
This is a connection-level parameter set via the WebSocket URL query
parameter and cannot be changed during the session.
@@ -247,7 +246,7 @@ class OpenAIRealtimeLLMService(LLMService):
If None, uses default SessionProperties.
.. deprecated:: 0.0.105
Use ``settings=OpenAIRealtimeLLMSettings(session_properties=...)``
Use ``settings=OpenAIRealtimeLLMService.Settings(session_properties=...)``
instead.
settings: Runtime-updatable settings for this service.
start_audio_paused: Whether to start with audio input paused. Defaults to False.
@@ -277,7 +276,7 @@ class OpenAIRealtimeLLMService(LLMService):
)
# 1. Initialize default_settings with hardcoded defaults
default_settings = OpenAIRealtimeLLMSettings(
default_settings = self.Settings(
model="gpt-realtime-1.5",
system_instruction=None,
temperature=None,
@@ -294,13 +293,13 @@ class OpenAIRealtimeLLMService(LLMService):
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", OpenAIRealtimeLLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
if session_properties is not None:
_warn_deprecated_param(
"session_properties",
OpenAIRealtimeLLMSettings,
self.Settings,
"session_properties",
)
default_settings.session_properties = session_properties
@@ -312,7 +311,7 @@ class OpenAIRealtimeLLMService(LLMService):
default_settings.system_instruction = session_properties.instructions
# Sync top-level model back into session_properties
OpenAIRealtimeLLMSettings._sync_top_level_to_sp(default_settings)
self.Settings._sync_top_level_to_sp(default_settings)
# 3. Apply settings delta (canonical API, always wins)
if settings is not None:

View File

@@ -35,12 +35,11 @@ from pipecat.frames.frames import (
VADUserStoppedSpeakingFrame,
)
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven
from pipecat.services.stt_latency import OPENAI_REALTIME_TTFS_P99, OPENAI_TTFS_P99
from pipecat.services.stt_service import WebsocketSTTService
from pipecat.services.whisper.base_stt import (
BaseWhisperSTTService,
BaseWhisperSTTSettings,
Transcription,
)
from pipecat.transcriptions.language import Language
@@ -56,7 +55,7 @@ except ModuleNotFoundError:
@dataclass
class OpenAISTTSettings(BaseWhisperSTTSettings):
class OpenAISTTSettings(BaseWhisperSTTService.Settings):
"""Settings for the OpenAI STT service."""
pass
@@ -70,7 +69,7 @@ class OpenAISTTService(BaseWhisperSTTService):
"""
Settings = OpenAISTTSettings
_settings: OpenAISTTSettings
_settings: Settings
def __init__(
self,
@@ -81,7 +80,7 @@ class OpenAISTTService(BaseWhisperSTTService):
language: Optional[Language] = Language.EN,
prompt: Optional[str] = None,
temperature: Optional[float] = None,
settings: Optional[OpenAISTTSettings] = None,
settings: Optional[Settings] = None,
ttfs_p99_latency: Optional[float] = OPENAI_TTFS_P99,
**kwargs,
):
@@ -91,24 +90,24 @@ class OpenAISTTService(BaseWhisperSTTService):
model: Model to use — either gpt-4o or Whisper.
.. deprecated:: 0.0.105
Use ``settings=OpenAISTTSettings(model=...)`` instead.
Use ``settings=OpenAISTTService.Settings(model=...)`` instead.
api_key: OpenAI API key. Defaults to None.
base_url: API base URL. Defaults to None.
language: Language of the audio input. Defaults to English.
.. deprecated:: 0.0.105
Use ``settings=OpenAISTTSettings(language=...)`` instead.
Use ``settings=OpenAISTTService.Settings(language=...)`` instead.
prompt: Optional text to guide the model's style or continue a previous segment.
.. deprecated:: 0.0.105
Use ``settings=OpenAISTTSettings(prompt=...)`` instead.
Use ``settings=OpenAISTTService.Settings(prompt=...)`` instead.
temperature: Optional sampling temperature between 0 and 1. Defaults to 0.0.
.. deprecated:: 0.0.105
Use ``settings=OpenAISTTSettings(temperature=...)`` instead.
Use ``settings=OpenAISTTService.Settings(temperature=...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
@@ -118,7 +117,7 @@ class OpenAISTTService(BaseWhisperSTTService):
"""
# --- 1. Hardcoded defaults ---
_language = language or Language.EN
default_settings = OpenAISTTSettings(
default_settings = self.Settings(
model="gpt-4o-transcribe",
language=self.language_to_service_language(_language),
prompt=None,
@@ -127,13 +126,13 @@ class OpenAISTTService(BaseWhisperSTTService):
# --- 2. Deprecated direct-arg overrides ---
if model is not None:
_warn_deprecated_param("model", OpenAISTTSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
if prompt is not None:
_warn_deprecated_param("prompt", OpenAISTTSettings, "prompt")
self._warn_init_param_moved_to_settings("prompt", "prompt")
default_settings.prompt = prompt
if temperature is not None:
_warn_deprecated_param("temperature", OpenAISTTSettings, "temperature")
self._warn_init_param_moved_to_settings("temperature", "temperature")
default_settings.temperature = temperature
# --- 3. (no params object for this service) ---
@@ -234,7 +233,7 @@ class OpenAIRealtimeSTTService(WebsocketSTTService):
"""
Settings = OpenAIRealtimeSTTSettings
_settings: OpenAIRealtimeSTTSettings
_settings: Settings
def __init__(
self,
@@ -247,7 +246,7 @@ class OpenAIRealtimeSTTService(WebsocketSTTService):
turn_detection: Optional[Union[dict, Literal[False]]] = False,
noise_reduction: Optional[Literal["near_field", "far_field"]] = None,
should_interrupt: bool = True,
settings: Optional[OpenAIRealtimeSTTSettings] = None,
settings: Optional[Settings] = None,
ttfs_p99_latency: Optional[float] = OPENAI_REALTIME_TTFS_P99,
**kwargs,
):
@@ -259,20 +258,20 @@ class OpenAIRealtimeSTTService(WebsocketSTTService):
``"gpt-4o-transcribe"`` and ``"gpt-4o-mini-transcribe"``.
.. deprecated:: 0.0.105
Use ``settings=OpenAIRealtimeSTTSettings(model=...)`` instead.
Use ``settings=OpenAIRealtimeSTTService.Settings(model=...)`` instead.
base_url: WebSocket base URL for the Realtime API.
Defaults to ``"wss://api.openai.com/v1/realtime"``.
language: Language of the audio input. Defaults to English.
.. deprecated:: 0.0.105
Use ``settings=OpenAIRealtimeSTTSettings(language=...)`` instead.
Use ``settings=OpenAIRealtimeSTTService.Settings(language=...)`` instead.
prompt: Optional prompt text to guide transcription style
or provide keyword hints.
.. deprecated:: 0.0.105
Use ``settings=OpenAIRealtimeSTTSettings(prompt=...)`` instead.
Use ``settings=OpenAIRealtimeSTTService.Settings(prompt=...)`` instead.
turn_detection: Server-side VAD configuration. Defaults to
``False`` (disabled), which relies on a local VAD
@@ -284,7 +283,7 @@ class OpenAIRealtimeSTTService(WebsocketSTTService):
microphones, or ``None`` to disable.
.. deprecated:: 0.0.106
Use ``settings=OpenAIRealtimeSTTSettings(noise_reduction=...)`` instead.
Use ``settings=OpenAIRealtimeSTTService.Settings(noise_reduction=...)`` instead.
should_interrupt: Whether to interrupt bot output when
speech is detected by server-side VAD. Only applies when
turn detection is enabled. Defaults to True.
@@ -302,7 +301,7 @@ class OpenAIRealtimeSTTService(WebsocketSTTService):
)
# --- 1. Hardcoded defaults ---
default_settings = OpenAIRealtimeSTTSettings(
default_settings = self.Settings(
model="gpt-4o-transcribe",
language=Language.EN,
prompt=None,
@@ -311,16 +310,16 @@ class OpenAIRealtimeSTTService(WebsocketSTTService):
# --- 2. Deprecated direct-arg overrides ---
if model is not None:
_warn_deprecated_param("model", OpenAIRealtimeSTTSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
if language is not None and language != Language.EN:
_warn_deprecated_param("language", OpenAIRealtimeSTTSettings, "language")
self._warn_init_param_moved_to_settings("language", "language")
default_settings.language = language
if prompt is not None:
_warn_deprecated_param("prompt", OpenAIRealtimeSTTSettings, "prompt")
self._warn_init_param_moved_to_settings("prompt", "prompt")
default_settings.prompt = prompt
if noise_reduction is not None:
_warn_deprecated_param("noise_reduction", OpenAIRealtimeSTTSettings, "noise_reduction")
self._warn_init_param_moved_to_settings("noise_reduction", "noise_reduction")
default_settings.noise_reduction = noise_reduction
# --- 3. (no params object for this service) ---
@@ -376,7 +375,7 @@ class OpenAIRealtimeSTTService(WebsocketSTTService):
Sends a ``session.update`` to the server when the session is active.
Args:
delta: A :class:`STTSettings` (or ``OpenAIRealtimeSTTSettings``) delta.
delta: A :class:`STTSettings` (or ``OpenAIRealtimeSTTService.Settings``) delta.
Returns:
Dict mapping changed field names to their previous values.

View File

@@ -23,7 +23,7 @@ from pipecat.frames.frames import (
StartFrame,
TTSAudioRawFrame,
)
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven
from pipecat.services.tts_service import TTSService
from pipecat.utils.tracing.service_decorators import traced_tts
@@ -82,7 +82,7 @@ class OpenAITTSService(TTSService):
"""
Settings = OpenAITTSSettings
_settings: OpenAITTSSettings
_settings: Settings
OPENAI_SAMPLE_RATE = 24000 # OpenAI TTS always outputs at 24kHz
@@ -90,7 +90,7 @@ class OpenAITTSService(TTSService):
"""Input parameters for OpenAI TTS configuration.
.. deprecated:: 0.0.105
Use ``settings=OpenAITTSSettings(...)`` instead.
Use ``settings=OpenAITTSService.Settings(...)`` instead.
Parameters:
instructions: Instructions to guide voice synthesis behavior.
@@ -111,7 +111,7 @@ class OpenAITTSService(TTSService):
instructions: Optional[str] = None,
speed: Optional[float] = None,
params: Optional[InputParams] = None,
settings: Optional[OpenAITTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize OpenAI TTS service.
@@ -122,28 +122,28 @@ class OpenAITTSService(TTSService):
voice: Voice ID to use for synthesis. Defaults to "alloy".
.. deprecated:: 0.0.105
Use ``settings=OpenAITTSSettings(voice=...)`` instead.
Use ``settings=OpenAITTSService.Settings(voice=...)`` instead.
model: TTS model to use. Defaults to "gpt-4o-mini-tts".
.. deprecated:: 0.0.105
Use ``settings=OpenAITTSSettings(model=...)`` instead.
Use ``settings=OpenAITTSService.Settings(model=...)`` instead.
sample_rate: Output audio sample rate in Hz. If None, uses OpenAI's default 24kHz.
instructions: Optional instructions to guide voice synthesis behavior.
.. deprecated:: 0.0.105
Use ``settings=OpenAITTSSettings(instructions=...)`` instead.
Use ``settings=OpenAITTSService.Settings(instructions=...)`` instead.
speed: Voice speed control (0.25 to 4.0, default 1.0).
.. deprecated:: 0.0.105
Use ``settings=OpenAITTSSettings(speed=...)`` instead.
Use ``settings=OpenAITTSService.Settings(speed=...)`` instead.
params: Optional synthesis controls (acting instructions, speed, ...).
.. deprecated:: 0.0.105
Use ``settings=OpenAITTSSettings(...)`` instead.
Use ``settings=OpenAITTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
@@ -156,7 +156,7 @@ class OpenAITTSService(TTSService):
)
# 1. Initialize default_settings with hardcoded defaults
default_settings = OpenAITTSSettings(
default_settings = self.Settings(
model="gpt-4o-mini-tts",
voice="alloy",
language=None,
@@ -166,21 +166,21 @@ class OpenAITTSService(TTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice is not None:
_warn_deprecated_param("voice", OpenAITTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice", "voice")
default_settings.voice = voice
if model is not None:
_warn_deprecated_param("model", OpenAITTSSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
if instructions is not None:
_warn_deprecated_param("instructions", OpenAITTSSettings, "instructions")
self._warn_init_param_moved_to_settings("instructions", "instructions")
default_settings.instructions = instructions
if speed is not None:
_warn_deprecated_param("speed", OpenAITTSSettings, "speed")
self._warn_init_param_moved_to_settings("speed", "speed")
default_settings.speed = speed
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", OpenAITTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
if params.instructions is not None:
default_settings.instructions = params.instructions

View File

@@ -11,7 +11,7 @@ from dataclasses import dataclass
from loguru import logger
from .openai import OpenAIRealtimeBetaLLMService, OpenAIRealtimeBetaLLMSettings
from .openai import OpenAIRealtimeBetaLLMService
try:
from websockets.asyncio.client import connect as websocket_connect
@@ -24,7 +24,7 @@ except ModuleNotFoundError as e:
@dataclass
class AzureRealtimeBetaLLMSettings(OpenAIRealtimeBetaLLMSettings):
class AzureRealtimeBetaLLMSettings(OpenAIRealtimeBetaLLMService.Settings):
"""Settings for AzureRealtimeBetaLLMService."""
pass
@@ -43,7 +43,7 @@ class AzureRealtimeBetaLLMService(OpenAIRealtimeBetaLLMService):
"""
Settings = AzureRealtimeBetaLLMSettings
_settings: AzureRealtimeBetaLLMSettings
_settings: Settings
def __init__(
self,

View File

@@ -54,7 +54,7 @@ from pipecat.processors.aggregators.openai_llm_context import (
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.llm_service import FunctionCallFromLLM, LLMService
from pipecat.services.openai.llm import OpenAIContextAggregatorPair
from pipecat.services.settings import LLMSettings, _warn_deprecated_param
from pipecat.services.settings import LLMSettings
from pipecat.transcriptions.language import Language
from pipecat.utils.time import time_now_iso8601
from pipecat.utils.tracing.service_decorators import traced_openai_realtime, traced_stt
@@ -112,7 +112,7 @@ class OpenAIRealtimeBetaLLMService(LLMService):
"""
Settings = OpenAIRealtimeBetaLLMSettings
_settings: OpenAIRealtimeBetaLLMSettings
_settings: Settings
# Overriding the default adapter to use the OpenAIRealtimeLLMAdapter one.
adapter_class = OpenAIRealtimeLLMAdapter
@@ -124,7 +124,7 @@ class OpenAIRealtimeBetaLLMService(LLMService):
model: Optional[str] = None,
base_url: str = "wss://api.openai.com/v1/realtime",
session_properties: Optional[events.SessionProperties] = None,
settings: Optional[OpenAIRealtimeBetaLLMSettings] = None,
settings: Optional[Settings] = None,
start_audio_paused: bool = False,
send_transcription_frames: bool = True,
**kwargs,
@@ -136,7 +136,7 @@ class OpenAIRealtimeBetaLLMService(LLMService):
model: OpenAI model name.
.. deprecated:: 0.0.105
Use ``settings=OpenAIRealtimeBetaLLMSettings(model=...)`` instead.
Use ``settings=OpenAIRealtimeBetaLLMService.Settings(model=...)`` instead.
base_url: WebSocket base URL for the realtime API.
Defaults to "wss://api.openai.com/v1/realtime".
@@ -157,7 +157,7 @@ class OpenAIRealtimeBetaLLMService(LLMService):
)
# 1. Initialize default_settings with hardcoded defaults
default_settings = OpenAIRealtimeBetaLLMSettings(
default_settings = self.Settings(
model="gpt-4o-realtime-preview-2025-06-03",
system_instruction=None,
temperature=None,
@@ -173,7 +173,7 @@ class OpenAIRealtimeBetaLLMService(LLMService):
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", OpenAIRealtimeBetaLLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. Apply settings delta (canonical API, always wins)
if settings is not None:

View File

@@ -16,9 +16,8 @@ from typing import Dict, Optional
from loguru import logger
from pipecat.adapters.services.open_ai_adapter import OpenAILLMInvocationParams
from pipecat.services.openai.base_llm import OpenAILLMSettings
from pipecat.services.openai.base_llm import BaseOpenAILLMService
from pipecat.services.openai.llm import OpenAILLMService
from pipecat.services.settings import _warn_deprecated_param
try:
from openpipe import AsyncOpenAI as OpenPipeAI
@@ -29,7 +28,7 @@ except ModuleNotFoundError as e:
@dataclass
class OpenPipeLLMSettings(OpenAILLMSettings):
class OpenPipeLLMSettings(BaseOpenAILLMService.Settings):
"""Settings for OpenPipeLLMService."""
pass
@@ -44,7 +43,7 @@ class OpenPipeLLMService(OpenAILLMService):
"""
Settings = OpenPipeLLMSettings
_settings: OpenPipeLLMSettings
_settings: Settings
def __init__(
self,
@@ -55,7 +54,7 @@ class OpenPipeLLMService(OpenAILLMService):
openpipe_api_key: Optional[str] = None,
openpipe_base_url: str = "https://app.openpipe.ai/api/v1",
tags: Optional[Dict[str, str]] = None,
settings: Optional[OpenPipeLLMSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize OpenPipe LLM service.
@@ -64,7 +63,7 @@ class OpenPipeLLMService(OpenAILLMService):
model: The model name to use. Defaults to "gpt-4.1".
.. deprecated:: 0.0.105
Use ``settings=OpenAILLMSettings(model=...)`` instead.
Use ``settings=OpenPipeLLMService.Settings(model=...)`` instead.
api_key: OpenAI API key for authentication. If None, reads from environment.
base_url: Custom OpenAI API endpoint URL. Uses default if None.
@@ -76,11 +75,11 @@ class OpenPipeLLMService(OpenAILLMService):
**kwargs: Additional arguments passed to parent OpenAILLMService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = OpenPipeLLMSettings(model="gpt-4.1")
default_settings = self.Settings(model="gpt-4.1")
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", OpenPipeLLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. (No step 3, as there's no params object to apply)

View File

@@ -15,13 +15,12 @@ from typing import Any, Dict, Optional
from loguru import logger
from pipecat.services.openai.base_llm import OpenAILLMSettings
from pipecat.services.openai.base_llm import BaseOpenAILLMService
from pipecat.services.openai.llm import OpenAILLMService
from pipecat.services.settings import _warn_deprecated_param
@dataclass
class OpenRouterLLMSettings(OpenAILLMSettings):
class OpenRouterLLMSettings(BaseOpenAILLMService.Settings):
"""Settings for OpenRouterLLMService."""
pass
@@ -35,7 +34,7 @@ class OpenRouterLLMService(OpenAILLMService):
"""
Settings = OpenRouterLLMSettings
_settings: OpenRouterLLMSettings
_settings: Settings
def __init__(
self,
@@ -43,7 +42,7 @@ class OpenRouterLLMService(OpenAILLMService):
api_key: Optional[str] = None,
model: Optional[str] = None,
base_url: str = "https://openrouter.ai/api/v1",
settings: Optional[OpenRouterLLMSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the OpenRouter LLM service.
@@ -54,7 +53,7 @@ class OpenRouterLLMService(OpenAILLMService):
model: The model identifier to use. Defaults to "openai/gpt-4o-2024-11-20".
.. deprecated:: 0.0.105
Use ``settings=OpenAILLMSettings(model=...)`` instead.
Use ``settings=OpenRouterLLMService.Settings(model=...)`` instead.
base_url: The base URL for OpenRouter API. Defaults to "https://openrouter.ai/api/v1".
settings: Runtime-updatable settings. When provided alongside deprecated
@@ -62,11 +61,11 @@ class OpenRouterLLMService(OpenAILLMService):
**kwargs: Additional keyword arguments passed to OpenAILLMService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = OpenRouterLLMSettings(model="openai/gpt-4o-2024-11-20")
default_settings = self.Settings(model="openai/gpt-4o-2024-11-20")
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", OpenRouterLLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. (No step 3, as there's no params object to apply)

View File

@@ -18,13 +18,12 @@ from pipecat.adapters.services.open_ai_adapter import OpenAILLMInvocationParams
from pipecat.metrics.metrics import LLMTokenUsage
from pipecat.processors.aggregators.llm_context import LLMContext
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
from pipecat.services.openai.base_llm import OpenAILLMSettings
from pipecat.services.openai.base_llm import BaseOpenAILLMService
from pipecat.services.openai.llm import OpenAILLMService
from pipecat.services.settings import _warn_deprecated_param
@dataclass
class PerplexityLLMSettings(OpenAILLMSettings):
class PerplexityLLMSettings(BaseOpenAILLMService.Settings):
"""Settings for PerplexityLLMService."""
pass
@@ -39,7 +38,7 @@ class PerplexityLLMService(OpenAILLMService):
"""
Settings = PerplexityLLMSettings
_settings: PerplexityLLMSettings
_settings: Settings
def __init__(
self,
@@ -47,7 +46,7 @@ class PerplexityLLMService(OpenAILLMService):
api_key: str,
base_url: str = "https://api.perplexity.ai",
model: Optional[str] = None,
settings: Optional[PerplexityLLMSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Perplexity LLM service.
@@ -58,18 +57,18 @@ class PerplexityLLMService(OpenAILLMService):
model: The model identifier to use. Defaults to "sonar".
.. deprecated:: 0.0.105
Use ``settings=OpenAILLMSettings(model=...)`` instead.
Use ``settings=PerplexityLLMService.Settings(model=...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional keyword arguments passed to OpenAILLMService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = PerplexityLLMSettings(model="sonar")
default_settings = self.Settings(model="sonar")
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", PerplexityLLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. (No step 3, as there's no params object to apply)

View File

@@ -19,7 +19,7 @@ from pipecat.frames.frames import (
Frame,
TTSStoppedFrame,
)
from pipecat.services.settings import TTSSettings, _warn_deprecated_param
from pipecat.services.settings import TTSSettings
from pipecat.services.tts_service import TTSService
from pipecat.utils.tracing.service_decorators import traced_tts
@@ -48,7 +48,7 @@ class PiperTTSService(TTSService):
"""
Settings = PiperTTSSettings
_settings: PiperTTSSettings
_settings: Settings
def __init__(
self,
@@ -57,7 +57,7 @@ class PiperTTSService(TTSService):
download_dir: Optional[Path] = None,
force_redownload: bool = False,
use_cuda: bool = False,
settings: Optional[PiperTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Piper TTS service.
@@ -66,7 +66,7 @@ class PiperTTSService(TTSService):
voice_id: Piper voice model identifier (e.g. `en_US-ryan-high`).
.. deprecated:: 0.0.105
Use ``settings=PiperTTSSettings(voice=...)`` instead.
Use ``settings=PiperTTSService.Settings(voice=...)`` instead.
download_dir: Directory for storing voice model files. Defaults to
the current working directory.
@@ -77,11 +77,11 @@ class PiperTTSService(TTSService):
**kwargs: Additional arguments passed to the parent `TTSService`.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = PiperTTSSettings(model=None, voice=None, language=None)
default_settings = self.Settings(model=None, voice=None, language=None)
# 2. Apply direct init arg overrides (deprecated)
if voice_id is not None:
_warn_deprecated_param("voice_id", PiperTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
# 3. (No step 3, as there's no params object to apply)
@@ -121,7 +121,7 @@ class PiperTTSService(TTSService):
"""
return True
async def _update_settings(self, delta: PiperTTSSettings) -> dict[str, Any]:
async def _update_settings(self, delta: Settings) -> dict[str, Any]:
"""Apply a settings delta.
Settings are stored but not applied to the active connection.
@@ -202,7 +202,7 @@ class PiperHttpTTSService(TTSService):
"""
Settings = PiperHttpTTSSettings
_settings: PiperHttpTTSSettings
_settings: Settings
def __init__(
self,
@@ -210,7 +210,7 @@ class PiperHttpTTSService(TTSService):
base_url: str,
aiohttp_session: aiohttp.ClientSession,
voice_id: Optional[str] = None,
settings: Optional[PiperHttpTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Piper TTS service.
@@ -221,18 +221,18 @@ class PiperHttpTTSService(TTSService):
voice_id: Piper voice model identifier (e.g. `en_US-ryan-high`).
.. deprecated:: 0.0.105
Use ``settings=PiperHttpTTSSettings(voice=...)`` instead.
Use ``settings=PiperHttpTTSService.Settings(voice=...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional arguments passed to the parent TTSService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = PiperHttpTTSSettings(model=None, voice=None, language=None)
default_settings = self.Settings(model=None, voice=None, language=None)
# 2. Apply direct init arg overrides (deprecated)
if voice_id is not None:
_warn_deprecated_param("voice_id", PiperHttpTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
# 3. (No step 3, as there's no params object to apply)

View File

@@ -11,13 +11,12 @@ from typing import Optional
from loguru import logger
from pipecat.services.openai.base_llm import OpenAILLMSettings
from pipecat.services.openai.base_llm import BaseOpenAILLMService
from pipecat.services.openai.llm import OpenAILLMService
from pipecat.services.settings import _warn_deprecated_param
@dataclass
class QwenLLMSettings(OpenAILLMSettings):
class QwenLLMSettings(BaseOpenAILLMService.Settings):
"""Settings for QwenLLMService."""
pass
@@ -31,7 +30,7 @@ class QwenLLMService(OpenAILLMService):
"""
Settings = QwenLLMSettings
_settings: QwenLLMSettings
_settings: Settings
def __init__(
self,
@@ -39,7 +38,7 @@ class QwenLLMService(OpenAILLMService):
api_key: str,
base_url: str = "https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
model: Optional[str] = None,
settings: Optional[QwenLLMSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Qwen LLM service.
@@ -50,18 +49,18 @@ class QwenLLMService(OpenAILLMService):
model: The model identifier to use. Defaults to "qwen-plus".
.. deprecated:: 0.0.105
Use ``settings=OpenAILLMSettings(model=...)`` instead.
Use ``settings=QwenLLMService.Settings(model=...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional keyword arguments passed to OpenAILLMService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = QwenLLMSettings(model="qwen-plus")
default_settings = self.Settings(model="qwen-plus")
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", QwenLLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. (No step 3, as there's no params object to apply)

View File

@@ -23,7 +23,7 @@ from pipecat.frames.frames import (
TTSStartedFrame,
TTSStoppedFrame,
)
from pipecat.services.settings import TTSSettings, _warn_deprecated_param
from pipecat.services.settings import TTSSettings
from pipecat.services.tts_service import WebsocketTTSService
from pipecat.utils.tracing.service_decorators import traced_tts
@@ -52,7 +52,7 @@ class ResembleAITTSService(WebsocketTTSService):
"""
Settings = ResembleAITTSSettings
_settings: ResembleAITTSSettings
_settings: Settings
def __init__(
self,
@@ -63,7 +63,7 @@ class ResembleAITTSService(WebsocketTTSService):
precision: Optional[str] = "PCM_16",
output_format: Optional[str] = "wav",
sample_rate: Optional[int] = 22050,
settings: Optional[ResembleAITTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Resemble AI TTS service.
@@ -73,7 +73,7 @@ class ResembleAITTSService(WebsocketTTSService):
voice_id: Voice UUID to use for synthesis.
.. deprecated:: 0.0.105
Use ``settings=ResembleAITTSSettings(voice=...)`` instead.
Use ``settings=ResembleAITTSService.Settings(voice=...)`` instead.
url: WebSocket URL for Resemble AI TTS API.
precision: PCM bit depth (PCM_32, PCM_24, PCM_16, or MULAW).
@@ -84,7 +84,7 @@ class ResembleAITTSService(WebsocketTTSService):
**kwargs: Additional arguments passed to the parent service.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = ResembleAITTSSettings(
default_settings = self.Settings(
model=None,
voice=None,
language=None,
@@ -92,7 +92,7 @@ class ResembleAITTSService(WebsocketTTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice_id is not None:
_warn_deprecated_param("voice_id", ResembleAITTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
# 3. (No step 3, as there's no params object to apply)

View File

@@ -31,7 +31,7 @@ from pipecat.frames.frames import (
TTSStoppedFrame,
)
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven
from pipecat.services.tts_service import (
InterruptibleTTSService,
TextAggregationMode,
@@ -132,13 +132,13 @@ class RimeTTSService(WebsocketTTSService):
"""
Settings = RimeTTSSettings
_settings: RimeTTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Configuration parameters for Rime TTS service.
.. deprecated:: 0.0.105
Use ``settings=RimeTTSSettings(...)`` instead.
Use ``settings=RimeTTSService.Settings(...)`` instead.
Parameters:
language: Language for synthesis. Defaults to English.
@@ -177,7 +177,7 @@ class RimeTTSService(WebsocketTTSService):
model: Optional[str] = None,
sample_rate: Optional[int] = None,
params: Optional[InputParams] = None,
settings: Optional[RimeTTSSettings] = None,
settings: Optional[Settings] = None,
text_aggregator: Optional[BaseTextAggregator] = None,
text_aggregation_mode: Optional[TextAggregationMode] = None,
aggregate_sentences: Optional[bool] = None,
@@ -190,19 +190,19 @@ class RimeTTSService(WebsocketTTSService):
voice_id: ID of the voice to use.
.. deprecated:: 0.0.105
Use ``settings=RimeTTSSettings(voice=...)`` instead.
Use ``settings=RimeTTSService.Settings(voice=...)`` instead.
url: Rime websocket API endpoint.
model: Model ID to use for synthesis.
.. deprecated:: 0.0.105
Use ``settings=RimeTTSSettings(model=...)`` instead.
Use ``settings=RimeTTSService.Settings(model=...)`` instead.
sample_rate: Audio sample rate in Hz.
params: Additional configuration parameters.
.. deprecated:: 0.0.105
Use ``settings=RimeTTSSettings(...)`` instead.
Use ``settings=RimeTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
@@ -220,7 +220,7 @@ class RimeTTSService(WebsocketTTSService):
**kwargs: Additional arguments passed to parent class.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = RimeTTSSettings(
default_settings = self.Settings(
model="arcana",
voice=None,
language=None,
@@ -241,15 +241,15 @@ class RimeTTSService(WebsocketTTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice_id is not None:
_warn_deprecated_param("voice_id", RimeTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
if model is not None:
_warn_deprecated_param("model", RimeTTSSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", RimeTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.language = (
self.language_to_service_language(params.language) if params.language else None
@@ -663,13 +663,13 @@ class RimeHttpTTSService(TTSService):
"""
Settings = RimeTTSSettings
_settings: RimeTTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Configuration parameters for Rime HTTP TTS service.
.. deprecated:: 0.0.105
Use ``settings=RimeTTSSettings(...)`` instead.
Use ``settings=RimeHttpTTSService.Settings(...)`` instead.
Parameters:
language: Language for synthesis. Defaults to English.
@@ -696,7 +696,7 @@ class RimeHttpTTSService(TTSService):
model: Optional[str] = None,
sample_rate: Optional[int] = None,
params: Optional[InputParams] = None,
settings: Optional[RimeTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize Rime HTTP TTS service.
@@ -706,26 +706,26 @@ class RimeHttpTTSService(TTSService):
voice_id: ID of the voice to use.
.. deprecated:: 0.0.105
Use ``settings=RimeTTSSettings(voice=...)`` instead.
Use ``settings=RimeHttpTTSService.Settings(voice=...)`` instead.
aiohttp_session: Shared aiohttp session for HTTP requests.
model: Model ID to use for synthesis.
.. deprecated:: 0.0.105
Use ``settings=RimeTTSSettings(model=...)`` instead.
Use ``settings=RimeHttpTTSService.Settings(model=...)`` instead.
sample_rate: Audio sample rate in Hz.
params: Additional configuration parameters.
.. deprecated:: 0.0.105
Use ``settings=RimeTTSSettings(...)`` instead.
Use ``settings=RimeHttpTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional arguments passed to parent TTSService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = RimeTTSSettings(
default_settings = self.Settings(
model="mistv2",
voice=None,
language="eng",
@@ -744,15 +744,15 @@ class RimeHttpTTSService(TTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice_id is not None:
_warn_deprecated_param("voice_id", RimeTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
if model is not None:
_warn_deprecated_param("model", RimeTTSSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", RimeTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.language = (
self.language_to_service_language(params.language) if params.language else "eng"
@@ -888,13 +888,13 @@ class RimeNonJsonTTSService(InterruptibleTTSService):
"""
Settings = RimeNonJsonTTSSettings
_settings: RimeNonJsonTTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Configuration parameters for Rime Non-JSON WebSocket TTS service.
.. deprecated:: 0.0.105
Use ``settings=RimeNonJsonTTSSettings(...)`` instead.
Use ``settings=RimeNonJsonTTSService.Settings(...)`` instead.
Args:
language: Language for synthesis. Defaults to English.
@@ -922,7 +922,7 @@ class RimeNonJsonTTSService(InterruptibleTTSService):
audio_format: str = "pcm",
sample_rate: Optional[int] = None,
params: Optional[InputParams] = None,
settings: Optional[RimeNonJsonTTSSettings] = None,
settings: Optional[Settings] = None,
aggregate_sentences: Optional[bool] = None,
text_aggregation_mode: Optional[TextAggregationMode] = None,
**kwargs,
@@ -934,20 +934,20 @@ class RimeNonJsonTTSService(InterruptibleTTSService):
voice_id: ID of the voice to use.
.. deprecated:: 0.0.105
Use ``settings=RimeNonJsonTTSSettings(voice=...)`` instead.
Use ``settings=RimeNonJsonTTSService.Settings(voice=...)`` instead.
url: Rime websocket API endpoint.
model: Model ID to use for synthesis.
.. deprecated:: 0.0.105
Use ``settings=RimeNonJsonTTSSettings(model=...)`` instead.
Use ``settings=RimeNonJsonTTSService.Settings(model=...)`` instead.
audio_format: Audio format to use.
sample_rate: Audio sample rate in Hz.
params: Additional configuration parameters.
.. deprecated:: 0.0.105
Use ``settings=RimeNonJsonTTSSettings(...)`` instead.
Use ``settings=RimeNonJsonTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
@@ -962,7 +962,7 @@ class RimeNonJsonTTSService(InterruptibleTTSService):
**kwargs: Additional arguments passed to parent class.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = RimeNonJsonTTSSettings(
default_settings = self.Settings(
voice=None,
model="arcana",
language=None,
@@ -974,15 +974,15 @@ class RimeNonJsonTTSService(InterruptibleTTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice_id is not None:
_warn_deprecated_param("voice_id", RimeNonJsonTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
if model is not None:
_warn_deprecated_param("model", RimeNonJsonTTSSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", RimeNonJsonTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.language = (
self.language_to_service_language(params.language) if params.language else None

View File

@@ -22,14 +22,13 @@ from pipecat.metrics.metrics import LLMTokenUsage
from pipecat.processors.aggregators.llm_context import LLMContext
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
from pipecat.services.llm_service import FunctionCallFromLLM
from pipecat.services.openai.base_llm import OpenAILLMSettings
from pipecat.services.openai.base_llm import BaseOpenAILLMService
from pipecat.services.openai.llm import OpenAILLMService
from pipecat.services.settings import _warn_deprecated_param
from pipecat.utils.tracing.service_decorators import traced_llm
@dataclass
class SambaNovaLLMSettings(OpenAILLMSettings):
class SambaNovaLLMSettings(BaseOpenAILLMService.Settings):
"""Settings for SambaNovaLLMService."""
pass
@@ -43,7 +42,7 @@ class SambaNovaLLMService(OpenAILLMService): # type: ignore
"""
Settings = SambaNovaLLMSettings
_settings: SambaNovaLLMSettings
_settings: Settings
def __init__(
self,
@@ -51,7 +50,7 @@ class SambaNovaLLMService(OpenAILLMService): # type: ignore
api_key: str,
model: Optional[str] = None,
base_url: str = "https://api.sambanova.ai/v1",
settings: Optional[SambaNovaLLMSettings] = None,
settings: Optional[Settings] = None,
**kwargs: Dict[Any, Any],
) -> None:
"""Initialize SambaNova LLM service.
@@ -61,7 +60,7 @@ class SambaNovaLLMService(OpenAILLMService): # type: ignore
model: The model identifier to use. Defaults to "Llama-4-Maverick-17B-128E-Instruct".
.. deprecated:: 0.0.105
Use ``settings=OpenAILLMSettings(model=...)`` instead.
Use ``settings=SambaNovaLLMService.Settings(model=...)`` instead.
base_url: The base URL for SambaNova API. Defaults to "https://api.sambanova.ai/v1".
settings: Runtime-updatable settings. When provided alongside deprecated
@@ -69,11 +68,11 @@ class SambaNovaLLMService(OpenAILLMService): # type: ignore
**kwargs: Additional keyword arguments passed to OpenAILLMService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = SambaNovaLLMSettings(model="Llama-4-Maverick-17B-128E-Instruct")
default_settings = self.Settings(model="Llama-4-Maverick-17B-128E-Instruct")
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", SambaNovaLLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. (No step 3, as there's no params object to apply)

View File

@@ -11,18 +11,16 @@ from typing import Any, Optional
from loguru import logger
from pipecat.services.settings import _warn_deprecated_param
from pipecat.services.stt_latency import SAMBANOVA_TTFS_P99
from pipecat.services.whisper.base_stt import (
BaseWhisperSTTService,
BaseWhisperSTTSettings,
Transcription,
)
from pipecat.transcriptions.language import Language
@dataclass
class SambaNovaSTTSettings(BaseWhisperSTTSettings):
class SambaNovaSTTSettings(BaseWhisperSTTService.Settings):
"""Settings for the SambaNova STT service."""
pass
@@ -46,7 +44,7 @@ class SambaNovaSTTService(BaseWhisperSTTService): # type: ignore
language: Optional[Language] = None,
prompt: Optional[str] = None,
temperature: Optional[float] = None,
settings: Optional[SambaNovaSTTSettings] = None,
settings: Optional[Settings] = None,
ttfs_p99_latency: Optional[float] = SAMBANOVA_TTFS_P99,
**kwargs: Any,
) -> None:
@@ -56,24 +54,24 @@ class SambaNovaSTTService(BaseWhisperSTTService): # type: ignore
model: Whisper model to use.
.. deprecated:: 0.0.105
Use ``settings=SambaNovaSTTSettings(model=...)`` instead.
Use ``settings=SambaNovaSTTService.Settings(model=...)`` instead.
api_key: SambaNova API key. Defaults to None.
base_url: API base URL. Defaults to "https://api.sambanova.ai/v1".
language: Language of the audio input.
.. deprecated:: 0.0.105
Use ``settings=SambaNovaSTTSettings(language=...)`` instead.
Use ``settings=SambaNovaSTTService.Settings(language=...)`` instead.
prompt: Optional text to guide the model's style or continue a previous segment.
.. deprecated:: 0.0.105
Use ``settings=SambaNovaSTTSettings(prompt=...)`` instead.
Use ``settings=SambaNovaSTTService.Settings(prompt=...)`` instead.
temperature: Optional sampling temperature between 0 and 1.
.. deprecated:: 0.0.105
Use ``settings=SambaNovaSTTSettings(temperature=...)`` instead.
Use ``settings=SambaNovaSTTService.Settings(temperature=...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
@@ -82,7 +80,7 @@ class SambaNovaSTTService(BaseWhisperSTTService): # type: ignore
**kwargs: Additional arguments passed to `pipecat.services.whisper.base_stt.BaseWhisperSTTService`.
"""
# --- 1. Hardcoded defaults ---
default_settings = SambaNovaSTTSettings(
default_settings = self.Settings(
model="Whisper-Large-v3",
language=self.language_to_service_language(Language.EN),
prompt=None,
@@ -91,16 +89,16 @@ class SambaNovaSTTService(BaseWhisperSTTService): # type: ignore
# --- 2. Deprecated direct-arg overrides ---
if model is not None:
_warn_deprecated_param("model", SambaNovaSTTSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
if language is not None:
_warn_deprecated_param("language", SambaNovaSTTSettings, "language")
self._warn_init_param_moved_to_settings("language", "language")
default_settings.language = self.language_to_service_language(language)
if prompt is not None:
_warn_deprecated_param("prompt", SambaNovaSTTSettings, "prompt")
self._warn_init_param_moved_to_settings("prompt", "prompt")
default_settings.prompt = prompt
if temperature is not None:
_warn_deprecated_param("temperature", SambaNovaSTTSettings, "temperature")
self._warn_init_param_moved_to_settings("temperature", "temperature")
default_settings.temperature = temperature
# --- 3. (no params object for this service) ---

View File

@@ -36,7 +36,6 @@ from pipecat.services.settings import (
NOT_GIVEN,
STTSettings,
_NotGiven,
_warn_deprecated_param,
is_given,
)
from pipecat.services.stt_latency import SARVAM_TTFS_P99
@@ -172,13 +171,13 @@ class SarvamSTTService(STTService):
"""
Settings = SarvamSTTSettings
_settings: SarvamSTTSettings
_settings: Settings
class InputParams(BaseModel):
"""Configuration parameters for Sarvam STT service.
.. deprecated:: 0.0.105
Use ``settings=SarvamSTTSettings(...)`` instead.
Use ``settings=SarvamSTTService.Settings(...)`` instead.
Parameters:
language: Target language for transcription.
@@ -210,7 +209,7 @@ class SarvamSTTService(STTService):
sample_rate: Optional[int] = None,
input_audio_codec: str = "wav",
params: Optional[InputParams] = None,
settings: Optional[SarvamSTTSettings] = None,
settings: Optional[Settings] = None,
ttfs_p99_latency: Optional[float] = SARVAM_TTFS_P99,
keepalive_timeout: Optional[float] = None,
keepalive_interval: float = 5.0,
@@ -223,7 +222,7 @@ class SarvamSTTService(STTService):
model: Sarvam model to use for transcription.
.. deprecated:: 0.0.105
Use ``settings=SarvamSTTSettings(model=...)`` instead.
Use ``settings=SarvamSTTService.Settings(model=...)`` instead.
mode: Mode of operation. Options: transcribe, translate, verbatim,
translit, codemix. Only applicable to models that support it
@@ -233,7 +232,7 @@ class SarvamSTTService(STTService):
params: Configuration parameters for Sarvam STT service.
.. deprecated:: 0.0.105
Use ``settings=SarvamSTTSettings(...)`` instead.
Use ``settings=SarvamSTTService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
@@ -245,7 +244,7 @@ class SarvamSTTService(STTService):
**kwargs: Additional arguments passed to the parent STTService.
"""
# --- 1. Hardcoded defaults ---
default_settings = SarvamSTTSettings(
default_settings = self.Settings(
model="saarika:v2.5",
language=None,
prompt=None,
@@ -255,12 +254,12 @@ class SarvamSTTService(STTService):
# --- 2. Deprecated direct-arg overrides ---
if model is not None:
_warn_deprecated_param("model", SarvamSTTSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# --- 3. Deprecated params overrides ---
if params is not None:
_warn_deprecated_param("params", SarvamSTTSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.language = params.language
default_settings.prompt = params.prompt
@@ -374,7 +373,7 @@ class SarvamSTTService(STTService):
"""Apply a settings delta, validate, sync state, and reconnect.
Args:
delta: A :class:`STTSettings` (or ``SarvamSTTSettings``) delta.
delta: A :class:`STTSettings` (or ``SarvamSTTService.Settings``) delta.
Returns:
Dict mapping changed field names to their previous values.
@@ -389,11 +388,7 @@ class SarvamSTTService(STTService):
f"Model '{self._settings.model}' does not support language parameter "
"(auto-detects language)."
)
if (
isinstance(delta, SarvamSTTSettings)
and is_given(delta.prompt)
and delta.prompt is not None
):
if isinstance(delta, self.Settings) and is_given(delta.prompt) and delta.prompt is not None:
if not self._config.supports_prompt:
raise ValueError(
f"Model '{self._settings.model}' does not support prompt parameter."
@@ -417,7 +412,7 @@ class SarvamSTTService(STTService):
"""Set the transcription/translation prompt and reconnect.
.. deprecated:: 0.0.104
Use ``STTUpdateSettingsFrame(SarvamSTTSettings(prompt=...))`` instead.
Use ``STTUpdateSettingsFrame(SarvamSTTService.Settings(prompt=...))`` instead.
Args:
prompt: Prompt text to guide transcription/translation style/context.
@@ -430,7 +425,7 @@ class SarvamSTTService(STTService):
warnings.simplefilter("always")
warnings.warn(
f"{self.__class__.__name__}.set_prompt() is deprecated. "
"Use STTUpdateSettingsFrame(SarvamSTTSettings(prompt=...)) instead.",
"Use STTUpdateSettingsFrame(self.Settings(prompt=...)) instead.",
DeprecationWarning,
stacklevel=2,
)

View File

@@ -60,7 +60,7 @@ from pipecat.frames.frames import (
)
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.sarvam._sdk import sdk_headers
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven
from pipecat.services.tts_service import InterruptibleTTSService, TextAggregationMode, TTSService
from pipecat.transcriptions.language import Language, resolve_language
from pipecat.utils.tracing.service_decorators import traced_tts
@@ -284,7 +284,7 @@ class SarvamHttpTTSSettings(TTSSettings):
class SarvamTTSSettings(SarvamHttpTTSSettings):
"""Settings for SarvamTTSService.
Extends :class:`SarvamHttpTTSSettings` with WebSocket-specific buffering parameters.
Extends :class:`SarvamHttpTTSService.Settings` with WebSocket-specific buffering parameters.
Parameters:
min_buffer_size: Minimum characters to buffer before generating audio.
@@ -352,13 +352,13 @@ class SarvamHttpTTSService(TTSService):
"""
Settings = SarvamHttpTTSSettings
_settings: SarvamHttpTTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Input parameters for Sarvam TTS configuration.
.. deprecated:: 0.0.105
Use ``SarvamHttpTTSSettings`` directly via the ``settings`` parameter instead.
Use ``SarvamHttpTTSService.Settings`` directly via the ``settings`` parameter instead.
Parameters:
language: Language for synthesis. Defaults to English (India).
@@ -416,7 +416,7 @@ class SarvamHttpTTSService(TTSService):
base_url: str = "https://api.sarvam.ai",
sample_rate: Optional[int] = None,
params: Optional[InputParams] = None,
settings: Optional[SarvamHttpTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Sarvam TTS service.
@@ -427,14 +427,14 @@ class SarvamHttpTTSService(TTSService):
voice_id: Speaker voice ID. If None, uses model-appropriate default.
.. deprecated:: 0.0.105
Use ``settings=SarvamHttpTTSSettings(voice=...)`` instead.
Use ``settings=SarvamHttpTTSService.Settings(voice=...)`` instead.
model: TTS model to use. Options:
- "bulbul:v2" (default): Standard model with pitch/loudness support
- "bulbul:v3-beta": Advanced model with temperature control
.. deprecated:: 0.0.105
Use ``settings=SarvamHttpTTSSettings(model=...)`` instead.
Use ``settings=SarvamHttpTTSService.Settings(model=...)`` instead.
base_url: Sarvam AI API base URL. Defaults to "https://api.sarvam.ai".
sample_rate: Audio sample rate in Hz (8000, 16000, 22050, 24000).
@@ -442,14 +442,14 @@ class SarvamHttpTTSService(TTSService):
params: Additional voice and preprocessing parameters. If None, uses defaults.
.. deprecated:: 0.0.105
Use ``settings=SarvamHttpTTSSettings(...)`` instead.
Use ``settings=SarvamHttpTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional arguments passed to parent TTSService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = SarvamHttpTTSSettings(
default_settings = self.Settings(
model="bulbul:v2",
voice="anushka",
language="en-IN",
@@ -462,15 +462,15 @@ class SarvamHttpTTSService(TTSService):
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", SarvamHttpTTSSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
if voice_id is not None:
_warn_deprecated_param("voice_id", SarvamHttpTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", SarvamHttpTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
if params.language is not None:
default_settings.language = (
@@ -719,13 +719,13 @@ class SarvamTTSService(InterruptibleTTSService):
"""
Settings = SarvamTTSSettings
_settings: SarvamTTSSettings
_settings: Settings
class InputParams(BaseModel):
"""Configuration parameters for Sarvam TTS WebSocket service.
.. deprecated:: 0.0.105
Use ``SarvamTTSSettings`` directly via the ``settings`` parameter instead.
Use ``SarvamTTSService.Settings`` directly via the ``settings`` parameter instead.
Parameters:
pitch: Voice pitch adjustment (-0.75 to 0.75). Defaults to 0.0.
@@ -819,7 +819,7 @@ class SarvamTTSService(InterruptibleTTSService):
text_aggregation_mode: Optional[TextAggregationMode] = None,
sample_rate: Optional[int] = None,
params: Optional[InputParams] = None,
settings: Optional[SarvamTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Sarvam TTS service with voice and transport configuration.
@@ -831,12 +831,12 @@ class SarvamTTSService(InterruptibleTTSService):
- "bulbul:v3-beta": Advanced model with temperature control
.. deprecated:: 0.0.105
Use ``settings=SarvamTTSSettings(model=...)`` instead.
Use ``settings=SarvamTTSService.Settings(model=...)`` instead.
voice_id: Speaker voice ID. If None, uses model-appropriate default.
.. deprecated:: 0.0.105
Use ``settings=SarvamTTSSettings(voice=...)`` instead.
Use ``settings=SarvamTTSService.Settings(voice=...)`` instead.
url: WebSocket URL for the TTS backend (default production URL).
aggregate_sentences: Deprecated. Use text_aggregation_mode instead.
@@ -850,7 +850,7 @@ class SarvamTTSService(InterruptibleTTSService):
params: Optional input parameters to override defaults.
.. deprecated:: 0.0.105
Use ``settings=SarvamTTSSettings(...)`` instead.
Use ``settings=SarvamTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
@@ -859,7 +859,7 @@ class SarvamTTSService(InterruptibleTTSService):
See https://docs.sarvam.ai/api-reference-docs/text-to-speech/stream
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = SarvamTTSSettings(
default_settings = self.Settings(
model="bulbul:v2",
voice="anushka",
language="en-IN",
@@ -874,10 +874,10 @@ class SarvamTTSService(InterruptibleTTSService):
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", SarvamTTSSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
if voice_id is not None:
_warn_deprecated_param("voice_id", SarvamTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
# Init-only audio format fields (not runtime-updatable)
@@ -886,7 +886,7 @@ class SarvamTTSService(InterruptibleTTSService):
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", SarvamTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
if params.language is not None:
default_settings.language = (

View File

@@ -37,7 +37,6 @@ Key helpers:
from __future__ import annotations
import copy
import warnings
from dataclasses import dataclass, field, fields
from typing import TYPE_CHECKING, Any, ClassVar, Dict, Mapping, Optional, Type, TypeVar
@@ -49,45 +48,6 @@ if TYPE_CHECKING:
from pipecat.turns.user_turn_completion_mixin import UserTurnCompletionConfig
# ---------------------------------------------------------------------------
# Deprecation helper
# ---------------------------------------------------------------------------
def _warn_deprecated_param(
param_name: str,
settings_class: type,
settings_field: str | None = None,
stacklevel: int = 3,
):
"""Emit DeprecationWarning for a deprecated init parameter.
Args:
param_name: Name of the deprecated parameter.
settings_class: The settings class to use instead.
settings_field: Specific field on the settings class, if different
from *param_name*.
stacklevel: Stack depth for the warning. Default ``3`` targets
the caller's caller (i.e. user code that instantiated the service).
"""
settings_class_name = settings_class.__name__
if settings_field:
msg = (
f"The `{param_name}` parameter is deprecated. "
f"Use `settings={settings_class_name}({settings_field}=...)` instead. "
f"If both are provided, `settings` takes precedence."
)
else:
msg = (
f"The `{param_name}` parameter is deprecated. "
f"Use `settings={settings_class_name}(...)` instead. "
f"If both are provided, `settings` takes precedence."
)
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn(msg, DeprecationWarning, stacklevel=stacklevel)
# ---------------------------------------------------------------------------
# NOT_GIVEN sentinel
# ---------------------------------------------------------------------------

View File

@@ -24,7 +24,7 @@ from pipecat.frames.frames import (
VADUserStoppedSpeakingFrame,
)
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven
from pipecat.services.stt_latency import SONIOX_TTFS_P99
from pipecat.services.stt_service import WebsocketSTTService
from pipecat.transcriptions.language import Language
@@ -80,7 +80,7 @@ class SonioxInputParams(BaseModel):
"""Real-time transcription settings.
.. deprecated:: 0.0.105
Use ``settings=SonioxSTTSettings(...)`` instead.
Use ``settings=SonioxSTTService.Settings(...)`` instead.
See Soniox WebSocket API documentation for more details:
https://soniox.com/docs/speech-to-text/api-reference/websocket-api#configuration-parameters
@@ -175,7 +175,7 @@ class SonioxSTTService(WebsocketSTTService):
"""
Settings = SonioxSTTSettings
_settings: SonioxSTTSettings
_settings: Settings
def __init__(
self,
@@ -188,7 +188,7 @@ class SonioxSTTService(WebsocketSTTService):
num_channels: int = 1,
params: Optional[SonioxInputParams] = None,
vad_force_turn_endpoint: bool = True,
settings: Optional[SonioxSTTSettings] = None,
settings: Optional[Settings] = None,
ttfs_p99_latency: Optional[float] = SONIOX_TTFS_P99,
**kwargs,
):
@@ -201,7 +201,7 @@ class SonioxSTTService(WebsocketSTTService):
model: Soniox model to use for transcription.
.. deprecated:: 0.0.105
Use ``settings=SonioxSTTSettings(model=...)`` instead.
Use ``settings=SonioxSTTService.Settings(model=...)`` instead.
audio_format: Audio format for transcription. Defaults to ``"pcm_s16le"``.
num_channels: Number of audio channels. Defaults to 1.
@@ -209,7 +209,7 @@ class SonioxSTTService(WebsocketSTTService):
speaker diarization.
.. deprecated:: 0.0.105
Use ``settings=SonioxSTTSettings(...)`` instead.
Use ``settings=SonioxSTTService.Settings(...)`` instead.
vad_force_turn_endpoint: Listen to `VADUserStoppedSpeakingFrame` to send finalize message to Soniox.
If disabled, Soniox will detect the end of the speech. Defaults to True.
@@ -220,7 +220,7 @@ class SonioxSTTService(WebsocketSTTService):
**kwargs: Additional arguments passed to the STTService.
"""
# --- 1. Hardcoded defaults ---
default_settings = SonioxSTTSettings(
default_settings = self.Settings(
model="stt-rt-v4",
language=None,
language_hints=None,
@@ -233,12 +233,12 @@ class SonioxSTTService(WebsocketSTTService):
# --- 2. Deprecated direct-arg overrides ---
if model is not None:
_warn_deprecated_param("model", SonioxSTTSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# --- 3. Deprecated params overrides ---
if params is not None:
_warn_deprecated_param("params", SonioxSTTSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.model = params.model
if params.audio_format is not None:
@@ -297,7 +297,7 @@ class SonioxSTTService(WebsocketSTTService):
await super().start(frame)
await self._connect()
async def _update_settings(self, delta: SonioxSTTSettings) -> dict[str, Any]:
async def _update_settings(self, delta: Settings) -> dict[str, Any]:
"""Apply settings delta and reconnect if anything changed.
Args:

View File

@@ -33,7 +33,7 @@ from pipecat.frames.frames import (
VADUserStoppedSpeakingFrame,
)
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven
from pipecat.services.stt_latency import SPEECHMATICS_TTFS_P99
from pipecat.services.stt_service import STTService
from pipecat.transcriptions.language import Language, resolve_language
@@ -176,7 +176,7 @@ class SpeechmaticsSTTService(STTService):
"""
Settings = SpeechmaticsSTTSettings
_settings: SpeechmaticsSTTSettings
_settings: Settings
# Export related classes as class attributes
TurnDetectionMode = TurnDetectionMode
@@ -343,7 +343,7 @@ class SpeechmaticsSTTService(STTService):
"""Update parameters for Speechmatics STT service.
.. deprecated:: 0.0.104
Use ``SpeechmaticsSTTSettings`` with ``STTUpdateSettingsFrame`` instead.
Use ``SpeechmaticsSTTService.Settings`` with ``STTUpdateSettingsFrame`` instead.
Parameters:
focus_speakers: List of speaker IDs to focus on. When enabled, only these speakers are
@@ -380,7 +380,7 @@ class SpeechmaticsSTTService(STTService):
encoding: AudioEncoding = AudioEncoding.PCM_S16LE,
params: InputParams | None = None,
should_interrupt: bool = True,
settings: SpeechmaticsSTTSettings | None = None,
settings: Settings | None = None,
ttfs_p99_latency: float | None = SPEECHMATICS_TTFS_P99,
**kwargs,
):
@@ -396,7 +396,7 @@ class SpeechmaticsSTTService(STTService):
params: Input parameters for the service.
.. deprecated:: 0.0.105
Use ``settings=SpeechmaticsSTTSettings(...)`` instead.
Use ``settings=SpeechmaticsSTTService.Settings(...)`` instead.
should_interrupt: Determine whether the bot should be interrupted when Speechmatics turn_detection_mode is configured to detect user speech.
settings: Runtime-updatable settings. When provided alongside deprecated
@@ -424,7 +424,7 @@ class SpeechmaticsSTTService(STTService):
self._check_deprecated_args(kwargs, _params)
# --- 1. Hardcoded defaults ---
default_settings = SpeechmaticsSTTSettings(
default_settings = self.Settings(
model=None, # Will be resolved from operating_point after config is built
language=Language.EN,
domain=None,
@@ -454,7 +454,7 @@ class SpeechmaticsSTTService(STTService):
# --- 3. Deprecated params overrides ---
if params is not None:
_warn_deprecated_param("params", SpeechmaticsSTTSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.language = _params.language
default_settings.domain = _params.domain
@@ -537,11 +537,11 @@ class SpeechmaticsSTTService(STTService):
await super().start(frame)
await self._connect()
async def _update_settings(self, delta: SpeechmaticsSTTSettings) -> dict[str, Any]:
async def _update_settings(self, delta: Settings) -> dict[str, Any]:
"""Apply settings delta, reconnecting only when necessary.
Fields are classified into three categories (see
``SpeechmaticsSTTSettings``):
``SpeechmaticsSTTService.Settings``):
* **HOT_FIELDS** diarization speaker settings that can be pushed
to a live Speechmatics connection without reconnecting.
@@ -561,7 +561,7 @@ class SpeechmaticsSTTService(STTService):
if not changed:
return changed
no_reconnect = SpeechmaticsSTTSettings.HOT_FIELDS | SpeechmaticsSTTSettings.LOCAL_FIELDS
no_reconnect = self.Settings.HOT_FIELDS | self.Settings.LOCAL_FIELDS
needs_reconnect = bool(changed.keys() - no_reconnect)
if needs_reconnect:
@@ -571,7 +571,7 @@ class SpeechmaticsSTTService(STTService):
self._config = self._build_config(self._settings)
await self._disconnect()
await self._connect()
elif changed.keys() & SpeechmaticsSTTSettings.HOT_FIELDS:
elif changed.keys() & self.Settings.HOT_FIELDS:
logger.debug(f"{self} applying hot settings update: {changed.keys()}")
if self._config.enable_diarization:
# Only hot-updatable fields changed — push to the live session.
@@ -586,7 +586,7 @@ class SpeechmaticsSTTService(STTService):
)
# Diarization not enabled — the new settings will take effect
# if/when diarization is enabled, which does require a reconnect.
elif changed.keys() & SpeechmaticsSTTSettings.LOCAL_FIELDS:
elif changed.keys() & self.Settings.LOCAL_FIELDS:
logger.debug(
f"{self} local settings update, no special action required: {changed.keys()}"
)
@@ -705,7 +705,7 @@ class SpeechmaticsSTTService(STTService):
# CONFIGURATION
# ============================================================================
def _build_config(self, settings: SpeechmaticsSTTSettings) -> VoiceAgentConfig:
def _build_config(self, settings: Settings) -> VoiceAgentConfig:
"""Build a ``VoiceAgentConfig`` from the given settings.
Used both at init time (with explicit settings, before
@@ -778,7 +778,7 @@ class SpeechmaticsSTTService(STTService):
.. deprecated:: 0.0.104
Use ``STTUpdateSettingsFrame`` with
``SpeechmaticsSTTSettings(...)`` instead.
``SpeechmaticsSTTService.Settings(...)`` instead.
This can update the speakers to listen to or ignore during an in-flight
transcription. Only available if diarization is enabled.
@@ -790,7 +790,7 @@ class SpeechmaticsSTTService(STTService):
warnings.simplefilter("always")
warnings.warn(
"update_params() is deprecated. Use STTUpdateSettingsFrame with "
"SpeechmaticsSTTSettings(...) instead.",
"self.Settings(...) instead.",
DeprecationWarning,
)
# Check possible

View File

@@ -20,7 +20,7 @@ from pipecat.frames.frames import (
Frame,
TTSAudioRawFrame,
)
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven
from pipecat.services.tts_service import TTSService
from pipecat.utils.network import exponential_backoff_time
from pipecat.utils.tracing.service_decorators import traced_tts
@@ -54,7 +54,7 @@ class SpeechmaticsTTSService(TTSService):
"""
Settings = SpeechmaticsTTSSettings
_settings: SpeechmaticsTTSSettings
_settings: Settings
SPEECHMATICS_SAMPLE_RATE = 16000
@@ -62,7 +62,7 @@ class SpeechmaticsTTSService(TTSService):
"""Optional input parameters for Speechmatics TTS configuration.
.. deprecated:: 0.0.105
Use ``settings=SpeechmaticsTTSSettings(...)`` instead.
Use ``settings=SpeechmaticsTTSService.Settings(...)`` instead.
Parameters:
max_retries: Maximum number of retries for TTS requests. Defaults to 5.
@@ -79,7 +79,7 @@ class SpeechmaticsTTSService(TTSService):
aiohttp_session: aiohttp.ClientSession,
sample_rate: Optional[int] = SPEECHMATICS_SAMPLE_RATE,
params: Optional[InputParams] = None,
settings: Optional[SpeechmaticsTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Speechmatics TTS service.
@@ -90,14 +90,14 @@ class SpeechmaticsTTSService(TTSService):
voice_id: Voice model to use for synthesis.
.. deprecated:: 0.0.105
Use ``settings=SpeechmaticsTTSSettings(voice=...)`` instead.
Use ``settings=SpeechmaticsTTSService.Settings(voice=...)`` instead.
aiohttp_session: Shared aiohttp session for HTTP requests.
sample_rate: Audio sample rate in Hz.
params: Input parameters for the service.
.. deprecated:: 0.0.105
Use ``settings=SpeechmaticsTTSSettings(...)`` instead.
Use ``settings=SpeechmaticsTTSService.Settings(...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
@@ -110,7 +110,7 @@ class SpeechmaticsTTSService(TTSService):
)
# 1. Initialize default_settings with hardcoded defaults
default_settings = SpeechmaticsTTSSettings(
default_settings = self.Settings(
model=None,
voice="sarah",
language=None,
@@ -119,12 +119,12 @@ class SpeechmaticsTTSService(TTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice_id is not None:
_warn_deprecated_param("voice_id", SpeechmaticsTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
# 3. Apply params overrides — only if settings not provided
if params is not None:
_warn_deprecated_param("params", SpeechmaticsTTSSettings)
self._warn_init_param_moved_to_settings("params")
if not settings:
default_settings.max_retries = params.max_retries

View File

@@ -60,7 +60,7 @@ class TavusVideoService(AIService):
"""
Settings = TavusVideoSettings
_settings: TavusVideoSettings
_settings: Settings
def __init__(
self,
@@ -69,7 +69,7 @@ class TavusVideoService(AIService):
replica_id: str,
persona_id: str = "pipecat-stream",
session: aiohttp.ClientSession,
settings: Optional[TavusVideoSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
) -> None:
"""Initialize the Tavus video service.

View File

@@ -11,13 +11,12 @@ from typing import Optional
from loguru import logger
from pipecat.services.openai.base_llm import OpenAILLMSettings
from pipecat.services.openai.base_llm import BaseOpenAILLMService
from pipecat.services.openai.llm import OpenAILLMService
from pipecat.services.settings import _warn_deprecated_param
@dataclass
class TogetherLLMSettings(OpenAILLMSettings):
class TogetherLLMSettings(BaseOpenAILLMService.Settings):
"""Settings for TogetherLLMService."""
pass
@@ -31,7 +30,7 @@ class TogetherLLMService(OpenAILLMService):
"""
Settings = TogetherLLMSettings
_settings: TogetherLLMSettings
_settings: Settings
def __init__(
self,
@@ -39,7 +38,7 @@ class TogetherLLMService(OpenAILLMService):
api_key: str,
base_url: str = "https://api.together.xyz/v1",
model: Optional[str] = None,
settings: Optional[TogetherLLMSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize Together.ai LLM service.
@@ -50,18 +49,18 @@ class TogetherLLMService(OpenAILLMService):
model: The model identifier to use. Defaults to "meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo".
.. deprecated:: 0.0.105
Use ``settings=OpenAILLMSettings(model=...)`` instead.
Use ``settings=TogetherLLMService.Settings(model=...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional keyword arguments passed to OpenAILLMService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = TogetherLLMSettings(model="meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo")
default_settings = self.Settings(model="meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo")
# 2. Apply direct init arg overrides (deprecated)
if model is not None:
_warn_deprecated_param("model", TogetherLLMSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
# 3. (No step 3, as there's no params object to apply)

View File

@@ -167,13 +167,13 @@ class UltravoxRealtimeLLMService(LLMService):
"""
Settings = UltravoxRealtimeLLMSettings
_settings: UltravoxRealtimeLLMSettings
_settings: Settings
def __init__(
self,
*,
params: Union[AgentInputParams, OneShotInputParams, JoinUrlInputParams],
settings: Optional[UltravoxRealtimeLLMSettings] = None,
settings: Optional[Settings] = None,
one_shot_selected_tools: Optional[ToolsSchema] = None,
**kwargs,
):
@@ -188,7 +188,7 @@ class UltravoxRealtimeLLMService(LLMService):
**kwargs: Additional arguments passed to parent LLMService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = UltravoxRealtimeLLMSettings(
default_settings = self.Settings(
model=None,
system_instruction=None,
temperature=None,
@@ -383,7 +383,7 @@ class UltravoxRealtimeLLMService(LLMService):
await self.cancel_task(self._receive_task, timeout=1.0)
self._receive_task = None
async def _update_settings(self, delta: UltravoxRealtimeLLMSettings):
async def _update_settings(self, delta: Settings):
changed = await super()._update_settings(delta)
if "output_medium" in changed:
await self._update_output_medium(self._settings.output_medium)

View File

@@ -18,7 +18,7 @@ from openai import AsyncOpenAI
from openai.types.audio import Transcription
from pipecat.frames.frames import ErrorFrame, Frame, TranscriptionFrame
from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven
from pipecat.services.stt_latency import WHISPER_TTFS_P99
from pipecat.services.stt_service import SegmentedSTTService
from pipecat.transcriptions.language import Language, resolve_language
@@ -123,7 +123,7 @@ class BaseWhisperSTTService(SegmentedSTTService):
"""
Settings = BaseWhisperSTTSettings
_settings: BaseWhisperSTTSettings
_settings: Settings
def __init__(
self,
@@ -136,7 +136,7 @@ class BaseWhisperSTTService(SegmentedSTTService):
temperature: Optional[float] = None,
include_prob_metrics: bool = False,
push_empty_transcripts: bool = False,
settings: Optional[BaseWhisperSTTSettings] = None,
settings: Optional[Settings] = None,
ttfs_p99_latency: Optional[float] = WHISPER_TTFS_P99,
**kwargs,
):
@@ -146,24 +146,24 @@ class BaseWhisperSTTService(SegmentedSTTService):
model: Name of the Whisper model to use.
.. deprecated:: 0.0.105
Use ``settings=BaseWhisperSTTSettings(model=...)`` instead.
Use ``settings=BaseWhisperSTTService.Settings(model=...)`` instead.
api_key: Service API key. Defaults to None.
base_url: Service API base URL. Defaults to None.
language: Language of the audio input.
.. deprecated:: 0.0.105
Use ``settings=BaseWhisperSTTSettings(language=...)`` instead.
Use ``settings=BaseWhisperSTTService.Settings(language=...)`` instead.
prompt: Optional text to guide the model's style or continue a previous segment.
.. deprecated:: 0.0.105
Use ``settings=BaseWhisperSTTSettings(prompt=...)`` instead.
Use ``settings=BaseWhisperSTTService.Settings(prompt=...)`` instead.
temperature: Sampling temperature between 0 and 1.
.. deprecated:: 0.0.105
Use ``settings=BaseWhisperSTTSettings(temperature=...)`` instead.
Use ``settings=BaseWhisperSTTService.Settings(temperature=...)`` instead.
include_prob_metrics: If True, enables probability metrics in API response.
Each service implements this differently (see child classes).
@@ -181,7 +181,7 @@ class BaseWhisperSTTService(SegmentedSTTService):
**kwargs: Additional arguments passed to SegmentedSTTService.
"""
# --- 1. Hardcoded defaults ---
default_settings = BaseWhisperSTTSettings(
default_settings = self.Settings(
model=None,
language=None,
prompt=None,
@@ -190,16 +190,16 @@ class BaseWhisperSTTService(SegmentedSTTService):
# --- 2. Deprecated direct-arg overrides ---
if model is not None:
_warn_deprecated_param("model", BaseWhisperSTTSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model
if language is not None:
_warn_deprecated_param("language", BaseWhisperSTTSettings, "language")
self._warn_init_param_moved_to_settings("language", "language")
default_settings.language = self.language_to_service_language(language)
if prompt is not None:
_warn_deprecated_param("prompt", BaseWhisperSTTSettings, "prompt")
self._warn_init_param_moved_to_settings("prompt", "prompt")
default_settings.prompt = prompt
if temperature is not None:
_warn_deprecated_param("temperature", BaseWhisperSTTSettings, "temperature")
self._warn_init_param_moved_to_settings("temperature", "temperature")
default_settings.temperature = temperature
# --- 3. (no params object for this service) ---

View File

@@ -20,7 +20,7 @@ from loguru import logger
from typing_extensions import TYPE_CHECKING, override
from pipecat.frames.frames import ErrorFrame, Frame, TranscriptionFrame
from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven, _warn_deprecated_param
from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven
from pipecat.services.stt_service import SegmentedSTTService
from pipecat.transcriptions.language import Language, resolve_language
from pipecat.utils.time import time_now_iso8601
@@ -208,7 +208,7 @@ class WhisperSTTService(SegmentedSTTService):
"""
Settings = WhisperSTTSettings
_settings: WhisperSTTSettings
_settings: Settings
def __init__(
self,
@@ -218,7 +218,7 @@ class WhisperSTTService(SegmentedSTTService):
compute_type: str = "default",
no_speech_prob: Optional[float] = None,
language: Optional[Language] = None,
settings: Optional[WhisperSTTSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the Whisper STT service.
@@ -227,7 +227,7 @@ class WhisperSTTService(SegmentedSTTService):
model: The Whisper model to use for transcription. Can be a Model enum or string.
.. deprecated:: 0.0.105
Use ``settings=WhisperSTTSettings(model=...)`` instead.
Use ``settings=WhisperSTTService.Settings(model=...)`` instead.
device: The device to run inference on ('cpu', 'cuda', or 'auto').
Defaults to ``"auto"``.
@@ -236,19 +236,19 @@ class WhisperSTTService(SegmentedSTTService):
no_speech_prob: Probability threshold for filtering out non-speech segments.
.. deprecated:: 0.0.105
Use ``settings=WhisperSTTSettings(no_speech_prob=...)`` instead.
Use ``settings=WhisperSTTService.Settings(no_speech_prob=...)`` instead.
language: The default language for transcription.
.. deprecated:: 0.0.105
Use ``settings=WhisperSTTSettings(language=...)`` instead.
Use ``settings=WhisperSTTService.Settings(language=...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional arguments passed to SegmentedSTTService.
"""
# --- 1. Hardcoded defaults ---
default_settings = WhisperSTTSettings(
default_settings = self.Settings(
model=Model.DISTIL_MEDIUM_EN.value,
language=Language.EN,
no_speech_prob=0.4,
@@ -256,13 +256,13 @@ class WhisperSTTService(SegmentedSTTService):
# --- 2. Deprecated direct-arg overrides ---
if model is not None:
_warn_deprecated_param("model", WhisperSTTSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model if isinstance(model, str) else model.value
if no_speech_prob is not None:
_warn_deprecated_param("no_speech_prob", WhisperSTTSettings, "no_speech_prob")
self._warn_init_param_moved_to_settings("no_speech_prob", "no_speech_prob")
default_settings.no_speech_prob = no_speech_prob
if language is not None:
_warn_deprecated_param("language", WhisperSTTSettings, "language")
self._warn_init_param_moved_to_settings("language", "language")
default_settings.language = language
# --- 3. (no params object for this service) ---
@@ -382,7 +382,7 @@ class WhisperSTTServiceMLX(WhisperSTTService):
"""
Settings = WhisperMLXSTTSettings
_settings: WhisperMLXSTTSettings
_settings: Settings
def __init__(
self,
@@ -391,7 +391,7 @@ class WhisperSTTServiceMLX(WhisperSTTService):
no_speech_prob: Optional[float] = None,
language: Optional[Language] = None,
temperature: Optional[float] = None,
settings: Optional[WhisperMLXSTTSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the MLX Whisper STT service.
@@ -400,29 +400,29 @@ class WhisperSTTServiceMLX(WhisperSTTService):
model: The MLX Whisper model to use for transcription. Can be an MLXModel enum or string.
.. deprecated:: 0.0.105
Use ``settings=WhisperMLXSTTSettings(model=...)`` instead.
Use ``settings=WhisperSTTServiceMLX.Settings(model=...)`` instead.
no_speech_prob: Probability threshold for filtering out non-speech segments.
.. deprecated:: 0.0.105
Use ``settings=WhisperMLXSTTSettings(no_speech_prob=...)`` instead.
Use ``settings=WhisperSTTServiceMLX.Settings(no_speech_prob=...)`` instead.
language: The default language for transcription.
.. deprecated:: 0.0.105
Use ``settings=WhisperMLXSTTSettings(language=...)`` instead.
Use ``settings=WhisperSTTServiceMLX.Settings(language=...)`` instead.
temperature: Temperature for sampling. Can be a float or tuple of floats.
.. deprecated:: 0.0.105
Use ``settings=WhisperMLXSTTSettings(temperature=...)`` instead.
Use ``settings=WhisperSTTServiceMLX.Settings(temperature=...)`` instead.
settings: Runtime-updatable settings. When provided alongside deprecated
parameters, ``settings`` values take precedence.
**kwargs: Additional arguments passed to SegmentedSTTService.
"""
# --- 1. Hardcoded defaults ---
default_settings = WhisperMLXSTTSettings(
default_settings = self.Settings(
model=MLXModel.TINY.value,
language=Language.EN,
no_speech_prob=0.6,
@@ -432,16 +432,16 @@ class WhisperSTTServiceMLX(WhisperSTTService):
# --- 2. Deprecated direct-arg overrides ---
if model is not None:
_warn_deprecated_param("model", WhisperMLXSTTSettings, "model")
self._warn_init_param_moved_to_settings("model", "model")
default_settings.model = model if isinstance(model, str) else model.value
if no_speech_prob is not None:
_warn_deprecated_param("no_speech_prob", WhisperMLXSTTSettings, "no_speech_prob")
self._warn_init_param_moved_to_settings("no_speech_prob", "no_speech_prob")
default_settings.no_speech_prob = no_speech_prob
if language is not None:
_warn_deprecated_param("language", WhisperMLXSTTSettings, "language")
self._warn_init_param_moved_to_settings("language", "language")
default_settings.language = language
if temperature is not None:
_warn_deprecated_param("temperature", WhisperMLXSTTSettings, "temperature")
self._warn_init_param_moved_to_settings("temperature", "temperature")
default_settings.temperature = temperature
# --- 3. (no params object for this service) ---

View File

@@ -23,7 +23,7 @@ from pipecat.frames.frames import (
StartFrame,
TTSAudioRawFrame,
)
from pipecat.services.settings import TTSSettings, _warn_deprecated_param
from pipecat.services.settings import TTSSettings
from pipecat.services.tts_service import TTSService
from pipecat.transcriptions.language import Language, resolve_language
from pipecat.utils.tracing.service_decorators import traced_tts
@@ -84,7 +84,7 @@ class XTTSService(TTSService):
"""
Settings = XTTSTTSSettings
_settings: XTTSTTSSettings
_settings: Settings
def __init__(
self,
@@ -94,7 +94,7 @@ class XTTSService(TTSService):
aiohttp_session: aiohttp.ClientSession,
language: Language = Language.EN,
sample_rate: Optional[int] = None,
settings: Optional[XTTSTTSSettings] = None,
settings: Optional[Settings] = None,
**kwargs,
):
"""Initialize the XTTS service.
@@ -103,7 +103,7 @@ class XTTSService(TTSService):
voice_id: ID of the voice/speaker to use for synthesis.
.. deprecated:: 0.0.105
Use ``settings=XTTSTTSSettings(voice=...)`` instead.
Use ``settings=XTTSService.Settings(voice=...)`` instead.
base_url: Base URL of the XTTS streaming server.
aiohttp_session: HTTP session for making requests to the server.
@@ -114,7 +114,7 @@ class XTTSService(TTSService):
**kwargs: Additional arguments passed to parent TTSService.
"""
# 1. Initialize default_settings with hardcoded defaults
default_settings = XTTSTTSSettings(
default_settings = self.Settings(
model=None,
voice=None,
language=self.language_to_service_language(language),
@@ -122,7 +122,7 @@ class XTTSService(TTSService):
# 2. Apply direct init arg overrides (deprecated)
if voice_id is not None:
_warn_deprecated_param("voice_id", XTTSTTSSettings, "voice")
self._warn_init_param_moved_to_settings("voice_id", "voice")
default_settings.voice = voice_id
# 3. (No step 3, as there's no params object to apply)