Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from .version import __version__

__all__ = [
"LLM",
"STT",
"SpeechStream",
"logger",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class STTOptions:
buffer_size_seconds: float = 0.08
encoding: str = "pcm_s16le"
temperature: float | None = None
# TODO(laurent): support language detection
language: LanguageCode = LanguageCode("en")
vad_threshold: float = 0.6
vad_bucket: int | None = 2
Expand All @@ -71,7 +70,7 @@ def __init__(
self,
*,
api_key: str | None = None,
model_endpoint: str | None = "wss://api.gradium.ai/api/speech/asr",
model_endpoint: str | None = None,
model_name: str = "default",
sample_rate: int = SUPPORTED_SAMPLE_RATE,
encoding: NotGivenOr[STTEncoding] = NOT_GIVEN,
Expand Down Expand Up @@ -106,12 +105,11 @@ def __init__(

self._api_key = api_key

model_endpoint = model_endpoint or os.environ.get("GRADIUM_MODEL_ENDPOINT")

if not model_endpoint:
raise ValueError(
"The model endpoint is required, you can find it in the Gradium dashboard"
)
model_endpoint = (
model_endpoint
or os.environ.get("GRADIUM_MODEL_ENDPOINT")
or "wss://api.gradium.ai/api/speech/asr"
)

self._model_endpoint = model_endpoint
self._model_name = model_name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ def __init__(
self,
*,
api_key: str | None = None,
model_endpoint: str | None = "wss://api.gradium.ai/api/speech/tts",
model_endpoint: str | None = None,
model_name: str = "default",
voice: str | None = None,
voice_id: str | None = "YTpq7expH9539ERJ",
voice_id: str | None = "4SZHfMpw-p46Ywgs",
pronunciation_id: str | None = None,
json_config: dict[str, Any] | None = None,
http_session: aiohttp.ClientSession | None = None,
Expand Down Expand Up @@ -90,12 +90,11 @@ def __init__(
"or set it as the `GRADIUM_API_KEY` environment variable"
)

model_endpoint = model_endpoint or os.environ.get("GRADIUM_MODEL_ENDPOINT")

if not model_endpoint:
raise ValueError(
"The model endpoint is required, you can find it in the Gradium dashboard"
)
model_endpoint = (
model_endpoint
or os.environ.get("GRADIUM_MODEL_ENDPOINT")
or "wss://api.gradium.ai/api/speech/tts"
)

self._api_key = api_key
self._model_endpoint = model_endpoint
Expand Down Expand Up @@ -142,10 +141,13 @@ def update_options(
self,
*,
voice: NotGivenOr[str] = NOT_GIVEN,
voice_id: NotGivenOr[str] = NOT_GIVEN,
json_config: NotGivenOr[dict[str, Any]] = NOT_GIVEN,
) -> None:
if is_given(voice):
self._opts.voice = voice
if is_given(voice_id):
self._opts.voice_id = voice_id
if is_given(json_config):
self._opts.json_config = json_config

Expand Down