sarvamai 0.1.11a1__py3-none-any.whl → 0.1.11a3__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/__init__.py +10 -4
- sarvamai/client.py +3 -0
- sarvamai/core/client_wrapper.py +2 -2
- sarvamai/requests/__init__.py +2 -0
- sarvamai/requests/configure_connection_data.py +2 -3
- sarvamai/requests/speech_to_text_translate_job_parameters.py +28 -0
- sarvamai/speech_to_text_translate_job/__init__.py +4 -0
- sarvamai/speech_to_text_translate_job/client.py +494 -0
- sarvamai/speech_to_text_translate_job/raw_client.py +1241 -0
- sarvamai/text_to_speech/client.py +7 -7
- sarvamai/text_to_speech/raw_client.py +7 -7
- sarvamai/types/__init__.py +6 -4
- sarvamai/types/configure_connection_data.py +2 -1
- sarvamai/types/configure_connection_data_output_audio_codec.py +7 -0
- sarvamai/types/speech_to_text_translate_job_parameters.py +40 -0
- sarvamai/types/text_to_speech_output_audio_codec.py +7 -0
- {sarvamai-0.1.11a1.dist-info → sarvamai-0.1.11a3.dist-info}/METADATA +1 -1
- {sarvamai-0.1.11a1.dist-info → sarvamai-0.1.11a3.dist-info}/RECORD +19 -14
- sarvamai/types/audio_codec.py +0 -5
- sarvamai/types/format.py +0 -5
- {sarvamai-0.1.11a1.dist-info → sarvamai-0.1.11a3.dist-info}/WHEEL +0 -0
sarvamai/__init__.py
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
# isort: skip_file
|
|
4
4
|
|
|
5
5
|
from .types import (
|
|
6
|
-
AudioCodec,
|
|
7
6
|
AudioData,
|
|
8
7
|
AudioMessage,
|
|
9
8
|
AudioOutput,
|
|
@@ -25,6 +24,7 @@ from .types import (
|
|
|
25
24
|
ConfigureConnection,
|
|
26
25
|
ConfigureConnectionData,
|
|
27
26
|
ConfigureConnectionDataOutputAudioBitrate,
|
|
27
|
+
ConfigureConnectionDataOutputAudioCodec,
|
|
28
28
|
ConfigureConnectionDataSpeaker,
|
|
29
29
|
ConfigureConnectionDataTargetLanguageCode,
|
|
30
30
|
CreateChatCompletionResponse,
|
|
@@ -43,7 +43,6 @@ from .types import (
|
|
|
43
43
|
FilesUploadResponse,
|
|
44
44
|
FinishReason,
|
|
45
45
|
FlushSignal,
|
|
46
|
-
Format,
|
|
47
46
|
JobState,
|
|
48
47
|
JobStatusV1,
|
|
49
48
|
LanguageIdentificationResponse,
|
|
@@ -63,6 +62,7 @@ from .types import (
|
|
|
63
62
|
SpeechToTextResponseData,
|
|
64
63
|
SpeechToTextStreamingResponse,
|
|
65
64
|
SpeechToTextTranscriptionData,
|
|
65
|
+
SpeechToTextTranslateJobParameters,
|
|
66
66
|
SpeechToTextTranslateLanguage,
|
|
67
67
|
SpeechToTextTranslateModel,
|
|
68
68
|
SpeechToTextTranslateResponse,
|
|
@@ -77,6 +77,7 @@ from .types import (
|
|
|
77
77
|
TaskState,
|
|
78
78
|
TextToSpeechLanguage,
|
|
79
79
|
TextToSpeechModel,
|
|
80
|
+
TextToSpeechOutputAudioCodec,
|
|
80
81
|
TextToSpeechResponse,
|
|
81
82
|
TextToSpeechSpeaker,
|
|
82
83
|
TimestampsModel,
|
|
@@ -105,6 +106,7 @@ from . import (
|
|
|
105
106
|
speech_to_text,
|
|
106
107
|
speech_to_text_job,
|
|
107
108
|
speech_to_text_streaming,
|
|
109
|
+
speech_to_text_translate_job,
|
|
108
110
|
speech_to_text_translate_streaming,
|
|
109
111
|
text,
|
|
110
112
|
text_to_speech,
|
|
@@ -157,6 +159,7 @@ from .requests import (
|
|
|
157
159
|
SpeechToTextResponseParams,
|
|
158
160
|
SpeechToTextStreamingResponseParams,
|
|
159
161
|
SpeechToTextTranscriptionDataParams,
|
|
162
|
+
SpeechToTextTranslateJobParametersParams,
|
|
160
163
|
SpeechToTextTranslateResponseDataParams,
|
|
161
164
|
SpeechToTextTranslateResponseParams,
|
|
162
165
|
SpeechToTextTranslateStreamingResponseParams,
|
|
@@ -185,7 +188,6 @@ from .version import __version__
|
|
|
185
188
|
|
|
186
189
|
__all__ = [
|
|
187
190
|
"AsyncSarvamAI",
|
|
188
|
-
"AudioCodec",
|
|
189
191
|
"AudioData",
|
|
190
192
|
"AudioDataParams",
|
|
191
193
|
"AudioMessage",
|
|
@@ -226,6 +228,7 @@ __all__ = [
|
|
|
226
228
|
"ConfigureConnection",
|
|
227
229
|
"ConfigureConnectionData",
|
|
228
230
|
"ConfigureConnectionDataOutputAudioBitrate",
|
|
231
|
+
"ConfigureConnectionDataOutputAudioCodec",
|
|
229
232
|
"ConfigureConnectionDataParams",
|
|
230
233
|
"ConfigureConnectionDataSpeaker",
|
|
231
234
|
"ConfigureConnectionDataTargetLanguageCode",
|
|
@@ -261,7 +264,6 @@ __all__ = [
|
|
|
261
264
|
"FlushSignal",
|
|
262
265
|
"FlushSignalParams",
|
|
263
266
|
"ForbiddenError",
|
|
264
|
-
"Format",
|
|
265
267
|
"InternalServerError",
|
|
266
268
|
"JobState",
|
|
267
269
|
"JobStatusV1",
|
|
@@ -299,6 +301,8 @@ __all__ = [
|
|
|
299
301
|
"SpeechToTextStreamingVadSignals",
|
|
300
302
|
"SpeechToTextTranscriptionData",
|
|
301
303
|
"SpeechToTextTranscriptionDataParams",
|
|
304
|
+
"SpeechToTextTranslateJobParameters",
|
|
305
|
+
"SpeechToTextTranslateJobParametersParams",
|
|
302
306
|
"SpeechToTextTranslateLanguage",
|
|
303
307
|
"SpeechToTextTranslateModel",
|
|
304
308
|
"SpeechToTextTranslateResponse",
|
|
@@ -323,6 +327,7 @@ __all__ = [
|
|
|
323
327
|
"TaskState",
|
|
324
328
|
"TextToSpeechLanguage",
|
|
325
329
|
"TextToSpeechModel",
|
|
330
|
+
"TextToSpeechOutputAudioCodec",
|
|
326
331
|
"TextToSpeechResponse",
|
|
327
332
|
"TextToSpeechResponseParams",
|
|
328
333
|
"TextToSpeechSpeaker",
|
|
@@ -349,6 +354,7 @@ __all__ = [
|
|
|
349
354
|
"speech_to_text",
|
|
350
355
|
"speech_to_text_job",
|
|
351
356
|
"speech_to_text_streaming",
|
|
357
|
+
"speech_to_text_translate_job",
|
|
352
358
|
"speech_to_text_translate_streaming",
|
|
353
359
|
"text",
|
|
354
360
|
"text_to_speech",
|
sarvamai/client.py
CHANGED
|
@@ -11,6 +11,7 @@ from .environment import SarvamAIEnvironment
|
|
|
11
11
|
from .speech_to_text.client import AsyncSpeechToTextClient, SpeechToTextClient
|
|
12
12
|
from .speech_to_text_job.client import AsyncSpeechToTextJobClient, SpeechToTextJobClient
|
|
13
13
|
from .speech_to_text_streaming.client import AsyncSpeechToTextStreamingClient, SpeechToTextStreamingClient
|
|
14
|
+
from .speech_to_text_translate_job.client import AsyncSpeechToTextTranslateJobClient, SpeechToTextTranslateJobClient
|
|
14
15
|
from .speech_to_text_translate_streaming.client import (
|
|
15
16
|
AsyncSpeechToTextTranslateStreamingClient,
|
|
16
17
|
SpeechToTextTranslateStreamingClient,
|
|
@@ -90,6 +91,7 @@ class SarvamAI:
|
|
|
90
91
|
self.text_to_speech = TextToSpeechClient(client_wrapper=self._client_wrapper)
|
|
91
92
|
self.chat = ChatClient(client_wrapper=self._client_wrapper)
|
|
92
93
|
self.speech_to_text_job = SpeechToTextJobClient(client_wrapper=self._client_wrapper)
|
|
94
|
+
self.speech_to_text_translate_job = SpeechToTextTranslateJobClient(client_wrapper=self._client_wrapper)
|
|
93
95
|
self.speech_to_text_streaming = SpeechToTextStreamingClient(client_wrapper=self._client_wrapper)
|
|
94
96
|
self.speech_to_text_translate_streaming = SpeechToTextTranslateStreamingClient(
|
|
95
97
|
client_wrapper=self._client_wrapper
|
|
@@ -167,6 +169,7 @@ class AsyncSarvamAI:
|
|
|
167
169
|
self.text_to_speech = AsyncTextToSpeechClient(client_wrapper=self._client_wrapper)
|
|
168
170
|
self.chat = AsyncChatClient(client_wrapper=self._client_wrapper)
|
|
169
171
|
self.speech_to_text_job = AsyncSpeechToTextJobClient(client_wrapper=self._client_wrapper)
|
|
172
|
+
self.speech_to_text_translate_job = AsyncSpeechToTextTranslateJobClient(client_wrapper=self._client_wrapper)
|
|
170
173
|
self.speech_to_text_streaming = AsyncSpeechToTextStreamingClient(client_wrapper=self._client_wrapper)
|
|
171
174
|
self.speech_to_text_translate_streaming = AsyncSpeechToTextTranslateStreamingClient(
|
|
172
175
|
client_wrapper=self._client_wrapper
|
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.11a3",
|
|
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.11a3",
|
|
30
30
|
**(self.get_custom_headers() or {}),
|
|
31
31
|
}
|
|
32
32
|
headers["api-subscription-key"] = self.api_subscription_key
|
sarvamai/requests/__init__.py
CHANGED
|
@@ -48,6 +48,7 @@ from .speech_to_text_response import SpeechToTextResponseParams
|
|
|
48
48
|
from .speech_to_text_response_data import SpeechToTextResponseDataParams
|
|
49
49
|
from .speech_to_text_streaming_response import SpeechToTextStreamingResponseParams
|
|
50
50
|
from .speech_to_text_transcription_data import SpeechToTextTranscriptionDataParams
|
|
51
|
+
from .speech_to_text_translate_job_parameters import SpeechToTextTranslateJobParametersParams
|
|
51
52
|
from .speech_to_text_translate_response import SpeechToTextTranslateResponseParams
|
|
52
53
|
from .speech_to_text_translate_response_data import SpeechToTextTranslateResponseDataParams
|
|
53
54
|
from .speech_to_text_translate_streaming_response import SpeechToTextTranslateStreamingResponseParams
|
|
@@ -106,6 +107,7 @@ __all__ = [
|
|
|
106
107
|
"SpeechToTextResponseParams",
|
|
107
108
|
"SpeechToTextStreamingResponseParams",
|
|
108
109
|
"SpeechToTextTranscriptionDataParams",
|
|
110
|
+
"SpeechToTextTranslateJobParametersParams",
|
|
109
111
|
"SpeechToTextTranslateResponseDataParams",
|
|
110
112
|
"SpeechToTextTranslateResponseParams",
|
|
111
113
|
"SpeechToTextTranslateStreamingResponseParams",
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
import typing
|
|
4
|
-
|
|
5
3
|
import typing_extensions
|
|
6
4
|
from ..types.configure_connection_data_output_audio_bitrate import ConfigureConnectionDataOutputAudioBitrate
|
|
5
|
+
from ..types.configure_connection_data_output_audio_codec import ConfigureConnectionDataOutputAudioCodec
|
|
7
6
|
from ..types.configure_connection_data_speaker import ConfigureConnectionDataSpeaker
|
|
8
7
|
from ..types.configure_connection_data_target_language_code import ConfigureConnectionDataTargetLanguageCode
|
|
9
8
|
|
|
@@ -62,7 +61,7 @@ class ConfigureConnectionDataParams(typing_extensions.TypedDict):
|
|
|
62
61
|
of mixed-language text. Default is false.
|
|
63
62
|
"""
|
|
64
63
|
|
|
65
|
-
output_audio_codec: typing_extensions.NotRequired[
|
|
64
|
+
output_audio_codec: typing_extensions.NotRequired[ConfigureConnectionDataOutputAudioCodec]
|
|
66
65
|
"""
|
|
67
66
|
Audio codec (currently supports MP3 only, optimized for real-time playback)
|
|
68
67
|
"""
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing_extensions
|
|
4
|
+
from ..types.speech_to_text_translate_model import SpeechToTextTranslateModel
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class SpeechToTextTranslateJobParametersParams(typing_extensions.TypedDict):
|
|
8
|
+
prompt: typing_extensions.NotRequired[str]
|
|
9
|
+
"""
|
|
10
|
+
Prompt to assist the transcription
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
model: typing_extensions.NotRequired[SpeechToTextTranslateModel]
|
|
14
|
+
"""
|
|
15
|
+
Model to be used for converting speech to text in target language
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
with_diarization: typing_extensions.NotRequired[bool]
|
|
19
|
+
"""
|
|
20
|
+
Enables speaker diarization, which identifies and separates different speakers in the audio.
|
|
21
|
+
When set to true, the API will provide speaker-specific segments in the response.
|
|
22
|
+
Note: This parameter is currently in Beta mode.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
num_speakers: typing_extensions.NotRequired[int]
|
|
26
|
+
"""
|
|
27
|
+
Number of speakers to be detected in the audio. This is used when with_diarization is set to true.
|
|
28
|
+
"""
|
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
|
+
from ..core.request_options import RequestOptions
|
|
7
|
+
from ..requests.bulk_job_callback import BulkJobCallbackParams
|
|
8
|
+
from ..requests.speech_to_text_translate_job_parameters import SpeechToTextTranslateJobParametersParams
|
|
9
|
+
from ..types.bulk_job_init_response_v_1 import BulkJobInitResponseV1
|
|
10
|
+
from ..types.files_download_response import FilesDownloadResponse
|
|
11
|
+
from ..types.files_upload_response import FilesUploadResponse
|
|
12
|
+
from ..types.job_status_v_1 import JobStatusV1
|
|
13
|
+
from .raw_client import AsyncRawSpeechToTextTranslateJobClient, RawSpeechToTextTranslateJobClient
|
|
14
|
+
|
|
15
|
+
# this is used as the default value for optional parameters
|
|
16
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class SpeechToTextTranslateJobClient:
|
|
20
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
21
|
+
self._raw_client = RawSpeechToTextTranslateJobClient(client_wrapper=client_wrapper)
|
|
22
|
+
|
|
23
|
+
@property
|
|
24
|
+
def with_raw_response(self) -> RawSpeechToTextTranslateJobClient:
|
|
25
|
+
"""
|
|
26
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
27
|
+
|
|
28
|
+
Returns
|
|
29
|
+
-------
|
|
30
|
+
RawSpeechToTextTranslateJobClient
|
|
31
|
+
"""
|
|
32
|
+
return self._raw_client
|
|
33
|
+
|
|
34
|
+
def initialise(
|
|
35
|
+
self,
|
|
36
|
+
*,
|
|
37
|
+
job_parameters: SpeechToTextTranslateJobParametersParams,
|
|
38
|
+
ptu_id: typing.Optional[int] = None,
|
|
39
|
+
callback: typing.Optional[BulkJobCallbackParams] = OMIT,
|
|
40
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
41
|
+
) -> BulkJobInitResponseV1:
|
|
42
|
+
"""
|
|
43
|
+
Get a job uuid, and storage folder details for speech to text tranlsate bulk job v1
|
|
44
|
+
|
|
45
|
+
Parameters
|
|
46
|
+
----------
|
|
47
|
+
job_parameters : SpeechToTextTranslateJobParametersParams
|
|
48
|
+
Job Parameters for the bulk job
|
|
49
|
+
|
|
50
|
+
ptu_id : typing.Optional[int]
|
|
51
|
+
|
|
52
|
+
callback : typing.Optional[BulkJobCallbackParams]
|
|
53
|
+
Parameters for callback URL
|
|
54
|
+
|
|
55
|
+
request_options : typing.Optional[RequestOptions]
|
|
56
|
+
Request-specific configuration.
|
|
57
|
+
|
|
58
|
+
Returns
|
|
59
|
+
-------
|
|
60
|
+
BulkJobInitResponseV1
|
|
61
|
+
Successful Response
|
|
62
|
+
|
|
63
|
+
Examples
|
|
64
|
+
--------
|
|
65
|
+
from sarvamai import SarvamAI
|
|
66
|
+
|
|
67
|
+
client = SarvamAI(
|
|
68
|
+
api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
|
|
69
|
+
)
|
|
70
|
+
client.speech_to_text_translate_job.initialise(
|
|
71
|
+
job_parameters={},
|
|
72
|
+
)
|
|
73
|
+
"""
|
|
74
|
+
_response = self._raw_client.initialise(
|
|
75
|
+
job_parameters=job_parameters, ptu_id=ptu_id, callback=callback, request_options=request_options
|
|
76
|
+
)
|
|
77
|
+
return _response.data
|
|
78
|
+
|
|
79
|
+
def get_status(self, job_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> JobStatusV1:
|
|
80
|
+
"""
|
|
81
|
+
Get the status of a speech to text translate bulk job V1
|
|
82
|
+
|
|
83
|
+
Parameters
|
|
84
|
+
----------
|
|
85
|
+
job_id : str
|
|
86
|
+
The unique identifier of the job
|
|
87
|
+
|
|
88
|
+
request_options : typing.Optional[RequestOptions]
|
|
89
|
+
Request-specific configuration.
|
|
90
|
+
|
|
91
|
+
Returns
|
|
92
|
+
-------
|
|
93
|
+
JobStatusV1
|
|
94
|
+
Successful Response
|
|
95
|
+
|
|
96
|
+
Examples
|
|
97
|
+
--------
|
|
98
|
+
from sarvamai import SarvamAI
|
|
99
|
+
|
|
100
|
+
client = SarvamAI(
|
|
101
|
+
api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
|
|
102
|
+
)
|
|
103
|
+
client.speech_to_text_translate_job.get_status(
|
|
104
|
+
job_id="job_id",
|
|
105
|
+
)
|
|
106
|
+
"""
|
|
107
|
+
_response = self._raw_client.get_status(job_id, request_options=request_options)
|
|
108
|
+
return _response.data
|
|
109
|
+
|
|
110
|
+
def start(
|
|
111
|
+
self,
|
|
112
|
+
job_id: str,
|
|
113
|
+
*,
|
|
114
|
+
ptu_id: typing.Optional[int] = None,
|
|
115
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
116
|
+
) -> JobStatusV1:
|
|
117
|
+
"""
|
|
118
|
+
Start a speech to text translate bulk job V1
|
|
119
|
+
|
|
120
|
+
Parameters
|
|
121
|
+
----------
|
|
122
|
+
job_id : str
|
|
123
|
+
The unique identifier of the job
|
|
124
|
+
|
|
125
|
+
ptu_id : typing.Optional[int]
|
|
126
|
+
|
|
127
|
+
request_options : typing.Optional[RequestOptions]
|
|
128
|
+
Request-specific configuration.
|
|
129
|
+
|
|
130
|
+
Returns
|
|
131
|
+
-------
|
|
132
|
+
JobStatusV1
|
|
133
|
+
Successful Response
|
|
134
|
+
|
|
135
|
+
Examples
|
|
136
|
+
--------
|
|
137
|
+
from sarvamai import SarvamAI
|
|
138
|
+
|
|
139
|
+
client = SarvamAI(
|
|
140
|
+
api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
|
|
141
|
+
)
|
|
142
|
+
client.speech_to_text_translate_job.start(
|
|
143
|
+
job_id="job_id",
|
|
144
|
+
)
|
|
145
|
+
"""
|
|
146
|
+
_response = self._raw_client.start(job_id, ptu_id=ptu_id, request_options=request_options)
|
|
147
|
+
return _response.data
|
|
148
|
+
|
|
149
|
+
def get_upload_links(
|
|
150
|
+
self,
|
|
151
|
+
*,
|
|
152
|
+
job_id: str,
|
|
153
|
+
files: typing.Sequence[str],
|
|
154
|
+
ptu_id: typing.Optional[int] = None,
|
|
155
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
156
|
+
) -> FilesUploadResponse:
|
|
157
|
+
"""
|
|
158
|
+
Start a speech to text bulk job V1
|
|
159
|
+
|
|
160
|
+
Parameters
|
|
161
|
+
----------
|
|
162
|
+
job_id : str
|
|
163
|
+
|
|
164
|
+
files : typing.Sequence[str]
|
|
165
|
+
|
|
166
|
+
ptu_id : typing.Optional[int]
|
|
167
|
+
|
|
168
|
+
request_options : typing.Optional[RequestOptions]
|
|
169
|
+
Request-specific configuration.
|
|
170
|
+
|
|
171
|
+
Returns
|
|
172
|
+
-------
|
|
173
|
+
FilesUploadResponse
|
|
174
|
+
Successful Response
|
|
175
|
+
|
|
176
|
+
Examples
|
|
177
|
+
--------
|
|
178
|
+
from sarvamai import SarvamAI
|
|
179
|
+
|
|
180
|
+
client = SarvamAI(
|
|
181
|
+
api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
|
|
182
|
+
)
|
|
183
|
+
client.speech_to_text_translate_job.get_upload_links(
|
|
184
|
+
job_id="job_id",
|
|
185
|
+
files=["files"],
|
|
186
|
+
)
|
|
187
|
+
"""
|
|
188
|
+
_response = self._raw_client.get_upload_links(
|
|
189
|
+
job_id=job_id, files=files, ptu_id=ptu_id, request_options=request_options
|
|
190
|
+
)
|
|
191
|
+
return _response.data
|
|
192
|
+
|
|
193
|
+
def get_download_links(
|
|
194
|
+
self,
|
|
195
|
+
*,
|
|
196
|
+
job_id: str,
|
|
197
|
+
files: typing.Sequence[str],
|
|
198
|
+
ptu_id: typing.Optional[int] = None,
|
|
199
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
200
|
+
) -> FilesDownloadResponse:
|
|
201
|
+
"""
|
|
202
|
+
Start a speech to text bulk job V1
|
|
203
|
+
|
|
204
|
+
Parameters
|
|
205
|
+
----------
|
|
206
|
+
job_id : str
|
|
207
|
+
|
|
208
|
+
files : typing.Sequence[str]
|
|
209
|
+
|
|
210
|
+
ptu_id : typing.Optional[int]
|
|
211
|
+
|
|
212
|
+
request_options : typing.Optional[RequestOptions]
|
|
213
|
+
Request-specific configuration.
|
|
214
|
+
|
|
215
|
+
Returns
|
|
216
|
+
-------
|
|
217
|
+
FilesDownloadResponse
|
|
218
|
+
Successful Response
|
|
219
|
+
|
|
220
|
+
Examples
|
|
221
|
+
--------
|
|
222
|
+
from sarvamai import SarvamAI
|
|
223
|
+
|
|
224
|
+
client = SarvamAI(
|
|
225
|
+
api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
|
|
226
|
+
)
|
|
227
|
+
client.speech_to_text_translate_job.get_download_links(
|
|
228
|
+
job_id="job_id",
|
|
229
|
+
files=["files"],
|
|
230
|
+
)
|
|
231
|
+
"""
|
|
232
|
+
_response = self._raw_client.get_download_links(
|
|
233
|
+
job_id=job_id, files=files, ptu_id=ptu_id, request_options=request_options
|
|
234
|
+
)
|
|
235
|
+
return _response.data
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
class AsyncSpeechToTextTranslateJobClient:
|
|
239
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
240
|
+
self._raw_client = AsyncRawSpeechToTextTranslateJobClient(client_wrapper=client_wrapper)
|
|
241
|
+
|
|
242
|
+
@property
|
|
243
|
+
def with_raw_response(self) -> AsyncRawSpeechToTextTranslateJobClient:
|
|
244
|
+
"""
|
|
245
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
246
|
+
|
|
247
|
+
Returns
|
|
248
|
+
-------
|
|
249
|
+
AsyncRawSpeechToTextTranslateJobClient
|
|
250
|
+
"""
|
|
251
|
+
return self._raw_client
|
|
252
|
+
|
|
253
|
+
async def initialise(
|
|
254
|
+
self,
|
|
255
|
+
*,
|
|
256
|
+
job_parameters: SpeechToTextTranslateJobParametersParams,
|
|
257
|
+
ptu_id: typing.Optional[int] = None,
|
|
258
|
+
callback: typing.Optional[BulkJobCallbackParams] = OMIT,
|
|
259
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
260
|
+
) -> BulkJobInitResponseV1:
|
|
261
|
+
"""
|
|
262
|
+
Get a job uuid, and storage folder details for speech to text tranlsate bulk job v1
|
|
263
|
+
|
|
264
|
+
Parameters
|
|
265
|
+
----------
|
|
266
|
+
job_parameters : SpeechToTextTranslateJobParametersParams
|
|
267
|
+
Job Parameters for the bulk job
|
|
268
|
+
|
|
269
|
+
ptu_id : typing.Optional[int]
|
|
270
|
+
|
|
271
|
+
callback : typing.Optional[BulkJobCallbackParams]
|
|
272
|
+
Parameters for callback URL
|
|
273
|
+
|
|
274
|
+
request_options : typing.Optional[RequestOptions]
|
|
275
|
+
Request-specific configuration.
|
|
276
|
+
|
|
277
|
+
Returns
|
|
278
|
+
-------
|
|
279
|
+
BulkJobInitResponseV1
|
|
280
|
+
Successful Response
|
|
281
|
+
|
|
282
|
+
Examples
|
|
283
|
+
--------
|
|
284
|
+
import asyncio
|
|
285
|
+
|
|
286
|
+
from sarvamai import AsyncSarvamAI
|
|
287
|
+
|
|
288
|
+
client = AsyncSarvamAI(
|
|
289
|
+
api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
|
|
290
|
+
)
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
async def main() -> None:
|
|
294
|
+
await client.speech_to_text_translate_job.initialise(
|
|
295
|
+
job_parameters={},
|
|
296
|
+
)
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
asyncio.run(main())
|
|
300
|
+
"""
|
|
301
|
+
_response = await self._raw_client.initialise(
|
|
302
|
+
job_parameters=job_parameters, ptu_id=ptu_id, callback=callback, request_options=request_options
|
|
303
|
+
)
|
|
304
|
+
return _response.data
|
|
305
|
+
|
|
306
|
+
async def get_status(self, job_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> JobStatusV1:
|
|
307
|
+
"""
|
|
308
|
+
Get the status of a speech to text translate bulk job V1
|
|
309
|
+
|
|
310
|
+
Parameters
|
|
311
|
+
----------
|
|
312
|
+
job_id : str
|
|
313
|
+
The unique identifier of the job
|
|
314
|
+
|
|
315
|
+
request_options : typing.Optional[RequestOptions]
|
|
316
|
+
Request-specific configuration.
|
|
317
|
+
|
|
318
|
+
Returns
|
|
319
|
+
-------
|
|
320
|
+
JobStatusV1
|
|
321
|
+
Successful Response
|
|
322
|
+
|
|
323
|
+
Examples
|
|
324
|
+
--------
|
|
325
|
+
import asyncio
|
|
326
|
+
|
|
327
|
+
from sarvamai import AsyncSarvamAI
|
|
328
|
+
|
|
329
|
+
client = AsyncSarvamAI(
|
|
330
|
+
api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
|
|
331
|
+
)
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
async def main() -> None:
|
|
335
|
+
await client.speech_to_text_translate_job.get_status(
|
|
336
|
+
job_id="job_id",
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
asyncio.run(main())
|
|
341
|
+
"""
|
|
342
|
+
_response = await self._raw_client.get_status(job_id, request_options=request_options)
|
|
343
|
+
return _response.data
|
|
344
|
+
|
|
345
|
+
async def start(
|
|
346
|
+
self,
|
|
347
|
+
job_id: str,
|
|
348
|
+
*,
|
|
349
|
+
ptu_id: typing.Optional[int] = None,
|
|
350
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
351
|
+
) -> JobStatusV1:
|
|
352
|
+
"""
|
|
353
|
+
Start a speech to text translate bulk job V1
|
|
354
|
+
|
|
355
|
+
Parameters
|
|
356
|
+
----------
|
|
357
|
+
job_id : str
|
|
358
|
+
The unique identifier of the job
|
|
359
|
+
|
|
360
|
+
ptu_id : typing.Optional[int]
|
|
361
|
+
|
|
362
|
+
request_options : typing.Optional[RequestOptions]
|
|
363
|
+
Request-specific configuration.
|
|
364
|
+
|
|
365
|
+
Returns
|
|
366
|
+
-------
|
|
367
|
+
JobStatusV1
|
|
368
|
+
Successful Response
|
|
369
|
+
|
|
370
|
+
Examples
|
|
371
|
+
--------
|
|
372
|
+
import asyncio
|
|
373
|
+
|
|
374
|
+
from sarvamai import AsyncSarvamAI
|
|
375
|
+
|
|
376
|
+
client = AsyncSarvamAI(
|
|
377
|
+
api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
|
|
378
|
+
)
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
async def main() -> None:
|
|
382
|
+
await client.speech_to_text_translate_job.start(
|
|
383
|
+
job_id="job_id",
|
|
384
|
+
)
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
asyncio.run(main())
|
|
388
|
+
"""
|
|
389
|
+
_response = await self._raw_client.start(job_id, ptu_id=ptu_id, request_options=request_options)
|
|
390
|
+
return _response.data
|
|
391
|
+
|
|
392
|
+
async def get_upload_links(
|
|
393
|
+
self,
|
|
394
|
+
*,
|
|
395
|
+
job_id: str,
|
|
396
|
+
files: typing.Sequence[str],
|
|
397
|
+
ptu_id: typing.Optional[int] = None,
|
|
398
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
399
|
+
) -> FilesUploadResponse:
|
|
400
|
+
"""
|
|
401
|
+
Start a speech to text bulk job V1
|
|
402
|
+
|
|
403
|
+
Parameters
|
|
404
|
+
----------
|
|
405
|
+
job_id : str
|
|
406
|
+
|
|
407
|
+
files : typing.Sequence[str]
|
|
408
|
+
|
|
409
|
+
ptu_id : typing.Optional[int]
|
|
410
|
+
|
|
411
|
+
request_options : typing.Optional[RequestOptions]
|
|
412
|
+
Request-specific configuration.
|
|
413
|
+
|
|
414
|
+
Returns
|
|
415
|
+
-------
|
|
416
|
+
FilesUploadResponse
|
|
417
|
+
Successful Response
|
|
418
|
+
|
|
419
|
+
Examples
|
|
420
|
+
--------
|
|
421
|
+
import asyncio
|
|
422
|
+
|
|
423
|
+
from sarvamai import AsyncSarvamAI
|
|
424
|
+
|
|
425
|
+
client = AsyncSarvamAI(
|
|
426
|
+
api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
|
|
427
|
+
)
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
async def main() -> None:
|
|
431
|
+
await client.speech_to_text_translate_job.get_upload_links(
|
|
432
|
+
job_id="job_id",
|
|
433
|
+
files=["files"],
|
|
434
|
+
)
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
asyncio.run(main())
|
|
438
|
+
"""
|
|
439
|
+
_response = await self._raw_client.get_upload_links(
|
|
440
|
+
job_id=job_id, files=files, ptu_id=ptu_id, request_options=request_options
|
|
441
|
+
)
|
|
442
|
+
return _response.data
|
|
443
|
+
|
|
444
|
+
async def get_download_links(
|
|
445
|
+
self,
|
|
446
|
+
*,
|
|
447
|
+
job_id: str,
|
|
448
|
+
files: typing.Sequence[str],
|
|
449
|
+
ptu_id: typing.Optional[int] = None,
|
|
450
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
451
|
+
) -> FilesDownloadResponse:
|
|
452
|
+
"""
|
|
453
|
+
Start a speech to text bulk job V1
|
|
454
|
+
|
|
455
|
+
Parameters
|
|
456
|
+
----------
|
|
457
|
+
job_id : str
|
|
458
|
+
|
|
459
|
+
files : typing.Sequence[str]
|
|
460
|
+
|
|
461
|
+
ptu_id : typing.Optional[int]
|
|
462
|
+
|
|
463
|
+
request_options : typing.Optional[RequestOptions]
|
|
464
|
+
Request-specific configuration.
|
|
465
|
+
|
|
466
|
+
Returns
|
|
467
|
+
-------
|
|
468
|
+
FilesDownloadResponse
|
|
469
|
+
Successful Response
|
|
470
|
+
|
|
471
|
+
Examples
|
|
472
|
+
--------
|
|
473
|
+
import asyncio
|
|
474
|
+
|
|
475
|
+
from sarvamai import AsyncSarvamAI
|
|
476
|
+
|
|
477
|
+
client = AsyncSarvamAI(
|
|
478
|
+
api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
|
|
479
|
+
)
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
async def main() -> None:
|
|
483
|
+
await client.speech_to_text_translate_job.get_download_links(
|
|
484
|
+
job_id="job_id",
|
|
485
|
+
files=["files"],
|
|
486
|
+
)
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
asyncio.run(main())
|
|
490
|
+
"""
|
|
491
|
+
_response = await self._raw_client.get_download_links(
|
|
492
|
+
job_id=job_id, files=files, ptu_id=ptu_id, request_options=request_options
|
|
493
|
+
)
|
|
494
|
+
return _response.data
|