deepgram: fix an issue with user provided LiveOptions

This commit is contained in:
Aleix Conchillo Flaqué
2025-05-27 15:17:44 -07:00
parent e987c4741a
commit 0099f60d29
2 changed files with 13 additions and 8 deletions

View File

@@ -147,6 +147,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Fixed a `DeegramSTTService` connection issue when the user provided their own
`LiveOptions`.
- Fixed a `DailyTransport` issue that would cause images needing resize to block - Fixed a `DailyTransport` issue that would cause images needing resize to block
the event loop. the event loop.

View File

@@ -78,17 +78,19 @@ class DeepgramSTTService(STTService):
vad_events=False, vad_events=False,
) )
merged_options = default_options merged_options = default_options.to_dict()
if live_options: if live_options:
merged_options = LiveOptions(**{**default_options.to_dict(), **live_options.to_dict()}) default_model = default_options.model
merged_options.update(live_options.to_dict())
# NOTE(aleix): Fixes an in deepgram-sdk where `model` is initialized
# to the string "None" instead of the value `None`.
if "model" in merged_options and merged_options["model"] == "None":
merged_options["model"] = default_model
# deepgram connection requires language to be a string if "language" in merged_options and isinstance(merged_options["language"], Language):
if isinstance(merged_options.language, Language) and hasattr( merged_options["language"] = merged_options["language"].value
merged_options.language, "value"
):
merged_options.language = merged_options.language.value
self._settings = merged_options.to_dict() self._settings = merged_options
self._addons = addons self._addons = addons
self._client = DeepgramClient( self._client = DeepgramClient(