livekit-plugins-elevenlabs 1.0.19__py3-none-any.whl → 1.0.21__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.
@@ -12,6 +12,11 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ """ElevenLabs plugin for LiveKit Agents
16
+
17
+ See https://docs.livekit.io/agents/integrations/tts/elevenlabs/ for more information.
18
+ """
19
+
15
20
  from .models import TTSEncoding, TTSModels
16
21
  from .stt import STT
17
22
  from .tts import DEFAULT_VOICE_ID, TTS, Voice, VoiceSettings
@@ -88,7 +88,7 @@ class _TTSOptions:
88
88
  sample_rate: int
89
89
  streaming_latency: NotGivenOr[int]
90
90
  word_tokenizer: tokenize.WordTokenizer
91
- chunk_length_schedule: list[int]
91
+ chunk_length_schedule: NotGivenOr[list[int]]
92
92
  enable_ssml_parsing: bool
93
93
  inactivity_timeout: int
94
94
 
@@ -99,7 +99,7 @@ class TTS(tts.TTS):
99
99
  *,
100
100
  voice_id: str = DEFAULT_VOICE_ID,
101
101
  voice_settings: NotGivenOr[VoiceSettings] = NOT_GIVEN,
102
- model: TTSModels | str = "eleven_flash_v2_5",
102
+ model: TTSModels | str = "eleven_turbo_v2_5",
103
103
  encoding: NotGivenOr[TTSEncoding] = NOT_GIVEN,
104
104
  api_key: NotGivenOr[str] = NOT_GIVEN,
105
105
  base_url: NotGivenOr[str] = NOT_GIVEN,
@@ -124,14 +124,11 @@ class TTS(tts.TTS):
124
124
  inactivity_timeout (int): Inactivity timeout in seconds for the websocket connection. Defaults to 300.
125
125
  word_tokenizer (NotGivenOr[tokenize.WordTokenizer]): Tokenizer for processing text. Defaults to basic WordTokenizer.
126
126
  enable_ssml_parsing (bool): Enable SSML parsing for input text. Defaults to False.
127
- chunk_length_schedule (NotGivenOr[list[int]]): Schedule for chunk lengths, ranging from 50 to 500. Defaults to [80, 120, 200, 260].
127
+ chunk_length_schedule (NotGivenOr[list[int]]): Schedule for chunk lengths, ranging from 50 to 500. Defaults are [120, 160, 250, 290].
128
128
  http_session (aiohttp.ClientSession | None): Custom HTTP session for API requests. Optional.
129
129
  language (NotGivenOr[str]): Language code for the TTS model, as of 10/24/24 only valid for "eleven_turbo_v2_5".
