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