sarvamai 0.1.23a2__py3-none-any.whl → 0.1.23a4__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 (68) 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 +10 -1
  24. sarvamai/requests/speech_to_text_transcription_data.py +2 -2
  25. sarvamai/speech_to_text/client.py +29 -2
  26. sarvamai/speech_to_text/raw_client.py +81 -56
  27. sarvamai/speech_to_text_job/client.py +60 -15
  28. sarvamai/speech_to_text_job/raw_client.py +120 -120
  29. sarvamai/speech_to_text_streaming/__init__.py +10 -38
  30. sarvamai/speech_to_text_streaming/client.py +32 -6
  31. sarvamai/speech_to_text_streaming/raw_client.py +32 -6
  32. sarvamai/speech_to_text_streaming/types/__init__.py +8 -36
  33. sarvamai/speech_to_text_streaming/types/speech_to_text_streaming_mode.py +7 -0
  34. sarvamai/speech_to_text_streaming/types/speech_to_text_streaming_model.py +5 -0
  35. sarvamai/speech_to_text_translate_job/raw_client.py +120 -120
  36. sarvamai/speech_to_text_translate_streaming/__init__.py +5 -36
  37. sarvamai/speech_to_text_translate_streaming/types/__init__.py +3 -36
  38. sarvamai/text/raw_client.py +60 -60
  39. sarvamai/text_to_speech/client.py +100 -16
  40. sarvamai/text_to_speech/raw_client.py +120 -36
  41. sarvamai/text_to_speech_streaming/__init__.py +2 -29
  42. sarvamai/text_to_speech_streaming/client.py +19 -6
  43. sarvamai/text_to_speech_streaming/raw_client.py +19 -6
  44. sarvamai/text_to_speech_streaming/types/__init__.py +3 -31
  45. sarvamai/text_to_speech_streaming/types/text_to_speech_streaming_model.py +5 -0
  46. sarvamai/types/__init__.py +102 -222
  47. sarvamai/types/chat_completion_request_message.py +2 -6
  48. sarvamai/types/configure_connection.py +4 -0
  49. sarvamai/types/configure_connection_data.py +40 -11
  50. sarvamai/types/configure_connection_data_model.py +5 -0
  51. sarvamai/types/configure_connection_data_speaker.py +35 -1
  52. sarvamai/types/error_response_data.py +1 -1
  53. sarvamai/types/file_signed_url_details.py +1 -1
  54. sarvamai/types/mode.py +7 -0
  55. sarvamai/types/speech_to_text_job_parameters.py +10 -1
  56. sarvamai/types/speech_to_text_model.py +3 -1
  57. sarvamai/types/speech_to_text_transcription_data.py +2 -2
  58. sarvamai/types/speech_to_text_translate_model.py +1 -1
  59. sarvamai/types/text_to_speech_model.py +1 -1
  60. sarvamai/types/text_to_speech_speaker.py +35 -1
  61. {sarvamai-0.1.23a2.dist-info → sarvamai-0.1.23a4.dist-info}/METADATA +1 -2
  62. {sarvamai-0.1.23a2.dist-info → sarvamai-0.1.23a4.dist-info}/RECORD +63 -63
  63. sarvamai/core/http_sse/__init__.py +0 -42
  64. sarvamai/core/http_sse/_api.py +0 -112
  65. sarvamai/core/http_sse/_decoders.py +0 -61
  66. sarvamai/core/http_sse/_exceptions.py +0 -7
  67. sarvamai/core/http_sse/_models.py +0 -17
  68. {sarvamai-0.1.23a2.dist-info → sarvamai-0.1.23a4.dist-info}/WHEEL +0 -0
@@ -2,42 +2,11 @@
2
2
 
3
3
  # isort: skip_file
4
4
 
