sarvamai 0.1.23a3__py3-none-any.whl → 0.1.23a5__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 (71) hide show
  1. sarvamai/__init__.py +203 -405
  2. sarvamai/chat/raw_client.py +20 -20
  3. sarvamai/client.py +34 -186
  4. sarvamai/core/__init__.py +21 -76
  5. sarvamai/core/client_wrapper.py +3 -19
  6. sarvamai/core/force_multipart.py +2 -4
  7. sarvamai/core/http_client.py +97 -217
  8. sarvamai/core/http_response.py +1 -1
  9. sarvamai/core/jsonable_encoder.py +0 -8
  10. sarvamai/core/pydantic_utilities.py +4 -110
  11. sarvamai/errors/__init__.py +6 -40
  12. sarvamai/errors/bad_request_error.py +1 -1
  13. sarvamai/errors/forbidden_error.py +1 -1
  14. sarvamai/errors/internal_server_error.py +1 -1
  15. sarvamai/errors/service_unavailable_error.py +1 -1
  16. sarvamai/errors/too_many_requests_error.py +1 -1
  17. sarvamai/errors/unprocessable_entity_error.py +1 -1
  18. sarvamai/requests/__init__.py +62 -150
  19. sarvamai/requests/configure_connection.py +4 -0
  20. sarvamai/requests/configure_connection_data.py +40 -11
  21. sarvamai/requests/error_response_data.py +1 -1
  22. sarvamai/requests/file_signed_url_details.py +1 -1
  23. sarvamai/requests/speech_to_text_job_parameters.py +43 -2
  24. sarvamai/requests/speech_to_text_transcription_data.py +2 -2
  25. sarvamai/requests/speech_to_text_translate_job_parameters.py +4 -1
  26. sarvamai/speech_to_text/client.py +95 -10
  27. sarvamai/speech_to_text/raw_client.py +147 -64
  28. sarvamai/speech_to_text_job/client.py +60 -15
  29. sarvamai/speech_to_text_job/raw_client.py +120 -120
  30. sarvamai/speech_to_text_streaming/__init__.py +10 -38
  31. sarvamai/speech_to_text_streaming/client.py +90 -8
  32. sarvamai/speech_to_text_streaming/raw_client.py +90 -8
  33. sarvamai/speech_to_text_streaming/types/__init__.py +8 -36
  34. sarvamai/speech_to_text_streaming/types/speech_to_text_streaming_mode.py +7 -0
  35. sarvamai/speech_to_text_streaming/types/speech_to_text_streaming_model.py +5 -0
  36. sarvamai/speech_to_text_translate_job/raw_client.py +120 -120
  37. sarvamai/speech_to_text_translate_streaming/__init__.py +5 -36
  38. sarvamai/speech_to_text_translate_streaming/client.py +8 -2
  39. sarvamai/speech_to_text_translate_streaming/raw_client.py +8 -2
  40. sarvamai/speech_to_text_translate_streaming/types/__init__.py +3 -36
  41. sarvamai/text/raw_client.py +60 -60
  42. sarvamai/text_to_speech/client.py +100 -16
  43. sarvamai/text_to_speech/raw_client.py +120 -36
  44. sarvamai/text_to_speech_streaming/__init__.py +2 -29
  45. sarvamai/text_to_speech_streaming/client.py +19 -6
  46. sarvamai/text_to_speech_streaming/raw_client.py +19 -6
  47. sarvamai/text_to_speech_streaming/types/__init__.py +3 -31
  48. sarvamai/text_to_speech_streaming/types/text_to_speech_streaming_model.py +5 -0
  49. sarvamai/types/__init__.py +102 -222
  50. sarvamai/types/chat_completion_request_message.py +2 -6
  51. sarvamai/types/configure_connection.py +4 -0
  52. sarvamai/types/configure_connection_data.py +40 -11
  53. sarvamai/types/configure_connection_data_model.py +5 -0
  54. sarvamai/types/configure_connection_data_speaker.py +35 -1
  55. sarvamai/types/error_response_data.py +1 -1
  56. sarvamai/types/file_signed_url_details.py +1 -1
  57. sarvamai/types/mode.py +5 -0
  58. sarvamai/types/speech_to_text_job_parameters.py +43 -2
  59. sarvamai/types/speech_to_text_model.py +1 -1
  60. sarvamai/types/speech_to_text_transcription_data.py +2 -2
  61. sarvamai/types/speech_to_text_translate_job_parameters.py +4 -1
  62. sarvamai/types/text_to_speech_model.py +1 -1
  63. sarvamai/types/text_to_speech_speaker.py +35 -1
  64. {sarvamai-0.1.23a3.dist-info → sarvamai-0.1.23a5.dist-info}/METADATA +1 -2
  65. {sarvamai-0.1.23a3.dist-info → sarvamai-0.1.23a5.dist-info}/RECORD +66 -66
  66. sarvamai/core/http_sse/__init__.py +0 -42
  67. sarvamai/core/http_sse/_api.py +0 -112
  68. sarvamai/core/http_sse/_decoders.py +0 -61
  69. sarvamai/core/http_sse/_exceptions.py +0 -7
  70. sarvamai/core/http_sse/_models.py +0 -17
  71. {sarvamai-0.1.23a3.dist-info → sarvamai-0.1.23a5.dist-info}/WHEEL +0 -0
