Review feedback, clarify corresponding class in STTSettings docstrings

This commit is contained in:
Mark Backman
2026-03-06 15:14:54 -05:00
parent 6431ad8e2a
commit 7d41049b35
19 changed files with 35 additions and 31 deletions

View File

@@ -81,7 +81,7 @@ def map_language_from_assemblyai(language_code: str) -> Language:
@dataclass @dataclass
class AssemblyAISTTSettings(STTSettings): class AssemblyAISTTSettings(STTSettings):
"""Settings for the AssemblyAI STT service. """Settings for AssemblyAISTTService.
Parameters: Parameters:
formatted_finals: Whether to enable transcript formatting. formatted_finals: Whether to enable transcript formatting.

View File

@@ -47,7 +47,7 @@ except ModuleNotFoundError as e:
@dataclass @dataclass
class AWSTranscribeSTTSettings(STTSettings): class AWSTranscribeSTTSettings(STTSettings):
"""Settings for the AWS Transcribe STT service.""" """Settings for AWSTranscribeSTTService."""
pass pass

View File

@@ -53,7 +53,7 @@ except ModuleNotFoundError as e:
@dataclass @dataclass
class AzureSTTSettings(STTSettings): class AzureSTTSettings(STTSettings):
"""Settings for the Azure STT service.""" """Settings for AzureSTTService."""
pass pass

View File

@@ -46,7 +46,7 @@ except ModuleNotFoundError as e:
@dataclass @dataclass
class CartesiaSTTSettings(STTSettings): class CartesiaSTTSettings(STTSettings):
"""Settings for the Cartesia STT service.""" """Settings for CartesiaSTTService."""
pass pass

View File

@@ -71,7 +71,7 @@ class FluxEventType(str, Enum):
@dataclass @dataclass
class DeepgramFluxSTTSettings(STTSettings): class DeepgramFluxSTTSettings(STTSettings):
"""Settings for the Deepgram Flux STT service. """Settings for DeepgramFluxSTTService.
Parameters: Parameters:
eager_eot_threshold: EagerEndOfTurn/TurnResumed threshold. Off by default. eager_eot_threshold: EagerEndOfTurn/TurnResumed threshold. Off by default.

View File

@@ -177,7 +177,7 @@ class LiveOptions:
@dataclass @dataclass
class DeepgramSTTSettings(STTSettings): class DeepgramSTTSettings(STTSettings):
"""Settings for Deepgram STT services. """Settings for DeepgramSTTService.
``model`` and ``language`` are inherited from ``STTSettings`` / ``model`` and ``language`` are inherited from ``STTSettings`` /
``ServiceSettings``. Additional Deepgram connection params may ``ServiceSettings``. Additional Deepgram connection params may

View File

@@ -179,7 +179,7 @@ class CommitStrategy(str, Enum):
@dataclass @dataclass
class ElevenLabsSTTSettings(STTSettings): class ElevenLabsSTTSettings(STTSettings):
"""Settings for the ElevenLabs file-based STT service. """Settings for ElevenLabsSTTService.
Parameters: Parameters:
tag_audio_events: Whether to include audio events like (laughter), tag_audio_events: Whether to include audio events like (laughter),
@@ -191,7 +191,7 @@ class ElevenLabsSTTSettings(STTSettings):
@dataclass @dataclass
class ElevenLabsRealtimeSTTSettings(STTSettings): class ElevenLabsRealtimeSTTSettings(STTSettings):
"""Settings for the ElevenLabs Realtime STT service. """Settings for ElevenLabsRealtimeSTTService.
See ``ElevenLabsRealtimeSTTService.InputParams`` for detailed descriptions. See ``ElevenLabsRealtimeSTTService.InputParams`` for detailed descriptions.

View File

@@ -143,7 +143,7 @@ def language_to_fal_language(language: Language) -> Optional[str]:
@dataclass @dataclass
class FalSTTSettings(STTSettings): class FalSTTSettings(STTSettings):
"""Settings for the Fal Wizper STT service.""" """Settings for FalSTTService."""
pass pass

View File

