From 421696e1c25d5b387e47b476f87d28889add7e06 Mon Sep 17 00:00:00 2001 From: Paul Kompfner Date: Thu, 19 Feb 2026 11:28:29 -0500 Subject: [PATCH] Replace `Any` with specific types and add `| _NotGiven` to all `*Settings` field annotations across 49 service files Every `*Settings` dataclass field whose default is `NOT_GIVEN` now carries `_NotGiven` in its type union so the type system accurately reflects the three-state semantics (real value, `None` where applicable, or not-yet-specified). Fields previously typed as bare `Any`, `str`, `float`, `bool`, `list`, `dict`, or `Optional[X]` are now narrowed to the specific type from the corresponding `InputParams` Pydantic model. --- src/pipecat/services/anthropic/llm.py | 8 ++-- src/pipecat/services/assemblyai/stt.py | 6 ++- src/pipecat/services/asyncai/tts.py | 8 ++-- src/pipecat/services/aws/llm.py | 8 ++-- src/pipecat/services/aws/stt.py | 12 ++--- src/pipecat/services/aws/tts.py | 12 ++--- src/pipecat/services/azure/stt.py | 6 +-- src/pipecat/services/azure/tts.py | 18 +++---- src/pipecat/services/camb/tts.py | 4 +- src/pipecat/services/cartesia/stt.py | 4 +- src/pipecat/services/cartesia/tts.py | 16 +++---- src/pipecat/services/deepgram/stt.py | 4 +- .../services/deepgram/stt_sagemaker.py | 4 +- src/pipecat/services/deepgram/tts.py | 4 +- src/pipecat/services/elevenlabs/stt.py | 20 ++++---- src/pipecat/services/elevenlabs/tts.py | 38 ++++++++------- src/pipecat/services/fal/stt.py | 8 ++-- src/pipecat/services/fish/tts.py | 16 +++---- src/pipecat/services/gladia/stt.py | 4 +- .../services/google/gemini_live/llm.py | 20 ++++---- src/pipecat/services/google/llm.py | 6 ++- src/pipecat/services/google/stt.py | 26 +++++----- src/pipecat/services/google/tts.py | 40 +++++++++------- src/pipecat/services/gradium/stt.py | 4 +- src/pipecat/services/gradium/tts.py | 4 +- src/pipecat/services/groq/tts.py | 8 ++-- src/pipecat/services/hathora/stt.py | 4 +- src/pipecat/services/hathora/tts.py | 6 +-- src/pipecat/services/inworld/tts.py | 14 +++--- src/pipecat/services/kokoro/tts.py | 4 +- src/pipecat/services/lmnt/tts.py | 4 +- src/pipecat/services/minimax/tts.py | 26 +++++----- src/pipecat/services/neuphonic/tts.py | 10 ++-- src/pipecat/services/nvidia/stt.py | 12 ++--- src/pipecat/services/openai/base_llm.py | 6 +-- src/pipecat/services/openai/stt.py | 4 +- src/pipecat/services/openai/tts.py | 6 +-- .../services/openai_realtime_beta/openai.py | 8 ++-- src/pipecat/services/playht/tts.py | 12 ++--- src/pipecat/services/resembleai/tts.py | 8 ++-- src/pipecat/services/rime/tts.py | 36 +++++++------- src/pipecat/services/sarvam/stt.py | 10 ++-- src/pipecat/services/sarvam/tts.py | 40 ++++++++-------- src/pipecat/services/soniox/stt.py | 4 +- src/pipecat/services/speechmatics/stt.py | 48 ++++++++++--------- src/pipecat/services/ultravox/llm.py | 4 +- src/pipecat/services/whisper/base_stt.py | 8 ++-- src/pipecat/services/whisper/stt.py | 14 +++--- src/pipecat/services/xtts/tts.py | 4 +- 49 files changed, 314 insertions(+), 286 deletions(-) diff --git a/src/pipecat/services/anthropic/llm.py b/src/pipecat/services/anthropic/llm.py index 159b666d1..4416aa018 100644 --- a/src/pipecat/services/anthropic/llm.py +++ b/src/pipecat/services/anthropic/llm.py @@ -59,7 +59,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, is_given +from pipecat.services.settings import LLMSettings, _NotGiven, is_given from pipecat.utils.tracing.service_decorators import traced_llm try: @@ -79,8 +79,10 @@ class AnthropicLLMSettings(LLMSettings): thinking: Extended thinking configuration. """ - enable_prompt_caching: Any = field(default_factory=lambda: _NOT_GIVEN) - thinking: Any = field(default_factory=lambda: _NOT_GIVEN) + enable_prompt_caching: bool | _NotGiven = field(default_factory=lambda: _NOT_GIVEN) + thinking: "AnthropicLLMService.ThinkingConfig" | _NotGiven = field( + default_factory=lambda: _NOT_GIVEN + ) @classmethod def from_mapping(cls, settings): diff --git a/src/pipecat/services/assemblyai/stt.py b/src/pipecat/services/assemblyai/stt.py index 23b7d149b..6a33b6a20 100644 --- a/src/pipecat/services/assemblyai/stt.py +++ b/src/pipecat/services/assemblyai/stt.py @@ -30,7 +30,7 @@ from pipecat.frames.frames import ( VADUserStoppedSpeakingFrame, ) from pipecat.processors.frame_processor import FrameDirection -from pipecat.services.settings import NOT_GIVEN, STTSettings +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 @@ -64,7 +64,9 @@ class AssemblyAISTTSettings(STTSettings): connection_params: Connection configuration parameters. """ - connection_params: AssemblyAIConnectionParams = field(default_factory=lambda: NOT_GIVEN) + connection_params: AssemblyAIConnectionParams | _NotGiven = field( + default_factory=lambda: NOT_GIVEN + ) class AssemblyAISTTService(WebsocketSTTService): diff --git a/src/pipecat/services/asyncai/tts.py b/src/pipecat/services/asyncai/tts.py index 489d7cbff..d01fd4396 100644 --- a/src/pipecat/services/asyncai/tts.py +++ b/src/pipecat/services/asyncai/tts.py @@ -28,7 +28,7 @@ from pipecat.frames.frames import ( TTSStoppedFrame, ) from pipecat.processors.frame_processor import FrameDirection -from pipecat.services.settings import NOT_GIVEN, TTSSettings +from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven from pipecat.services.tts_service import AudioContextTTSService, TTSService from pipecat.transcriptions.language import Language, resolve_language from pipecat.utils.tracing.service_decorators import traced_tts @@ -84,9 +84,9 @@ class AsyncAITTSSettings(TTSSettings): output_sample_rate: Audio sample rate in Hz. """ - output_container: str = field(default_factory=lambda: NOT_GIVEN) - output_encoding: str = field(default_factory=lambda: NOT_GIVEN) - output_sample_rate: int = field(default_factory=lambda: NOT_GIVEN) + output_container: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + output_encoding: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + output_sample_rate: int | _NotGiven = field(default_factory=lambda: NOT_GIVEN) @classmethod def from_mapping(cls, settings: Mapping[str, Any]) -> "AsyncAITTSSettings": diff --git a/src/pipecat/services/aws/llm.py b/src/pipecat/services/aws/llm.py index 3fca8e374..b39d518ec 100644 --- a/src/pipecat/services/aws/llm.py +++ b/src/pipecat/services/aws/llm.py @@ -56,7 +56,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 +from pipecat.services.settings import NOT_GIVEN, LLMSettings, _NotGiven from pipecat.utils.tracing.service_decorators import traced_llm try: @@ -80,8 +80,10 @@ class AWSBedrockLLMSettings(LLMSettings): additional_model_request_fields: Additional model-specific parameters. """ - latency: Any = field(default_factory=lambda: NOT_GIVEN) - additional_model_request_fields: Any = field(default_factory=lambda: NOT_GIVEN) + latency: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + additional_model_request_fields: Dict[str, Any] | _NotGiven = field( + default_factory=lambda: NOT_GIVEN + ) @dataclass diff --git a/src/pipecat/services/aws/stt.py b/src/pipecat/services/aws/stt.py index 21220e646..09552ecfc 100644 --- a/src/pipecat/services/aws/stt.py +++ b/src/pipecat/services/aws/stt.py @@ -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 NOT_GIVEN, STTSettings +from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven 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 @@ -57,11 +57,11 @@ class AWSTranscribeSTTSettings(STTSettings): enable_channel_identification: Whether to enable channel identification. """ - sample_rate: int = field(default_factory=lambda: NOT_GIVEN) - media_encoding: str = field(default_factory=lambda: NOT_GIVEN) - number_of_channels: int = field(default_factory=lambda: NOT_GIVEN) - show_speaker_label: bool = field(default_factory=lambda: NOT_GIVEN) - enable_channel_identification: bool = field(default_factory=lambda: NOT_GIVEN) + sample_rate: int | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + media_encoding: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + number_of_channels: int | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + show_speaker_label: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + enable_channel_identification: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class AWSTranscribeSTTService(WebsocketSTTService): diff --git a/src/pipecat/services/aws/tts.py b/src/pipecat/services/aws/tts.py index 47c524196..e223a1abc 100644 --- a/src/pipecat/services/aws/tts.py +++ b/src/pipecat/services/aws/tts.py @@ -25,7 +25,7 @@ from pipecat.frames.frames import ( TTSStartedFrame, TTSStoppedFrame, ) -from pipecat.services.settings import NOT_GIVEN, TTSSettings +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 @@ -135,11 +135,11 @@ class AWSPollyTTSSettings(TTSSettings): lexicon_names: List of pronunciation lexicons to apply. """ - engine: str = field(default_factory=lambda: NOT_GIVEN) - pitch: str = field(default_factory=lambda: NOT_GIVEN) - rate: str = field(default_factory=lambda: NOT_GIVEN) - volume: str = field(default_factory=lambda: NOT_GIVEN) - lexicon_names: List[str] = field(default_factory=lambda: NOT_GIVEN) + engine: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + pitch: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + rate: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + volume: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + lexicon_names: List[str] | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class AWSPollyTTSService(TTSService): diff --git a/src/pipecat/services/azure/stt.py b/src/pipecat/services/azure/stt.py index 18fc9b108..d161b3829 100644 --- a/src/pipecat/services/azure/stt.py +++ b/src/pipecat/services/azure/stt.py @@ -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 NOT_GIVEN, STTSettings +from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven from pipecat.services.stt_latency import AZURE_TTFS_P99 from pipecat.services.stt_service import STTService from pipecat.transcriptions.language import Language @@ -59,8 +59,8 @@ class AzureSTTSettings(STTSettings): sample_rate: Audio sample rate in Hz. """ - region: str = field(default_factory=lambda: NOT_GIVEN) - sample_rate: Optional[int] = field(default_factory=lambda: NOT_GIVEN) + region: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + sample_rate: int | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class AzureSTTService(STTService): diff --git a/src/pipecat/services/azure/tts.py b/src/pipecat/services/azure/tts.py index b72b33901..b69e60b69 100644 --- a/src/pipecat/services/azure/tts.py +++ b/src/pipecat/services/azure/tts.py @@ -26,7 +26,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 +from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven from pipecat.services.tts_service import TTSService, WordTTSService from pipecat.transcriptions.language import Language from pipecat.utils.tracing.service_decorators import traced_tts @@ -82,14 +82,14 @@ class AzureTTSSettings(TTSSettings): volume: Volume level (e.g., "+20%", "loud", "x-soft"). """ - emphasis: str = field(default_factory=lambda: NOT_GIVEN) - language: str = field(default_factory=lambda: NOT_GIVEN) - pitch: str = field(default_factory=lambda: NOT_GIVEN) - rate: str = field(default_factory=lambda: NOT_GIVEN) - role: str = field(default_factory=lambda: NOT_GIVEN) - style: str = field(default_factory=lambda: NOT_GIVEN) - style_degree: str = field(default_factory=lambda: NOT_GIVEN) - volume: str = field(default_factory=lambda: NOT_GIVEN) + emphasis: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + language: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + pitch: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + rate: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + role: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + style: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + style_degree: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + volume: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class AzureBaseTTSService: diff --git a/src/pipecat/services/camb/tts.py b/src/pipecat/services/camb/tts.py index 95b0ddd52..40dabd17e 100644 --- a/src/pipecat/services/camb/tts.py +++ b/src/pipecat/services/camb/tts.py @@ -32,7 +32,7 @@ from pipecat.frames.frames import ( TTSStartedFrame, TTSStoppedFrame, ) -from pipecat.services.settings import NOT_GIVEN, TTSSettings +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 @@ -144,7 +144,7 @@ class CambTTSSettings(TTSSettings): Ignored for other models. Max 1000 characters. """ - user_instructions: str = field(default_factory=lambda: NOT_GIVEN) + user_instructions: str | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class CambTTSService(TTSService): diff --git a/src/pipecat/services/cartesia/stt.py b/src/pipecat/services/cartesia/stt.py index 6629d05bb..e3270936b 100644 --- a/src/pipecat/services/cartesia/stt.py +++ b/src/pipecat/services/cartesia/stt.py @@ -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 +from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven from pipecat.services.stt_latency import CARTESIA_TTFS_P99 from pipecat.services.stt_service import WebsocketSTTService from pipecat.transcriptions.language import Language @@ -52,7 +52,7 @@ class CartesiaSTTSettings(STTSettings): encoding: Audio encoding format (e.g. ``"pcm_s16le"``). """ - encoding: str = field(default_factory=lambda: NOT_GIVEN) + encoding: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class CartesiaLiveOptions: diff --git a/src/pipecat/services/cartesia/tts.py b/src/pipecat/services/cartesia/tts.py index 4e45f50aa..0d8936fdd 100644 --- a/src/pipecat/services/cartesia/tts.py +++ b/src/pipecat/services/cartesia/tts.py @@ -28,7 +28,7 @@ from pipecat.frames.frames import ( TTSStoppedFrame, ) from pipecat.processors.frame_processor import FrameDirection -from pipecat.services.settings import NOT_GIVEN, TTSSettings, is_given +from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven, is_given from pipecat.services.tts_service import AudioContextWordTTSService, TTSService from pipecat.transcriptions.language import Language, resolve_language from pipecat.utils.text.base_text_aggregator import BaseTextAggregator @@ -209,13 +209,13 @@ class CartesiaTTSSettings(TTSSettings): custom pronunciations. """ - output_container: str = field(default_factory=lambda: NOT_GIVEN) - output_encoding: str = field(default_factory=lambda: NOT_GIVEN) - output_sample_rate: int = field(default_factory=lambda: NOT_GIVEN) - speed: str = field(default_factory=lambda: NOT_GIVEN) - emotion: List[str] = field(default_factory=lambda: NOT_GIVEN) - generation_config: GenerationConfig = field(default_factory=lambda: NOT_GIVEN) - pronunciation_dict_id: str = field(default_factory=lambda: NOT_GIVEN) + output_container: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + output_encoding: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + output_sample_rate: int | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + speed: Literal["slow", "normal", "fast"] | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + emotion: List[str] | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + generation_config: GenerationConfig | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + pronunciation_dict_id: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) @classmethod def from_mapping(cls, settings: Mapping[str, Any]) -> "CartesiaTTSSettings": diff --git a/src/pipecat/services/deepgram/stt.py b/src/pipecat/services/deepgram/stt.py index f52932b2c..8d4a72fc3 100644 --- a/src/pipecat/services/deepgram/stt.py +++ b/src/pipecat/services/deepgram/stt.py @@ -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, is_given +from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven, is_given from pipecat.services.stt_latency import DEEPGRAM_TTFS_P99 from pipecat.services.stt_service import STTService from pipecat.transcriptions.language import Language @@ -55,7 +55,7 @@ class DeepgramSTTSettings(STTSettings): live_options: Deepgram ``LiveOptions`` for detailed configuration. """ - live_options: LiveOptions = field(default_factory=lambda: NOT_GIVEN) + live_options: LiveOptions | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class DeepgramSTTService(STTService): diff --git a/src/pipecat/services/deepgram/stt_sagemaker.py b/src/pipecat/services/deepgram/stt_sagemaker.py index 870ded11f..3184bf7f8 100644 --- a/src/pipecat/services/deepgram/stt_sagemaker.py +++ b/src/pipecat/services/deepgram/stt_sagemaker.py @@ -32,7 +32,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 NOT_GIVEN, STTSettings, is_given +from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven, 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 @@ -57,7 +57,7 @@ class DeepgramSageMakerSTTSettings(STTSettings): live_options: Deepgram ``LiveOptions`` for detailed configuration. """ - live_options: LiveOptions = field(default_factory=lambda: NOT_GIVEN) + live_options: LiveOptions | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class DeepgramSageMakerSTTService(STTService): diff --git a/src/pipecat/services/deepgram/tts.py b/src/pipecat/services/deepgram/tts.py index 7f4d78f13..3458a4529 100644 --- a/src/pipecat/services/deepgram/tts.py +++ b/src/pipecat/services/deepgram/tts.py @@ -30,7 +30,7 @@ from pipecat.frames.frames import ( TTSStoppedFrame, ) from pipecat.processors.frame_processor import FrameDirection -from pipecat.services.settings import NOT_GIVEN, TTSSettings +from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven from pipecat.services.tts_service import TTSService, WebsocketTTSService from pipecat.utils.tracing.service_decorators import traced_tts @@ -53,7 +53,7 @@ class DeepgramTTSSettings(TTSSettings): encoding: Audio encoding format (linear16, mulaw, alaw). """ - encoding: str = field(default_factory=lambda: NOT_GIVEN) + encoding: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class DeepgramTTSService(WebsocketTTSService): diff --git a/src/pipecat/services/elevenlabs/stt.py b/src/pipecat/services/elevenlabs/stt.py index e5b7b3843..c3e6b29e7 100644 --- a/src/pipecat/services/elevenlabs/stt.py +++ b/src/pipecat/services/elevenlabs/stt.py @@ -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 +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 @@ -185,7 +185,7 @@ class ElevenLabsSTTSettings(STTSettings): tag_audio_events: Whether to include audio event tags in transcription. """ - tag_audio_events: bool = field(default_factory=lambda: NOT_GIVEN) + tag_audio_events: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) @dataclass @@ -205,14 +205,14 @@ class ElevenLabsRealtimeSTTSettings(STTSettings): include_language_detection: Whether to include language detection in transcripts. """ - commit_strategy: CommitStrategy = field(default_factory=lambda: NOT_GIVEN) - vad_silence_threshold_secs: float = field(default_factory=lambda: NOT_GIVEN) - vad_threshold: float = field(default_factory=lambda: NOT_GIVEN) - min_speech_duration_ms: int = field(default_factory=lambda: NOT_GIVEN) - min_silence_duration_ms: int = field(default_factory=lambda: NOT_GIVEN) - include_timestamps: bool = field(default_factory=lambda: NOT_GIVEN) - enable_logging: bool = field(default_factory=lambda: NOT_GIVEN) - include_language_detection: bool = field(default_factory=lambda: NOT_GIVEN) + commit_strategy: CommitStrategy | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + vad_silence_threshold_secs: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + vad_threshold: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + min_speech_duration_ms: int | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + min_silence_duration_ms: int | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + include_timestamps: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + enable_logging: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + include_language_detection: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class ElevenLabsSTTService(SegmentedSTTService): diff --git a/src/pipecat/services/elevenlabs/tts.py b/src/pipecat/services/elevenlabs/tts.py index fbde4a4b7..9503866a7 100644 --- a/src/pipecat/services/elevenlabs/tts.py +++ b/src/pipecat/services/elevenlabs/tts.py @@ -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, is_given +from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven, is_given from pipecat.services.tts_service import ( AudioContextWordTTSService, WordTTSService, @@ -206,15 +206,17 @@ class ElevenLabsTTSSettings(TTSSettings): apply_text_normalization: Text normalization mode ("auto", "on", "off"). """ - stability: float = field(default_factory=lambda: NOT_GIVEN) - similarity_boost: float = field(default_factory=lambda: NOT_GIVEN) - style: float = field(default_factory=lambda: NOT_GIVEN) - use_speaker_boost: bool = field(default_factory=lambda: NOT_GIVEN) - speed: float = field(default_factory=lambda: NOT_GIVEN) - auto_mode: str = field(default_factory=lambda: NOT_GIVEN) - enable_ssml_parsing: bool = field(default_factory=lambda: NOT_GIVEN) - enable_logging: bool = field(default_factory=lambda: NOT_GIVEN) - apply_text_normalization: str = field(default_factory=lambda: NOT_GIVEN) + stability: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + similarity_boost: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + style: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + use_speaker_boost: bool | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + speed: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + auto_mode: bool | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + enable_ssml_parsing: bool | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + enable_logging: bool | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + apply_text_normalization: Literal["auto", "on", "off"] | None | _NotGiven = field( + default_factory=lambda: NOT_GIVEN + ) #: Fields in the WS URL — changing any of these requires a reconnect. URL_FIELDS: ClassVar[frozenset[str]] = frozenset({"voice", "model", "language"}) @@ -242,13 +244,15 @@ class ElevenLabsHttpTTSSettings(TTSSettings): apply_text_normalization: Text normalization mode ("auto", "on", "off"). """ - optimize_streaming_latency: int = field(default_factory=lambda: NOT_GIVEN) - stability: float = field(default_factory=lambda: NOT_GIVEN) - similarity_boost: float = field(default_factory=lambda: NOT_GIVEN) - style: float = field(default_factory=lambda: NOT_GIVEN) - use_speaker_boost: bool = field(default_factory=lambda: NOT_GIVEN) - speed: float = field(default_factory=lambda: NOT_GIVEN) - apply_text_normalization: str = field(default_factory=lambda: NOT_GIVEN) + optimize_streaming_latency: int | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + stability: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + similarity_boost: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + style: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + use_speaker_boost: bool | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + speed: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + apply_text_normalization: Literal["auto", "on", "off"] | None | _NotGiven = field( + default_factory=lambda: NOT_GIVEN + ) _aliases: ClassVar[Dict[str, str]] = {"voice_id": "voice"} diff --git a/src/pipecat/services/fal/stt.py b/src/pipecat/services/fal/stt.py index a29d8d70d..bcfc583c6 100644 --- a/src/pipecat/services/fal/stt.py +++ b/src/pipecat/services/fal/stt.py @@ -18,7 +18,7 @@ from loguru import logger from pydantic import BaseModel from pipecat.frames.frames import ErrorFrame, Frame, TranscriptionFrame -from pipecat.services.settings import NOT_GIVEN, STTSettings +from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven from pipecat.services.stt_latency import FAL_TTFS_P99 from pipecat.services.stt_service import SegmentedSTTService from pipecat.transcriptions.language import Language, resolve_language @@ -159,9 +159,9 @@ class FalSTTSettings(STTSettings): version: Version of Wizper model to use. Defaults to '3'. """ - task: str = field(default_factory=lambda: NOT_GIVEN) - chunk_level: str = field(default_factory=lambda: NOT_GIVEN) - version: str = field(default_factory=lambda: NOT_GIVEN) + task: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + chunk_level: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + version: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class FalSTTService(SegmentedSTTService): diff --git a/src/pipecat/services/fish/tts.py b/src/pipecat/services/fish/tts.py index 09ed72099..131495769 100644 --- a/src/pipecat/services/fish/tts.py +++ b/src/pipecat/services/fish/tts.py @@ -29,7 +29,7 @@ from pipecat.frames.frames import ( TTSStoppedFrame, ) from pipecat.processors.frame_processor import FrameDirection -from pipecat.services.settings import NOT_GIVEN, TTSSettings +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 @@ -61,13 +61,13 @@ class FishAudioTTSSettings(TTSSettings): reference_id: Reference ID of the voice model. """ - fish_sample_rate: int = field(default_factory=lambda: NOT_GIVEN) - latency: str = field(default_factory=lambda: NOT_GIVEN) - format: str = field(default_factory=lambda: NOT_GIVEN) - normalize: bool = field(default_factory=lambda: NOT_GIVEN) - prosody_speed: float = field(default_factory=lambda: NOT_GIVEN) - prosody_volume: int = field(default_factory=lambda: NOT_GIVEN) - reference_id: str = field(default_factory=lambda: NOT_GIVEN) + fish_sample_rate: int | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + latency: str | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + format: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + normalize: bool | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + prosody_speed: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + prosody_volume: int | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + reference_id: str | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) _aliases: ClassVar[Dict[str, str]] = {"voice_id": "voice", "sample_rate": "fish_sample_rate"} diff --git a/src/pipecat/services/gladia/stt.py b/src/pipecat/services/gladia/stt.py index 25922e7aa..c92d9469f 100644 --- a/src/pipecat/services/gladia/stt.py +++ b/src/pipecat/services/gladia/stt.py @@ -33,7 +33,7 @@ from pipecat.frames.frames import ( UserStoppedSpeakingFrame, ) from pipecat.services.gladia.config import GladiaInputParams -from pipecat.services.settings import NOT_GIVEN, STTSettings +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 @@ -188,7 +188,7 @@ class GladiaSTTSettings(STTSettings): input_params: Gladia ``GladiaInputParams`` for detailed configuration. """ - input_params: GladiaInputParams = field(default_factory=lambda: NOT_GIVEN) + input_params: GladiaInputParams | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class GladiaSTTService(WebsocketSTTService): diff --git a/src/pipecat/services/google/gemini_live/llm.py b/src/pipecat/services/google/gemini_live/llm.py index 3047e258d..00b540385 100644 --- a/src/pipecat/services/google/gemini_live/llm.py +++ b/src/pipecat/services/google/gemini_live/llm.py @@ -76,7 +76,7 @@ from pipecat.services.openai.llm import ( OpenAIAssistantContextAggregator, OpenAIUserContextAggregator, ) -from pipecat.services.settings import NOT_GIVEN, LLMSettings +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 @@ -617,14 +617,16 @@ class GeminiLiveLLMSettings(LLMSettings): proactivity: Proactivity configuration. """ - modalities: Any = field(default_factory=lambda: NOT_GIVEN) - language: Any = field(default_factory=lambda: NOT_GIVEN) - media_resolution: Any = field(default_factory=lambda: NOT_GIVEN) - vad: Any = field(default_factory=lambda: NOT_GIVEN) - context_window_compression: Any = field(default_factory=lambda: NOT_GIVEN) - thinking: Any = field(default_factory=lambda: NOT_GIVEN) - enable_affective_dialog: Any = field(default_factory=lambda: NOT_GIVEN) - proactivity: Any = field(default_factory=lambda: NOT_GIVEN) + modalities: GeminiModalities | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + language: Language | str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + media_resolution: GeminiMediaResolution | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + vad: GeminiVADParams | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + context_window_compression: ContextWindowCompressionParams | dict | _NotGiven = field( + default_factory=lambda: NOT_GIVEN + ) + thinking: ThinkingConfig | dict | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + enable_affective_dialog: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + proactivity: ProactivityConfig | dict | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class GeminiLiveLLMService(LLMService): diff --git a/src/pipecat/services/google/llm.py b/src/pipecat/services/google/llm.py index bf1958f66..0a097b770 100644 --- a/src/pipecat/services/google/llm.py +++ b/src/pipecat/services/google/llm.py @@ -58,7 +58,7 @@ from pipecat.services.openai.llm import ( OpenAIAssistantContextAggregator, OpenAIUserContextAggregator, ) -from pipecat.services.settings import NOT_GIVEN, LLMSettings, is_given +from pipecat.services.settings import NOT_GIVEN, LLMSettings, _NotGiven, is_given from pipecat.utils.tracing.service_decorators import traced_llm # Suppress gRPC fork warnings @@ -681,7 +681,9 @@ class GoogleLLMSettings(LLMSettings): thinking: Thinking configuration. """ - thinking: Any = field(default_factory=lambda: NOT_GIVEN) + thinking: "GoogleLLMService.ThinkingConfig" | _NotGiven = field( + default_factory=lambda: NOT_GIVEN + ) @classmethod def from_mapping(cls, settings): diff --git a/src/pipecat/services/google/stt.py b/src/pipecat/services/google/stt.py index cdd583c8e..72d4f12b6 100644 --- a/src/pipecat/services/google/stt.py +++ b/src/pipecat/services/google/stt.py @@ -36,7 +36,7 @@ from pipecat.frames.frames import ( StartFrame, TranscriptionFrame, ) -from pipecat.services.settings import NOT_GIVEN, STTSettings +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 @@ -383,17 +383,19 @@ class GoogleSTTSettings(STTSettings): enable_voice_activity_events: Detect voice activity in audio. """ - languages: Any = field(default_factory=lambda: NOT_GIVEN) - language_codes: Any = field(default_factory=lambda: NOT_GIVEN) - use_separate_recognition_per_channel: Any = field(default_factory=lambda: NOT_GIVEN) - enable_automatic_punctuation: Any = field(default_factory=lambda: NOT_GIVEN) - enable_spoken_punctuation: Any = field(default_factory=lambda: NOT_GIVEN) - enable_spoken_emojis: Any = field(default_factory=lambda: NOT_GIVEN) - profanity_filter: Any = field(default_factory=lambda: NOT_GIVEN) - enable_word_time_offsets: Any = field(default_factory=lambda: NOT_GIVEN) - enable_word_confidence: Any = field(default_factory=lambda: NOT_GIVEN) - enable_interim_results: Any = field(default_factory=lambda: NOT_GIVEN) - enable_voice_activity_events: Any = field(default_factory=lambda: NOT_GIVEN) + languages: List[Language] | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + language_codes: List[str] | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + use_separate_recognition_per_channel: bool | _NotGiven = field( + default_factory=lambda: NOT_GIVEN + ) + enable_automatic_punctuation: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + enable_spoken_punctuation: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + enable_spoken_emojis: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + profanity_filter: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + enable_word_time_offsets: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + enable_word_confidence: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + enable_interim_results: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + enable_voice_activity_events: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class GoogleSTTService(STTService): diff --git a/src/pipecat/services/google/tts.py b/src/pipecat/services/google/tts.py index e47aa384a..60bed9c6d 100644 --- a/src/pipecat/services/google/tts.py +++ b/src/pipecat/services/google/tts.py @@ -24,7 +24,7 @@ from pipecat.utils.tracing.service_decorators import traced_tts os.environ["GRPC_ENABLE_FORK_SUPPORT"] = "false" from dataclasses import dataclass, field -from typing import Any, AsyncGenerator, List, Literal, Optional +from typing import Any, AsyncGenerator, Dict, List, Literal, Optional from loguru import logger from pydantic import BaseModel @@ -37,7 +37,7 @@ from pipecat.frames.frames import ( TTSStartedFrame, TTSStoppedFrame, ) -from pipecat.services.settings import NOT_GIVEN, TTSSettings, is_given +from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven, is_given from pipecat.services.tts_service import TTSService from pipecat.transcriptions.language import Language, resolve_language @@ -493,14 +493,20 @@ class GoogleHttpTTSSettings(TTSSettings): google_style: Google-specific voice style. """ - pitch: str = field(default_factory=lambda: NOT_GIVEN) - rate: str = field(default_factory=lambda: NOT_GIVEN) - speaking_rate: float = field(default_factory=lambda: NOT_GIVEN) - volume: str = field(default_factory=lambda: NOT_GIVEN) - emphasis: str = field(default_factory=lambda: NOT_GIVEN) - language: str = field(default_factory=lambda: NOT_GIVEN) - gender: str = field(default_factory=lambda: NOT_GIVEN) - google_style: str = field(default_factory=lambda: NOT_GIVEN) + pitch: str | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + rate: str | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + speaking_rate: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + volume: str | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + emphasis: Literal["strong", "moderate", "reduced", "none"] | None | _NotGiven = field( + default_factory=lambda: NOT_GIVEN + ) + language: str | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + gender: Literal["male", "female", "neutral"] | None | _NotGiven = field( + default_factory=lambda: NOT_GIVEN + ) + google_style: ( + Literal["apologetic", "calm", "empathetic", "firm", "lively"] | None | _NotGiven + ) = field(default_factory=lambda: NOT_GIVEN) @dataclass @@ -512,8 +518,8 @@ class GoogleStreamTTSSettings(TTSSettings): speaking_rate: The speaking rate, in the range [0.25, 2.0]. """ - language: str = field(default_factory=lambda: NOT_GIVEN) - speaking_rate: float = field(default_factory=lambda: NOT_GIVEN) + language: str | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + speaking_rate: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) @dataclass @@ -527,10 +533,12 @@ class GeminiTTSSettings(TTSSettings): speaker_configs: List of speaker configurations for multi-speaker mode. """ - language: str = field(default_factory=lambda: NOT_GIVEN) - prompt: str = field(default_factory=lambda: NOT_GIVEN) - multi_speaker: bool = field(default_factory=lambda: NOT_GIVEN) - speaker_configs: List[dict] = field(default_factory=lambda: NOT_GIVEN) + language: str | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + prompt: str | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + multi_speaker: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + speaker_configs: list[dict[str, Any]] | None | _NotGiven = field( + default_factory=lambda: NOT_GIVEN + ) class GoogleHttpTTSService(TTSService): diff --git a/src/pipecat/services/gradium/stt.py b/src/pipecat/services/gradium/stt.py index 381f76884..1583fac3c 100644 --- a/src/pipecat/services/gradium/stt.py +++ b/src/pipecat/services/gradium/stt.py @@ -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, is_given +from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven, is_given from pipecat.services.stt_latency import GRADIUM_TTFS_P99 from pipecat.services.stt_service import WebsocketSTTService from pipecat.transcriptions.language import Language, resolve_language @@ -75,7 +75,7 @@ class GradiumSTTSettings(STTSettings): generated. Higher delays allow more context but increase latency. """ - delay_in_frames: int = field(default_factory=lambda: NOT_GIVEN) + delay_in_frames: int | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class GradiumSTTService(WebsocketSTTService): diff --git a/src/pipecat/services/gradium/tts.py b/src/pipecat/services/gradium/tts.py index 3bffbb5bf..c41c77436 100644 --- a/src/pipecat/services/gradium/tts.py +++ b/src/pipecat/services/gradium/tts.py @@ -23,7 +23,7 @@ from pipecat.frames.frames import ( TTSStoppedFrame, ) from pipecat.processors.frame_processor import FrameDirection -from pipecat.services.settings import NOT_GIVEN, TTSSettings +from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven from pipecat.services.tts_service import InterruptibleWordTTSService from pipecat.utils.tracing.service_decorators import traced_tts @@ -47,7 +47,7 @@ class GradiumTTSSettings(TTSSettings): output_format: Audio output format. """ - output_format: str = field(default_factory=lambda: NOT_GIVEN) + output_format: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class GradiumTTSService(InterruptibleWordTTSService): diff --git a/src/pipecat/services/groq/tts.py b/src/pipecat/services/groq/tts.py index e4c10f2e9..b3b4c5f57 100644 --- a/src/pipecat/services/groq/tts.py +++ b/src/pipecat/services/groq/tts.py @@ -21,7 +21,7 @@ from pipecat.frames.frames import ( TTSStartedFrame, TTSStoppedFrame, ) -from pipecat.services.settings import NOT_GIVEN, TTSSettings +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 @@ -44,9 +44,9 @@ class GroqTTSSettings(TTSSettings): groq_sample_rate: Audio sample rate. """ - output_format: str = field(default_factory=lambda: NOT_GIVEN) - speed: float = field(default_factory=lambda: NOT_GIVEN) - groq_sample_rate: int = field(default_factory=lambda: NOT_GIVEN) + output_format: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + speed: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + groq_sample_rate: int | _NotGiven = field(default_factory=lambda: NOT_GIVEN) _aliases: ClassVar[Dict[str, str]] = {"voice_id": "voice", "sample_rate": "groq_sample_rate"} diff --git a/src/pipecat/services/hathora/stt.py b/src/pipecat/services/hathora/stt.py index a620ed79a..e77e382c0 100644 --- a/src/pipecat/services/hathora/stt.py +++ b/src/pipecat/services/hathora/stt.py @@ -19,7 +19,7 @@ from pipecat.frames.frames import ( Frame, TranscriptionFrame, ) -from pipecat.services.settings import NOT_GIVEN, STTSettings +from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven from pipecat.services.stt_latency import HATHORA_TTFS_P99 from pipecat.services.stt_service import SegmentedSTTService from pipecat.transcriptions.language import Language @@ -39,7 +39,7 @@ class HathoraSTTSettings(STTSettings): what is supported. """ - config: Optional[list] = field(default_factory=lambda: NOT_GIVEN) + config: list[ConfigOption] | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class HathoraSTTService(SegmentedSTTService): diff --git a/src/pipecat/services/hathora/tts.py b/src/pipecat/services/hathora/tts.py index f3524734a..e15dfcc54 100644 --- a/src/pipecat/services/hathora/tts.py +++ b/src/pipecat/services/hathora/tts.py @@ -22,7 +22,7 @@ from pipecat.frames.frames import ( TTSStartedFrame, TTSStoppedFrame, ) -from pipecat.services.settings import NOT_GIVEN, TTSSettings +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 @@ -58,8 +58,8 @@ class HathoraTTSSettings(TTSSettings): what is supported. """ - speed: float = field(default_factory=lambda: NOT_GIVEN) - config: list = field(default_factory=lambda: NOT_GIVEN) + speed: float | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + config: list[ConfigOption] | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class HathoraTTSService(TTSService): diff --git a/src/pipecat/services/inworld/tts.py b/src/pipecat/services/inworld/tts.py index fea30f3a1..bdbbb82d7 100644 --- a/src/pipecat/services/inworld/tts.py +++ b/src/pipecat/services/inworld/tts.py @@ -24,7 +24,7 @@ import websockets from loguru import logger from pydantic import BaseModel -from pipecat.services.settings import NOT_GIVEN, TTSSettings, is_given +from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven, is_given try: from websockets.asyncio.client import connect as websocket_connect @@ -67,12 +67,12 @@ class InworldTTSSettings(TTSSettings): apply_text_normalization: Whether to apply text normalization. """ - audio_encoding: str = field(default_factory=lambda: NOT_GIVEN) - audio_sample_rate: int = field(default_factory=lambda: NOT_GIVEN) - speaking_rate: float = field(default_factory=lambda: NOT_GIVEN) - temperature: float = field(default_factory=lambda: NOT_GIVEN) - auto_mode: bool = field(default_factory=lambda: NOT_GIVEN) - apply_text_normalization: str = field(default_factory=lambda: NOT_GIVEN) + audio_encoding: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + audio_sample_rate: int | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + speaking_rate: float | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + temperature: float | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + auto_mode: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + apply_text_normalization: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) _aliases: ClassVar[Dict[str, str]] = { "voice_id": "voice", diff --git a/src/pipecat/services/kokoro/tts.py b/src/pipecat/services/kokoro/tts.py index b88511437..735145da7 100644 --- a/src/pipecat/services/kokoro/tts.py +++ b/src/pipecat/services/kokoro/tts.py @@ -23,7 +23,7 @@ from pipecat.frames.frames import ( TTSStartedFrame, TTSStoppedFrame, ) -from pipecat.services.settings import NOT_GIVEN, TTSSettings +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 @@ -97,7 +97,7 @@ class KokoroTTSSettings(TTSSettings): lang_code: Kokoro language code for synthesis. """ - lang_code: str = field(default_factory=lambda: NOT_GIVEN) + lang_code: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class KokoroTTSService(TTSService): diff --git a/src/pipecat/services/lmnt/tts.py b/src/pipecat/services/lmnt/tts.py index 5b2adcaf4..94f4a1a9e 100644 --- a/src/pipecat/services/lmnt/tts.py +++ b/src/pipecat/services/lmnt/tts.py @@ -24,7 +24,7 @@ from pipecat.frames.frames import ( TTSStoppedFrame, ) from pipecat.processors.frame_processor import FrameDirection -from pipecat.services.settings import NOT_GIVEN, TTSSettings +from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven from pipecat.services.tts_service import InterruptibleTTSService from pipecat.transcriptions.language import Language, resolve_language from pipecat.utils.tracing.service_decorators import traced_tts @@ -81,7 +81,7 @@ class LmntTTSSettings(TTSSettings): format: Audio output format. Defaults to "raw". """ - format: str = field(default_factory=lambda: NOT_GIVEN) + format: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class LmntTTSService(InterruptibleTTSService): diff --git a/src/pipecat/services/minimax/tts.py b/src/pipecat/services/minimax/tts.py index 6a107d950..290439704 100644 --- a/src/pipecat/services/minimax/tts.py +++ b/src/pipecat/services/minimax/tts.py @@ -26,7 +26,7 @@ from pipecat.frames.frames import ( TTSStartedFrame, TTSStoppedFrame, ) -from pipecat.services.settings import NOT_GIVEN, TTSSettings, is_given +from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven, is_given from pipecat.services.tts_service import TTSService from pipecat.transcriptions.language import Language, resolve_language from pipecat.utils.tracing.service_decorators import traced_tts @@ -107,18 +107,18 @@ class MiniMaxTTSSettings(TTSSettings): language_boost: Language boost string for multilingual support. """ - stream: bool = field(default_factory=lambda: NOT_GIVEN) - speed: float = field(default_factory=lambda: NOT_GIVEN) - volume: float = field(default_factory=lambda: NOT_GIVEN) - pitch: int = field(default_factory=lambda: NOT_GIVEN) - emotion: str = field(default_factory=lambda: NOT_GIVEN) - text_normalization: bool = field(default_factory=lambda: NOT_GIVEN) - latex_read: bool = field(default_factory=lambda: NOT_GIVEN) - audio_bitrate: int = field(default_factory=lambda: NOT_GIVEN) - audio_format: str = field(default_factory=lambda: NOT_GIVEN) - audio_channel: int = field(default_factory=lambda: NOT_GIVEN) - audio_sample_rate: int = field(default_factory=lambda: NOT_GIVEN) - language_boost: str = field(default_factory=lambda: NOT_GIVEN) + stream: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + speed: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + volume: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + pitch: int | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + emotion: str | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + text_normalization: bool | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + latex_read: bool | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + audio_bitrate: int | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + audio_format: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + audio_channel: int | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + audio_sample_rate: int | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + language_boost: str | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) _aliases: ClassVar[Dict[str, str]] = {"voice_id": "voice"} diff --git a/src/pipecat/services/neuphonic/tts.py b/src/pipecat/services/neuphonic/tts.py index 0797f9b1b..2e51297ab 100644 --- a/src/pipecat/services/neuphonic/tts.py +++ b/src/pipecat/services/neuphonic/tts.py @@ -35,7 +35,7 @@ from pipecat.frames.frames import ( TTSStoppedFrame, ) from pipecat.processors.frame_processor import FrameDirection -from pipecat.services.settings import NOT_GIVEN, TTSSettings +from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven from pipecat.services.tts_service import InterruptibleTTSService, TTSService from pipecat.transcriptions.language import Language, resolve_language from pipecat.utils.tracing.service_decorators import traced_tts @@ -85,10 +85,10 @@ class NeuphonicTTSSettings(TTSSettings): sampling_rate: Audio sample rate. """ - lang_code: str = field(default_factory=lambda: NOT_GIVEN) - speed: float = field(default_factory=lambda: NOT_GIVEN) - encoding: str = field(default_factory=lambda: NOT_GIVEN) - sampling_rate: int = field(default_factory=lambda: NOT_GIVEN) + lang_code: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + speed: float | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + encoding: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + sampling_rate: int | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class NeuphonicTTSService(InterruptibleTTSService): diff --git a/src/pipecat/services/nvidia/stt.py b/src/pipecat/services/nvidia/stt.py index 8e1babec7..a79119c34 100644 --- a/src/pipecat/services/nvidia/stt.py +++ b/src/pipecat/services/nvidia/stt.py @@ -23,7 +23,7 @@ from pipecat.frames.frames import ( StartFrame, TranscriptionFrame, ) -from pipecat.services.settings import NOT_GIVEN, STTSettings +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 @@ -110,11 +110,11 @@ class NvidiaSegmentedSTTSettings(STTSettings): boosted_lm_score: Score boost for specified words. """ - profanity_filter: bool = field(default_factory=lambda: NOT_GIVEN) - automatic_punctuation: bool = field(default_factory=lambda: NOT_GIVEN) - verbatim_transcripts: bool = field(default_factory=lambda: NOT_GIVEN) - boosted_lm_words: Optional[List[str]] = field(default_factory=lambda: NOT_GIVEN) - boosted_lm_score: float = field(default_factory=lambda: NOT_GIVEN) + profanity_filter: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + automatic_punctuation: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + verbatim_transcripts: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + boosted_lm_words: List[str] | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + boosted_lm_score: float | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class NvidiaSTTService(STTService): diff --git a/src/pipecat/services/openai/base_llm.py b/src/pipecat/services/openai/base_llm.py index 13cbc07cb..5b624010f 100644 --- a/src/pipecat/services/openai/base_llm.py +++ b/src/pipecat/services/openai/base_llm.py @@ -43,7 +43,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 +from pipecat.services.settings import LLMSettings, _NotGiven from pipecat.utils.tracing.service_decorators import traced_llm @@ -56,8 +56,8 @@ class OpenAILLMSettings(LLMSettings): service_tier: Service tier to use (e.g., "auto", "flex", "priority"). """ - max_completion_tokens: Any = field(default_factory=lambda: _NOT_GIVEN) - service_tier: Any = field(default_factory=lambda: _NOT_GIVEN) + max_completion_tokens: int | _NotGiven = field(default_factory=lambda: _NOT_GIVEN) + service_tier: str | _NotGiven = field(default_factory=lambda: _NOT_GIVEN) class BaseOpenAILLMService(LLMService): diff --git a/src/pipecat/services/openai/stt.py b/src/pipecat/services/openai/stt.py index 6daefd1da..82ad8c0f0 100644 --- a/src/pipecat/services/openai/stt.py +++ b/src/pipecat/services/openai/stt.py @@ -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, is_given +from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven, is_given 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, Transcription @@ -133,7 +133,7 @@ class OpenAIRealtimeSTTSettings(STTSettings): prompt: Optional prompt text to guide transcription style. """ - prompt: Optional[str] = field(default_factory=lambda: NOT_GIVEN) + prompt: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class OpenAIRealtimeSTTService(WebsocketSTTService): diff --git a/src/pipecat/services/openai/tts.py b/src/pipecat/services/openai/tts.py index f283a7912..2253e369a 100644 --- a/src/pipecat/services/openai/tts.py +++ b/src/pipecat/services/openai/tts.py @@ -25,7 +25,7 @@ from pipecat.frames.frames import ( TTSStartedFrame, TTSStoppedFrame, ) -from pipecat.services.settings import NOT_GIVEN, TTSSettings +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 @@ -71,8 +71,8 @@ class OpenAITTSSettings(TTSSettings): speed: Voice speed control (0.25 to 4.0, default 1.0). """ - instructions: str = field(default_factory=lambda: NOT_GIVEN) - speed: float = field(default_factory=lambda: NOT_GIVEN) + instructions: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + speed: float | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class OpenAITTSService(TTSService): diff --git a/src/pipecat/services/openai_realtime_beta/openai.py b/src/pipecat/services/openai_realtime_beta/openai.py index b456ed0b8..ef40dcb15 100644 --- a/src/pipecat/services/openai_realtime_beta/openai.py +++ b/src/pipecat/services/openai_realtime_beta/openai.py @@ -11,7 +11,7 @@ import json import time import warnings from dataclasses import dataclass, field -from typing import Any, Optional +from typing import Optional from loguru import logger @@ -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 NOT_GIVEN, LLMSettings +from pipecat.services.settings import NOT_GIVEN, LLMSettings, _NotGiven 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 @@ -100,7 +100,9 @@ class OpenAIRealtimeBetaLLMSettings(LLMSettings): session_properties: OpenAI Realtime session configuration. """ - session_properties: Any = field(default_factory=lambda: NOT_GIVEN) + session_properties: events.SessionProperties | _NotGiven = field( + default_factory=lambda: NOT_GIVEN + ) class OpenAIRealtimeBetaLLMService(LLMService): diff --git a/src/pipecat/services/playht/tts.py b/src/pipecat/services/playht/tts.py index 1965c9ea3..b5c683fbe 100644 --- a/src/pipecat/services/playht/tts.py +++ b/src/pipecat/services/playht/tts.py @@ -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, is_given +from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven, is_given from pipecat.services.tts_service import InterruptibleTTSService, TTSService from pipecat.transcriptions.language import Language, resolve_language from pipecat.utils.tracing.service_decorators import traced_tts @@ -111,11 +111,11 @@ class PlayHTTTSSettings(TTSSettings): playht_sample_rate: Audio sample rate sent to the API. """ - output_format: str = field(default_factory=lambda: NOT_GIVEN) - voice_engine: str = field(default_factory=lambda: NOT_GIVEN) - speed: float = field(default_factory=lambda: NOT_GIVEN) - seed: int = field(default_factory=lambda: NOT_GIVEN) - playht_sample_rate: int = field(default_factory=lambda: NOT_GIVEN) + output_format: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + voice_engine: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + speed: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + seed: int | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + playht_sample_rate: int | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class PlayHTTTSService(InterruptibleTTSService): diff --git a/src/pipecat/services/resembleai/tts.py b/src/pipecat/services/resembleai/tts.py index acba883e4..f2873a8a1 100644 --- a/src/pipecat/services/resembleai/tts.py +++ b/src/pipecat/services/resembleai/tts.py @@ -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 +from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven from pipecat.services.tts_service import AudioContextWordTTSService from pipecat.transcriptions.language import Language from pipecat.utils.text.base_text_aggregator import BaseTextAggregator @@ -50,9 +50,9 @@ class ResembleAITTSSettings(TTSSettings): resemble_sample_rate: Audio sample rate sent to the API. """ - precision: str = field(default_factory=lambda: NOT_GIVEN) - output_format: str = field(default_factory=lambda: NOT_GIVEN) - resemble_sample_rate: int = field(default_factory=lambda: NOT_GIVEN) + precision: str | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + output_format: str | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + resemble_sample_rate: int | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) _aliases: ClassVar[Dict[str, str]] = { "voice_id": "voice", diff --git a/src/pipecat/services/rime/tts.py b/src/pipecat/services/rime/tts.py index d76eafbfa..87596cefd 100644 --- a/src/pipecat/services/rime/tts.py +++ b/src/pipecat/services/rime/tts.py @@ -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, is_given +from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven, is_given from pipecat.services.tts_service import ( AudioContextWordTTSService, InterruptibleTTSService, @@ -86,15 +86,15 @@ class RimeTTSSettings(TTSSettings): inlineSpeedAlpha: Inline speed control markup. """ - modelId: str = field(default_factory=lambda: NOT_GIVEN) - audioFormat: str = field(default_factory=lambda: NOT_GIVEN) - samplingRate: int = field(default_factory=lambda: NOT_GIVEN) - lang: str = field(default_factory=lambda: NOT_GIVEN) - speedAlpha: float = field(default_factory=lambda: NOT_GIVEN) - reduceLatency: bool = field(default_factory=lambda: NOT_GIVEN) - pauseBetweenBrackets: bool = field(default_factory=lambda: NOT_GIVEN) - phonemizeBetweenBrackets: bool = field(default_factory=lambda: NOT_GIVEN) - inlineSpeedAlpha: str = field(default_factory=lambda: NOT_GIVEN) + modelId: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + audioFormat: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + samplingRate: int | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + lang: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + speedAlpha: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + reduceLatency: bool | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + pauseBetweenBrackets: bool | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + phonemizeBetweenBrackets: bool | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + inlineSpeedAlpha: str | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) _aliases: ClassVar[Dict[str, str]] = {"speaker": "voice"} @@ -114,14 +114,14 @@ class RimeNonJsonTTSSettings(TTSSettings): top_p: Cumulative probability threshold (0.0-1.0). """ - modelId: str = field(default_factory=lambda: NOT_GIVEN) - audioFormat: str = field(default_factory=lambda: NOT_GIVEN) - samplingRate: int = field(default_factory=lambda: NOT_GIVEN) - lang: str = field(default_factory=lambda: NOT_GIVEN) - segment: str = field(default_factory=lambda: NOT_GIVEN) - repetition_penalty: float = field(default_factory=lambda: NOT_GIVEN) - temperature: float = field(default_factory=lambda: NOT_GIVEN) - top_p: float = field(default_factory=lambda: NOT_GIVEN) + modelId: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + audioFormat: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + samplingRate: int | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + lang: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + segment: str | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + repetition_penalty: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + temperature: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + top_p: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) _aliases: ClassVar[Dict[str, str]] = {"speaker": "voice"} diff --git a/src/pipecat/services/sarvam/stt.py b/src/pipecat/services/sarvam/stt.py index 80e6d6ca2..aa6baef14 100644 --- a/src/pipecat/services/sarvam/stt.py +++ b/src/pipecat/services/sarvam/stt.py @@ -32,7 +32,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, STTSettings, is_given +from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven, is_given from pipecat.services.stt_latency import SARVAM_TTFS_P99 from pipecat.services.stt_service import STTService from pipecat.transcriptions.language import Language, resolve_language @@ -142,10 +142,10 @@ class SarvamSTTSettings(STTSettings): high_vad_sensitivity: Enable high VAD sensitivity. """ - prompt: Optional[str] = field(default_factory=lambda: NOT_GIVEN) - mode: Optional[str] = field(default_factory=lambda: NOT_GIVEN) - vad_signals: Optional[bool] = field(default_factory=lambda: NOT_GIVEN) - high_vad_sensitivity: Optional[bool] = field(default_factory=lambda: NOT_GIVEN) + prompt: str | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + mode: str | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + vad_signals: bool | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + high_vad_sensitivity: bool | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class SarvamSTTService(STTService): diff --git a/src/pipecat/services/sarvam/tts.py b/src/pipecat/services/sarvam/tts.py index aff96f1dd..332643fc9 100644 --- a/src/pipecat/services/sarvam/tts.py +++ b/src/pipecat/services/sarvam/tts.py @@ -62,7 +62,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, is_given +from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven, is_given from pipecat.services.tts_service import InterruptibleTTSService, TTSService from pipecat.transcriptions.language import Language, resolve_language from pipecat.utils.tracing.service_decorators import traced_tts @@ -266,13 +266,13 @@ class SarvamHttpTTSSettings(TTSSettings): sample_rate: Audio sample rate. """ - language: str = field(default_factory=lambda: NOT_GIVEN) - enable_preprocessing: bool = field(default_factory=lambda: NOT_GIVEN) - pace: float = field(default_factory=lambda: NOT_GIVEN) - pitch: float = field(default_factory=lambda: NOT_GIVEN) - loudness: float = field(default_factory=lambda: NOT_GIVEN) - temperature: float = field(default_factory=lambda: NOT_GIVEN) - sarvam_sample_rate: int = field(default_factory=lambda: NOT_GIVEN) + language: str | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + enable_preprocessing: bool | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + pace: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + pitch: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + loudness: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + temperature: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + sarvam_sample_rate: int | _NotGiven = field(default_factory=lambda: NOT_GIVEN) @dataclass @@ -305,18 +305,18 @@ class SarvamTTSSettings(TTSSettings): **Note:** Only supported for bulbul:v3-beta. Ignored for v2. """ - target_language_code: str = field(default_factory=lambda: NOT_GIVEN) - speaker: str = field(default_factory=lambda: NOT_GIVEN) - speech_sample_rate: str = field(default_factory=lambda: NOT_GIVEN) - enable_preprocessing: bool = field(default_factory=lambda: NOT_GIVEN) - min_buffer_size: int = field(default_factory=lambda: NOT_GIVEN) - max_chunk_length: int = field(default_factory=lambda: NOT_GIVEN) - output_audio_codec: str = field(default_factory=lambda: NOT_GIVEN) - output_audio_bitrate: str = field(default_factory=lambda: NOT_GIVEN) - pace: float = field(default_factory=lambda: NOT_GIVEN) - pitch: float = field(default_factory=lambda: NOT_GIVEN) - loudness: float = field(default_factory=lambda: NOT_GIVEN) - temperature: float = field(default_factory=lambda: NOT_GIVEN) + target_language_code: str | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + speaker: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + speech_sample_rate: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + enable_preprocessing: bool | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + min_buffer_size: int | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + max_chunk_length: int | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + output_audio_codec: str | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + output_audio_bitrate: str | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + pace: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + pitch: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + loudness: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + temperature: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class SarvamHttpTTSService(TTSService): diff --git a/src/pipecat/services/soniox/stt.py b/src/pipecat/services/soniox/stt.py index 5c4b49cbe..1f34c061c 100644 --- a/src/pipecat/services/soniox/stt.py +++ b/src/pipecat/services/soniox/stt.py @@ -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, is_given +from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven, is_given from pipecat.services.stt_latency import SONIOX_TTFS_P99 from pipecat.services.stt_service import WebsocketSTTService from pipecat.transcriptions.language import Language @@ -144,7 +144,7 @@ class SonioxSTTSettings(STTSettings): input_params: Soniox ``SonioxInputParams`` for detailed configuration. """ - input_params: SonioxInputParams = field(default_factory=lambda: NOT_GIVEN) + input_params: SonioxInputParams | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class SonioxSTTService(WebsocketSTTService): diff --git a/src/pipecat/services/speechmatics/stt.py b/src/pipecat/services/speechmatics/stt.py index 166e19d97..2e23765b2 100644 --- a/src/pipecat/services/speechmatics/stt.py +++ b/src/pipecat/services/speechmatics/stt.py @@ -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, is_given +from pipecat.services.settings import NOT_GIVEN, STTSettings, _NotGiven, is_given from pipecat.services.stt_latency import SPEECHMATICS_TTFS_P99 from pipecat.services.stt_service import STTService from pipecat.transcriptions.language import Language, resolve_language @@ -115,28 +115,30 @@ class SpeechmaticsSTTSettings(STTSettings): extra_params: Extra parameters for the STT engine. """ - domain: str = field(default_factory=lambda: NOT_GIVEN) - turn_detection_mode: TurnDetectionMode = field(default_factory=lambda: NOT_GIVEN) - speaker_active_format: str = field(default_factory=lambda: NOT_GIVEN) - speaker_passive_format: str = field(default_factory=lambda: NOT_GIVEN) - focus_speakers: list = field(default_factory=lambda: NOT_GIVEN) - ignore_speakers: list = field(default_factory=lambda: NOT_GIVEN) - focus_mode: Any = field(default_factory=lambda: NOT_GIVEN) - known_speakers: list = field(default_factory=lambda: NOT_GIVEN) - additional_vocab: list = field(default_factory=lambda: NOT_GIVEN) - audio_encoding: Any = field(default_factory=lambda: NOT_GIVEN) - operating_point: Any = field(default_factory=lambda: NOT_GIVEN) - max_delay: float = field(default_factory=lambda: NOT_GIVEN) - end_of_utterance_silence_trigger: float = field(default_factory=lambda: NOT_GIVEN) - end_of_utterance_max_delay: float = field(default_factory=lambda: NOT_GIVEN) - punctuation_overrides: dict = field(default_factory=lambda: NOT_GIVEN) - include_partials: bool = field(default_factory=lambda: NOT_GIVEN) - split_sentences: bool = field(default_factory=lambda: NOT_GIVEN) - enable_diarization: bool = field(default_factory=lambda: NOT_GIVEN) - speaker_sensitivity: float = field(default_factory=lambda: NOT_GIVEN) - max_speakers: int = field(default_factory=lambda: NOT_GIVEN) - prefer_current_speaker: bool = field(default_factory=lambda: NOT_GIVEN) - extra_params: dict = field(default_factory=lambda: NOT_GIVEN) + domain: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + turn_detection_mode: TurnDetectionMode | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + speaker_active_format: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + speaker_passive_format: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + focus_speakers: list[str] | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + ignore_speakers: list[str] | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + focus_mode: SpeakerFocusMode | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + known_speakers: list[SpeakerIdentifier] | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + additional_vocab: list[AdditionalVocabEntry] | _NotGiven = field( + default_factory=lambda: NOT_GIVEN + ) + audio_encoding: AudioEncoding | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + operating_point: OperatingPoint | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + max_delay: float | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + end_of_utterance_silence_trigger: float | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + end_of_utterance_max_delay: float | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + punctuation_overrides: dict[str, Any] | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + include_partials: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + split_sentences: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + enable_diarization: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + speaker_sensitivity: float | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + max_speakers: int | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + prefer_current_speaker: bool | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + extra_params: dict[str, Any] | _NotGiven = field(default_factory=lambda: NOT_GIVEN) #: Fields that can be updated on a live connection via the Speechmatics #: diarization-config API — no reconnect needed. diff --git a/src/pipecat/services/ultravox/llm.py b/src/pipecat/services/ultravox/llm.py index ef8baacb4..436653c7e 100644 --- a/src/pipecat/services/ultravox/llm.py +++ b/src/pipecat/services/ultravox/llm.py @@ -56,7 +56,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, LLMSettings +from pipecat.services.settings import NOT_GIVEN, LLMSettings, _NotGiven from pipecat.utils.time import time_now_iso8601 try: @@ -75,7 +75,7 @@ class UltravoxRealtimeLLMSettings(LLMSettings): output_medium: The output medium for the model ("voice" or "text"). """ - output_medium: str = field(default=NOT_GIVEN) + output_medium: str | _NotGiven = field(default=NOT_GIVEN) class AgentInputParams(BaseModel): diff --git a/src/pipecat/services/whisper/base_stt.py b/src/pipecat/services/whisper/base_stt.py index d50c24eb2..74ca2d102 100644 --- a/src/pipecat/services/whisper/base_stt.py +++ b/src/pipecat/services/whisper/base_stt.py @@ -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 +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 @@ -37,9 +37,9 @@ class BaseWhisperSTTSettings(STTSettings): temperature: Sampling temperature between 0 and 1. """ - base_url: Optional[str] = field(default_factory=lambda: NOT_GIVEN) - prompt: Optional[str] = field(default_factory=lambda: NOT_GIVEN) - temperature: Optional[float] = field(default_factory=lambda: NOT_GIVEN) + base_url: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + prompt: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + temperature: float | _NotGiven = field(default_factory=lambda: NOT_GIVEN) def language_to_whisper_language(language: Language) -> Optional[str]: diff --git a/src/pipecat/services/whisper/stt.py b/src/pipecat/services/whisper/stt.py index d4efcb166..033d815d9 100644 --- a/src/pipecat/services/whisper/stt.py +++ b/src/pipecat/services/whisper/stt.py @@ -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 +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 @@ -184,9 +184,9 @@ class WhisperSTTSettings(STTSettings): no_speech_prob: Probability threshold for filtering non-speech segments. """ - device: str = field(default_factory=lambda: NOT_GIVEN) - compute_type: str = field(default_factory=lambda: NOT_GIVEN) - no_speech_prob: float = field(default_factory=lambda: NOT_GIVEN) + device: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + compute_type: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + no_speech_prob: float | _NotGiven = field(default_factory=lambda: NOT_GIVEN) @dataclass @@ -199,9 +199,9 @@ class WhisperMLXSTTSettings(STTSettings): engine: Whisper engine identifier. """ - no_speech_prob: float = field(default_factory=lambda: NOT_GIVEN) - temperature: float = field(default_factory=lambda: NOT_GIVEN) - engine: str = field(default_factory=lambda: NOT_GIVEN) + no_speech_prob: float | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + temperature: float | _NotGiven = field(default_factory=lambda: NOT_GIVEN) + engine: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class WhisperSTTService(SegmentedSTTService): diff --git a/src/pipecat/services/xtts/tts.py b/src/pipecat/services/xtts/tts.py index 3ba332138..65aa25e36 100644 --- a/src/pipecat/services/xtts/tts.py +++ b/src/pipecat/services/xtts/tts.py @@ -25,7 +25,7 @@ from pipecat.frames.frames import ( TTSStartedFrame, TTSStoppedFrame, ) -from pipecat.services.settings import NOT_GIVEN, TTSSettings +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 @@ -78,7 +78,7 @@ class XTTSTTSSettings(TTSSettings): base_url: Base URL of the XTTS streaming server. """ - base_url: str = field(default_factory=lambda: NOT_GIVEN) + base_url: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN) class XTTSService(TTSService):