sarvamai 0.1.7__py3-none-any.whl → 0.1.7a0__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.
Files changed (38) hide show
  1. sarvamai/__init__.py +60 -1
  2. sarvamai/client.py +3 -0
  3. sarvamai/core/client_wrapper.py +2 -2
  4. sarvamai/errors/service_unavailable_error.py +1 -2
  5. sarvamai/requests/__init__.py +22 -0
  6. sarvamai/requests/base_job_parameters.py +7 -0
  7. sarvamai/requests/bulk_job_callback.py +15 -0
  8. sarvamai/requests/bulk_job_init_response_v_1.py +27 -0
  9. sarvamai/requests/file_signed_url_details.py +10 -0
  10. sarvamai/requests/files_download_response.py +15 -0
  11. sarvamai/requests/files_request.py +10 -0
  12. sarvamai/requests/files_upload_response.py +15 -0
  13. sarvamai/requests/job_status_v_1.py +70 -0
  14. sarvamai/requests/speech_to_text_job_parameters.py +32 -0
  15. sarvamai/requests/task_detail_v_1.py +15 -0
  16. sarvamai/requests/task_file_details.py +8 -0
  17. sarvamai/speech_to_text/raw_client.py +8 -9
  18. sarvamai/speech_to_text_job/__init__.py +4 -0
  19. sarvamai/speech_to_text_job/client.py +454 -0
  20. sarvamai/speech_to_text_job/raw_client.py +1189 -0
  21. sarvamai/types/__init__.py +28 -0
  22. sarvamai/types/base_job_parameters.py +17 -0
  23. sarvamai/types/bulk_job_callback.py +27 -0
  24. sarvamai/types/bulk_job_init_response_v_1.py +39 -0
  25. sarvamai/types/file_signed_url_details.py +20 -0
  26. sarvamai/types/files_download_response.py +25 -0
  27. sarvamai/types/files_request.py +20 -0
  28. sarvamai/types/files_upload_response.py +25 -0
  29. sarvamai/types/job_state.py +5 -0
  30. sarvamai/types/job_status_v_1.py +80 -0
  31. sarvamai/types/speech_to_text_job_parameters.py +44 -0
  32. sarvamai/types/storage_container_type.py +5 -0
  33. sarvamai/types/task_detail_v_1.py +25 -0
  34. sarvamai/types/task_file_details.py +20 -0
  35. sarvamai/types/task_state.py +5 -0
  36. {sarvamai-0.1.7.dist-info → sarvamai-0.1.7a0.dist-info}/METADATA +2 -2
  37. {sarvamai-0.1.7.dist-info → sarvamai-0.1.7a0.dist-info}/RECORD +38 -10
  38. {sarvamai-0.1.7.dist-info → sarvamai-0.1.7a0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,454 @@
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_job_parameters import SpeechToTextJobParametersParams
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 AsyncRawSpeechToTextJobClient, RawSpeechToTextJobClient
14
+
15
+ # this is used as the default value for optional parameters
16
+ OMIT = typing.cast(typing.Any, ...)
17
+
18
+
19
+ class SpeechToTextJobClient:
20
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
21
+ self._raw_client = RawSpeechToTextJobClient(client_wrapper=client_wrapper)
22
+
23
+ @property
24
+ def with_raw_response(self) -> RawSpeechToTextJobClient:
25
+ """
26
+ Retrieves a raw implementation of this client that returns raw responses.
27
+
28
+ Returns
29
+ -------
30
+ RawSpeechToTextJobClient
31
+ """
32
+ return self._raw_client
33
+
34
+ def initialise(
35
+ self,
36
+ *,
37
+ job_parameters: SpeechToTextJobParametersParams,
38
+ callback: typing.Optional[BulkJobCallbackParams] = OMIT,
39
+ request_options: typing.Optional[RequestOptions] = None,
40
+ ) -> BulkJobInitResponseV1:
41
+ """
42
+ Get a job uuid, and storage folder details for speech to text bulk job v1
43
+
44
+ Parameters
45
+ ----------
46
+ job_parameters : SpeechToTextJobParametersParams
47
+ Job Parameters for the bulk job
48
+
49
+ callback : typing.Optional[BulkJobCallbackParams]
50
+ Parameters for callback URL
51
+
52
+ request_options : typing.Optional[RequestOptions]
53
+ Request-specific configuration.
54
+
55
+ Returns
56
+ -------
57
+ BulkJobInitResponseV1
58
+ Successful Response
59
+
60
+ Examples
61
+ --------
62
+ from sarvamai import SarvamAI
63
+
64
+ client = SarvamAI(
65
+ api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
66
+ )
67
+ client.speech_to_text_job.initialise(
68
+ job_parameters={},
69
+ )
70
+ """
71
+ _response = self._raw_client.initialise(
72
+ job_parameters=job_parameters, callback=callback, request_options=request_options
73
+ )
74
+ return _response.data
75
+
76
+ def get_status(self, job_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> JobStatusV1:
77
+ """
78
+ Get the status of a speech to text bulk job V1
79
+
80
+ Parameters
81
+ ----------
82
+ job_id : str
83
+ The unique identifier of the job
84
+
85
+ request_options : typing.Optional[RequestOptions]
86
+ Request-specific configuration.
87
+
88
+ Returns
89
+ -------
90
+ JobStatusV1
91
+ Successful Response
92
+
93
+ Examples
94
+ --------
95
+ from sarvamai import SarvamAI
96
+
97
+ client = SarvamAI(
98
+ api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
99
+ )
100
+ client.speech_to_text_job.get_status(
101
+ job_id="job_id",
102
+ )
103
+ """
104
+ _response = self._raw_client.get_status(job_id, request_options=request_options)
105
+ return _response.data
106
+
107
+ def start(
108
+ self,
109
+ job_id: str,
110
+ *,
111
+ ptu_id: typing.Optional[int] = None,
112
+ request_options: typing.Optional[RequestOptions] = None,
113
+ ) -> JobStatusV1:
114
+ """
115
+ Start a speech to text bulk job V1
116
+
117
+ Parameters
118
+ ----------
119
+ job_id : str
120
+ The unique identifier of the job
121
+
122
+ ptu_id : typing.Optional[int]
123
+
124
+ request_options : typing.Optional[RequestOptions]
125
+ Request-specific configuration.
126
+
127
+ Returns
128
+ -------
129
+ JobStatusV1
130
+ Successful Response
131
+
132
+ Examples
133
+ --------
134
+ from sarvamai import SarvamAI
135
+
136
+ client = SarvamAI(
137
+ api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
138
+ )
139
+ client.speech_to_text_job.start(
140
+ job_id="job_id",
141
+ )
142
+ """
143
+ _response = self._raw_client.start(job_id, ptu_id=ptu_id, request_options=request_options)
144
+ return _response.data
145
+
146
+ def get_upload_links(
147
+ self, *, job_id: str, files: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
148
+ ) -> FilesUploadResponse:
149
+ """
150
+ Start a speech to text bulk job V1
151
+
152
+ Parameters
153
+ ----------
154
+ job_id : str
155
+
156
+ files : typing.Sequence[str]
157
+
158
+ request_options : typing.Optional[RequestOptions]
159
+ Request-specific configuration.
160
+
161
+ Returns
162
+ -------
163
+ FilesUploadResponse
164
+ Successful Response
165
+
166
+ Examples
167
+ --------
168
+ from sarvamai import SarvamAI
169
+
170
+ client = SarvamAI(
171
+ api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
172
+ )
173
+ client.speech_to_text_job.get_upload_links(
174
+ job_id="job_id",
175
+ files=["files"],
176
+ )
177
+ """
178
+ _response = self._raw_client.get_upload_links(job_id=job_id, files=files, request_options=request_options)
179
+ return _response.data
180
+
181
+ def get_download_links(
182
+ self, *, job_id: str, files: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
183
+ ) -> FilesDownloadResponse:
184
+ """
185
+ Start a speech to text bulk job V1
186
+
187
+ Parameters
188
+ ----------
189
+ job_id : str
190
+
191
+ files : typing.Sequence[str]
192
+
193
+ request_options : typing.Optional[RequestOptions]
194
+ Request-specific configuration.
195
+
196
+ Returns
197
+ -------
198
+ FilesDownloadResponse
199
+ Successful Response
200
+
201
+ Examples
202
+ --------
203
+ from sarvamai import SarvamAI
204
+
205
+ client = SarvamAI(
206
+ api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
207
+ )
208
+ client.speech_to_text_job.get_download_links(
209
+ job_id="job_id",
210
+ files=["files"],
211
+ )
212
+ """
213
+ _response = self._raw_client.get_download_links(job_id=job_id, files=files, request_options=request_options)
214
+ return _response.data
215
+
216
+
217
+ class AsyncSpeechToTextJobClient:
218
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
219
+ self._raw_client = AsyncRawSpeechToTextJobClient(client_wrapper=client_wrapper)
220
+
221
+ @property
222
+ def with_raw_response(self) -> AsyncRawSpeechToTextJobClient:
223
+ """
224
+ Retrieves a raw implementation of this client that returns raw responses.
225
+
226
+ Returns
227
+ -------
228
+ AsyncRawSpeechToTextJobClient
229
+ """
230
+ return self._raw_client
231
+
232
+ async def initialise(
233
+ self,
234
+ *,
235
+ job_parameters: SpeechToTextJobParametersParams,
236
+ callback: typing.Optional[BulkJobCallbackParams] = OMIT,
237
+ request_options: typing.Optional[RequestOptions] = None,
238
+ ) -> BulkJobInitResponseV1:
239
+ """
240
+ Get a job uuid, and storage folder details for speech to text bulk job v1
241
+
242
+ Parameters
243
+ ----------
244
+ job_parameters : SpeechToTextJobParametersParams
245
+ Job Parameters for the bulk job
246
+
247
+ callback : typing.Optional[BulkJobCallbackParams]
248
+ Parameters for callback URL
249
+
250
+ request_options : typing.Optional[RequestOptions]
251
+ Request-specific configuration.
252
+
253
+ Returns
254
+ -------
255
+ BulkJobInitResponseV1
256
+ Successful Response
257
+
258
+ Examples
259
+ --------
260
+ import asyncio
261
+
262
+ from sarvamai import AsyncSarvamAI
263
+
264
+ client = AsyncSarvamAI(
265
+ api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
266
+ )
267
+
268
+
269
+ async def main() -> None:
270
+ await client.speech_to_text_job.initialise(
271
+ job_parameters={},
272
+ )
273
+
274
+
275
+ asyncio.run(main())
276
+ """
277
+ _response = await self._raw_client.initialise(
278
+ job_parameters=job_parameters, callback=callback, request_options=request_options
279
+ )
280
+ return _response.data
281
+
282
+ async def get_status(self, job_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> JobStatusV1:
283
+ """
284
+ Get the status of a speech to text bulk job V1
285
+
286
+ Parameters
287
+ ----------
288
+ job_id : str
289
+ The unique identifier of the job
290
+
291
+ request_options : typing.Optional[RequestOptions]
292
+ Request-specific configuration.
293
+
294
+ Returns
295
+ -------
296
+ JobStatusV1
297
+ Successful Response
298
+
299
+ Examples
300
+ --------
301
+ import asyncio
302
+
303
+ from sarvamai import AsyncSarvamAI
304
+
305
+ client = AsyncSarvamAI(
306
+ api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
307
+ )
308
+
309
+
310
+ async def main() -> None:
311
+ await client.speech_to_text_job.get_status(
312
+ job_id="job_id",
313
+ )
314
+
315
+
316
+ asyncio.run(main())
317
+ """
318
+ _response = await self._raw_client.get_status(job_id, request_options=request_options)
319
+ return _response.data
320
+
321
+ async def start(
322
+ self,
323
+ job_id: str,
324
+ *,
325
+ ptu_id: typing.Optional[int] = None,
326
+ request_options: typing.Optional[RequestOptions] = None,
327
+ ) -> JobStatusV1:
328
+ """
329
+ Start a speech to text bulk job V1
330
+
331
+ Parameters
332
+ ----------
333
+ job_id : str
334
+ The unique identifier of the job
335
+
336
+ ptu_id : typing.Optional[int]
337
+
338
+ request_options : typing.Optional[RequestOptions]
339
+ Request-specific configuration.
340
+
341
+ Returns
342
+ -------
343
+ JobStatusV1
344
+ Successful Response
345
+
346
+ Examples
347
+ --------
348
+ import asyncio
349
+
350
+ from sarvamai import AsyncSarvamAI
351
+
352
+ client = AsyncSarvamAI(
353
+ api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
354
+ )
355
+
356
+
357
+ async def main() -> None:
358
+ await client.speech_to_text_job.start(
359
+ job_id="job_id",
360
+ )
361
+
362
+
363
+ asyncio.run(main())
364
+ """
365
+ _response = await self._raw_client.start(job_id, ptu_id=ptu_id, request_options=request_options)
366
+ return _response.data
367
+
368
+ async def get_upload_links(
369
+ self, *, job_id: str, files: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
370
+ ) -> FilesUploadResponse:
371
+ """
372
+ Start a speech to text bulk job V1
373
+
374
+ Parameters
375
+ ----------
376
+ job_id : str
377
+
378
+ files : typing.Sequence[str]
379
+
380
+ request_options : typing.Optional[RequestOptions]
381
+ Request-specific configuration.
382
+
383
+ Returns
384
+ -------
385
+ FilesUploadResponse
386
+ Successful Response
387
+
388
+ Examples
389
+ --------
390
+ import asyncio
391
+
392
+ from sarvamai import AsyncSarvamAI
393
+
394
+ client = AsyncSarvamAI(
395
+ api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
396
+ )
397
+
398
+
399
+ async def main() -> None:
400
+ await client.speech_to_text_job.get_upload_links(
401
+ job_id="job_id",
402
+ files=["files"],
403
+ )
404
+
405
+
406
+ asyncio.run(main())
407
+ """
408
+ _response = await self._raw_client.get_upload_links(job_id=job_id, files=files, request_options=request_options)
409
+ return _response.data
410
+
411
+ async def get_download_links(
412
+ self, *, job_id: str, files: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
413
+ ) -> FilesDownloadResponse:
414
+ """
415
+ Start a speech to text bulk job V1
416
+
417
+ Parameters
418
+ ----------
419
+ job_id : str
420
+
421
+ files : typing.Sequence[str]
422
+
423
+ request_options : typing.Optional[RequestOptions]
424
+ Request-specific configuration.
425
+
426
+ Returns
427
+ -------
428
+ FilesDownloadResponse
429
+ Successful Response
430
+
431
+ Examples
432
+ --------
433
+ import asyncio
434
+
435
+ from sarvamai import AsyncSarvamAI
436
+
437
+ client = AsyncSarvamAI(
438
+ api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
439
+ )
440
+
441
+
442
+ async def main() -> None:
443
+ await client.speech_to_text_job.get_download_links(
444
+ job_id="job_id",
445
+ files=["files"],
446
+ )
447
+
448
+
449
+ asyncio.run(main())
450
+ """
451
+ _response = await self._raw_client.get_download_links(
452
+ job_id=job_id, files=files, request_options=request_options
453
+ )
454
+ return _response.data