@@ -188,7 +188,7 @@ class _InputParamsDescriptor:
@dataclass @dataclass
class GladiaSTTSettings(STTSettings): class GladiaSTTSettings(STTSettings):
"""Settings for Gladia STT service. """Settings for GladiaSTTService.
Parameters: Parameters:
language_config: Language detection and handling configuration. language_config: Language detection and handling configuration.

View File

@@ -360,7 +360,7 @@ def language_to_google_stt_language(language: Language) -> Optional[str]:
@dataclass @dataclass
class GoogleSTTSettings(STTSettings): class GoogleSTTSettings(STTSettings):
"""Settings for Google Cloud Speech-to-Text V2. """Settings for GoogleSTTService.
Parameters: Parameters:
languages: List of ``Language`` enums for recognition languages: List of ``Language`` enums for recognition

View File

@@ -482,7 +482,7 @@ def language_to_gemini_tts_language(language: Language) -> Optional[str]:
@dataclass @dataclass
class GoogleHttpTTSSettings(TTSSettings): class GoogleHttpTTSSettings(TTSSettings):
"""Settings for Google HTTP TTS service. """Settings for GoogleHttpTTSService.
Parameters: Parameters:
pitch: Voice pitch adjustment (e.g., "+2st", "-50%"). pitch: Voice pitch adjustment (e.g., "+2st", "-50%").
@@ -513,7 +513,7 @@ class GoogleHttpTTSSettings(TTSSettings):
@dataclass @dataclass
class GoogleTTSSettings(TTSSettings): class GoogleTTSSettings(TTSSettings):
"""Settings for Google streaming TTS service. """Settings for GoogleTTSService.
Parameters: Parameters:
speaking_rate: The speaking rate, in the range [0.25, 2.0]. speaking_rate: The speaking rate, in the range [0.25, 2.0].
@@ -522,9 +522,14 @@ class GoogleTTSSettings(TTSSettings):
speaking_rate: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN) speaking_rate: float | None | _NotGiven = field(default_factory=lambda: NOT_GIVEN)
#: .. deprecated:: 0.0.105
#: Use ``GoogleTTSSettings`` instead.
GoogleStreamTTSSettings = GoogleTTSSettings
@dataclass @dataclass
class GeminiTTSSettings(TTSSettings): class GeminiTTSSettings(TTSSettings):
"""Settings for Gemini TTS service. """Settings for GeminiTTSService.
Parameters: Parameters:
prompt: Optional style instructions for how to synthesize the content. prompt: Optional style instructions for how to synthesize the content.

View File

@@ -68,7 +68,7 @@ def language_to_gradium_language(language: Language) -> Optional[str]:
@dataclass @dataclass
class GradiumSTTSettings(STTSettings): class GradiumSTTSettings(STTSettings):
"""Settings for the Gradium STT service.""" """Settings for GradiumSTTService."""
pass pass

View File

@@ -93,14 +93,14 @@ def language_to_nvidia_riva_language(language: Language) -> Optional[str]:
@dataclass @dataclass
class NvidiaSTTSettings(STTSettings): class NvidiaSTTSettings(STTSettings):
"""Settings for the NVIDIA Riva streaming STT service.""" """Settings for NvidiaSTTService."""
pass pass
@dataclass @dataclass
class NvidiaSegmentedSTTSettings(STTSettings): class NvidiaSegmentedSTTSettings(STTSettings):
"""Settings for the NVIDIA Riva segmented STT service. """Settings for NvidiaSegmentedSTTService.
Parameters: Parameters:
profanity_filter: Whether to filter profanity from results. profanity_filter: Whether to filter profanity from results.

View File

@@ -182,7 +182,7 @@ _OPENAI_SAMPLE_RATE = 24000
@dataclass @dataclass
class OpenAIRealtimeSTTSettings(STTSettings): class OpenAIRealtimeSTTSettings(STTSettings):
"""Settings for the OpenAI Realtime STT service. """Settings for OpenAIRealtimeSTTService.
Parameters: Parameters:
prompt: Optional prompt text to guide transcription style. prompt: Optional prompt text to guide transcription style.

