diff --git a/CHANGELOG.md b/CHANGELOG.md index b37ee9f11..60e4151af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 sending it through the transport. This makes sending DTMF generic across all output transports. +- Added new config parameters to `GladiaSTTService`. + - PreProcessingConfig > `audio_enhancer` to enhance audio quality. + - CustomVocabularyItem > `pronunciations` and `language` to specify special pronunciations and in which language it will be pronounced. + ## Changed - `pipecat.frames.frames.KeypadEntry` is deprecated and has been moved to diff --git a/src/pipecat/services/gladia/config.py b/src/pipecat/services/gladia/config.py index 09ed61bb0..2816ebd71 100644 --- a/src/pipecat/services/gladia/config.py +++ b/src/pipecat/services/gladia/config.py @@ -29,9 +29,11 @@ class PreProcessingConfig(BaseModel): """Configuration for audio pre-processing options. Parameters: + audio_enhancer: Apply pre-processing to the audio stream to enhance quality speech_threshold: Sensitivity for speech detection (0-1) """ + audio_enhancer: Optional[bool] = None speech_threshold: Optional[float] = None @@ -41,10 +43,14 @@ class CustomVocabularyItem(BaseModel): Parameters: value: The vocabulary word or phrase intensity: The bias intensity for this vocabulary item (0-1) + pronunciations: The pronunciations used in the transcription. + language: Specify the language in which it will be pronounced when sound comparison occurs. Default to transcription language. """ value: str intensity: float + pronunciations: Optional[List[str]] = None + language: Optional[str] = None class CustomVocabularyConfig(BaseModel): @@ -170,7 +176,7 @@ class GladiaInputParams(BaseModel): channels: Optional[int] = 1 custom_metadata: Optional[Dict[str, Any]] = None endpointing: Optional[float] = None - maximum_duration_without_endpointing: Optional[int] = 10 + maximum_duration_without_endpointing: Optional[int] = 5 language: Optional[Language] = None # Deprecated language_config: Optional[LanguageConfig] = None pre_processing: Optional[PreProcessingConfig] = None diff --git a/src/pipecat/services/gladia/stt.py b/src/pipecat/services/gladia/stt.py index ca3600643..991c24bcc 100644 --- a/src/pipecat/services/gladia/stt.py +++ b/src/pipecat/services/gladia/stt.py @@ -18,6 +18,7 @@ from typing import Any, AsyncGenerator, Dict, Literal, Optional import aiohttp from loguru import logger +from pipecat import __version__ as pipecat_version from pipecat.frames.frames import ( CancelFrame, EndFrame, @@ -303,8 +304,8 @@ class GladiaSTTService(STTService): } # Add custom_metadata if provided - if self._params.custom_metadata: - settings["custom_metadata"] = self._params.custom_metadata + settings["custom_metadata"] = dict(self._params.custom_metadata or {}) + settings["custom_metadata"]["pipecat"] = pipecat_version # Add endpointing parameters if provided if self._params.endpointing is not None: @@ -430,6 +431,7 @@ class GladiaSTTService(STTService): response = await self._setup_gladia(settings) self._session_url = response["url"] self._reconnection_attempts = 0 + logger.info(f"Session URL : {self._session_url}") # Connect with automatic reconnection async with websocket_connect(self._session_url) as websocket: