mirror of
https://github.com/ijaric/voice_assistant.git
synced 2025-05-24 14:33:26 +00:00
27 lines
785 B
Python
27 lines
785 B
Python
import typing
|
|
|
|
import pydantic
|
|
import pydantic_settings
|
|
|
|
import lib.app.split_settings.utils as app_split_settings_utils
|
|
|
|
|
|
class TTSYandexSettings(pydantic_settings.BaseSettings):
|
|
model_config = pydantic_settings.SettingsConfigDict(
|
|
env_file=app_split_settings_utils.ENV_PATH,
|
|
env_prefix="TTS_YANDEX_",
|
|
env_file_encoding="utf-8",
|
|
extra="ignore",
|
|
)
|
|
|
|
audio_format: typing.Literal["oggopus", "mp3", "lpcm"] = "oggopus"
|
|
sample_rate_hertz: int = 48000
|
|
api_key: pydantic.SecretStr = pydantic.Field(default=...)
|
|
|
|
@property
|
|
def base_headers(self) -> dict[str, str]:
|
|
return {
|
|
"Authorization": f"Api-Key {self.api_key.get_secret_value()}",
|
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
}
|