@@ -12,6 +12,7 @@ from ..types.files_upload_response import FilesUploadResponse
12
12
  from ..types.job_status_v_1_response import JobStatusV1Response
13
13
  from ..types.speech_to_text_model import SpeechToTextModel
14
14
  from ..types.speech_to_text_language import SpeechToTextLanguage
15
+ from ..types.mode import Mode
15
16
  from .raw_client import AsyncRawSpeechToTextJobClient, RawSpeechToTextJobClient
16
17
  from .job import AsyncSpeechToTextJob, SpeechToTextJob
17
18
 
@@ -72,7 +73,9 @@ class SpeechToTextJobClient:
72
73
  )
73
74
  """
74
75
  _response = self._raw_client.initialise(
75
- job_parameters=job_parameters, callback=callback, request_options=request_options
76
+ job_parameters=job_parameters,
77
+ callback=callback,
78
+ request_options=request_options,
76
79
  )
77
80
  return _response.data
78
81
 
@@ -145,11 +148,17 @@ class SpeechToTextJobClient:
145
148
  job_id="job_id",
146
149
  )
147
150
  """
148
- _response = self._raw_client.start(job_id, ptu_id=ptu_id, request_options=request_options)
151
+ _response = self._raw_client.start(
152
+ job_id, ptu_id=ptu_id, request_options=request_options
153
+ )
149
154
  return _response.data
150
155
 
151
156
  def get_upload_links(
152
- self, *, job_id: str, files: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
157
+ self,
158
+ *,
159
+ job_id: str,
160
+ files: typing.Sequence[str],
161
+ request_options: typing.Optional[RequestOptions] = None,
153
162
  ) -> FilesUploadResponse:
154
163
  """
155
164
  Start a speech to text bulk job V1
@@ -180,11 +189,17 @@ class SpeechToTextJobClient:
180
189
  files=["files"],
181
190
  )
182
191
  """
183
- _response = self._raw_client.get_upload_links(job_id=job_id, files=files, request_options=request_options)
192
+ _response = self._raw_client.get_upload_links(
193
+ job_id=job_id, files=files, request_options=request_options
194
+ )
184
195
  return _response.data
185
196
 
186
197
  def get_download_links(
187
- self, *, job_id: str, files: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
198
+ self,
199
+ *,
200
+ job_id: str,
201
+ files: typing.Sequence[str],
202
+ request_options: typing.Optional[RequestOptions] = None,
188
203
  ) -> FilesDownloadResponse:
189
204
  """
190
205
  Start a speech to text bulk job V1
@@ -215,12 +230,15 @@ class SpeechToTextJobClient:
215
230
  files=["files"],
216
231
  )
217
232
  """
218
- _response = self._raw_client.get_download_links(job_id=job_id, files=files, request_options=request_options)
233
+ _response = self._raw_client.get_download_links(
234
+ job_id=job_id, files=files, request_options=request_options
235
+ )
219
236
  return _response.data
220
237
 