View File

@@ -139,7 +139,7 @@ MODEL_CONFIGS: Dict[str, ModelConfig] = {
@dataclass @dataclass
class SarvamSTTSettings(STTSettings): class SarvamSTTSettings(STTSettings):
"""Settings for the Sarvam STT service. """Settings for SarvamSTTService.
Parameters: Parameters:
prompt: Optional prompt to guide transcription/translation style/context. prompt: Optional prompt to guide transcription/translation style/context.

View File

@@ -141,7 +141,7 @@ def _prepare_language_hints(
@dataclass @dataclass
class SonioxSTTSettings(STTSettings): class SonioxSTTSettings(STTSettings):
"""Settings for Soniox STT service. """Settings for SonioxSTTService.
Parameters: Parameters:
language_hints: List of language hints to use for transcription. language_hints: List of language hints to use for transcription.

View File

@@ -85,7 +85,7 @@ class TurnDetectionMode(str, Enum):
@dataclass @dataclass
class SpeechmaticsSTTSettings(STTSettings): class SpeechmaticsSTTSettings(STTSettings):
"""Settings for Speechmatics STT service. """Settings for SpeechmaticsSTTService.
See ``SpeechmaticsSTTService.InputParams`` for detailed descriptions of each field. See ``SpeechmaticsSTTService.InputParams`` for detailed descriptions of each field.
@@ -493,6 +493,12 @@ class SpeechmaticsSTTService(STTService):
if settings is not None: if settings is not None:
default_settings.apply_update(settings) default_settings.apply_update(settings)
# Build SDK config from settings, set model name before calling super
self._client: VoiceAgentClient | None = None
self._audio_encoding = encoding
self._config: VoiceAgentConfig = self._build_config(default_settings)
default_settings.model = self._config.operating_point.value
super().__init__( super().__init__(
sample_rate=sample_rate, sample_rate=sample_rate,
ttfs_p99_latency=ttfs_p99_latency, ttfs_p99_latency=ttfs_p99_latency,
@@ -500,13 +506,6 @@ class SpeechmaticsSTTService(STTService):
**kwargs, **kwargs,
) )
# Build SDK config from settings, then resolve model from operating_point
self._client: VoiceAgentClient | None = None
self._audio_encoding = encoding
self._config: VoiceAgentConfig = self._build_config(self._settings)
self._settings.model = self._config.operating_point.value
self._sync_model_name_to_metrics()
# Outbound frame queue # Outbound frame queue
self._outbound_frames: asyncio.Queue[Frame] = asyncio.Queue() self._outbound_frames: asyncio.Queue[Frame] = asyncio.Queue()

View File

@@ -28,7 +28,7 @@ from pipecat.utils.tracing.service_decorators import traced_stt
@dataclass @dataclass
class BaseWhisperSTTSettings(STTSettings): class BaseWhisperSTTSettings(STTSettings):
"""Settings for Whisper API-based STT services. """Settings for BaseWhisperSTTService.
Parameters: Parameters:
prompt: Optional text to guide the model's style or continue prompt: Optional text to guide the model's style or continue

View File

@@ -176,7 +176,7 @@ def language_to_whisper_language(language: Language) -> Optional[str]:
@dataclass @dataclass
class WhisperSTTSettings(STTSettings): class WhisperSTTSettings(STTSettings):
"""Settings for the local Whisper (Faster Whisper) STT service. """Settings for WhisperSTTService.
Parameters: Parameters:
no_speech_prob: Probability threshold for filtering non-speech segments. no_speech_prob: Probability threshold for filtering non-speech segments.
@@ -187,7 +187,7 @@ class WhisperSTTSettings(STTSettings):
@dataclass @dataclass
class WhisperMLXSTTSettings(STTSettings): class WhisperMLXSTTSettings(STTSettings):
"""Settings for the MLX Whisper STT service. """Settings for WhisperMLXSTTService.
Parameters: Parameters:
no_speech_prob: Probability threshold for filtering non-speech segments. no_speech_prob: Probability threshold for filtering non-speech segments.