livekit-plugins-aws 0.1.0__py3-none-any.whl → 0.1.1__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.
Potentially problematic release.
This version of livekit-plugins-aws might be problematic. Click here for more details.
- livekit/plugins/aws/models.py +1 -1
- livekit/plugins/aws/tts.py +32 -34
- livekit/plugins/aws/version.py +1 -1
- {livekit_plugins_aws-0.1.0.dist-info → livekit_plugins_aws-0.1.1.dist-info}/METADATA +2 -2
- {livekit_plugins_aws-0.1.0.dist-info → livekit_plugins_aws-0.1.1.dist-info}/RECORD +7 -7
- {livekit_plugins_aws-0.1.0.dist-info → livekit_plugins_aws-0.1.1.dist-info}/WHEEL +0 -0
- {livekit_plugins_aws-0.1.0.dist-info → livekit_plugins_aws-0.1.1.dist-info}/top_level.txt +0 -0
livekit/plugins/aws/models.py
CHANGED
livekit/plugins/aws/tts.py
CHANGED
|
@@ -18,7 +18,6 @@ from typing import Any, Callable, Optional
|
|
|
18
18
|
|
|
19
19
|
import aiohttp
|
|
20
20
|
from aiobotocore.session import AioSession, get_session
|
|
21
|
-
from livekit import rtc
|
|
22
21
|
from livekit.agents import (
|
|
23
22
|
APIConnectionError,
|
|
24
23
|
APIConnectOptions,
|
|
@@ -29,10 +28,9 @@ from livekit.agents import (
|
|
|
29
28
|
)
|
|
30
29
|
|
|
31
30
|
from ._utils import _get_aws_credentials
|
|
32
|
-
from .models import TTS_LANGUAGE,
|
|
31
|
+
from .models import TTS_LANGUAGE, TTS_SPEECH_ENGINE
|
|
33
32
|
|
|
34
33
|
TTS_NUM_CHANNELS: int = 1
|
|
35
|
-
DEFAULT_OUTPUT_FORMAT: TTS_OUTPUT_FORMAT = "pcm"
|
|
36
34
|
DEFAULT_SPEECH_ENGINE: TTS_SPEECH_ENGINE = "generative"
|
|
37
35
|
DEFAULT_SPEECH_REGION = "us-east-1"
|
|
38
36
|
DEFAULT_VOICE = "Ruth"
|
|
@@ -43,7 +41,6 @@ DEFAULT_SAMPLE_RATE = 16000
|
|
|
43
41
|
class _TTSOptions:
|
|
44
42
|
# https://docs.aws.amazon.com/polly/latest/dg/API_SynthesizeSpeech.html
|
|
45
43
|
voice: str | None
|
|
46
|
-
output_format: TTS_OUTPUT_FORMAT
|
|
47
44
|
speech_engine: TTS_SPEECH_ENGINE
|
|
48
45
|
speech_region: str
|
|
49
46
|
sample_rate: int
|
|
@@ -56,7 +53,6 @@ class TTS(tts.TTS):
|
|
|
56
53
|
*,
|
|
57
54
|
voice: str | None = DEFAULT_VOICE,
|
|
58
55
|
language: TTS_LANGUAGE | str | None = None,
|
|
59
|
-
output_format: TTS_OUTPUT_FORMAT = DEFAULT_OUTPUT_FORMAT,
|
|
60
56
|
speech_engine: TTS_SPEECH_ENGINE = DEFAULT_SPEECH_ENGINE,
|
|
61
57
|
sample_rate: int = DEFAULT_SAMPLE_RATE,
|
|
62
58
|
speech_region: str = DEFAULT_SPEECH_REGION,
|
|
@@ -75,7 +71,6 @@ class TTS(tts.TTS):
|
|
|
75
71
|
Args:
|
|
76
72
|
Voice (TTSModels, optional): Voice ID to use for the synthesis. Defaults to "Ruth".
|
|
77
73
|
language (TTS_LANGUAGE, optional): language code for the Synthesize Speech request. This is only necessary if using a bilingual voice, such as Aditi, which can be used for either Indian English (en-IN) or Hindi (hi-IN).
|
|
78
|
-
output_format(TTS_OUTPUT_FORMAT, optional): The format in which the returned output will be encoded. Defaults to "pcm".
|
|
79
74
|
sample_rate(int, optional): The audio frequency specified in Hz. Defaults to 16000.
|
|
80
75
|
speech_engine(TTS_SPEECH_ENGINE, optional): The engine to use for the synthesis. Defaults to "generative".
|
|
81
76
|
speech_region(str, optional): The region to use for the synthesis. Defaults to "us-east-1".
|
|
@@ -96,7 +91,6 @@ class TTS(tts.TTS):
|
|
|
96
91
|
|
|
97
92
|
self._opts = _TTSOptions(
|
|
98
93
|
voice=voice,
|
|
99
|
-
output_format=output_format,
|
|
100
94
|
speech_engine=speech_engine,
|
|
101
95
|
speech_region=speech_region,
|
|
102
96
|
language=language,
|
|
@@ -149,7 +143,7 @@ class ChunkedStream(tts.ChunkedStream):
|
|
|
149
143
|
async with self._get_client() as client:
|
|
150
144
|
params = {
|
|
151
145
|
"Text": self._input_text,
|
|
152
|
-
"OutputFormat":
|
|
146
|
+
"OutputFormat": "mp3",
|
|
153
147
|
"Engine": self._opts.speech_engine,
|
|
154
148
|
"VoiceId": self._opts.voice,
|
|
155
149
|
"TextType": "text",
|
|
@@ -158,32 +152,36 @@ class ChunkedStream(tts.ChunkedStream):
|
|
|
158
152
|
}
|
|
159
153
|
response = await client.synthesize_speech(**_strip_nones(params))
|
|
160
154
|
if "AudioStream" in response:
|
|
161
|
-
decoder = utils.codecs.
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
155
|
+
decoder = utils.codecs.AudioStreamDecoder(
|
|
156
|
+
sample_rate=self._opts.sample_rate,
|
|
157
|
+
num_channels=1,
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
# Create a task to push data to the decoder
|
|
161
|
+
async def push_data():
|
|
162
|
+
try:
|
|
163
|
+
async with response["AudioStream"] as resp:
|
|
164
|
+
async for data, _ in resp.content.iter_chunks():
|
|
165
|
+
decoder.push(data)
|
|
166
|
+
finally:
|
|
167
|
+
decoder.end_input()
|
|
168
|
+
|
|
169
|
+
# Start pushing data to the decoder
|
|
170
|
+
push_task = asyncio.create_task(push_data())
|
|
171
|
+
|
|
172
|
+
try:
|
|
173
|
+
# Create emitter and process decoded frames
|
|
174
|
+
emitter = tts.SynthesizedAudioEmitter(
|
|
175
|
+
event_ch=self._event_ch,
|
|
176
|
+
request_id=request_id,
|
|
177
|
+
segment_id=self._segment_id,
|
|
178
|
+
)
|
|
179
|
+
async for frame in decoder:
|
|
180
|
+
emitter.push(frame)
|
|
181
|
+
emitter.flush()
|
|
182
|
+
await push_task
|
|
183
|
+
finally:
|
|
184
|
+
await utils.aio.gracefully_cancel(push_task)
|
|
187
185
|
|
|
188
186
|
except asyncio.TimeoutError as e:
|
|
189
187
|
raise APITimeoutError() from e
|
livekit/plugins/aws/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: livekit-plugins-aws
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: LiveKit Agents Plugin for services from AWS
|
|
5
5
|
Home-page: https://github.com/livekit/agents
|
|
6
6
|
License: Apache-2.0
|
|
@@ -19,7 +19,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
19
19
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
20
|
Requires-Python: >=3.9.0
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
|
-
Requires-Dist: livekit-agents
|
|
22
|
+
Requires-Dist: livekit-agents[codecs]<1.0.0,>=0.12.16
|
|
23
23
|
Requires-Dist: aiobotocore==2.19.0
|
|
24
24
|
Requires-Dist: boto3==1.36.3
|
|
25
25
|
Requires-Dist: amazon-transcribe>=0.6.2
|
|
@@ -2,12 +2,12 @@ livekit/plugins/aws/__init__.py,sha256=Ea-hK7QdutnwdZvvs9K2fiR8RWJqz2JcONxXnV1kX
|
|
|
2
2
|
livekit/plugins/aws/_utils.py,sha256=iuDuQpPta4wLtgW1Wc2rHspZWoa7KZI76tujQIPY898,7411
|
|
3
3
|
livekit/plugins/aws/llm.py,sha256=yUAiBCtb2jRB1_S9BNrILTMmDffvKOpDod802kYnPVM,13527
|
|
4
4
|
livekit/plugins/aws/log.py,sha256=jFief0Xhv0n_F6sp6UFu9VKxs2bXNVGAfYGmEYfR_2Q,66
|
|
5
|
-
livekit/plugins/aws/models.py,sha256=
|
|
5
|
+
livekit/plugins/aws/models.py,sha256=Nf8RFmDulW7h03dG2lERTog3mgDK0TbLvW0eGOncuEE,704
|
|
6
6
|
livekit/plugins/aws/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
7
|
livekit/plugins/aws/stt.py,sha256=eH7gKtdCjwki20Th6PrCsjjtH-zjXa8ZWu-cu_KaT80,7935
|
|
8
|
-
livekit/plugins/aws/tts.py,sha256=
|
|
9
|
-
livekit/plugins/aws/version.py,sha256=
|
|
10
|
-
livekit_plugins_aws-0.1.
|
|
11
|
-
livekit_plugins_aws-0.1.
|
|
12
|
-
livekit_plugins_aws-0.1.
|
|
13
|
-
livekit_plugins_aws-0.1.
|
|
8
|
+
livekit/plugins/aws/tts.py,sha256=m2Z6VXyWsJebqzGTDqE39KvgkBgdQkZ731fuIjbszAY,7243
|
|
9
|
+
livekit/plugins/aws/version.py,sha256=3-nEcobvIJfZdV4yNIRuYpAGQ3svREnYIv2ivxoIZcQ,600
|
|
10
|
+
livekit_plugins_aws-0.1.1.dist-info/METADATA,sha256=9rnNMyDhecj1fQIbGcxvGo_I0cg7d_lI2xEf-tBMQfc,1702
|
|
11
|
+
livekit_plugins_aws-0.1.1.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
|
12
|
+
livekit_plugins_aws-0.1.1.dist-info/top_level.txt,sha256=OoDok3xUmXbZRvOrfvvXB-Juu4DX79dlq188E19YHoo,8
|
|
13
|
+
livekit_plugins_aws-0.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|