221
238
  def create_job(
222
239
  self,
223
240
  model: SpeechToTextModel = "saarika:v2.5",
241
+ mode: typing.Optional[Mode] = None,
224
242
  with_diarization: bool = False,
225
243
  with_timestamps: bool = False,
226
244
  language_code: typing.Optional[SpeechToTextLanguage] = None,
@@ -236,6 +254,10 @@ class SpeechToTextJobClient:
236
254
  model : SpeechToTextModel, default="saarika:v2.5"
237
255
  The model to use for transcription.
238
256
 
257
+ mode : typing.Optional[Mode], default=None
258
+ Mode of operation. Only applicable for saaras:v3 model.
259
+ Options: transcribe, translate, indic-en, verbatim, translit, codemix
260
+
239
261
  with_diarization : typing.Optional[bool], default=False
240
262
  Whether to enable speaker diarization (distinguishing who said what).
241
263
 
@@ -244,7 +266,7 @@ class SpeechToTextJobClient:
244
266
 
245
267
  language_code : typing.Optional[SpeechToTextLanguage], default=None
246
268
  The language code of the input audio (e.g., "hi-IN", "bn-IN").
247
-
269
+
248
270
  num_speakers : typing.Optional[int], default=None
249
271
  The number of distinct speakers in the audio, if known.
250
272
 
@@ -263,6 +285,7 @@ class SpeechToTextJobClient:
263
285
  job_parameters=SpeechToTextJobParametersParams(
264
286
  language_code=language_code,
265
287
  model=model,
288
+ mode=mode, # type: ignore[typeddict-item]
266
289
  num_speakers=num_speakers, # type: ignore[typeddict-item]
267
290
  with_diarization=with_diarization,
268
291
  with_timestamps=with_timestamps,
@@ -350,7 +373,9 @@ class AsyncSpeechToTextJobClient:
350
373
  asyncio.run(main())
351
374
  """
352
375
  _response = await self._raw_client.initialise(
353
- job_parameters=job_parameters, callback=callback, request_options=request_options
376
+ job_parameters=job_parameters,
377
+ callback=callback,
378
+ request_options=request_options,
354
379
  )
355
380
  return _response.data
356
381
 
@@ -392,7 +417,9 @@ class AsyncSpeechToTextJobClient:
392
417
 
393
418
  asyncio.run(main())
394
419
  """
395
- _response = await self._raw_client.get_status(job_id, request_options=request_options)
420
+ _response = await self._raw_client.get_status(
421
+ job_id, request_options=request_options
422
+ )
396
423
  return _response.data
397
424
 
398
425
  async def start(
@@ -439,11 +466,17 @@ class AsyncSpeechToTextJobClient:
439
466
 
440
467
  asyncio.run(main())
441
468
  """
442
- _response = await self._raw_client.start(job_id, ptu_id=ptu_id, request_options=request_options)
469
+ _response = await self._raw_client.start(
470
+ job_id, ptu_id=ptu_id, request_options=request_options
471
+ )
443
472
  return _response.data
444
473
 
445
474
  async def get_upload_links(
446
- self, *, job_id: str, files: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
475
+ self,
476
+ *,
477
+ job_id: str,
478
+ files: typing.Sequence[str],
479
+ request_options: typing.Optional[RequestOptions] = None,
447
480
  ) -> FilesUploadResponse:
448
481
  """
449
482
  Start a speech to text bulk job V1
@@ -482,11 +515,17 @@ class AsyncSpeechToTextJobClient:
482
515
 
483
516
  asyncio.run(main())
484
517
  """
485
- _response = await self._raw_client.get_upload_links(job_id=job_id, files=files, request_options=request_options)
518
+ _response = await self._raw_client.get_upload_links(
519
+ job_id=job_id, files=files, request_options=request_options
520
+ )
486
521
  return _response.data
487
522
 
488
523
  async def get_download_links(
489
- self, *, job_id: str, files: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
524
+ self,
525
+ *,
526
+ job_id: str,
527
+ files: typing.Sequence[str],
528
+ request_options: typing.Optional[RequestOptions] = None,
490
529
  ) -> FilesDownloadResponse:
491
530
  """
492
531
  Start a speech to text bulk job V1
@@ -533,6 +572,7 @@ class AsyncSpeechToTextJobClient:
533
572
  async def create_job(
534
573
  self,
535
574
  model: SpeechToTextModel = "saarika:v2.5",
575
+ mode: typing.Optional[Mode] = None,
536
576
  with_diarization: bool = False,
537
577
  with_timestamps: bool = False,
538
578
  language_code: typing.Optional[SpeechToTextLanguage] = None,
@@ -548,6 +588,10 @@ class AsyncSpeechToTextJobClient:
548
588
  model : SpeechToTextModel, default="saarika:v2.5"
549
589
  The model to use for transcription.
550
590
 
591
+ mode : typing.Optional[Mode], default=None
592
+ Mode of operation. Only applicable for saaras:v3 model.
593
+ Options: transcribe, translate, indic-en, verbatim, translit, codemix
594
+
551
595
  with_diarization : typing.Optional[bool], default=False
552
596
  Whether to enable speaker diarization (distinguishing who said what).
553
597
 
@@ -556,8 +600,8 @@ class AsyncSpeechToTextJobClient:
556
600
 
557
601
  language_code : typing.Optional[SpeechToTextLanguage], default=None
558
602
  The language code of the input audio (e.g., "hi-IN", "bn-IN").
559
-
560
- num_speakers : typing.Optional[int], default=None
603
+
604
+ num_speakers : typing.Optional[int] = None
561
605
  The number of distinct speakers in the audio, if known.
562
606
 
563
607
  callback : typing.Optional[BulkJobCallbackParams], default=OMIT
@@ -575,6 +619,7 @@ class AsyncSpeechToTextJobClient:
575
619
  job_parameters=SpeechToTextJobParametersParams(
576
620
  language_code=language_code,
577
621
  model=model,
622
+ mode=mode, # type: ignore[typeddict-item]
578
623
  with_diarization=with_diarization,
579
624
  with_timestamps=with_timestamps,
580
625
  num_speakers=num_speakers, # type: ignore[typeddict-item]