livekit-plugins-google 0.10.1__py3-none-any.whl → 0.10.2__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.
@@ -75,6 +75,7 @@ class InputTranscription:
75
75
  @dataclass
76
76
  class Capabilities:
77
77
  supports_truncate: bool
78
+ input_audio_sample_rate: int | None = None
78
79
 
79
80
 
80
81
  @dataclass
@@ -156,6 +157,7 @@ class RealtimeModel:
156
157
  super().__init__()
157
158
  self._capabilities = Capabilities(
158
159
  supports_truncate=False,
160
+ input_audio_sample_rate=16000,
159
161
  )
160
162
  self._model = model
161
163
  self._loop = loop or asyncio.get_event_loop()
@@ -56,6 +56,7 @@ class TranscriberSession(utils.EventEmitter[EventTypes]):
56
56
  super().__init__()
57
57
  self._client = client
58
58
  self._model = model
59
+ self._needed_sr = 16000
59
60
  self._closed = False
60
61
  system_instructions = types.Content(
61
62
  parts=[types.Part(text=SYSTEM_INSTRUCTIONS)]
@@ -72,18 +73,37 @@ class TranscriberSession(utils.EventEmitter[EventTypes]):
72
73
  self._main_task(), name="gemini-realtime-transcriber"
73
74
  )
74
75
  self._send_ch = utils.aio.Chan[ClientEvents]()
76
+ self._resampler: rtc.AudioResampler | None = None
75
77
  self._active_response_id = None
76
78
 
77
79
  def _push_audio(self, frame: rtc.AudioFrame) -> None:
78
80
  if self._closed:
79
81
  return