5
- import typing
6
- from importlib import import_module
7
-
8
- if typing.TYPE_CHECKING:
9
- from .types import (
10
- SpeechToTextTranslateStreamingFlushSignal,
11
- SpeechToTextTranslateStreamingHighVadSensitivity,
12
- SpeechToTextTranslateStreamingVadSignals,
13
- )
14
- _dynamic_imports: typing.Dict[str, str] = {
15
- "SpeechToTextTranslateStreamingFlushSignal": ".types",
16
- "SpeechToTextTranslateStreamingHighVadSensitivity": ".types",
17
- "SpeechToTextTranslateStreamingVadSignals": ".types",
18
- }
19
-
20
-
21
- def __getattr__(attr_name: str) -> typing.Any:
22
- module_name = _dynamic_imports.get(attr_name)
23
- if module_name is None:
24
- raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
25
- try:
26
- module = import_module(module_name, __package__)
27
- if module_name == f".{attr_name}":
28
- return module
29
- else:
30
- return getattr(module, attr_name)
31
- except ImportError as e:
32
- raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
33
- except AttributeError as e:
34
- raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
35
-
36
-
37
- def __dir__():
38
- lazy_attrs = list(_dynamic_imports.keys())
39
- return sorted(lazy_attrs)
40
-
5
+ from .types import (
6
+ SpeechToTextTranslateStreamingFlushSignal,
7
+ SpeechToTextTranslateStreamingHighVadSensitivity,
8
+ SpeechToTextTranslateStreamingVadSignals,
9
+ )
41
10
 
