livekit-plugins-google 0.11.2__py3-none-any.whl → 0.11.4__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.
@@ -26,6 +26,7 @@ from livekit.agents import (
26
26
  utils,
27
27
  )
28
28
 
29
+ from google.api_core.client_options import ClientOptions
29
30
  from google.api_core.exceptions import DeadlineExceeded, GoogleAPICallError
30
31
  from google.cloud import texttospeech
31
32
  from google.cloud.texttospeech_v1.types import SsmlVoiceGender, SynthesizeSpeechResponse
@@ -50,6 +51,7 @@ class TTS(tts.TTS):
50
51
  pitch: int = 0,
51
52
  effects_profile_id: str = "",
52
53
  speaking_rate: float = 1.0,
54
+ location: str = "global",
53
55
  credentials_info: dict | None = None,
54
56
  credentials_file: str | None = None,
55
57
  ) -> None:
@@ -65,6 +67,7 @@ class TTS(tts.TTS):
65
67
  gender (Gender | str, optional): Voice gender ("male", "female", "neutral"). Default is "neutral".
66
68
  voice_name (str, optional): Specific voice name. Default is an empty string.
67
69
  sample_rate (int, optional): Audio sample rate in Hz. Default is 24000.
70
+ location (str, optional): Location for the TTS client. Default is "global".
68
71
  pitch (float, optional): Speaking pitch, ranging from -20.0 to 20.0 semitones relative to the original pitch. Default is 0.
69
72
  effects_profile_id (str): Optional identifier for selecting audio effects profiles to apply to the synthesized speech.
70
73
  speaking_rate (float, optional): Speed of speech. Default is 1.0.
@@ -83,7 +86,7 @@ class TTS(tts.TTS):
83
86
  self._client: texttospeech.TextToSpeechAsyncClient | None = None
84
87
  self._credentials_info = credentials_info
85
88
  self._credentials_file = credentials_file
86
-
89
+ self._location = location
87
90
  voice = texttospeech.VoiceSelectionParams(
88
91
  name=voice_name,
89
92
  language_code=language,
@@ -126,22 +129,30 @@ class TTS(tts.TTS):
126
129
  self._opts.audio_config.speaking_rate = speaking_rate
127
130
 
128
131
  def _ensure_client(self) -> texttospeech.TextToSpeechAsyncClient:
132
+ api_endpoint = "texttospeech.googleapis.com"
133
+ if self._location != "global":
134
+ api_endpoint = f"{self._location}-texttospeech.googleapis.com"
135
+
129
136
  if self._client is None:
130
137
  if self._credentials_info:
131
138
  self._client = (
132
139
  texttospeech.TextToSpeechAsyncClient.from_service_account_info(
133
- self._credentials_info
140
+ self._credentials_info,
141
+ client_options=ClientOptions(api_endpoint=api_endpoint),
134
142
  )
135
143
  )
136
144
 
137
145
  elif self._credentials_file:
138
146
  self._client = (
139
147
  texttospeech.TextToSpeechAsyncClient.from_service_account_file(
140
- self._credentials_file
148
+ self._credentials_file,
149
+ client_options=ClientOptions(api_endpoint=api_endpoint),
141
150
  )
142
151
  )
143
152
  else:
144
- self._client = texttospeech.TextToSpeechAsyncClient()
153
+ self._client = texttospeech.TextToSpeechAsyncClient(
154
+ client_options=ClientOptions(api_endpoint=api_endpoint)
155
+ )
145
156
 
146
157
  assert self._client is not None
147
158
  return self._client
@@ -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.11.2"
15
+ __version__ = "0.11.4"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: livekit-plugins-google
3
- Version: 0.11.2
3
+ Version: 0.11.4
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==1.3.0
26
- Requires-Dist: livekit-agents<1.0.0,>=0.12.16
26
+ Requires-Dist: livekit-agents<1.0.0,>=0.12.20
27
27
  Dynamic: classifier
28
28
  Dynamic: description
29
29
  Dynamic: description-content-type
@@ -5,14 +5,14 @@ livekit/plugins/google/log.py,sha256=GI3YWN5YzrafnUccljzPRS_ZALkMNk1i21IRnTl2vNA
5
5
  livekit/plugins/google/models.py,sha256=SGjAumdDK97NNLwMFcqZdKR68f1NoGB2Rk1UP2-imG0,1457
6
6
  livekit/plugins/google/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  livekit/plugins/google/stt.py,sha256=l6UB9oaM7eFInnI_0t7Ub-edXLVRgvaiyHj-e_gEuwE,22781
8
- livekit/plugins/google/tts.py,sha256=pG9_pibO3NDGEMa4huU5S9lbeyI3daQyrS17SuTKfZI,8008
9
- livekit/plugins/google/version.py,sha256=_06ctkD1XWTWec2BVgcsxun2sFLxqnvJJJs7ZxIBuHA,601
8
+ livekit/plugins/google/tts.py,sha256=t4a6so5mR6HxrZa3In_PxD37voIxs1fRL4F9Zu5qltE,8645
9
+ livekit/plugins/google/version.py,sha256=XX_K9W2N9UIuMEH3faMsl1e2g5fvGryTmIzOvPGO-8Y,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
13
  livekit/plugins/google/beta/realtime/realtime_api.py,sha256=8JdWUMUheGhy1ia6JbN3_U2_cL7CNs8-1fTOAgW4I38,22999
14
14
  livekit/plugins/google/beta/realtime/transcriber.py,sha256=rjXO0cSPr3HATxrSfv1MX7IbrjmiTvnLPF280BfRBL8,9809
15
- livekit_plugins_google-0.11.2.dist-info/METADATA,sha256=MQF9voerbBB1t5fGRw94z7jyfgJOnsM-DmWxtCT10V8,3732
16
- livekit_plugins_google-0.11.2.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
17
- livekit_plugins_google-0.11.2.dist-info/top_level.txt,sha256=OoDok3xUmXbZRvOrfvvXB-Juu4DX79dlq188E19YHoo,8
18
- livekit_plugins_google-0.11.2.dist-info/RECORD,,
15
+ livekit_plugins_google-0.11.4.dist-info/METADATA,sha256=2d7KsoqJdccnWn-ljvJUOxpXM6x2mInHzK-a9fFaArk,3732
16
+ livekit_plugins_google-0.11.4.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
17
+ livekit_plugins_google-0.11.4.dist-info/top_level.txt,sha256=OoDok3xUmXbZRvOrfvvXB-Juu4DX79dlq188E19YHoo,8
18
+ livekit_plugins_google-0.11.4.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (77.0.3)
2
+ Generator: setuptools (80.7.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5