Skip to content

Commit 2f5778a

Browse files
committed
backwards compat
1 parent aa2fad9 commit 2f5778a

File tree

1 file changed

+14
-0
lines changed
  • livekit-plugins/livekit-plugins-phonic/livekit/plugins/phonic/realtime

1 file changed

+14
-0
lines changed

livekit-plugins/livekit-plugins-phonic/livekit/plugins/phonic/realtime/realtime_model.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ def __init__(
105105
default_language: NotGivenOr[str] = NOT_GIVEN,
106106
additional_languages: NotGivenOr[list[str]] = NOT_GIVEN,
107107
multilingual_mode: NotGivenOr[Literal["auto", "request"]] = NOT_GIVEN,
108+
languages: NotGivenOr[list[str]] = NOT_GIVEN,
108109
audio_speed: NotGivenOr[float] = NOT_GIVEN,
109110
phonic_tools: NotGivenOr[list[str]] = NOT_GIVEN,
110111
boosted_keywords: NotGivenOr[list[str]] = NOT_GIVEN,
@@ -132,6 +133,9 @@ def __init__(
132133
``default_language``).
133134
multilingual_mode: ``\"auto\"`` to detect language per utterance, ``\"request\"`` to
134135
switch only when the user asks (recommended).
136+
languages: Deprecated. Use ``default_language`` and ``additional_languages`` instead.
137+
When both of those are omitted and this is set, ``languages[0]`` is the default
138+
language and ``languages[1:]`` are additional languages.
135139
audio_speed: Audio playback speed multiplier.
136140
phonic_tools: Phonic tool names available to the assistant.
137141
boosted_keywords: Keywords to boost in speech recognition.
@@ -160,6 +164,16 @@ def __init__(
160164
"set PHONIC_API_KEY environment variable."
161165
)
162166

167+
if (
168+
is_given(languages)
169+
and not is_given(default_language)
170+
and not is_given(additional_languages)
171+
):
172+
if languages:
173+
default_language = languages[0]
174+
if len(languages) > 1:
175+
additional_languages = languages[1:]
176+
163177
self._opts = _RealtimeOptions(
164178
api_key=api_key,
165179
phonic_agent=phonic_agent,

0 commit comments

Comments
 (0)