sarvamai 0.1.11a2__py3-none-any.whl → 0.1.11a4__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.
@@ -0,0 +1,591 @@
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 .job import AsyncSpeechToTextTranslateJob, SpeechToTextTranslateJob
14
+ from .raw_client import AsyncRawSpeechToTextTranslateJobClient, RawSpeechToTextTranslateJobClient
15
+
16
+ # this is used as the default value for optional parameters
17
+ OMIT = typing.cast(typing.Any, ...)
18
+
19
+
20
+ class SpeechToTextTranslateJobClient:
21
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
22
+ self._raw_client = RawSpeechToTextTranslateJobClient(client_wrapper=client_wrapper)
23
+
24
+ @property
25
+ def with_raw_response(self) -> RawSpeechToTextTranslateJobClient:
26
+ """
27
+ Retrieves a raw implementation of this client that returns raw responses.
28
+
29
+ Returns
30
+ -------
31
+ RawSpeechToTextTranslateJobClient
32
+ """
33
+ return self._raw_client
34
+
35
+ def initialise(
36
+ self,
37
+ *,
38
+ job_parameters: SpeechToTextTranslateJobParametersParams,
39
+ ptu_id: typing.Optional[int] = None,
40
+ callback: typing.Optional[BulkJobCallbackParams] = OMIT,
41
+ request_options: typing.Optional[RequestOptions] = None,
42
+ ) -> BulkJobInitResponseV1:
43
+ """
44
+ Get a job uuid, and storage folder details for speech to text tranlsate bulk job v1
45
+
46
+ Parameters
47
+ ----------
48
+ job_parameters : SpeechToTextTranslateJobParametersParams
49
+ Job Parameters for the bulk job
50
+
51
+ ptu_id : typing.Optional[int]
52
+
53
+ callback : typing.Optional[BulkJobCallbackParams]
54
+ Parameters for callback URL
55
+
56
+ request_options : typing.Optional[RequestOptions]
57
+ Request-specific configuration.
58
+
59
+ Returns
60
+ -------
61
+ BulkJobInitResponseV1
62
+ Successful Response
63
+
64
+ Examples
65
+ --------
66
+ from sarvamai import SarvamAI
67
+
68
+ client = SarvamAI(
69
+ api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
70
+ )
71
+ client.speech_to_text_translate_job.initialise(
72
+ job_parameters={},
73
+ )
74
+ """
75
+ _response = self._raw_client.initialise(
76
+ job_parameters=job_parameters, ptu_id=ptu_id, callback=callback, request_options=request_options
77
+ )
78
+ return _response.data
79
+
80
+ def get_status(self, job_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> JobStatusV1:
81
+ """
82
+ Get the status of a speech to text translate bulk job V1
83
+
84
+ Parameters
85
+ ----------
86
+ job_id : str
87
+ The unique identifier of the job
88
+
89
+ request_options : typing.Optional[RequestOptions]
90
+ Request-specific configuration.
91
+
92
+ Returns
93
+ -------
94
+ JobStatusV1
95
+ Successful Response
96
+
97
+ Examples
98
+ --------
99
+ from sarvamai import SarvamAI
100
+
101
+ client = SarvamAI(
102
+ api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
103
+ )
104
+ client.speech_to_text_translate_job.get_status(
105
+ job_id="job_id",
106
+ )
107
+ """
108
+ _response = self._raw_client.get_status(job_id, request_options=request_options)
109
+ return _response.data
110
+
111
+ def start(
112
+ self,
113
+ job_id: str,
114
+ *,
115
+ ptu_id: typing.Optional[int] = None,
116
+ request_options: typing.Optional[RequestOptions] = None,
117
+ ) -> JobStatusV1:
118
+ """
119
+ Start a speech to text translate bulk job V1
120
+
121
+ Parameters
122
+ ----------
123
+ job_id : str
124
+ The unique identifier of the job
125
+
126
+ ptu_id : typing.Optional[int]
127
+
128
+ request_options : typing.Optional[RequestOptions]
129
+ Request-specific configuration.
130
+
131
+ Returns
132
+ -------
133
+ JobStatusV1
134
+ Successful Response
135
+
136
+ Examples
137
+ --------
138
+ from sarvamai import SarvamAI
139
+
140
+ client = SarvamAI(
141
+ api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
142
+ )
143
+ client.speech_to_text_translate_job.start(
144
+ job_id="job_id",
145
+ )
146
+ """
147
+ _response = self._raw_client.start(job_id, ptu_id=ptu_id, request_options=request_options)
148
+ return _response.data
149
+
150
+ def get_upload_links(
151
+ self,
152
+ *,
153
+ job_id: str,
154
+ files: typing.Sequence[str],
155
+ ptu_id: typing.Optional[int] = None,
156
+ request_options: typing.Optional[RequestOptions] = None,
157
+ ) -> FilesUploadResponse:
158
+ """
159
+ Start a speech to text bulk job V1
160
+
161
+ Parameters
162
+ ----------
163
+ job_id : str
164
+
165
+ files : typing.Sequence[str]
166
+
167
+ ptu_id : typing.Optional[int]
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_translate_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, ptu_id=ptu_id, 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
+ ptu_id: typing.Optional[int] = None,
200
+ request_options: typing.Optional[RequestOptions] = None,
201
+ ) -> FilesDownloadResponse:
202
+ """
203
+ Start a speech to text bulk job V1
204
+
205
+ Parameters
206
+ ----------
207
+ job_id : str
208
+
209
+ files : typing.Sequence[str]
210
+
211
+ ptu_id : typing.Optional[int]
212
+
213
+ request_options : typing.Optional[RequestOptions]
214
+ Request-specific configuration.
215
+
216
+ Returns
217
+ -------
218
+ FilesDownloadResponse
219
+ Successful Response
220
+
221
+ Examples
222
+ --------
223
+ from sarvamai import SarvamAI
224
+
225
+ client = SarvamAI(
226
+ api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
227
+ )
228
+ client.speech_to_text_translate_job.get_download_links(
229
+ job_id="job_id",
230
+ files=["files"],
231
+ )
232
+ """
233
+ _response = self._raw_client.get_download_links(
234
+ job_id=job_id, files=files, ptu_id=ptu_id, request_options=request_options
235
+ )
236
+ return _response.data
237
+
238
+ def create_job(
239
+ self,
240
+ job_parameters: SpeechToTextTranslateJobParametersParams,
241
+ callback: typing.Optional[BulkJobCallbackParams] = OMIT,
242
+ request_options: typing.Optional[RequestOptions] = None,
243
+ ) -> SpeechToTextTranslateJob:
244
+ """
245
+ Create a new Speech-to-Text-Translate bulk job.
246
+
247
+ Parameters
248
+ ----------
249
+ job_parameters : SpeechToTextTranslateJobParametersParams
250
+ The parameters required to configure the speech-to-text-translate job.
251
+
252
+ callback : typing.Optional[BulkJobCallbackParams], default=OMIT
253
+ Optional callback configuration to receive job completion events.
254
+
255
+ request_options : typing.Optional[RequestOptions], default=None
256
+ Request-specific configuration.
257
+
258
+ Returns
259
+ -------
260
+ SpeechToTextTranslateJob
261
+ A handle to the newly created Speech-to-Text-Translate job.
262
+ """
263
+ response = self.initialise(
264
+ job_parameters=job_parameters,
265
+ callback=callback,
266
+ request_options=request_options,
267
+ )
268
+ return SpeechToTextTranslateJob(job_id=response.job_id, client=self)
269
+
270
+ def get_job(self, job_id: str) -> SpeechToTextTranslateJob:
271
+ """
272
+ Get an existing Speech-to-Text-Translate job handle by job ID.
273
+
274
+ Parameters
275
+ ----------
276
+ job_id : str
277
+ The job ID of the previously created Speech-to-Text-Translate job.
278
+
279
+ Returns
280
+ -------
281
+ SpeechToTextTranslateJob
282
+ A job handle which can be used to check status or retrieve results.
283
+ """
284
+ return SpeechToTextTranslateJob(job_id=job_id, client=self)
285
+
286
+
287
+ class AsyncSpeechToTextTranslateJobClient:
288
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
289
+ self._raw_client = AsyncRawSpeechToTextTranslateJobClient(client_wrapper=client_wrapper)
290
+
291
+ @property
292
+ def with_raw_response(self) -> AsyncRawSpeechToTextTranslateJobClient:
293
+ """
294
+ Retrieves a raw implementation of this client that returns raw responses.
295
+
296
+ Returns
297
+ -------
298
+ AsyncRawSpeechToTextTranslateJobClient
299
+ """
300
+ return self._raw_client
301
+
302
+ async def initialise(
303
+ self,
304
+ *,
305
+ job_parameters: SpeechToTextTranslateJobParametersParams,
306
+ ptu_id: typing.Optional[int] = None,
307
+ callback: typing.Optional[BulkJobCallbackParams] = OMIT,
308
+ request_options: typing.Optional[RequestOptions] = None,
309
+ ) -> BulkJobInitResponseV1:
310
+ """
311
+ Get a job uuid, and storage folder details for speech to text tranlsate bulk job v1
312
+
313
+ Parameters
314
+ ----------
315
+ job_parameters : SpeechToTextTranslateJobParametersParams
316
+ Job Parameters for the bulk job
317
+
318
+ ptu_id : typing.Optional[int]
319
+
320
+ callback : typing.Optional[BulkJobCallbackParams]
321
+ Parameters for callback URL
322
+
323
+ request_options : typing.Optional[RequestOptions]
324
+ Request-specific configuration.
325
+
326
+ Returns
327
+ -------
328
+ BulkJobInitResponseV1
329
+ Successful Response
330
+
331
+ Examples
332
+ --------
333
+ import asyncio
334
+
335
+ from sarvamai import AsyncSarvamAI
336
+
337
+ client = AsyncSarvamAI(
338
+ api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
339
+ )
340
+
341
+
342
+ async def main() -> None:
343
+ await client.speech_to_text_translate_job.initialise(
344
+ job_parameters={},
345
+ )
346
+
347
+
348
+ asyncio.run(main())
349
+ """
350
+ _response = await self._raw_client.initialise(
351
+ job_parameters=job_parameters, ptu_id=ptu_id, callback=callback, request_options=request_options
352
+ )
353
+ return _response.data
354
+
355
+ async def get_status(self, job_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> JobStatusV1:
356
+ """
357
+ Get the status of a speech to text translate bulk job V1
358
+
359
+ Parameters
360
+ ----------
361
+ job_id : str
362
+ The unique identifier of the job
363
+
364
+ request_options : typing.Optional[RequestOptions]
365
+ Request-specific configuration.
366
+
367
+ Returns
368
+ -------
369
+ JobStatusV1
370
+ Successful Response
371
+
372
+ Examples
373
+ --------
374
+ import asyncio
375
+
376
+ from sarvamai import AsyncSarvamAI
377
+
378
+ client = AsyncSarvamAI(
379
+ api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
380
+ )
381
+
382
+
383
+ async def main() -> None:
384
+ await client.speech_to_text_translate_job.get_status(
385
+ job_id="job_id",
386
+ )
387
+
388
+
389
+ asyncio.run(main())
390
+ """
391
+ _response = await self._raw_client.get_status(job_id, request_options=request_options)
392
+ return _response.data
393
+
394
+ async def start(
395
+ self,
396
+ job_id: str,
397
+ *,
398
+ ptu_id: typing.Optional[int] = None,
399
+ request_options: typing.Optional[RequestOptions] = None,
400
+ ) -> JobStatusV1:
401
+ """
402
+ Start a speech to text translate bulk job V1
403
+
404
+ Parameters
405
+ ----------
406
+ job_id : str
407
+ The unique identifier of the job
408
+
409
+ ptu_id : typing.Optional[int]
410
+
411
+ request_options : typing.Optional[RequestOptions]
412
+ Request-specific configuration.
413
+
414
+ Returns
415
+ -------
416
+ JobStatusV1
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.start(
432
+ job_id="job_id",
433
+ )
434
+
435
+
436
+ asyncio.run(main())
437
+ """
438
+ _response = await self._raw_client.start(job_id, ptu_id=ptu_id, request_options=request_options)
439
+ return _response.data
440
+
441
+ async def get_upload_links(
442
+ self,
443
+ *,
444
+ job_id: str,
445
+ files: typing.Sequence[str],
446
+ ptu_id: typing.Optional[int] = None,
447
+ request_options: typing.Optional[RequestOptions] = None,
448
+ ) -> FilesUploadResponse:
449
+ """
450
+ Start a speech to text bulk job V1
451
+
452
+ Parameters
453
+ ----------
454
+ job_id : str
455
+
456
+ files : typing.Sequence[str]
457
+
458
+ ptu_id : typing.Optional[int]
459
+
460
+ request_options : typing.Optional[RequestOptions]
461
+ Request-specific configuration.
462
+
463
+ Returns
464
+ -------
465
+ FilesUploadResponse
466
+ Successful Response
467
+
468
+ Examples
469
+ --------
470
+ import asyncio
471
+
472
+ from sarvamai import AsyncSarvamAI
473
+
474
+ client = AsyncSarvamAI(
475
+ api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
476
+ )
477
+
478
+
479
+ async def main() -> None:
480
+ await client.speech_to_text_translate_job.get_upload_links(
481
+ job_id="job_id",
482
+ files=["files"],
483
+ )
484
+
485
+
486
+ asyncio.run(main())
487
+ """
488
+ _response = await self._raw_client.get_upload_links(
489
+ job_id=job_id, files=files, ptu_id=ptu_id, request_options=request_options
490
+ )
491
+ return _response.data
492
+
493
+ async def get_download_links(
494
+ self,
495
+ *,
496
+ job_id: str,
497
+ files: typing.Sequence[str],
498
+ ptu_id: typing.Optional[int] = None,
499
+ request_options: typing.Optional[RequestOptions] = None,
500
+ ) -> FilesDownloadResponse:
501
+ """
502
+ Start a speech to text bulk job V1
503
+
504
+ Parameters
505
+ ----------
506
+ job_id : str
507
+
508
+ files : typing.Sequence[str]
509
+
510
+ ptu_id : typing.Optional[int]
511
+
512
+ request_options : typing.Optional[RequestOptions]
513
+ Request-specific configuration.
514
+
515
+ Returns
516
+ -------
517
+ FilesDownloadResponse
518
+ Successful Response
519
+
520
+ Examples
521
+ --------
522
+ import asyncio
523
+
524
+ from sarvamai import AsyncSarvamAI
525
+
526
+ client = AsyncSarvamAI(
527
+ api_subscription_key="YOUR_API_SUBSCRIPTION_KEY",
528
+ )
529
+
530
+
531
+ async def main() -> None:
532
+ await client.speech_to_text_translate_job.get_download_links(
533
+ job_id="job_id",
534
+ files=["files"],
535
+ )
536
+
537
+
538
+ asyncio.run(main())
539
+ """
540
+ _response = await self._raw_client.get_download_links(
541
+ job_id=job_id, files=files, ptu_id=ptu_id, request_options=request_options
542
+ )
543
+ return _response.data
544
+
545
+ async def create_job(
546
+ self,
547
+ job_parameters: SpeechToTextTranslateJobParametersParams,
548
+ callback: typing.Optional[BulkJobCallbackParams] = OMIT,
549
+ request_options: typing.Optional[RequestOptions] = None,
550
+ ) -> "AsyncSpeechToTextTranslateJob":
551
+ """
552
+ Create a new Speech-to-Text-Translate bulk job.
553
+
554
+ Parameters
555
+ ----------
556
+ job_parameters : SpeechToTextTranslateJobParametersParams
557
+ The parameters required to configure the speech-to-text translate job.
558
+
559
+ callback : typing.Optional[BulkJobCallbackParams], default=OMIT
560
+ Optional callback configuration to receive job completion events.
561
+
562
+ request_options : typing.Optional[RequestOptions], default=None
563
+ Request-specific configuration.
564
+
565
+ Returns
566
+ -------
567
+ AsyncSpeechToTextTranslateJob
568
+ A handle to the newly created job.
569
+ """
570
+ response = await self.initialise(
571
+ job_parameters=job_parameters,
572
+ callback=callback,
573
+ request_options=request_options,
574
+ )
575
+ return AsyncSpeechToTextTranslateJob(job_id=response.job_id, client=self)
576
+
577
+ async def get_job(self, job_id: str) -> "AsyncSpeechToTextTranslateJob":
578
+ """
579
+ Get an existing Speech-to-Text-Translate job handle by job ID.
580
+
581
+ Parameters
582
+ ----------
583
+ job_id : str
584
+ The job ID of the previously created speech-to-text-translate job.
585
+
586
+ Returns
587
+ -------
588
+ AsyncSpeechToTextTranslateJob
589
+ A job handle which can be used to check status or retrieve results.
590
+ """
591
+ return AsyncSpeechToTextTranslateJob(job_id=job_id, client=self)