add requested changes from code review

This commit is contained in:
Mike Seese
2026-01-10 15:34:35 -08:00
parent d2df324f29
commit 2249f3d673
3 changed files with 14 additions and 8 deletions

View File

@@ -9,7 +9,6 @@ import os
from dotenv import load_dotenv from dotenv import load_dotenv
from loguru import logger from loguru import logger
from pipecat.audio.turn.smart_turn.base_smart_turn import SmartTurnParams
from pipecat.audio.turn.smart_turn.local_smart_turn_v3 import LocalSmartTurnAnalyzerV3 from pipecat.audio.turn.smart_turn.local_smart_turn_v3 import LocalSmartTurnAnalyzerV3
from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.audio.vad.silero import SileroVADAnalyzer
from pipecat.audio.vad.vad_analyzer import VADParams from pipecat.audio.vad.vad_analyzer import VADParams

View File

@@ -40,18 +40,18 @@ class HathoraSTTService(SegmentedSTTService):
config: Some models support additional config, refer to config: Some models support additional config, refer to
[docs](https://models.hathora.dev) for each model to see [docs](https://models.hathora.dev) for each model to see
what is supported. what is supported.
base_url: Base API URL for the Hathora STT service.
""" """
language: Optional[str] = None language: Optional[str] = None
config: Optional[list[ConfigOption]] = None config: Optional[list[ConfigOption]] = None
base_url: str = "https://api.models.hathora.dev/inference/v1/stt",
def __init__( def __init__(
self, self,
*, *,
model: str, model: str,
sample_rate: Optional[int] = None,
api_key: Optional[str] = None, api_key: Optional[str] = None,
base_url: str = "https://api.models.hathora.dev/inference/v1/stt",
params: Optional[InputParams] = None, params: Optional[InputParams] = None,
**kwargs, **kwargs,
): ):
@@ -60,17 +60,21 @@ class HathoraSTTService(SegmentedSTTService):
Args: Args:
model: Model to use; find available models model: Model to use; find available models
[here](https://models.hathora.dev). [here](https://models.hathora.dev).
sample_rate: The sample rate for audio input. If None, will be determined
from the start frame.
api_key: API key for authentication with the Hathora service; api_key: API key for authentication with the Hathora service;
provision one [here](https://models.hathora.dev/tokens). provision one [here](https://models.hathora.dev/tokens).
base_url: Base API URL for the Hathora STT service.
params: Configuration parameters. params: Configuration parameters.
**kwargs: Additional arguments passed to the parent class. **kwargs: Additional arguments passed to the parent class.
""" """
super().__init__( super().__init__(
sample_rate=sample_rate,
**kwargs, **kwargs,
) )
self._model = model self._model = model
self._api_key = api_key or os.getenv("HATHORA_API_KEY") self._api_key = api_key or os.getenv("HATHORA_API_KEY")
self._base_url = params.base_url self._base_url = base_url
params = params or HathoraSTTService.InputParams() params = params or HathoraSTTService.InputParams()

View File

@@ -59,19 +59,19 @@ class HathoraTTSService(TTSService):
config: Some models support additional config, refer to config: Some models support additional config, refer to
[docs](https://models.hathora.dev) for each model to see [docs](https://models.hathora.dev) for each model to see
what is supported. what is supported.
base_url: Base API URL for the Hathora TTS service.
""" """
speed: Optional[float] = None speed: Optional[float] = None
config: Optional[list[ConfigOption]] = None config: Optional[list[ConfigOption]] = None
base_url: str = "https://api.models.hathora.dev/inference/v1/tts",
def __init__( def __init__(
self, self,
*, *,
model: str, model: str,
voice_id: Optional[str] = None, voice_id: Optional[str] = None,
sample_rate: Optional[int] = None,
api_key: Optional[str] = None, api_key: Optional[str] = None,
base_url: str = "https://api.models.hathora.dev/inference/v1/tts",
params: Optional[InputParams] = None, params: Optional[InputParams] = None,
**kwargs, **kwargs,
): ):
@@ -81,17 +81,20 @@ class HathoraTTSService(TTSService):
model: Model to use; find available models model: Model to use; find available models
[here](https://models.hathora.dev). [here](https://models.hathora.dev).
voice_id: Voice to use for synthesis (if supported by model). voice_id: Voice to use for synthesis (if supported by model).
sample_rate: Output sample rate for generated audio.
api_key: API key for authentication with the Hathora service; api_key: API key for authentication with the Hathora service;
provision one [here](https://models.hathora.dev/tokens). provision one [here](https://models.hathora.dev/tokens).
base_url: Base API URL for the Hathora TTS service.
params: Configuration parameters. params: Configuration parameters.
**kwargs: Additional arguments passed to the parent class. **kwargs: Additional arguments passed to the parent class.
""" """
super().__init__( super().__init__(
sample_rate=sample_rate,
**kwargs, **kwargs,
) )
self._model = model self._model = model
self._api_key = api_key or os.getenv("HATHORA_API_KEY") self._api_key = api_key or os.getenv("HATHORA_API_KEY")
self._base_url = params.base_url self._base_url = base_url
params = params or HathoraTTSService.InputParams() params = params or HathoraTTSService.InputParams()
@@ -155,7 +158,7 @@ class HathoraTTSService(TTSService):
frame = TTSAudioRawFrame( frame = TTSAudioRawFrame(
audio=pcm_audio, audio=pcm_audio,
sample_rate=sample_rate, sample_rate=self.sample_rate,
num_channels=num_channels, num_channels=num_channels,
) )