sarvamai 0.1.11a5__py3-none-any.whl → 0.1.12a0__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.
- sarvamai/core/client_wrapper.py +2 -2
- sarvamai/core/events.py +9 -1
- sarvamai/speech_to_text_job/client.py +28 -26
- sarvamai/speech_to_text_streaming/client.py +7 -2
- sarvamai/speech_to_text_streaming/raw_client.py +7 -2
- sarvamai/speech_to_text_translate_job/client.py +18 -17
- sarvamai/speech_to_text_translate_streaming/client.py +7 -2
- sarvamai/speech_to_text_translate_streaming/raw_client.py +7 -2
- sarvamai/text_to_speech_streaming/client.py +7 -2
- sarvamai/text_to_speech_streaming/raw_client.py +7 -2
- {sarvamai-0.1.11a5.dist-info → sarvamai-0.1.12a0.dist-info}/METADATA +1 -1
- {sarvamai-0.1.11a5.dist-info → sarvamai-0.1.12a0.dist-info}/RECORD +13 -13
- {sarvamai-0.1.11a5.dist-info → sarvamai-0.1.12a0.dist-info}/WHEEL +0 -0
sarvamai/core/client_wrapper.py
CHANGED
|
@@ -23,10 +23,10 @@ class BaseClientWrapper:
|
|
|
23
23
|
|
|
24
24
|
def get_headers(self) -> typing.Dict[str, str]:
|
|
25
25
|
headers: typing.Dict[str, str] = {
|
|
26
|
-
"User-Agent": "sarvamai/0.1.
|
|
26
|
+
"User-Agent": "sarvamai/0.1.12a0",
|
|
27
27
|
"X-Fern-Language": "Python",
|
|
28
28
|
"X-Fern-SDK-Name": "sarvamai",
|
|
29
|
-
"X-Fern-SDK-Version": "0.1.
|
|
29
|
+
"X-Fern-SDK-Version": "0.1.12a0",
|
|
30
30
|
**(self.get_custom_headers() or {}),
|
|
31
31
|
}
|
|
32
32
|
headers["api-subscription-key"] = self.api_subscription_key
|
sarvamai/core/events.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
+
import inspect
|
|
3
4
|
import typing
|
|
4
5
|
from enum import Enum
|
|
5
6
|
|
|
@@ -19,7 +20,7 @@ class EventEmitterMixin:
|
|
|
19
20
|
def __init__(self) -> None:
|
|
20
21
|
self._callbacks: typing.Dict[EventType, typing.List[typing.Callable]] = {}
|
|
21
22
|
|
|
22
|
-
def on(self, event_name: EventType, callback: typing.Callable[[typing.Any],
|
|
23
|
+
def on(self, event_name: EventType, callback: typing.Callable[[typing.Any], typing.Any]) -> None:
|
|
23
24
|
if event_name not in self._callbacks:
|
|
24
25
|
self._callbacks[event_name] = []
|
|
25
26
|
self._callbacks[event_name].append(callback)
|
|
@@ -28,3 +29,10 @@ class EventEmitterMixin:
|
|
|
28
29
|
if event_name in self._callbacks:
|
|
29
30
|
for cb in self._callbacks[event_name]:
|
|
30
31
|
cb(data)
|
|
32
|
+
|
|
33
|
+
async def _emit_async(self, event_name: EventType, data: typing.Any) -> None:
|
|
34
|
+
if event_name in self._callbacks:
|
|
35
|
+
for cb in self._callbacks[event_name]:
|
|
36
|
+
res = cb(data)
|
|
37
|
+
if inspect.isawaitable(res):
|
|
38
|
+
await res
|
|
@@ -10,6 +10,8 @@ from ..types.bulk_job_init_response_v_1 import BulkJobInitResponseV1
|
|
|
10
10
|
from ..types.files_download_response import FilesDownloadResponse
|
|
11
11
|
from ..types.files_upload_response import FilesUploadResponse
|
|
12
12
|
from ..types.job_status_v_1 import JobStatusV1
|
|
13
|
+
from ..types.speech_to_text_model import SpeechToTextModel
|
|
14
|
+
from ..types.speech_to_text_language import SpeechToTextLanguage
|
|
13
15
|
from .raw_client import AsyncRawSpeechToTextJobClient, RawSpeechToTextJobClient
|
|
14
16
|
from .job import AsyncSpeechToTextJob, SpeechToTextJob
|
|
15
17
|
|
|
@@ -234,11 +236,11 @@ class SpeechToTextJobClient:
|
|
|
234
236
|
|
|
235
237
|
def create_job(
|
|
236
238
|
self,
|
|
237
|
-
|
|
238
|
-
|
|
239
|
+
model: SpeechToTextModel = "saarika:v2.5",
|
|
240
|
+
with_diarization: bool = False,
|
|
241
|
+
with_timestamps: bool = False,
|
|
242
|
+
language_code: typing.Optional[SpeechToTextLanguage] = None,
|
|
239
243
|
num_speakers: typing.Optional[int] = None,
|
|
240
|
-
with_diarization: typing.Optional[bool] = False,
|
|
241
|
-
with_timestamps: typing.Optional[bool] = False,
|
|
242
244
|
callback: typing.Optional[BulkJobCallbackParams] = OMIT,
|
|
243
245
|
request_options: typing.Optional[RequestOptions] = None,
|
|
244
246
|
) -> SpeechToTextJob:
|
|
@@ -247,21 +249,21 @@ class SpeechToTextJobClient:
|
|
|
247
249
|
|
|
248
250
|
Parameters
|
|
249
251
|
----------
|
|
250
|
-
|
|
251
|
-
The language code of the input audio (e.g., "en", "hi").
|
|
252
|
-
|
|
253
|
-
model : typing.Optional[str], default="saarika:v2.5"
|
|
252
|
+
model : SpeechToTextModel, default="saarika:v2.5"
|
|
254
253
|
The model to use for transcription.
|
|
255
254
|
|
|
256
|
-
num_speakers : typing.Optional[int], default=None
|
|
257
|
-
The number of distinct speakers in the audio, if known.
|
|
258
|
-
|
|
259
255
|
with_diarization : typing.Optional[bool], default=False
|
|
260
256
|
Whether to enable speaker diarization (distinguishing who said what).
|
|
261
257
|
|
|
262
258
|
with_timestamps : typing.Optional[bool], default=False
|
|
263
259
|
Whether to include word-level timestamps in the transcription output.
|
|
264
260
|
|
|
261
|
+
language_code : typing.Optional[SpeechToTextLanguage], default=None
|
|
262
|
+
The language code of the input audio (e.g., "hi-IN", "bn-IN").
|
|
263
|
+
|
|
264
|
+
num_speakers : typing.Optional[int], default=None
|
|
265
|
+
The number of distinct speakers in the audio, if known.
|
|
266
|
+
|
|
265
267
|
callback : typing.Optional[BulkJobCallbackParams], default=OMIT
|
|
266
268
|
Optional callback configuration to receive job completion events.
|
|
267
269
|
|
|
@@ -278,8 +280,8 @@ class SpeechToTextJobClient:
|
|
|
278
280
|
language_code=language_code,
|
|
279
281
|
model=model,
|
|
280
282
|
num_speakers=num_speakers, # type: ignore[typeddict-item]
|
|
281
|
-
with_diarization=with_diarization,
|
|
282
|
-
with_timestamps=with_timestamps,
|
|
283
|
+
with_diarization=with_diarization,
|
|
284
|
+
with_timestamps=with_timestamps,
|
|
283
285
|
),
|
|
284
286
|
callback=callback,
|
|
285
287
|
request_options=request_options,
|
|
@@ -562,11 +564,11 @@ class AsyncSpeechToTextJobClient:
|
|
|
562
564
|
|
|
563
565
|
async def create_job(
|
|
564
566
|
self,
|
|
565
|
-
|
|
566
|
-
|
|
567
|
+
model: SpeechToTextModel = "saarika:v2.5",
|
|
568
|
+
with_diarization: bool = False,
|
|
569
|
+
with_timestamps: bool = False,
|
|
570
|
+
language_code: typing.Optional[SpeechToTextLanguage] = None,
|
|
567
571
|
num_speakers: typing.Optional[int] = None,
|
|
568
|
-
with_diarization: typing.Optional[bool] = False,
|
|
569
|
-
with_timestamps: typing.Optional[bool] = False,
|
|
570
572
|
callback: typing.Optional[BulkJobCallbackParams] = OMIT,
|
|
571
573
|
request_options: typing.Optional[RequestOptions] = None,
|
|
572
574
|
) -> "AsyncSpeechToTextJob":
|
|
@@ -575,21 +577,21 @@ class AsyncSpeechToTextJobClient:
|
|
|
575
577
|
|
|
576
578
|
Parameters
|
|
577
579
|
----------
|
|
578
|
-
|
|
579
|
-
The language code of the input audio (e.g., "en", "hi").
|
|
580
|
-
|
|
581
|
-
model : typing.Optional[str], default="saarika:v2.5"
|
|
580
|
+
model : SpeechToTextModel, default="saarika:v2.5"
|
|
582
581
|
The model to use for transcription.
|
|
583
582
|
|
|
584
|
-
num_speakers : typing.Optional[int], default=None
|
|
585
|
-
The number of distinct speakers in the audio, if known.
|
|
586
|
-
|
|
587
583
|
with_diarization : typing.Optional[bool], default=False
|
|
588
584
|
Whether to enable speaker diarization (distinguishing who said what).
|
|
589
585
|
|
|
590
586
|
with_timestamps : typing.Optional[bool], default=False
|
|
591
587
|
Whether to include word-level timestamps in the transcription output.
|
|
592
588
|
|
|
589
|
+
language_code : typing.Optional[SpeechToTextLanguage], default=None
|
|
590
|
+
The language code of the input audio (e.g., "hi-IN", "bn-IN").
|
|
591
|
+
|
|
592
|
+
num_speakers : typing.Optional[int], default=None
|
|
593
|
+
The number of distinct speakers in the audio, if known.
|
|
594
|
+
|
|
593
595
|
callback : typing.Optional[BulkJobCallbackParams], default=OMIT
|
|
594
596
|
Optional callback configuration to receive job completion events.
|
|
595
597
|
|
|
@@ -605,9 +607,9 @@ class AsyncSpeechToTextJobClient:
|
|
|
605
607
|
job_parameters=SpeechToTextJobParametersParams(
|
|
606
608
|
language_code=language_code,
|
|
607
609
|
model=model,
|
|
610
|
+
with_diarization=with_diarization,
|
|
611
|
+
with_timestamps=with_timestamps,
|
|
608
612
|
num_speakers=num_speakers, # type: ignore[typeddict-item]
|
|
609
|
-
with_diarization=with_diarization, # type: ignore[typeddict-item]
|
|
610
|
-
with_timestamps=with_timestamps, # type: ignore[typeddict-item]
|
|
611
613
|
),
|
|
612
614
|
callback=callback,
|
|
613
615
|
request_options=request_options,
|
|
@@ -4,7 +4,7 @@ import typing
|
|
|
4
4
|
from contextlib import asynccontextmanager, contextmanager
|
|
5
5
|
|
|
6
6
|
import httpx
|
|
7
|
-
import websockets
|
|
7
|
+
import websockets.exceptions
|
|
8
8
|
import websockets.sync.client as websockets_sync_client
|
|
9
9
|
from ..core.api_error import ApiError
|
|
10
10
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
@@ -16,6 +16,11 @@ from .types.speech_to_text_streaming_language_code import SpeechToTextStreamingL
|
|
|
16
16
|
from .types.speech_to_text_streaming_model import SpeechToTextStreamingModel
|
|
17
17
|
from .types.speech_to_text_streaming_vad_signals import SpeechToTextStreamingVadSignals
|
|
18
18
|
|
|
19
|
+
try:
|
|
20
|
+
from websockets.legacy.client import connect as websockets_client_connect # type: ignore
|
|
21
|
+
except ImportError:
|
|
22
|
+
from websockets import connect as websockets_client_connect # type: ignore
|
|
23
|
+
|
|
19
24
|
|
|
20
25
|
class SpeechToTextStreamingClient:
|
|
21
26
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
@@ -174,7 +179,7 @@ class AsyncSpeechToTextStreamingClient:
|
|
|
174
179
|
if request_options and "additional_headers" in request_options:
|
|
175
180
|
headers.update(request_options["additional_headers"])
|
|
176
181
|
try:
|
|
177
|
-
async with
|
|
182
|
+
async with websockets_client_connect(ws_url, extra_headers=headers) as protocol:
|
|
178
183
|
yield AsyncSpeechToTextStreamingSocketClient(websocket=protocol)
|
|
179
184
|
except websockets.exceptions.InvalidStatusCode as exc:
|
|
180
185
|
status_code: int = exc.status_code
|
|
@@ -4,7 +4,7 @@ import typing
|
|
|
4
4
|
from contextlib import asynccontextmanager, contextmanager
|
|
5
5
|
|
|
6
6
|
import httpx
|
|
7
|
-
import websockets
|
|
7
|
+
import websockets.exceptions
|
|
8
8
|
import websockets.sync.client as websockets_sync_client
|
|
9
9
|
from ..core.api_error import ApiError
|
|
10
10
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
@@ -15,6 +15,11 @@ from .types.speech_to_text_streaming_language_code import SpeechToTextStreamingL
|
|
|
15
15
|
from .types.speech_to_text_streaming_model import SpeechToTextStreamingModel
|
|
16
16
|
from .types.speech_to_text_streaming_vad_signals import SpeechToTextStreamingVadSignals
|
|
17
17
|
|
|
18
|
+
try:
|
|
19
|
+
from websockets.legacy.client import connect as websockets_client_connect # type: ignore
|
|
20
|
+
except ImportError:
|
|
21
|
+
from websockets import connect as websockets_client_connect # type: ignore
|
|
22
|
+
|
|
18
23
|
|
|
19
24
|
class RawSpeechToTextStreamingClient:
|
|
20
25
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
@@ -151,7 +156,7 @@ class AsyncRawSpeechToTextStreamingClient:
|
|
|
151
156
|
if request_options and "additional_headers" in request_options:
|
|
152
157
|
headers.update(request_options["additional_headers"])
|
|
153
158
|
try:
|
|
154
|
-
async with
|
|
159
|
+
async with websockets_client_connect(ws_url, extra_headers=headers) as protocol:
|
|
155
160
|
yield AsyncSpeechToTextStreamingSocketClient(websocket=protocol)
|
|
156
161
|
except websockets.exceptions.InvalidStatusCode as exc:
|
|
157
162
|
status_code: int = exc.status_code
|
|
@@ -12,6 +12,7 @@ from ..types.bulk_job_init_response_v_1 import BulkJobInitResponseV1
|
|
|
12
12
|
from ..types.files_download_response import FilesDownloadResponse
|
|
13
13
|
from ..types.files_upload_response import FilesUploadResponse
|
|
14
14
|
from ..types.job_status_v_1 import JobStatusV1
|
|
15
|
+
from ..types.speech_to_text_translate_model import SpeechToTextTranslateModel
|
|
15
16
|
from .job import AsyncSpeechToTextTranslateJob, SpeechToTextTranslateJob
|
|
16
17
|
from .raw_client import (
|
|
17
18
|
AsyncRawSpeechToTextTranslateJobClient,
|
|
@@ -251,10 +252,10 @@ class SpeechToTextTranslateJobClient:
|
|
|
251
252
|
|
|
252
253
|
def create_job(
|
|
253
254
|
self,
|
|
255
|
+
model: SpeechToTextTranslateModel = "saaras:v2.5",
|
|
256
|
+
with_diarization: bool = False,
|
|
254
257
|
prompt: typing.Optional[str] = None,
|
|
255
|
-
model: typing.Optional[str] = "saaras:v2.5",
|
|
256
258
|
num_speakers: typing.Optional[int] = None,
|
|
257
|
-
with_diarization: typing.Optional[bool] = False,
|
|
258
259
|
callback: typing.Optional[BulkJobCallbackParams] = OMIT,
|
|
259
260
|
request_options: typing.Optional[RequestOptions] = None,
|
|
260
261
|
) -> SpeechToTextTranslateJob:
|
|
@@ -263,18 +264,18 @@ class SpeechToTextTranslateJobClient:
|
|
|
263
264
|
|
|
264
265
|
Parameters
|
|
265
266
|
----------
|
|
267
|
+
model : typing.Optional[SpeechToTextTranslateModel], default="saaras:v2.5"
|
|
268
|
+
The model to use for speech-to-text translation.
|
|
269
|
+
|
|
270
|
+
with_diarization : typing.Optional[bool], default=False
|
|
271
|
+
Whether to enable speaker diarization (i.e., distinguishing who is speaking).
|
|
272
|
+
|
|
266
273
|
prompt : typing.Optional[str], default=None
|
|
267
274
|
An optional prompt to guide the transcription and translation model.
|
|
268
275
|
|
|
269
|
-
model : typing.Optional[str], default="saaras:v2.5"
|
|
270
|
-
The model to use for speech-to-text translation.
|
|
271
|
-
|
|
272
276
|
num_speakers : typing.Optional[int], default=None
|
|
273
277
|
The number of distinct speakers in the input audio, if known.
|
|
274
278
|
|
|
275
|
-
with_diarization : typing.Optional[bool], default=False
|
|
276
|
-
Whether to enable speaker diarization (i.e., distinguishing who is speaking).
|
|
277
|
-
|
|
278
279
|
callback : typing.Optional[BulkJobCallbackParams], default=OMIT
|
|
279
280
|
Optional callback configuration to receive job completion events via webhook.
|
|
280
281
|
|
|
@@ -290,7 +291,7 @@ class SpeechToTextTranslateJobClient:
|
|
|
290
291
|
job_parameters=SpeechToTextTranslateJobParametersParams(
|
|
291
292
|
prompt=prompt, # type: ignore[typeddict-item]
|
|
292
293
|
model=model,
|
|
293
|
-
with_diarization=with_diarization,
|
|
294
|
+
with_diarization=with_diarization,
|
|
294
295
|
num_speakers=num_speakers, # type: ignore[typeddict-item]
|
|
295
296
|
),
|
|
296
297
|
callback=callback,
|
|
@@ -586,10 +587,10 @@ class AsyncSpeechToTextTranslateJobClient:
|
|
|
586
587
|
|
|
587
588
|
async def create_job(
|
|
588
589
|
self,
|
|
590
|
+
model: SpeechToTextTranslateModel = "saaras:v2.5",
|
|
591
|
+
with_diarization: bool = False,
|
|
589
592
|
prompt: typing.Optional[str] = None,
|
|
590
|
-
model: typing.Optional[str] = "saaras:v2.5",
|
|
591
593
|
num_speakers: typing.Optional[int] = None,
|
|
592
|
-
with_diarization: typing.Optional[bool] = False,
|
|
593
594
|
callback: typing.Optional[BulkJobCallbackParams] = OMIT,
|
|
594
595
|
request_options: typing.Optional[RequestOptions] = None,
|
|
595
596
|
) -> "AsyncSpeechToTextTranslateJob":
|
|
@@ -598,18 +599,18 @@ class AsyncSpeechToTextTranslateJobClient:
|
|
|
598
599
|
|
|
599
600
|
Parameters
|
|
600
601
|
----------
|
|
602
|
+
model : typing.Optional[SpeechToTextTranslateModel], default="saaras:v2.5"
|
|
603
|
+
The model to use for speech-to-text translation.
|
|
604
|
+
|
|
605
|
+
with_diarization : typing.Optional[bool], default=False
|
|
606
|
+
Whether to enable speaker diarization (i.e., distinguishing who is speaking).
|
|
607
|
+
|
|
601
608
|
prompt : typing.Optional[str], default=None
|
|
602
609
|
An optional prompt to guide the transcription and translation model.
|
|
603
610
|
|
|
604
|
-
model : typing.Optional[str], default="saaras:v2.5"
|
|
605
|
-
The model to use for speech-to-text translation.
|
|
606
|
-
|
|
607
611
|
num_speakers : typing.Optional[int], default=None
|
|
608
612
|
The number of distinct speakers in the input audio, if known.
|
|
609
613
|
|
|
610
|
-
with_diarization : typing.Optional[bool], default=False
|
|
611
|
-
Whether to enable speaker diarization (i.e., distinguishing who is speaking).
|
|
612
|
-
|
|
613
614
|
callback : typing.Optional[BulkJobCallbackParams], default=OMIT
|
|
614
615
|
Optional callback configuration to receive job completion events via webhook.
|
|
615
616
|
|
|
@@ -4,7 +4,7 @@ import typing
|
|
|
4
4
|
from contextlib import asynccontextmanager, contextmanager
|
|
5
5
|
|
|
6
6
|
import httpx
|
|
7
|
-
import websockets
|
|
7
|
+
import websockets.exceptions
|
|
8
8
|
import websockets.sync.client as websockets_sync_client
|
|
9
9
|
from ..core.api_error import ApiError
|
|
10
10
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
@@ -17,6 +17,11 @@ from .types.speech_to_text_translate_streaming_high_vad_sensitivity import (
|
|
|
17
17
|
from .types.speech_to_text_translate_streaming_model import SpeechToTextTranslateStreamingModel
|
|
18
18
|
from .types.speech_to_text_translate_streaming_vad_signals import SpeechToTextTranslateStreamingVadSignals
|
|
19
19
|
|
|
20
|
+
try:
|
|
21
|
+
from websockets.legacy.client import connect as websockets_client_connect # type: ignore
|
|
22
|
+
except ImportError:
|
|
23
|
+
from websockets import connect as websockets_client_connect # type: ignore
|
|
24
|
+
|
|
20
25
|
|
|
21
26
|
class SpeechToTextTranslateStreamingClient:
|
|
22
27
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
@@ -163,7 +168,7 @@ class AsyncSpeechToTextTranslateStreamingClient:
|
|
|
163
168
|
if request_options and "additional_headers" in request_options:
|
|
164
169
|
headers.update(request_options["additional_headers"])
|
|
165
170
|
try:
|
|
166
|
-
async with
|
|
171
|
+
async with websockets_client_connect(ws_url, extra_headers=headers) as protocol:
|
|
167
172
|
yield AsyncSpeechToTextTranslateStreamingSocketClient(websocket=protocol)
|
|
168
173
|
except websockets.exceptions.InvalidStatusCode as exc:
|
|
169
174
|
status_code: int = exc.status_code
|
|
@@ -4,7 +4,7 @@ import typing
|
|
|
4
4
|
from contextlib import asynccontextmanager, contextmanager
|
|
5
5
|
|
|
6
6
|
import httpx
|
|
7
|
-
import websockets
|
|
7
|
+
import websockets.exceptions
|
|
8
8
|
import websockets.sync.client as websockets_sync_client
|
|
9
9
|
from ..core.api_error import ApiError
|
|
10
10
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
@@ -16,6 +16,11 @@ from .types.speech_to_text_translate_streaming_high_vad_sensitivity import (
|
|
|
16
16
|
from .types.speech_to_text_translate_streaming_model import SpeechToTextTranslateStreamingModel
|
|
17
17
|
from .types.speech_to_text_translate_streaming_vad_signals import SpeechToTextTranslateStreamingVadSignals
|
|
18
18
|
|
|
19
|
+
try:
|
|
20
|
+
from websockets.legacy.client import connect as websockets_client_connect # type: ignore
|
|
21
|
+
except ImportError:
|
|
22
|
+
from websockets import connect as websockets_client_connect # type: ignore
|
|
23
|
+
|
|
19
24
|
|
|
20
25
|
class RawSpeechToTextTranslateStreamingClient:
|
|
21
26
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
@@ -140,7 +145,7 @@ class AsyncRawSpeechToTextTranslateStreamingClient:
|
|
|
140
145
|
if request_options and "additional_headers" in request_options:
|
|
141
146
|
headers.update(request_options["additional_headers"])
|
|
142
147
|
try:
|
|
143
|
-
async with
|
|
148
|
+
async with websockets_client_connect(ws_url, extra_headers=headers) as protocol:
|
|
144
149
|
yield AsyncSpeechToTextTranslateStreamingSocketClient(websocket=protocol)
|
|
145
150
|
except websockets.exceptions.InvalidStatusCode as exc:
|
|
146
151
|
status_code: int = exc.status_code
|
|
@@ -4,7 +4,7 @@ import typing
|
|
|
4
4
|
from contextlib import asynccontextmanager, contextmanager
|
|
5
5
|
|
|
6
6
|
import httpx
|
|
7
|
-
import websockets
|
|
7
|
+
import websockets.exceptions
|
|
8
8
|
import websockets.sync.client as websockets_sync_client
|
|
9
9
|
from ..core.api_error import ApiError
|
|
10
10
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
@@ -12,6 +12,11 @@ from ..core.request_options import RequestOptions
|
|
|
12
12
|
from .raw_client import AsyncRawTextToSpeechStreamingClient, RawTextToSpeechStreamingClient
|
|
13
13
|
from .socket_client import AsyncTextToSpeechStreamingSocketClient, TextToSpeechStreamingSocketClient
|
|
14
14
|
|
|
15
|
+
try:
|
|
16
|
+
from websockets.legacy.client import connect as websockets_client_connect # type: ignore
|
|
17
|
+
except ImportError:
|
|
18
|
+
from websockets import connect as websockets_client_connect # type: ignore
|
|
19
|
+
|
|
15
20
|
|
|
16
21
|
class TextToSpeechStreamingClient:
|
|
17
22
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
@@ -136,7 +141,7 @@ class AsyncTextToSpeechStreamingClient:
|
|
|
136
141
|
if request_options and "additional_headers" in request_options:
|
|
137
142
|
headers.update(request_options["additional_headers"])
|
|
138
143
|
try:
|
|
139
|
-
async with
|
|
144
|
+
async with websockets_client_connect(ws_url, extra_headers=headers) as protocol:
|
|
140
145
|
yield AsyncTextToSpeechStreamingSocketClient(websocket=protocol)
|
|
141
146
|
except websockets.exceptions.InvalidStatusCode as exc:
|
|
142
147
|
status_code: int = exc.status_code
|
|
@@ -4,13 +4,18 @@ import typing
|
|
|
4
4
|
from contextlib import asynccontextmanager, contextmanager
|
|
5
5
|
|
|
6
6
|
import httpx
|
|
7
|
-
import websockets
|
|
7
|
+
import websockets.exceptions
|
|
8
8
|
import websockets.sync.client as websockets_sync_client
|
|
9
9
|
from ..core.api_error import ApiError
|
|
10
10
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
11
11
|
from ..core.request_options import RequestOptions
|
|
12
12
|
from .socket_client import AsyncTextToSpeechStreamingSocketClient, TextToSpeechStreamingSocketClient
|
|
13
13
|
|
|
14
|
+
try:
|
|
15
|
+
from websockets.legacy.client import connect as websockets_client_connect # type: ignore
|
|
16
|
+
except ImportError:
|
|
17
|
+
from websockets import connect as websockets_client_connect # type: ignore
|
|
18
|
+
|
|
14
19
|
|
|
15
20
|
class RawTextToSpeechStreamingClient:
|
|
16
21
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
@@ -113,7 +118,7 @@ class AsyncRawTextToSpeechStreamingClient:
|
|
|
113
118
|
if request_options and "additional_headers" in request_options:
|
|
114
119
|
headers.update(request_options["additional_headers"])
|
|
115
120
|
try:
|
|
116
|
-
async with
|
|
121
|
+
async with websockets_client_connect(ws_url, extra_headers=headers) as protocol:
|
|
117
122
|
yield AsyncTextToSpeechStreamingSocketClient(websocket=protocol)
|
|
118
123
|
except websockets.exceptions.InvalidStatusCode as exc:
|
|
119
124
|
status_code: int = exc.status_code
|
|
@@ -5,9 +5,9 @@ sarvamai/chat/raw_client.py,sha256=A2kRuZcVWlJhyYCD7YKgqNkZEp3cYa1731KhRkhirU0,1
|
|
|
5
5
|
sarvamai/client.py,sha256=J30X_os1lPf8Wml0KDFEf6p8VGHhgF_lf3nw1T2D3qo,8207
|
|
6
6
|
sarvamai/core/__init__.py,sha256=YE2CtXeASe1RAbaI39twKWYKCuT4tW5is9HWHhJjR_g,1653
|
|
7
7
|
sarvamai/core/api_error.py,sha256=44vPoTyWN59gonCIZMdzw7M1uspygiLnr3GNFOoVL2Q,614
|
|
8
|
-
sarvamai/core/client_wrapper.py,sha256=
|
|
8
|
+
sarvamai/core/client_wrapper.py,sha256=urdkAU6KOLeN4S0XY6hOOcywys6hjEWrL1Hbz6ll3GI,2570
|
|
9
9
|
sarvamai/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
|
|
10
|
-
sarvamai/core/events.py,sha256=
|
|
10
|
+
sarvamai/core/events.py,sha256=HvKBdSoYcFetk7cgNXb7FxuY-FtY8NtUhZIN7mGVx8U,1159
|
|
11
11
|
sarvamai/core/file.py,sha256=d4NNbX8XvXP32z8KpK2Xovv33nFfruIrpz0QWxlgpZk,2663
|
|
12
12
|
sarvamai/core/force_multipart.py,sha256=awxh5MtcRYe74ehY8U76jzv6fYM_w_D3Rur7KQQzSDk,429
|
|
13
13
|
sarvamai/core/http_client.py,sha256=QurkBvCZZz2Z1d8znp4M2YbOXebBUPcPXRhPIS84Wvk,21214
|
|
@@ -87,12 +87,12 @@ sarvamai/speech_to_text/__init__.py,sha256=_VhToAyIt_5axN6CLJwtxg3-CO7THa_23pbUz
|
|
|
87
87
|
sarvamai/speech_to_text/client.py,sha256=lp2G2fI9SUbeOBBE1S5tjcp-Xb8wIhAuVadLKwXveh8,11003
|
|
88
88
|
sarvamai/speech_to_text/raw_client.py,sha256=A_56vEVeJdyttVJRiFxTMJ4n-s4l_PS8rI1DiLZlOmc,25331
|
|
89
89
|
sarvamai/speech_to_text_job/__init__.py,sha256=_VhToAyIt_5axN6CLJwtxg3-CO7THa_23pbUzqhXJa4,85
|
|
90
|
-
sarvamai/speech_to_text_job/client.py,sha256=
|
|
90
|
+
sarvamai/speech_to_text_job/client.py,sha256=v_q-fKp7Gz5izywtyIsjYE0CfJGa51k8sRBdWDmU0JU,18240
|
|
91
91
|
sarvamai/speech_to_text_job/job.py,sha256=LD47DCehRg5vHF8mc9C-gcVPiXRE-vpVMT8gGlrzK04,13923
|
|
92
92
|
sarvamai/speech_to_text_job/raw_client.py,sha256=v14drcQLAmpqozRUNKmw1F9j3omieMPC8R88Th1BID8,48055
|
|
93
93
|
sarvamai/speech_to_text_streaming/__init__.py,sha256=q7QygMmZCHJ-4FMhhL_6XNV_dsqlIFRCO1iSxoyxaaY,437
|
|
94
|
-
sarvamai/speech_to_text_streaming/client.py,sha256=
|
|
95
|
-
sarvamai/speech_to_text_streaming/raw_client.py,sha256=
|
|
94
|
+
sarvamai/speech_to_text_streaming/client.py,sha256=AzStfZDXhu2YAJEpnVbsy0WObub5ctlGBzqfeYOUlpA,8442
|
|
95
|
+
sarvamai/speech_to_text_streaming/raw_client.py,sha256=UrSRTR6NtB6SU0Ta8U2ER-PxBP1sDWL857l2LIaTxiU,7623
|
|
96
96
|
sarvamai/speech_to_text_streaming/socket_client.py,sha256=QI0vEjDvNTG9-EH99NolIuARYwD-P8Fms8rqKOD9HJQ,6419
|
|
97
97
|
sarvamai/speech_to_text_streaming/types/__init__.py,sha256=hzEDbcyy6K0Q9-Zx5k5lxAHxIgeHnAoPpvTLrL13YT0,599
|
|
98
98
|
sarvamai/speech_to_text_streaming/types/speech_to_text_streaming_high_vad_sensitivity.py,sha256=OwPwffa8TkLPGMnOTn5S7d-HmV8QmN3B7fHz8I1-VT8,180
|
|
@@ -100,12 +100,12 @@ sarvamai/speech_to_text_streaming/types/speech_to_text_streaming_language_code.p
|
|
|
100
100
|
sarvamai/speech_to_text_streaming/types/speech_to_text_streaming_model.py,sha256=b6F4ymgz4got6KVDqrweYvkET8itze63wUwWyjqDlO4,180
|
|
101
101
|
sarvamai/speech_to_text_streaming/types/speech_to_text_streaming_vad_signals.py,sha256=8wiFOB7WDMbYCcMTYgNFJaIjEytYeXpJLwr_O_mH0TI,172
|
|
102
102
|
sarvamai/speech_to_text_translate_job/__init__.py,sha256=_VhToAyIt_5axN6CLJwtxg3-CO7THa_23pbUzqhXJa4,85
|
|
103
|
-
sarvamai/speech_to_text_translate_job/client.py,sha256=
|
|
103
|
+
sarvamai/speech_to_text_translate_job/client.py,sha256=UmM9yACznkasSGodp1rNoi4Ang_D4EQ-tG-QtVwdaa4,19093
|
|
104
104
|
sarvamai/speech_to_text_translate_job/job.py,sha256=-DRzK4ZI3Jupf4H3GUX1ShIqDSTxGb59lIYGY9cQa7U,14109
|
|
105
105
|
sarvamai/speech_to_text_translate_job/raw_client.py,sha256=g-xk7H8ZwjmPSuJSgblVSH7kqGh_5wAkYUy5PdwTm-U,49362
|
|
106
106
|
sarvamai/speech_to_text_translate_streaming/__init__.py,sha256=_hmlce1Zs1grylysZhBUdtKfkaUROwVydtwz6l-1qqg,411
|
|
107
|
-
sarvamai/speech_to_text_translate_streaming/client.py,sha256=
|
|
108
|
-
sarvamai/speech_to_text_translate_streaming/raw_client.py,sha256=
|
|
107
|
+
sarvamai/speech_to_text_translate_streaming/client.py,sha256=xPPg5_JgpH8tYDUte6FGtpzXO2LGBUSRADN-ICqqA6U,8286
|
|
108
|
+
sarvamai/speech_to_text_translate_streaming/raw_client.py,sha256=WUj5dGWQT2HUYLFoi3SRJzXk1JMuLxhPQzbL45G5kO8,7395
|
|
109
109
|
sarvamai/speech_to_text_translate_streaming/socket_client.py,sha256=Xy86G9Mv1kGLf8xwFo3OBf98vqGQ50iigUAoOaApLdI,7842
|
|
110
110
|
sarvamai/speech_to_text_translate_streaming/types/__init__.py,sha256=zyKoGAbKW4d0-Zi56F0RfPUqtk_xUjWjF_RjTxbXXW4,556
|
|
111
111
|
sarvamai/speech_to_text_translate_streaming/types/speech_to_text_translate_streaming_high_vad_sensitivity.py,sha256=r6MvTlkM0VEpb4dpnMHtINOZ-gYc22o0Fx_Xce2rjvo,189
|
|
@@ -118,8 +118,8 @@ sarvamai/text_to_speech/__init__.py,sha256=_VhToAyIt_5axN6CLJwtxg3-CO7THa_23pbUz
|
|
|
118
118
|
sarvamai/text_to_speech/client.py,sha256=iwrQNfoMgCSOgvztTIXtLHQmSmn0RInwt5RSo9TwdtA,9617
|
|
119
119
|
sarvamai/text_to_speech/raw_client.py,sha256=si_aSjMR7SocIpKZFoVYqBmaIDuRm_6vxTM0dJ73PEo,15569
|
|
120
120
|
sarvamai/text_to_speech_streaming/__init__.py,sha256=_VhToAyIt_5axN6CLJwtxg3-CO7THa_23pbUzqhXJa4,85
|
|
121
|
-
sarvamai/text_to_speech_streaming/client.py,sha256=
|
|
122
|
-
sarvamai/text_to_speech_streaming/raw_client.py,sha256=
|
|
121
|
+
sarvamai/text_to_speech_streaming/client.py,sha256=tcYTUmWGseGQkLOsJdO4S3eZrFstjaLCPi5OcKflfus,6306
|
|
122
|
+
sarvamai/text_to_speech_streaming/raw_client.py,sha256=VdL5HYpUotIm5HaOqTwRkyZqoV0BuzwCtAfcB0g1y10,5487
|
|
123
123
|
sarvamai/text_to_speech_streaming/socket_client.py,sha256=NEcijnvjuNcWfzqpBi-xWsXVkL0NPq6EGAkEjnaq9hw,13909
|
|
124
124
|
sarvamai/types/__init__.py,sha256=_tcONO157t6xm41llByU9FzSYWCQO2gExsqKZOz0HpQ,7681
|
|
125
125
|
sarvamai/types/audio_data.py,sha256=rgOukLkLNJ_HBBVE2g5dfEL2CWjRoGiMvCtpq0qTB1Y,829
|
|
@@ -209,6 +209,6 @@ sarvamai/types/transliterate_mode.py,sha256=1jSEMlGcoLkWuk12TgoOpSgwifa4rThGKZ1h
|
|
|
209
209
|
sarvamai/types/transliterate_source_language.py,sha256=bSY9wJszF0sg-Cgg6F-YcWC8ly1mIlj9rqa15-jBtx8,283
|
|
210
210
|
sarvamai/types/transliteration_response.py,sha256=yt-lzTbDeJ_ZL4I8kQa6oESxA9ebeJJY7LfFHpdEsmM,815
|
|
211
211
|
sarvamai/version.py,sha256=Qkp3Ee9YH-O9RTix90e0i7iNrFAGN-QDt2AFwGA4n8k,75
|
|
212
|
-
sarvamai-0.1.
|
|
213
|
-
sarvamai-0.1.
|
|
214
|
-
sarvamai-0.1.
|
|
212
|
+
sarvamai-0.1.12a0.dist-info/METADATA,sha256=NmqR8YWdgGkuxs29tsMKBObG053U2IIjNYTF6xrePGA,26753
|
|
213
|
+
sarvamai-0.1.12a0.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
|
214
|
+
sarvamai-0.1.12a0.dist-info/RECORD,,
|
|
File without changes
|