livekit-plugins-google 1.0.22__py3-none-any.whl → 1.0.23__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- livekit/plugins/google/beta/realtime/api_proto.py +8 -2
- livekit/plugins/google/beta/realtime/realtime_api.py +26 -5
- livekit/plugins/google/llm.py +2 -5
- livekit/plugins/google/models.py +1 -0
- livekit/plugins/google/version.py +1 -1
- {livekit_plugins_google-1.0.22.dist-info → livekit_plugins_google-1.0.23.dist-info}/METADATA +3 -3
- {livekit_plugins_google-1.0.22.dist-info → livekit_plugins_google-1.0.23.dist-info}/RECORD +8 -8
- {livekit_plugins_google-1.0.22.dist-info → livekit_plugins_google-1.0.23.dist-info}/WHEEL +0 -0
@@ -5,9 +5,15 @@ from typing import Literal, Union
|
|
5
5
|
|
6
6
|
from google.genai import types
|
7
7
|
|
8
|
-
LiveAPIModels = Literal[
|
8
|
+
LiveAPIModels = Literal[
|
9
|
+
"gemini-2.0-flash-exp",
|
10
|
+
# models supported on Gemini API
|
11
|
+
"gemini-2.0-flash-live-001",
|
12
|
+
"gemini-2.5-flash-preview-native-audio-dialog",
|
13
|
+
"gemini-2.5-flash-exp-native-audio-thinking-dialog",
|
14
|
+
]
|
9
15
|
|
10
|
-
Voice = Literal["Puck", "Charon", "Kore", "Fenrir", "Aoede"]
|
16
|
+
Voice = Literal["Puck", "Charon", "Kore", "Fenrir", "Aoede", "Leda", "Oru", "Zephyr"]
|
11
17
|
|
12
18
|
|
13
19
|
ClientEvents = Union[
|
@@ -13,7 +13,6 @@ from google import genai
|
|
13
13
|
from google.genai.live import AsyncSession
|
14
14
|
from google.genai.types import (
|
15
15
|
AudioTranscriptionConfig,
|
16
|
-
AutomaticActivityDetection,
|
17
16
|
Blob,
|
18
17
|
Content,
|
19
18
|
FunctionDeclaration,
|
@@ -86,6 +85,9 @@ class _RealtimeOptions:
|
|
86
85
|
input_audio_transcription: AudioTranscriptionConfig | None
|
87
86
|
output_audio_transcription: AudioTranscriptionConfig | None
|
88
87
|
image_encode_options: NotGivenOr[images.EncodeOptions]
|
88
|
+
enable_affective_dialog: NotGivenOr[bool] = NOT_GIVEN
|
89
|
+
proactivity: NotGivenOr[bool] = NOT_GIVEN
|
90
|
+
realtime_input_config: NotGivenOr[RealtimeInputConfig] = NOT_GIVEN
|
89
91
|
|
90
92
|
|
91
93
|
@dataclass
|
@@ -131,6 +133,9 @@ class RealtimeModel(llm.RealtimeModel):
|
|
131
133
|
input_audio_transcription: NotGivenOr[AudioTranscriptionConfig | None] = NOT_GIVEN,
|
132
134
|
output_audio_transcription: NotGivenOr[AudioTranscriptionConfig | None] = NOT_GIVEN,
|
133
135
|
image_encode_options: NotGivenOr[images.EncodeOptions] = NOT_GIVEN,
|
136
|
+
enable_affective_dialog: NotGivenOr[bool] = NOT_GIVEN,
|
137
|
+
proactivity: NotGivenOr[bool] = NOT_GIVEN,
|
138
|
+
realtime_input_config: NotGivenOr[RealtimeInputConfig] = NOT_GIVEN,
|
134
139
|
) -> None:
|
135
140
|
"""
|
136
141
|
Initializes a RealtimeModel instance for interacting with Google's Realtime API.
|
@@ -161,6 +166,9 @@ class RealtimeModel(llm.RealtimeModel):
|
|
161
166
|
input_audio_transcription (AudioTranscriptionConfig | None, optional): The configuration for input audio transcription. Defaults to None.)
|
162
167
|
output_audio_transcription (AudioTranscriptionConfig | None, optional): The configuration for output audio transcription. Defaults to AudioTranscriptionConfig().
|
163
168
|
image_encode_options (images.EncodeOptions, optional): The configuration for image encoding. Defaults to DEFAULT_ENCODE_OPTIONS.
|
169
|
+
enable_affective_dialog (bool, optional): Whether to enable affective dialog. Defaults to False.
|
170
|
+
proactivity (bool, optional): Whether to enable proactive audio. Defaults to False.
|
171
|
+
realtime_input_config (RealtimeInputConfig, optional): The configuration for realtime input. Defaults to None.
|
164
172
|
|
165
173
|
Raises:
|
166
174
|
ValueError: If the API key is required but not found.
|
@@ -232,6 +240,9 @@ class RealtimeModel(llm.RealtimeModel):
|
|
232
240
|
output_audio_transcription=output_audio_transcription,
|
233
241
|
language=language,
|
234
242
|
image_encode_options=image_encode_options,
|
243
|
+
enable_affective_dialog=enable_affective_dialog,
|
244
|
+
proactivity=proactivity,
|
245
|
+
realtime_input_config=realtime_input_config,
|
235
246
|
)
|
236
247
|
|
237
248
|
self._sessions = weakref.WeakSet[RealtimeSession]()
|
@@ -583,7 +594,7 @@ class RealtimeSession(llm.RealtimeSession):
|
|
583
594
|
def _build_connect_config(self) -> LiveConnectConfig:
|
584
595
|
temp = self._opts.temperature if is_given(self._opts.temperature) else None
|
585
596
|
|
586
|
-
|
597
|
+
conf = LiveConnectConfig(
|
587
598
|
response_modalities=self._opts.response_modalities
|
588
599
|
if is_given(self._opts.response_modalities)
|
589
600
|
else [Modality.AUDIO],
|
@@ -615,11 +626,18 @@ class RealtimeSession(llm.RealtimeSession):
|
|
615
626
|
input_audio_transcription=self._opts.input_audio_transcription,
|
616
627
|
output_audio_transcription=self._opts.output_audio_transcription,
|
617
628
|
session_resumption=SessionResumptionConfig(handle=self._session_resumption_handle),
|
618
|
-
realtime_input_config=
|
619
|
-
automatic_activity_detection=AutomaticActivityDetection(),
|
620
|
-
),
|
629
|
+
realtime_input_config=self._opts.realtime_input_config,
|
621
630
|
)
|
622
631
|
|
632
|
+
if is_given(self._opts.proactivity):
|
633
|
+
conf.proactivity = {"proactive_audio": self._opts.proactivity}
|
634
|
+
if is_given(self._opts.enable_affective_dialog):
|
635
|
+
conf.enable_affective_dialog = self._opts.enable_affective_dialog
|
636
|
+
if is_given(self._opts.realtime_input_config):
|
637
|
+
conf.realtime_input_config = self._opts.realtime_input_config
|
638
|
+
|
639
|
+
return conf
|
640
|
+
|
623
641
|
def _start_new_generation(self):
|
624
642
|
if self._current_generation and not self._current_generation._done:
|
625
643
|
logger.warning("starting new generation while another is active. Finalizing previous.")
|
@@ -789,6 +807,9 @@ class RealtimeSession(llm.RealtimeSession):
|
|
789
807
|
return token_details_map
|
790
808
|
|
791
809
|
for token_detail in token_details:
|
810
|
+
if not token_detail.token_count:
|
811
|
+
continue
|
812
|
+
|
792
813
|
if token_detail.modality == Modality.AUDIO:
|
793
814
|
token_details_map["audio_tokens"] += token_detail.token_count
|
794
815
|
elif token_detail.modality == Modality.TEXT:
|
livekit/plugins/google/llm.py
CHANGED
@@ -304,11 +304,8 @@ class LLMStream(llm.LLMStream):
|
|
304
304
|
or not response.candidates[0].content
|
305
305
|
or not response.candidates[0].content.parts
|
306
306
|
):
|
307
|
-
|
308
|
-
|
309
|
-
retryable=True,
|
310
|
-
request_id=request_id,
|
311
|
-
)
|
307
|
+
logger.warning(f"no candidates in the response: {response}")
|
308
|
+
continue
|
312
309
|
|
313
310
|
if len(response.candidates) > 1:
|
314
311
|
logger.warning(
|
livekit/plugins/google/models.py
CHANGED
@@ -97,6 +97,7 @@ Gender = Literal["male", "female", "neutral"]
|
|
97
97
|
ChatModels = Literal[
|
98
98
|
"gemini-2.5-pro-preview-05-06",
|
99
99
|
"gemini-2.5-flash-preview-04-17",
|
100
|
+
"gemini-2.5-flash-preview-05-20",
|
100
101
|
"gemini-2.0-flash-001",
|
101
102
|
"gemini-2.0-flash-lite-preview-02-05",
|
102
103
|
"gemini-2.0-pro-exp-02-05",
|
{livekit_plugins_google-1.0.22.dist-info → livekit_plugins_google-1.0.23.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: livekit-plugins-google
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.23
|
4
4
|
Summary: Agent Framework plugin for services from Google Cloud
|
5
5
|
Project-URL: Documentation, https://docs.livekit.io
|
6
6
|
Project-URL: Website, https://livekit.io/
|
@@ -21,8 +21,8 @@ Requires-Python: >=3.9.0
|
|
21
21
|
Requires-Dist: google-auth<3,>=2
|
22
22
|
Requires-Dist: google-cloud-speech<3,>=2
|
23
23
|
Requires-Dist: google-cloud-texttospeech<3,>=2.24
|
24
|
-
Requires-Dist: google-genai>=
|
25
|
-
Requires-Dist: livekit-agents>=1.0.
|
24
|
+
Requires-Dist: google-genai>=v1.16.1
|
25
|
+
Requires-Dist: livekit-agents>=1.0.23
|
26
26
|
Description-Content-Type: text/markdown
|
27
27
|
|
28
28
|
# Google AI plugin for LiveKit Agents
|
@@ -1,16 +1,16 @@
|
|
1
1
|
livekit/plugins/google/__init__.py,sha256=xain2qUzU-YWhYWsLBkW8Q-szV-htpnzHTqymMPo-j0,1364
|
2
|
-
livekit/plugins/google/llm.py,sha256=
|
2
|
+
livekit/plugins/google/llm.py,sha256=E1T_7cugMVN13dyAbXHVS5sC1lxRPNUemwJdV29-CPk,16206
|
3
3
|
livekit/plugins/google/log.py,sha256=GI3YWN5YzrafnUccljzPRS_ZALkMNk1i21IRnTl2vNA,69
|
4
|
-
livekit/plugins/google/models.py,sha256=
|
4
|
+
livekit/plugins/google/models.py,sha256=hOpfbN_qdQ1ZTpCN9m9dvG2eb6WgQ3KE3WRpIeeM_T0,1569
|
5
5
|
livekit/plugins/google/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
6
|
livekit/plugins/google/stt.py,sha256=2jk-1fHiBT8UW_n3CZsIEdMp2iBnUAlTnmefdUd8rAM,23620
|
7
7
|
livekit/plugins/google/tts.py,sha256=FfhNfGtW8drmYDDfLLZDjaIp2GvNiIdoovgtZq4t_l8,14211
|
8
8
|
livekit/plugins/google/utils.py,sha256=UBAbddYk7G8Nojg6bSC7_xN2pdl9qhs86HGhKYFuf9M,10509
|
9
|
-
livekit/plugins/google/version.py,sha256
|
9
|
+
livekit/plugins/google/version.py,sha256=BRUqwxRBnPVqEcIODJdaZHGAanu4zkwM4NsAQjNtUEM,601
|
10
10
|
livekit/plugins/google/beta/__init__.py,sha256=5PnoG3Ux24bjzMSzmTeSVljE9EINivGcbWUEV6egGnM,216
|
11
11
|
livekit/plugins/google/beta/realtime/__init__.py,sha256=_fW2NMN22F-hnQ4xAJ_g5lPbR7CvM_xXzSWlUQY-E-U,188
|
12
|
-
livekit/plugins/google/beta/realtime/api_proto.py,sha256=
|
13
|
-
livekit/plugins/google/beta/realtime/realtime_api.py,sha256=
|
14
|
-
livekit_plugins_google-1.0.
|
15
|
-
livekit_plugins_google-1.0.
|
16
|
-
livekit_plugins_google-1.0.
|
12
|
+
livekit/plugins/google/beta/realtime/api_proto.py,sha256=NfE7xr2N3JOu7gVfWbAmDcEhs8vuZgMRu5vpScPJzsg,776
|
13
|
+
livekit/plugins/google/beta/realtime/realtime_api.py,sha256=fgN2InMMCQL8JAHm-6J-SekzS5ymeH-hMRLzSW86Qkw,37477
|
14
|
+
livekit_plugins_google-1.0.23.dist-info/METADATA,sha256=69J1PJEwdaM6jWeMUXpbaU8A0quqi3UjDb5884qG9mI,1909
|
15
|
+
livekit_plugins_google-1.0.23.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
16
|
+
livekit_plugins_google-1.0.23.dist-info/RECORD,,
|
File without changes
|