livekit-plugins-cartesia 0.4.10__py3-none-any.whl → 1.0.0.dev4__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.
@@ -8,7 +8,7 @@ TTSEncoding = Literal[
8
8
  # "pcm_alaw",
9
9
  ]
10
10
 
11
- TTSModels = Literal["sonic", "sonic-2", "sonic-lite", "sonic-preview", "sonic-turbo"]
11
+ TTSModels = Literal["sonic-english", "sonic-multilingual"]
12
12
  TTSLanguages = Literal["en", "es", "fr", "de", "pt", "zh", "ja"]
13
13
  TTSDefaultVoiceId = "794f9389-aac1-45b6-b726-9d9369183238"
14
14
  TTSVoiceSpeed = Literal["fastest", "fast", "normal", "slow", "slowest"]
@@ -20,9 +20,10 @@ import json
20
20
  import os
21
21
  import weakref
22
22
  from dataclasses import dataclass
23
- from typing import Any, Optional
23
+ from typing import Any
24
24
 
25
25
  import aiohttp
26
+
26
27
  from livekit.agents import (
27
28
  APIConnectionError,
28
29
  APIConnectOptions,
@@ -34,13 +35,7 @@ from livekit.agents import (
34
35
  )
35
36
 
36
37
  from .log import logger
37
- from .models import (
38
- TTSDefaultVoiceId,
39
- TTSEncoding,
40
- TTSModels,
41
- TTSVoiceEmotion,
42
- TTSVoiceSpeed,
43
- )
38
+ from .models import TTSDefaultVoiceId, TTSEncoding, TTSModels, TTSVoiceEmotion, TTSVoiceSpeed
44
39
 
45
40
  API_AUTH_HEADER = "X-API-Key"
46
41
  API_VERSION_HEADER = "Cartesia-Version"
@@ -73,7 +68,7 @@ class TTS(tts.TTS):
73
68
  def __init__(
74
69
  self,
75
70
  *,
76
- model: TTSModels | str = "sonic-2",
71
+ model: TTSModels | str = "sonic",
77
72
  language: str = "en",
78
73
  encoding: TTSEncoding = "pcm_s16le",
79
74
  voice: str | list[float] = TTSDefaultVoiceId,
@@ -90,7 +85,7 @@ class TTS(tts.TTS):
90
85
  See https://docs.cartesia.ai/reference/web-socket/stream-speech/stream-speech for more details on the the Cartesia API.
91
86
 
92
87
  Args:
93
- model (TTSModels, optional): The Cartesia TTS model to use. Defaults to "sonic-2".
88
+ model (TTSModels, optional): The Cartesia TTS model to use. Defaults to "sonic-english".
94
89
  language (str, optional): The language code for synthesis. Defaults to "en".
95
90
  encoding (TTSEncoding, optional): The audio encoding format. Defaults to "pcm_s16le".
96
91
  voice (str | list[float], optional): The voice ID or embedding array.
@@ -137,9 +132,7 @@ class TTS(tts.TTS):
137
132
  url = self._opts.get_ws_url(
138
133
  f"/tts/websocket?api_key={self._opts.api_key}&cartesia_version={API_VERSION}"
139
134
  )
140
- return await asyncio.wait_for(
141
- session.ws_connect(url), self._conn_options.timeout
142
- )
135
+ return await asyncio.wait_for(session.ws_connect(url), self._conn_options.timeout)
143
136
 
144
137
  async def _close_ws(self, ws: aiohttp.ClientWebSocketResponse):
145
138
  await ws.close()
@@ -169,7 +162,7 @@ class TTS(tts.TTS):
169
162
  and emotion. If any parameter is not provided, the existing value will be retained.
170
163
 
171
164
  Args:
172
- model (TTSModels, optional): The Cartesia TTS model to use. Defaults to "sonic-2".
165
+ model (TTSModels, optional): The Cartesia TTS model to use. Defaults to "sonic-english".
173
166
  language (str, optional): The language code for synthesis. Defaults to "en".
174
167
  voice (str | list[float], optional): The voice ID or embedding array.
175
168
  speed (TTSVoiceSpeed | float, optional): Voice Control - Speed (https://docs.cartesia.ai/user-guides/voice-control)
@@ -186,7 +179,7 @@ class TTS(tts.TTS):
186
179
  self,
187
180
  text: str,
188
181
  *,
189
- conn_options: Optional[APIConnectOptions] = None,
182
+ conn_options: APIConnectOptions | None = None,
190
183
  ) -> ChunkedStream:
191
184
  return ChunkedStream(
192
185
  tts=self,
@@ -196,16 +189,12 @@ class TTS(tts.TTS):
196
189
  session=self._ensure_session(),
197
190
  )
198
191
 
199
- def stream(
200
- self, *, conn_options: Optional[APIConnectOptions] = None
201
- ) -> "SynthesizeStream":
202
- stream = SynthesizeStream(
192
+ def stream(self, *, conn_options: APIConnectOptions | None = None) -> SynthesizeStream:
193
+ return SynthesizeStream(
203
194
  tts=self,
204
195
  pool=self._pool,
205
196
  opts=self._opts,
206
197
  )
207
- self._streams.add(stream)
208
- return stream
209
198
 
210
199
  async def aclose(self) -> None:
211
200
  for stream in list(self._streams):
@@ -225,7 +214,7 @@ class ChunkedStream(tts.ChunkedStream):
225
214
  input_text: str,
226
215
  opts: _TTSOptions,
227
216
  session: aiohttp.ClientSession,
228
- conn_options: Optional[APIConnectOptions] = None,
217
+ conn_options: APIConnectOptions | None = None,
229
218
  ) -> None:
230
219
  super().__init__(tts=tts, input_text=input_text, conn_options=conn_options)
231
220
  self._opts, self._session = opts, session
@@ -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.4.10"
15
+ __version__ = "1.0.0.dev4"
@@ -1,35 +1,25 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: livekit-plugins-cartesia
3
- Version: 0.4.10
3
+ Version: 1.0.0.dev4
4
4
  Summary: LiveKit Agents Plugin for Cartesia
5
- Home-page: https://github.com/livekit/agents
6
- License: Apache-2.0
7
5
  Project-URL: Documentation, https://docs.livekit.io
8
6
  Project-URL: Website, https://livekit.io/
9
7
  Project-URL: Source, https://github.com/livekit/agents
10
- Keywords: webrtc,realtime,audio,video,livekit
8
+ Author-email: LiveKit <support@livekit.io>
9
+ License-Expression: Apache-2.0
10
+ Keywords: audio,livekit,realtime,video,webrtc
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: License :: OSI Approved :: Apache Software License
13
- Classifier: Topic :: Multimedia :: Sound/Audio
14
- Classifier: Topic :: Multimedia :: Video
15
- Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
16
13
  Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
17
15
  Classifier: Programming Language :: Python :: 3.9
18
16
  Classifier: Programming Language :: Python :: 3.10
19
- Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Topic :: Multimedia :: Sound/Audio
18
+ Classifier: Topic :: Multimedia :: Video
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
20
  Requires-Python: >=3.9.0
21
+ Requires-Dist: livekit-agents>=1.0.0.dev4
21
22
  Description-Content-Type: text/markdown
22
- Requires-Dist: livekit-agents<1.0.0,>=0.12.16
23
- Dynamic: classifier
24
- Dynamic: description
25
- Dynamic: description-content-type
26
- Dynamic: home-page
27
- Dynamic: keywords
28
- Dynamic: license
29
- Dynamic: project-url
30
- Dynamic: requires-dist
31
- Dynamic: requires-python
32
- Dynamic: summary
33
23
 
34
24
  # LiveKit Plugins Cartesia
35
25
 
@@ -0,0 +1,9 @@
1
+ livekit/plugins/cartesia/__init__.py,sha256=UTa6Q7IxhRBCwPftowHEUDvmBg99J_UjGS_yxTzKD7g,1095
2
+ livekit/plugins/cartesia/log.py,sha256=4Mnhjng_DU1dIWP9IWjIQGZ67EV3LnQhWMWCHVudJbo,71
3
+ livekit/plugins/cartesia/models.py,sha256=56CJgo7my-w-vpedir_ImV_aqKASeLihE5DbcCCgGJI,950
4
+ livekit/plugins/cartesia/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ livekit/plugins/cartesia/tts.py,sha256=Zub4MXXVXQgV0t6al_uidDWH3BTVaYftyVbAFbkTU-U,13999
6
+ livekit/plugins/cartesia/version.py,sha256=koM_bT4QbztrKQ60Gjg7V4oe99CuxgGcpuUtWMOEKqU,605
7
+ livekit_plugins_cartesia-1.0.0.dev4.dist-info/METADATA,sha256=DxLT1utt8LaD23sG9baagoFSCnS6SwhRzPILssbq82Y,1265
8
+ livekit_plugins_cartesia-1.0.0.dev4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
+ livekit_plugins_cartesia-1.0.0.dev4.dist-info/RECORD,,
@@ -1,5 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (76.0.0)
2
+ Generator: hatchling 1.27.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
-
@@ -1,10 +0,0 @@
1
- livekit/plugins/cartesia/__init__.py,sha256=UTa6Q7IxhRBCwPftowHEUDvmBg99J_UjGS_yxTzKD7g,1095
2
- livekit/plugins/cartesia/log.py,sha256=4Mnhjng_DU1dIWP9IWjIQGZ67EV3LnQhWMWCHVudJbo,71
3
- livekit/plugins/cartesia/models.py,sha256=KGY-r2luJuUNY6a3nnB0Rx-5Td12hikk-GtYLnqvysE,977
4
- livekit/plugins/cartesia/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- livekit/plugins/cartesia/tts.py,sha256=cOoNFXNlw2NFN5o6PgLTccu_-y_W0MTAwNciNDtxdd8,14128
6
- livekit/plugins/cartesia/version.py,sha256=EAXwrHdOWRivmdK-RTQl1YBemh0E8ui_JHvG9dT490M,601
7
- livekit_plugins_cartesia-0.4.10.dist-info/METADATA,sha256=TXT6xGvQ3of6Gl9PyCCYLrurnkDdfyiOjzyrXC0gga4,1471
8
- livekit_plugins_cartesia-0.4.10.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
9
- livekit_plugins_cartesia-0.4.10.dist-info/top_level.txt,sha256=OoDok3xUmXbZRvOrfvvXB-Juu4DX79dlq188E19YHoo,8
10
- livekit_plugins_cartesia-0.4.10.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- livekit