130
130
  """ # noqa: E501
131
131
 
132
- if not is_given(chunk_length_schedule):
133
- chunk_length_schedule = [80, 120, 200, 260]
134
-
135
132
  if not is_given(encoding):
136
133
  encoding = _DefaultEncoding
137
134
 
@@ -404,11 +401,13 @@ class SynthesizeStream(tts.SynthesizeStream):
404
401
  # 11labs protocol expects the first message to be an "init msg"
405
402
  init_pkt = {
406
403
  "text": " ",
407
- "voice_settings": _strip_nones(dataclasses.asdict(self._opts.voice_settings))
408
- if is_given(self._opts.voice_settings)
409
- else None,
410
- "generation_config": {"chunk_length_schedule": self._opts.chunk_length_schedule},
411
404
  }
405
+ if is_given(self._opts.chunk_length_schedule):
406
+ init_pkt["generation_config"] = {
407
+ "chunk_length_schedule": self._opts.chunk_length_schedule
408
+ }
409
+ if is_given(self._opts.voice_settings):
410
+ init_pkt["voice_settings"] = _strip_nones(dataclasses.asdict(self._opts.voice_settings))
412
411
  await ws_conn.send_str(json.dumps(init_pkt))
413
412
  eos_sent = False
414
413
 
@@ -486,7 +485,6 @@ class SynthesizeStream(tts.SynthesizeStream):
486
485
  if data.get("audio"):
487
486
  b64data = base64.b64decode(data["audio"])
488
487
  decoder.push(b64data)
489
-
490
488
  elif data.get("isFinal"):
491
489
  decoder.end_input()
492
490
  break
@@ -498,12 +496,7 @@ class SynthesizeStream(tts.SynthesizeStream):
498
496
  body=None,
499
497
  )
500
498
  else:
501
- raise APIStatusError(
502
- message=f"unexpected 11labs message {data}",
503
- status_code=500,
504
- request_id=request_id,
505
- body=None,
506
- )
499
+ logger.warning(f"unexpected 11labs message {data}")
507
500
 
508
501
  tasks = [
509
502
  asyncio.create_task(send_task()),
@@ -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__ = "1.0.19"
15
+ __version__ = "1.0.21"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: livekit-plugins-elevenlabs
3
- Version: 1.0.19
3
+ Version: 1.0.21
4
4
  Summary: Agent Framework plugin for voice synthesis with ElevenLabs' API.
5
5
  Project-URL: Documentation, https://docs.livekit.io
6
6
  Project-URL: Website, https://livekit.io/
@@ -18,12 +18,14 @@ Classifier: Topic :: Multimedia :: Sound/Audio
18
18
  Classifier: Topic :: Multimedia :: Video
19
19
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
20
  Requires-Python: >=3.9.0
21
- Requires-Dist: livekit-agents[codecs]>=1.0.19
21
+ Requires-Dist: livekit-agents[codecs]>=1.0.21
22
22
  Description-Content-Type: text/markdown
23
23
 
24
- # LiveKit Plugins Elevenlabs
24
+ # ElevenLabs plugin for LiveKit Agents
25
25
 
26
- Agent Framework plugin for voice synthesis with [ElevenLabs](https://elevenlabs.io/) API.
26
+ Support for voice synthesis with [ElevenLabs](https://elevenlabs.io/).
27
+
28
+ See [https://docs.livekit.io/agents/integrations/tts/elevenlabs/](https://docs.livekit.io/agents/integrations/tts/elevenlabs/) for more information.
27
29
 
28
30
  ## Installation
29
31
 
@@ -0,0 +1,10 @@
1
+ livekit/plugins/elevenlabs/__init__.py,sha256=wDHAYf2M89U-wTdW8UjDPI_TQaO9XK03Y0mJpsXvobk,1419
2
+ livekit/plugins/elevenlabs/log.py,sha256=hIuXqDsEB5GBa7rQY3z4Uqi1oCqc_lRmCHZEmXz0LHw,73
3
+ livekit/plugins/elevenlabs/models.py,sha256=p_wHEz15bdsNEqwzN831ysm70PNWQ-xeN__BKvGPZxA,401
4
+ livekit/plugins/elevenlabs/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ livekit/plugins/elevenlabs/stt.py,sha256=1B8c7t_52GIbnPSFLq44Fkm0gnnFUZs7xX9nIWbsAQM,4528
6
+ livekit/plugins/elevenlabs/tts.py,sha256=MxIt8FR0V9vs6VEKkeC_LNBnksa1f-U3YHKh243m9fo,20109
7
+ livekit/plugins/elevenlabs/version.py,sha256=5lzQkS1jEPqreexacwMd18b2EOx7R5m8AQMKtQRBgC4,601
8
+ livekit_plugins_elevenlabs-1.0.21.dist-info/METADATA,sha256=dKiUUUb_NyadLg33B8LfPKObZ0f0qlXgAHHwECsy4tU,1455
9
+ livekit_plugins_elevenlabs-1.0.21.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
+ livekit_plugins_elevenlabs-1.0.21.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- livekit/plugins/elevenlabs/__init__.py,sha256=h6pPP9kT348Gfgzo9Wj3LpkoiW0JfIu3POL1CDWK3PE,1287
2
- livekit/plugins/elevenlabs/log.py,sha256=hIuXqDsEB5GBa7rQY3z4Uqi1oCqc_lRmCHZEmXz0LHw,73
3
- livekit/plugins/elevenlabs/models.py,sha256=p_wHEz15bdsNEqwzN831ysm70PNWQ-xeN__BKvGPZxA,401
4
- livekit/plugins/elevenlabs/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- livekit/plugins/elevenlabs/stt.py,sha256=1B8c7t_52GIbnPSFLq44Fkm0gnnFUZs7xX9nIWbsAQM,4528
6
- livekit/plugins/elevenlabs/tts.py,sha256=5QHq9Yds7dclJZgyPyfHtnkMXb_eSzGBQvOIEh_S3oA,20305
7
- livekit/plugins/elevenlabs/version.py,sha256=UDC8ahmGgRkv-qMQUY3QibuuVevGMQ9Fd4yIhcQBZwA,601
8
- livekit_plugins_elevenlabs-1.0.19.dist-info/METADATA,sha256=GzvJZv865rY5NCclqmKVlKtc4xpjYpNZzOXT7NkEqeY,1314
9
- livekit_plugins_elevenlabs-1.0.19.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
- livekit_plugins_elevenlabs-1.0.19.dist-info/RECORD,,