42
11
  __all__ = [
43
12
  "SpeechToTextTranslateStreamingFlushSignal",
@@ -2,42 +2,9 @@
2
2
 
3
3
  # isort: skip_file
4
4
 
5
- import typing
6
- from importlib import import_module
7
-
8
- if typing.TYPE_CHECKING:
9
- from .speech_to_text_translate_streaming_flush_signal import SpeechToTextTranslateStreamingFlushSignal
10
- from .speech_to_text_translate_streaming_high_vad_sensitivity import (
11
- SpeechToTextTranslateStreamingHighVadSensitivity,
12
- )
13
- from .speech_to_text_translate_streaming_vad_signals import SpeechToTextTranslateStreamingVadSignals
14
- _dynamic_imports: typing.Dict[str, str] = {
15
- "SpeechToTextTranslateStreamingFlushSignal": ".speech_to_text_translate_streaming_flush_signal",
16
- "SpeechToTextTranslateStreamingHighVadSensitivity": ".speech_to_text_translate_streaming_high_vad_sensitivity",
17
- "SpeechToTextTranslateStreamingVadSignals": ".speech_to_text_translate_streaming_vad_signals",
18
- }
19
-
20
-
21
- def __getattr__(attr_name: str) -> typing.Any:
22
- module_name = _dynamic_imports.get(attr_name)
23
- if module_name is None:
24
- raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
25
- try:
26
- module = import_module(module_name, __package__)
27
- if module_name == f".{attr_name}":
28
- return module
29
- else:
30
- return getattr(module, attr_name)
31
- except ImportError as e:
32
- raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
33
- except AttributeError as e:
34
- raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
35
-
36
-
37
- def __dir__():
38
- lazy_attrs = list(_dynamic_imports.keys())
39
- return sorted(lazy_attrs)
40
-
5
+ from .speech_to_text_translate_streaming_flush_signal import SpeechToTextTranslateStreamingFlushSignal
6
+ from .speech_to_text_translate_streaming_high_vad_sensitivity import SpeechToTextTranslateStreamingHighVadSensitivity
7
+ from .speech_to_text_translate_streaming_vad_signals import SpeechToTextTranslateStreamingVadSignals
41
8
 
42
9
  __all__ = [
43
10
  "SpeechToTextTranslateStreamingFlushSignal",
@@ -192,9 +192,9 @@ class RawTextClient:
192
192
  raise BadRequestError(
193
193
  headers=dict(_response.headers),
194
194
  body=typing.cast(
195
- typing.Any,
195
+ typing.Optional[typing.Any],
196
196
  parse_obj_as(
197
- type_=typing.Any, # type: ignore
197
+ type_=typing.Optional[typing.Any], # type: ignore
198
198
  object_=_response.json(),
199
199
  ),
200
200
  ),
@@ -203,9 +203,9 @@ class RawTextClient:
203
203
  raise ForbiddenError(
204
204
  headers=dict(_response.headers),
205
205
  body=typing.cast(
206
- typing.Any,
206
+ typing.Optional[typing.Any],
207
207
  parse_obj_as(
208
- type_=typing.Any, # type: ignore
208
+ type_=typing.Optional[typing.Any], # type: ignore
209
209
  object_=_response.json(),
210
210
  ),
211
211
  ),
@@ -214,9 +214,9 @@ class RawTextClient:
214
214
  raise UnprocessableEntityError(
215
215
  headers=dict(_response.headers),
216
216
  body=typing.cast(
217
- typing.Any,
217
+ typing.Optional[typing.Any],
218
218
  parse_obj_as(
219
- type_=typing.Any, # type: ignore
219
+ type_=typing.Optional[typing.Any], # type: ignore
220
220
  object_=_response.json(),
221
221
  ),
222
222
  ),
@@ -225,9 +225,9 @@ class RawTextClient:
225
225
  raise TooManyRequestsError(
226
226
  headers=dict(_response.headers),
227
227
  body=typing.cast(
228
- typing.Any,
228
+ typing.Optional[typing.Any],
229
229
  parse_obj_as(
230
- type_=typing.Any, # type: ignore
230
+ type_=typing.Optional[typing.Any], # type: ignore
231
231
  object_=_response.json(),
232
232
  ),
233
233
  ),
@@ -236,9 +236,9 @@ class RawTextClient:
236
236
  raise InternalServerError(
237
237
  headers=dict(_response.headers),
238
238
  body=typing.cast(
239
- typing.Any,
239
+ typing.Optional[typing.Any],
240
240
  parse_obj_as(
241
- type_=typing.Any, # type: ignore
241
+ type_=typing.Optional[typing.Any], # type: ignore
242
242
  object_=_response.json(),
243
243
  ),
244
244
  ),
@@ -294,9 +294,9 @@ class RawTextClient:
294
294
  raise BadRequestError(
295
295
  headers=dict(_response.headers),
296
296
  body=typing.cast(
297
- typing.Any,
297
+ typing.Optional[typing.Any],
298
298
  parse_obj_as(
299
- type_=typing.Any, # type: ignore
299
+ type_=typing.Optional[typing.Any], # type: ignore
300
300
  object_=_response.json(),
301
301
  ),
302
302
  ),
@@ -305,9 +305,9 @@ class RawTextClient:
305
305
  raise ForbiddenError(
306
306
  headers=dict(_response.headers),
307
307
  body=typing.cast(
308
- typing.Any,
308
+ typing.Optional[typing.Any],
309
309
  parse_obj_as(
310
- type_=typing.Any, # type: ignore
310
+ type_=typing.Optional[typing.Any], # type: ignore
311
311
  object_=_response.json(),
312
312
  ),
313
313
  ),
@@ -316,9 +316,9 @@ class RawTextClient:
316
316
  raise UnprocessableEntityError(
317
317
  headers=dict(_response.headers),
318
318
  body=typing.cast(
319
- typing.Any,
319
+ typing.Optional[typing.Any],
320
320
  parse_obj_as(
321
- type_=typing.Any, # type: ignore
321
+ type_=typing.Optional[typing.Any], # type: ignore
322
322
  object_=_response.json(),
323
323
  ),
324
324
  ),
@@ -327,9 +327,9 @@ class RawTextClient:
327
327
  raise TooManyRequestsError(
328
328
  headers=dict(_response.headers),
329
329
  body=typing.cast(
330
- typing.Any,
330
+ typing.Optional[typing.Any],
331
331
  parse_obj_as(
332
- type_=typing.Any, # type: ignore
332
+ type_=typing.Optional[typing.Any], # type: ignore
333
333
  object_=_response.json(),
334
334
  ),
335
335
  ),
@@ -338,9 +338,9 @@ class RawTextClient:
338
338
  raise InternalServerError(
339
339
  headers=dict(_response.headers),
340
340
  body=typing.cast(
341
- typing.Any,
341
+ typing.Optional[typing.Any],
342
342
  parse_obj_as(
343
- type_=typing.Any, # type: ignore
343
+ type_=typing.Optional[typing.Any], # type: ignore
344
344
  object_=_response.json(),
345
345
  ),
346
346
  ),
@@ -478,9 +478,9 @@ class RawTextClient:
478
478
  raise BadRequestError(
479
479
  headers=dict(_response.headers),
480
480
  body=typing.cast(
481
- typing.Any,
481
+ typing.Optional[typing.Any],
482
482
  parse_obj_as(
483
- type_=typing.Any, # type: ignore
483
+ type_=typing.Optional[typing.Any], # type: ignore
484
484
  object_=_response.json(),
485
485
  ),
486
486
  ),
@@ -489,9 +489,9 @@ class RawTextClient:
489
489
  raise ForbiddenError(
490
490
  headers=dict(_response.headers),
491
491
  body=typing.cast(
492
- typing.Any,
492
+ typing.Optional[typing.Any],
493
493
  parse_obj_as(
494
- type_=typing.Any, # type: ignore
494
+ type_=typing.Optional[typing.Any], # type: ignore
495
495
  object_=_response.json(),
496
496
  ),
497
497
  ),
@@ -500,9 +500,9 @@ class RawTextClient:
500
500
  raise UnprocessableEntityError(
501
501
  headers=dict(_response.headers),
502
502
  body=typing.cast(
503
- typing.Any,
503
+ typing.Optional[typing.Any],
504
504
  parse_obj_as(
505
- type_=typing.Any, # type: ignore
505
+ type_=typing.Optional[typing.Any], # type: ignore
506
506
  object_=_response.json(),
507
507
  ),
508
508
  ),
@@ -511,9 +511,9 @@ class RawTextClient:
511
511
  raise TooManyRequestsError(
512
512
  headers=dict(_response.headers),
513
513
  body=typing.cast(
514
- typing.Any,
514
+ typing.Optional[typing.Any],
515
515
  parse_obj_as(
516
- type_=typing.Any, # type: ignore
516
+ type_=typing.Optional[typing.Any], # type: ignore
517
517
  object_=_response.json(),
518
518
  ),
519
519
  ),
@@ -522,9 +522,9 @@ class RawTextClient:
522
522
  raise InternalServerError(
523
523
  headers=dict(_response.headers),
524
524
  body=typing.cast(
525
- typing.Any,
525
+ typing.Optional[typing.Any],
526
526
  parse_obj_as(
527
- type_=typing.Any, # type: ignore
527
+ type_=typing.Optional[typing.Any], # type: ignore
528
528
  object_=_response.json(),
529
529
  ),
530
530
  ),
@@ -696,9 +696,9 @@ class AsyncRawTextClient:
696
696
  raise BadRequestError(
697
697
  headers=dict(_response.headers),
698
698
  body=typing.cast(
699
- typing.Any,
699
+ typing.Optional[typing.Any],
700
700
  parse_obj_as(
701
- type_=typing.Any, # type: ignore
701
+ type_=typing.Optional[typing.Any], # type: ignore
702
702
  object_=_response.json(),
703
703
  ),
704
704
  ),
@@ -707,9 +707,9 @@ class AsyncRawTextClient:
707
707
  raise ForbiddenError(
708
708
  headers=dict(_response.headers),
709
709
  body=typing.cast(
710
- typing.Any,
710
+ typing.Optional[typing.Any],
711
711
  parse_obj_as(
712
- type_=typing.Any, # type: ignore
712
+ type_=typing.Optional[typing.Any], # type: ignore
713
713
  object_=_response.json(),
714
714
  ),
715
715
  ),
@@ -718,9 +718,9 @@ class AsyncRawTextClient:
718
718
  raise UnprocessableEntityError(
719
719
  headers=dict(_response.headers),
720
720
  body=typing.cast(
721
- typing.Any,
721
+ typing.Optional[typing.Any],
722
722
  parse_obj_as(
723
- type_=typing.Any, # type: ignore
723
+ type_=typing.Optional[typing.Any], # type: ignore
724
724
  object_=_response.json(),
725
725
  ),
726
726
  ),
@@ -729,9 +729,9 @@ class AsyncRawTextClient:
729
729
  raise TooManyRequestsError(
730
730
  headers=dict(_response.headers),
731
731
  body=typing.cast(
732
- typing.Any,
732
+ typing.Optional[typing.Any],
733
733
  parse_obj_as(
734
- type_=typing.Any, # type: ignore
734
+ type_=typing.Optional[typing.Any], # type: ignore
735
735
  object_=_response.json(),
736
736
  ),
737
737
  ),
@@ -740,9 +740,9 @@ class AsyncRawTextClient:
740
740
  raise InternalServerError(
741
741
  headers=dict(_response.headers),
742
742
  body=typing.cast(
743
- typing.Any,
743
+ typing.Optional[typing.Any],
744
744
  parse_obj_as(
745
- type_=typing.Any, # type: ignore
745
+ type_=typing.Optional[typing.Any], # type: ignore
746
746
  object_=_response.json(),
747
747
  ),
748
748
  ),
@@ -798,9 +798,9 @@ class AsyncRawTextClient:
798
798
  raise BadRequestError(
799
799
  headers=dict(_response.headers),
800
800
  body=typing.cast(
801
- typing.Any,
801
+ typing.Optional[typing.Any],
802
802
  parse_obj_as(
803
- type_=typing.Any, # type: ignore
803
+ type_=typing.Optional[typing.Any], # type: ignore
804
804
  object_=_response.json(),
805
805
  ),
806
806
  ),
@@ -809,9 +809,9 @@ class AsyncRawTextClient:
809
809
  raise ForbiddenError(
810
810
  headers=dict(_response.headers),
811
811
  body=typing.cast(
812
- typing.Any,
812
+ typing.Optional[typing.Any],
813
813
  parse_obj_as(
814
- type_=typing.Any, # type: ignore
814
+ type_=typing.Optional[typing.Any], # type: ignore
815
815
  object_=_response.json(),
816
816
  ),
817
817
  ),
@@ -820,9 +820,9 @@ class AsyncRawTextClient:
820
820
  raise UnprocessableEntityError(
821
821
  headers=dict(_response.headers),
822
822
  body=typing.cast(
823
- typing.Any,
823
+ typing.Optional[typing.Any],
824
824
  parse_obj_as(
825
- type_=typing.Any, # type: ignore
825
+ type_=typing.Optional[typing.Any], # type: ignore
826
826
  object_=_response.json(),
827
827
  ),
828
828
  ),
@@ -831,9 +831,9 @@ class AsyncRawTextClient:
831
831
  raise TooManyRequestsError(
832
832
  headers=dict(_response.headers),
833
833
  body=typing.cast(
834
- typing.Any,
834
+ typing.Optional[typing.Any],
835
835
  parse_obj_as(
836
- type_=typing.Any, # type: ignore
836
+ type_=typing.Optional[typing.Any], # type: ignore
837
837
  object_=_response.json(),
838
838
  ),
839
839
  ),
@@ -842,9 +842,9 @@ class AsyncRawTextClient:
842
842
  raise InternalServerError(
843
843
  headers=dict(_response.headers),
844
844
  body=typing.cast(
845
- typing.Any,
845
+ typing.Optional[typing.Any],
846
846
  parse_obj_as(
847
- type_=typing.Any, # type: ignore
847
+ type_=typing.Optional[typing.Any], # type: ignore
848
848
  object_=_response.json(),
849
849
  ),
850
850
  ),
@@ -982,9 +982,9 @@ class AsyncRawTextClient:
982
982
  raise BadRequestError(
983
983
  headers=dict(_response.headers),
984
984
  body=typing.cast(
985
- typing.Any,
985
+ typing.Optional[typing.Any],
986
986
  parse_obj_as(
987
- type_=typing.Any, # type: ignore
987
+ type_=typing.Optional[typing.Any], # type: ignore
988
988
  object_=_response.json(),
989
989
  ),
990
990
  ),
@@ -993,9 +993,9 @@ class AsyncRawTextClient:
993
993
  raise ForbiddenError(
994
994
  headers=dict(_response.headers),
995
995
  body=typing.cast(
996
- typing.Any,
996
+ typing.Optional[typing.Any],
997
997
  parse_obj_as(
998
- type_=typing.Any, # type: ignore
998
+ type_=typing.Optional[typing.Any], # type: ignore
999
999
  object_=_response.json(),
1000
1000
  ),
1001
1001
  ),
@@ -1004,9 +1004,9 @@ class AsyncRawTextClient:
1004
1004
  raise UnprocessableEntityError(
1005
1005
  headers=dict(_response.headers),
1006
1006
  body=typing.cast(
1007
- typing.Any,
1007
+ typing.Optional[typing.Any],
1008
1008
  parse_obj_as(
1009
- type_=typing.Any, # type: ignore
1009
+ type_=typing.Optional[typing.Any], # type: ignore
1010
1010
  object_=_response.json(),
1011
1011
  ),
1012
1012
  ),
@@ -1015,9 +1015,9 @@ class AsyncRawTextClient:
1015
1015
  raise TooManyRequestsError(
1016
1016
  headers=dict(_response.headers),
1017
1017
  body=typing.cast(
1018
- typing.Any,
1018
+ typing.Optional[typing.Any],
1019
1019
  parse_obj_as(
1020
- type_=typing.Any, # type: ignore
1020
+ type_=typing.Optional[typing.Any], # type: ignore
1021
1021
  object_=_response.json(),
1022
1022
  ),
1023
1023
  ),
@@ -1026,9 +1026,9 @@ class AsyncRawTextClient:
1026
1026
  raise InternalServerError(
1027
1027
  headers=dict(_response.headers),
1028
1028
  body=typing.cast(
1029
- typing.Any,
1029
+ typing.Optional[typing.Any],
1030
1030
  parse_obj_as(
1031
- type_=typing.Any, # type: ignore
1031
+ type_=typing.Optional[typing.Any], # type: ignore
1032
1032
  object_=_response.json(),
1033
1033
  ),
1034
1034
  ),