livekit-plugins-elevenlabs 0.1.3__py3-none-any.whl → 0.1.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.
@@ -184,6 +184,7 @@ class SynthesizeStream(tts.SynthesizeStream):
184
184
  retry_count = 0
185
185
  listen_task: Optional[asyncio.Task] = None
186
186
  ws: Optional[aiohttp.ClientWebSocketResponse] = None
187
+ retry_text_queue: asyncio.Queue[str] = asyncio.Queue()
187
188
  while True:
188
189
  try:
189
190
  ws = await self._try_connect()
@@ -194,7 +195,13 @@ class SynthesizeStream(tts.SynthesizeStream):
194
195
  # forward queued text to 11labs
195
196
  started = False
196
197
  while not ws.closed:
197
- text = await self._queue.get()
198
+ text = None
199
+ if retry_text_queue.empty():
200
+ text = await retry_text_queue.get()
201
+ retry_text_queue.task_done()
202
+ else:
203
+ text = await self._queue.get()
204
+
198
205
  if not started:
199
206
  self._event_queue.put_nowait(
200
207
  tts.SynthesisEvent(type=tts.SynthesisEventType.STARTED)
@@ -204,7 +211,19 @@ class SynthesizeStream(tts.SynthesizeStream):
204
211
  text=text,
205
212
  try_trigger_generation=True,
206
213
  )
207
- await ws.send_str(json.dumps(text_packet))
214
+
215
+ # This case can happen in normal operation because 11labs will not
216
+ # keep connections open indefinitely if we are not sending data.
217
+ try:
218
+ await ws.send_str(json.dumps(text_packet))
219
+ except Exception:
220
+ await retry_text_queue.put(text)
221
+ break
222
+
223
+ # We call self._queue.task_done() even if we are retrying the text because
224
+ # all text has gone through self._queue. An exception may have short-circuited
225
+ # out of the loop so task_done() will not have already been called on text that
226
+ # is being retried.
208
227
  self._queue.task_done()
209
228
  if text == STREAM_EOS:
210
229
  await listen_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__ = "0.1.3"
15
+ __version__ = "0.1.4"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: livekit-plugins-elevenlabs
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: Agent Framework plugin for voice synthesis with ElevenLabs' API.
5
5
  Home-page: https://github.com/livekit/agents
6
6
  License: Apache-2.0
@@ -0,0 +1,8 @@
1
+ livekit/plugins/elevenlabs/__init__.py,sha256=-FQ-hnTqqbaVFa0sEu8CwInVp9vzkt-nRWkd34ruFFk,977
2
+ livekit/plugins/elevenlabs/models.py,sha256=g46mCMMHP3x3qtHmybHHMcid1UwmjKCcF0T4IWjMjWE,163
3
+ livekit/plugins/elevenlabs/tts.py,sha256=K3dg8En-GX6-pKxioSeEP1jTsIOuPaDAfgYvC_itE4k,11110
4
+ livekit/plugins/elevenlabs/version.py,sha256=JisuVeJTYHFXsPWF9pf3j_4J8bsnqlKqN-xXzq_6vhI,600
5
+ livekit_plugins_elevenlabs-0.1.4.dist-info/METADATA,sha256=wZTATw_9t4d1x-UsahhpwFITfX_J6c1kxvaU5Izq8kM,1360
6
+ livekit_plugins_elevenlabs-0.1.4.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
7
+ livekit_plugins_elevenlabs-0.1.4.dist-info/top_level.txt,sha256=OoDok3xUmXbZRvOrfvvXB-Juu4DX79dlq188E19YHoo,8
8
+ livekit_plugins_elevenlabs-0.1.4.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- livekit/plugins/elevenlabs/__init__.py,sha256=-FQ-hnTqqbaVFa0sEu8CwInVp9vzkt-nRWkd34ruFFk,977
2
- livekit/plugins/elevenlabs/models.py,sha256=g46mCMMHP3x3qtHmybHHMcid1UwmjKCcF0T4IWjMjWE,163
3
- livekit/plugins/elevenlabs/tts.py,sha256=xfx22n3T85vyu0dAjObaPzaaJC7dFewU2ZLa47cIZhg,10160
4
- livekit/plugins/elevenlabs/version.py,sha256=tpb8RDeB0haxcQ6bcP2ohrPerLn7AiijcHoutd5FqYg,600
5
- livekit_plugins_elevenlabs-0.1.3.dist-info/METADATA,sha256=7f-98TJdfwIqJDHrICrppAo1o0gywcA8LoHWd-ETcAw,1360
6
- livekit_plugins_elevenlabs-0.1.3.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
7
- livekit_plugins_elevenlabs-0.1.3.dist-info/top_level.txt,sha256=OoDok3xUmXbZRvOrfvvXB-Juu4DX79dlq188E19YHoo,8
8
- livekit_plugins_elevenlabs-0.1.3.dist-info/RECORD,,