80
- self._queue_msg(
81
- types.LiveClientRealtimeInput(
82
- media_chunks=[
83
- types.Blob(data=frame.data.tobytes(), mime_type="audio/pcm")
84
- ]
82
+ if frame.sample_rate != self._needed_sr:
83
+ if not self._resampler:
84
+ self._resampler = rtc.AudioResampler(
85
+ frame.sample_rate,
86
+ self._needed_sr,
87
+ quality=rtc.AudioResamplerQuality.HIGH,
88
+ )
89
+
90
+ if self._resampler:
91
+ for f in self._resampler.push(frame):
92
+ self._queue_msg(
93
+ types.LiveClientRealtimeInput(
94
+ media_chunks=[
95
+ types.Blob(data=f.data.tobytes(), mime_type="audio/pcm")
96
+ ]
97
+ )
98
+ )
99
+ else:
100
+ self._queue_msg(
101
+ types.LiveClientRealtimeInput(
102
+ media_chunks=[
103
+ types.Blob(data=frame.data.tobytes(), mime_type="audio/pcm")
104
+ ]
105
+ )
85
106
  )
86
- )
87
107
 
88
108
  def _queue_msg(self, msg: ClientEvents) -> None:
89
109
  if not self._closed:
@@ -108,8 +108,8 @@ class LLM(llm.LLM):
108
108
  self._api_key = api_key or os.environ.get("GOOGLE_API_KEY", None)
109
109
  _gac = os.environ.get("GOOGLE_APPLICATION_CREDENTIALS")
110
110
  if _gac is None:
111
- raise ValueError(
112
- "`GOOGLE_APPLICATION_CREDENTIALS` environment variable is not set. please set it to the path of the service account key file."
111
+ logger.warning(
112
+ "`GOOGLE_APPLICATION_CREDENTIALS` environment variable is not set. please set it to the path of the service account key file. Otherwise, use any of the other Google Cloud auth methods."
113
113
  )
114
114
 
115
115
  if vertexai:
@@ -12,4 +12,4 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- __version__ = "0.10.1"
15
+ __version__ = "0.10.2"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: livekit-plugins-google
3
- Version: 0.10.1
3
+ Version: 0.10.2
4
4
  Summary: Agent Framework plugin for services from Google Cloud
5
5
  Home-page: https://github.com/livekit/agents
6
6
  License: Apache-2.0
@@ -23,7 +23,7 @@ Requires-Dist: google-auth<3,>=2
23
23
  Requires-Dist: google-cloud-speech<3,>=2
24
24
  Requires-Dist: google-cloud-texttospeech<3,>=2
25
25
  Requires-Dist: google-genai==0.5.0
26
- Requires-Dist: livekit-agents>=0.12.3
26
+ Requires-Dist: livekit-agents>=0.12.11
27
27
  Dynamic: classifier
28
28
  Dynamic: description
29
29
  Dynamic: description-content-type
@@ -1,18 +1,18 @@
1
1
  livekit/plugins/google/__init__.py,sha256=e_kSlFNmKhyyeliz7f4WOKc_Y0-y39QjO5nCWuguhss,1171
2
2
  livekit/plugins/google/_utils.py,sha256=mjsqblhGMgAZ2MNPisAVkNsqq4gfO6vvprEKzAGoVwE,7248
3
- livekit/plugins/google/llm.py,sha256=vL8iyRqWVPT0wCDeXTlybytlyJ-J-VolVQYqP-ZVlb0,16388
3
+ livekit/plugins/google/llm.py,sha256=o9EJBv3rS5vKRq7m5YjSSqOxtH6pPekxRS_lra35hzk,16445
4
4
  livekit/plugins/google/log.py,sha256=GI3YWN5YzrafnUccljzPRS_ZALkMNk1i21IRnTl2vNA,69
5
5
  livekit/plugins/google/models.py,sha256=w_qmOk5y86vjtszDiGpP9p0ctjQeaB8-UzqprxgpvCY,1407
6
6
  livekit/plugins/google/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  livekit/plugins/google/stt.py,sha256=FA6Lpeb8QvRXLzkQ7cjsoMxHdtEGwHWkpN_TKqAdKAQ,21097
8
8
  livekit/plugins/google/tts.py,sha256=95qXCigVQYWNbcN3pIKBpIah4b31U_MWtXv5Ji0AMc4,9229
9
- livekit/plugins/google/version.py,sha256=byify7f_Iz8-hX3925GgkmUjX78ckJT4IS6Klbgy6WQ,601
9
+ livekit/plugins/google/version.py,sha256=jklx55q_NtxoIUiYD5AFOO11S_Jij8P491Y8nkw-VZk,601
10
10
  livekit/plugins/google/beta/__init__.py,sha256=AxRYc7NGG62Tv1MmcZVCDHNvlhbC86hM-_yP01Qb28k,47
11
11
  livekit/plugins/google/beta/realtime/__init__.py,sha256=sGTn6JFNyA30QUXBZ_BV3l2eHpGAzR35ByXxg77vWNU,205
12
12
  livekit/plugins/google/beta/realtime/api_proto.py,sha256=9EhmwgeIgKDqdSijv5Q9pgx7UhAakK02ZDwbnUsra_o,657
13
- livekit/plugins/google/beta/realtime/realtime_api.py,sha256=579kextvlPbBPV6Zoo3Mkqk0C0UN-Ybfb-gTiR7-f9E,21060
14
- livekit/plugins/google/beta/realtime/transcriber.py,sha256=3TaYbtvPWHkxKlDSZSMLWBbR7KewBRg3HcdIxuGhl9c,5880
15
- livekit_plugins_google-0.10.1.dist-info/METADATA,sha256=7XQzkOSP0LocoGcx4TX6VLIUsEvVIvQ1J6wLF7kLocE,2057
16
- livekit_plugins_google-0.10.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
17
- livekit_plugins_google-0.10.1.dist-info/top_level.txt,sha256=OoDok3xUmXbZRvOrfvvXB-Juu4DX79dlq188E19YHoo,8
18
- livekit_plugins_google-0.10.1.dist-info/RECORD,,
13
+ livekit/plugins/google/beta/realtime/realtime_api.py,sha256=OwNoPmmomMtRkmYw-g2u7hIYpeIrSSNky7FlcHBVyFQ,21150
14
+ livekit/plugins/google/beta/realtime/transcriber.py,sha256=JnZ75NyiOLkpvQ5N2nDniumDKcrjiq_tlryiLbuBoDM,6658
15
+ livekit_plugins_google-0.10.2.dist-info/METADATA,sha256=dTBdAuYpGyCFVJNw0c8upUEdaFgdodWwrm1bB3a4Xp4,2058
16
+ livekit_plugins_google-0.10.2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
17
+ livekit_plugins_google-0.10.2.dist-info/top_level.txt,sha256=OoDok3xUmXbZRvOrfvvXB-Juu4DX79dlq188E19YHoo,8
18
+ livekit_plugins_google-0.10.2.dist-info/RECORD,,