sarvamai 0.1.22a4__py3-none-any.whl → 0.1.23a2__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.
- sarvamai/__init__.py +405 -200
- sarvamai/chat/raw_client.py +20 -20
- sarvamai/client.py +186 -34
- sarvamai/core/__init__.py +76 -21
- sarvamai/core/client_wrapper.py +19 -3
- sarvamai/core/force_multipart.py +4 -2
- sarvamai/core/http_client.py +217 -97
- sarvamai/core/http_response.py +1 -1
- sarvamai/core/http_sse/__init__.py +42 -0
- sarvamai/core/http_sse/_api.py +112 -0
- sarvamai/core/http_sse/_decoders.py +61 -0
- sarvamai/core/http_sse/_exceptions.py +7 -0
- sarvamai/core/http_sse/_models.py +17 -0
- sarvamai/core/jsonable_encoder.py +8 -0
- sarvamai/core/pydantic_utilities.py +110 -4
- sarvamai/errors/__init__.py +40 -6
- sarvamai/errors/bad_request_error.py +1 -1
- sarvamai/errors/forbidden_error.py +1 -1
- sarvamai/errors/internal_server_error.py +1 -1
- sarvamai/errors/service_unavailable_error.py +1 -1
- sarvamai/errors/too_many_requests_error.py +1 -1
- sarvamai/errors/unprocessable_entity_error.py +1 -1
- sarvamai/requests/__init__.py +150 -62
- sarvamai/requests/audio_data.py +0 -6
- sarvamai/requests/error_response_data.py +1 -1
- sarvamai/requests/file_signed_url_details.py +1 -1
- sarvamai/requests/speech_to_text_transcription_data.py +2 -2
- sarvamai/speech_to_text/raw_client.py +54 -52
- sarvamai/speech_to_text_job/raw_client.py +120 -120
- sarvamai/speech_to_text_streaming/__init__.py +38 -8
- sarvamai/speech_to_text_streaming/client.py +0 -13
- sarvamai/speech_to_text_streaming/raw_client.py +0 -13
- sarvamai/speech_to_text_streaming/types/__init__.py +36 -6
- sarvamai/speech_to_text_translate_job/raw_client.py +120 -120
- sarvamai/speech_to_text_translate_streaming/__init__.py +36 -7
- sarvamai/speech_to_text_translate_streaming/client.py +0 -13
- sarvamai/speech_to_text_translate_streaming/raw_client.py +0 -13
- sarvamai/speech_to_text_translate_streaming/types/__init__.py +36 -5
- sarvamai/text/client.py +0 -12
- sarvamai/text/raw_client.py +60 -72
- sarvamai/text_to_speech/client.py +18 -0
- sarvamai/text_to_speech/raw_client.py +38 -20
- sarvamai/text_to_speech_streaming/__init__.py +28 -1
- sarvamai/text_to_speech_streaming/types/__init__.py +30 -1
- sarvamai/types/__init__.py +222 -100
- sarvamai/types/audio_data.py +0 -6
- sarvamai/types/chat_completion_request_message.py +6 -2
- sarvamai/types/error_response_data.py +1 -1
- sarvamai/types/file_signed_url_details.py +1 -1
- sarvamai/types/speech_to_text_transcription_data.py +2 -2
- {sarvamai-0.1.22a4.dist-info → sarvamai-0.1.23a2.dist-info}/METADATA +2 -1
- {sarvamai-0.1.22a4.dist-info → sarvamai-0.1.23a2.dist-info}/RECORD +53 -51
- sarvamai/speech_to_text_streaming/types/speech_to_text_streaming_input_audio_codec.py +0 -33
- sarvamai/speech_to_text_translate_streaming/types/speech_to_text_translate_streaming_input_audio_codec.py +0 -33
- sarvamai/types/audio_data_input_audio_codec.py +0 -33
- {sarvamai-0.1.22a4.dist-info → sarvamai-0.1.23a2.dist-info}/WHEEL +0 -0
sarvamai/text/raw_client.py
CHANGED
|
@@ -44,7 +44,6 @@ class RawTextClient:
|
|
|
44
44
|
speaker_gender: typing.Optional[TranslateSpeakerGender] = OMIT,
|
|
45
45
|
mode: typing.Optional[TranslateMode] = OMIT,
|
|
46
46
|
model: typing.Optional[TranslateModel] = OMIT,
|
|
47
|
-
enable_preprocessing: typing.Optional[bool] = OMIT,
|
|
48
47
|
output_script: typing.Optional[TransliterateMode] = OMIT,
|
|
49
48
|
numerals_format: typing.Optional[NumeralsFormat] = OMIT,
|
|
50
49
|
request_options: typing.Optional[RequestOptions] = None,
|
|
@@ -122,10 +121,6 @@ class RawTextClient:
|
|
|
122
121
|
- mayura:v1: Supports 12 languages with all modes, output scripts, and automatic language detection.
|
|
123
122
|
- sarvam-translate:v1: Supports all 22 scheduled languages of India, formal mode only.
|
|
124
123
|
|
|
125
|
-
enable_preprocessing : typing.Optional[bool]
|
|
126
|
-
This will enable custom preprocessing of the input text which can result in better translations.
|
|
127
|
-
Recommendation- You can switch on whenever there is some complex text with difficult vocabulary and sentences, for which you want simple translations that people can understand.
|
|
128
|
-
|
|
129
124
|
output_script : typing.Optional[TransliterateMode]
|
|
130
125
|
**output_script**: This is an optional parameter which controls the transliteration style applied to the output text.
|
|
131
126
|
|
|
@@ -174,7 +169,6 @@ class RawTextClient:
|
|
|
174
169
|
"speaker_gender": speaker_gender,
|
|
175
170
|
"mode": mode,
|
|
176
171
|
"model": model,
|
|
177
|
-
"enable_preprocessing": enable_preprocessing,
|
|
178
172
|
"output_script": output_script,
|
|
179
173
|
"numerals_format": numerals_format,
|
|
180
174
|
},
|
|
@@ -198,9 +192,9 @@ class RawTextClient:
|
|
|
198
192
|
raise BadRequestError(
|
|
199
193
|
headers=dict(_response.headers),
|
|
200
194
|
body=typing.cast(
|
|
201
|
-
typing.
|
|
195
|
+
typing.Any,
|
|
202
196
|
parse_obj_as(
|
|
203
|
-
type_=typing.
|
|
197
|
+
type_=typing.Any, # type: ignore
|
|
204
198
|
object_=_response.json(),
|
|
205
199
|
),
|
|
206
200
|
),
|
|
@@ -209,9 +203,9 @@ class RawTextClient:
|
|
|
209
203
|
raise ForbiddenError(
|
|
210
204
|
headers=dict(_response.headers),
|
|
211
205
|
body=typing.cast(
|
|
212
|
-
typing.
|
|
206
|
+
typing.Any,
|
|
213
207
|
parse_obj_as(
|
|
214
|
-
type_=typing.
|
|
208
|
+
type_=typing.Any, # type: ignore
|
|
215
209
|
object_=_response.json(),
|
|
216
210
|
),
|
|
217
211
|
),
|
|
@@ -220,9 +214,9 @@ class RawTextClient:
|
|
|
220
214
|
raise UnprocessableEntityError(
|
|
221
215
|
headers=dict(_response.headers),
|
|
222
216
|
body=typing.cast(
|
|
223
|
-
typing.
|
|
217
|
+
typing.Any,
|
|
224
218
|
parse_obj_as(
|
|
225
|
-
type_=typing.
|
|
219
|
+
type_=typing.Any, # type: ignore
|
|
226
220
|
object_=_response.json(),
|
|
227
221
|
),
|
|
228
222
|
),
|
|
@@ -231,9 +225,9 @@ class RawTextClient:
|
|
|
231
225
|
raise TooManyRequestsError(
|
|
232
226
|
headers=dict(_response.headers),
|
|
233
227
|
body=typing.cast(
|
|
234
|
-
typing.
|
|
228
|
+
typing.Any,
|
|
235
229
|
parse_obj_as(
|
|
236
|
-
type_=typing.
|
|
230
|
+
type_=typing.Any, # type: ignore
|
|
237
231
|
object_=_response.json(),
|
|
238
232
|
),
|
|
239
233
|
),
|
|
@@ -242,9 +236,9 @@ class RawTextClient:
|
|
|
242
236
|
raise InternalServerError(
|
|
243
237
|
headers=dict(_response.headers),
|
|
244
238
|
body=typing.cast(
|
|
245
|
-
typing.
|
|
239
|
+
typing.Any,
|
|
246
240
|
parse_obj_as(
|
|
247
|
-
type_=typing.
|
|
241
|
+
type_=typing.Any, # type: ignore
|
|
248
242
|
object_=_response.json(),
|
|
249
243
|
),
|
|
250
244
|
),
|
|
@@ -300,9 +294,9 @@ class RawTextClient:
|
|
|
300
294
|
raise BadRequestError(
|
|
301
295
|
headers=dict(_response.headers),
|
|
302
296
|
body=typing.cast(
|
|
303
|
-
typing.
|
|
297
|
+
typing.Any,
|
|
304
298
|
parse_obj_as(
|
|
305
|
-
type_=typing.
|
|
299
|
+
type_=typing.Any, # type: ignore
|
|
306
300
|
object_=_response.json(),
|
|
307
301
|
),
|
|
308
302
|
),
|
|
@@ -311,9 +305,9 @@ class RawTextClient:
|
|
|
311
305
|
raise ForbiddenError(
|
|
312
306
|
headers=dict(_response.headers),
|
|
313
307
|
body=typing.cast(
|
|
314
|
-
typing.
|
|
308
|
+
typing.Any,
|
|
315
309
|
parse_obj_as(
|
|
316
|
-
type_=typing.
|
|
310
|
+
type_=typing.Any, # type: ignore
|
|
317
311
|
object_=_response.json(),
|
|
318
312
|
),
|
|
319
313
|
),
|
|
@@ -322,9 +316,9 @@ class RawTextClient:
|
|
|
322
316
|
raise UnprocessableEntityError(
|
|
323
317
|
headers=dict(_response.headers),
|
|
324
318
|
body=typing.cast(
|
|
325
|
-
typing.
|
|
319
|
+
typing.Any,
|
|
326
320
|
parse_obj_as(
|
|
327
|
-
type_=typing.
|
|
321
|
+
type_=typing.Any, # type: ignore
|
|
328
322
|
object_=_response.json(),
|
|
329
323
|
),
|
|
330
324
|
),
|
|
@@ -333,9 +327,9 @@ class RawTextClient:
|
|
|
333
327
|
raise TooManyRequestsError(
|
|
334
328
|
headers=dict(_response.headers),
|
|
335
329
|
body=typing.cast(
|
|
336
|
-
typing.
|
|
330
|
+
typing.Any,
|
|
337
331
|
parse_obj_as(
|
|
338
|
-
type_=typing.
|
|
332
|
+
type_=typing.Any, # type: ignore
|
|
339
333
|
object_=_response.json(),
|
|
340
334
|
),
|
|
341
335
|
),
|
|
@@ -344,9 +338,9 @@ class RawTextClient:
|
|
|
344
338
|
raise InternalServerError(
|
|
345
339
|
headers=dict(_response.headers),
|
|
346
340
|
body=typing.cast(
|
|
347
|
-
typing.
|
|
341
|
+
typing.Any,
|
|
348
342
|
parse_obj_as(
|
|
349
|
-
type_=typing.
|
|
343
|
+
type_=typing.Any, # type: ignore
|
|
350
344
|
object_=_response.json(),
|
|
351
345
|
),
|
|
352
346
|
),
|
|
@@ -484,9 +478,9 @@ class RawTextClient:
|
|
|
484
478
|
raise BadRequestError(
|
|
485
479
|
headers=dict(_response.headers),
|
|
486
480
|
body=typing.cast(
|
|
487
|
-
typing.
|
|
481
|
+
typing.Any,
|
|
488
482
|
parse_obj_as(
|
|
489
|
-
type_=typing.
|
|
483
|
+
type_=typing.Any, # type: ignore
|
|
490
484
|
object_=_response.json(),
|
|
491
485
|
),
|
|
492
486
|
),
|
|
@@ -495,9 +489,9 @@ class RawTextClient:
|
|
|
495
489
|
raise ForbiddenError(
|
|
496
490
|
headers=dict(_response.headers),
|
|
497
491
|
body=typing.cast(
|
|
498
|
-
typing.
|
|
492
|
+
typing.Any,
|
|
499
493
|
parse_obj_as(
|
|
500
|
-
type_=typing.
|
|
494
|
+
type_=typing.Any, # type: ignore
|
|
501
495
|
object_=_response.json(),
|
|
502
496
|
),
|
|
503
497
|
),
|
|
@@ -506,9 +500,9 @@ class RawTextClient:
|
|
|
506
500
|
raise UnprocessableEntityError(
|
|
507
501
|
headers=dict(_response.headers),
|
|
508
502
|
body=typing.cast(
|
|
509
|
-
typing.
|
|
503
|
+
typing.Any,
|
|
510
504
|
parse_obj_as(
|
|
511
|
-
type_=typing.
|
|
505
|
+
type_=typing.Any, # type: ignore
|
|
512
506
|
object_=_response.json(),
|
|
513
507
|
),
|
|
514
508
|
),
|
|
@@ -517,9 +511,9 @@ class RawTextClient:
|
|
|
517
511
|
raise TooManyRequestsError(
|
|
518
512
|
headers=dict(_response.headers),
|
|
519
513
|
body=typing.cast(
|
|
520
|
-
typing.
|
|
514
|
+
typing.Any,
|
|
521
515
|
parse_obj_as(
|
|
522
|
-
type_=typing.
|
|
516
|
+
type_=typing.Any, # type: ignore
|
|
523
517
|
object_=_response.json(),
|
|
524
518
|
),
|
|
525
519
|
),
|
|
@@ -528,9 +522,9 @@ class RawTextClient:
|
|
|
528
522
|
raise InternalServerError(
|
|
529
523
|
headers=dict(_response.headers),
|
|
530
524
|
body=typing.cast(
|
|
531
|
-
typing.
|
|
525
|
+
typing.Any,
|
|
532
526
|
parse_obj_as(
|
|
533
|
-
type_=typing.
|
|
527
|
+
type_=typing.Any, # type: ignore
|
|
534
528
|
object_=_response.json(),
|
|
535
529
|
),
|
|
536
530
|
),
|
|
@@ -554,7 +548,6 @@ class AsyncRawTextClient:
|
|
|
554
548
|
speaker_gender: typing.Optional[TranslateSpeakerGender] = OMIT,
|
|
555
549
|
mode: typing.Optional[TranslateMode] = OMIT,
|
|
556
550
|
model: typing.Optional[TranslateModel] = OMIT,
|
|
557
|
-
enable_preprocessing: typing.Optional[bool] = OMIT,
|
|
558
551
|
output_script: typing.Optional[TransliterateMode] = OMIT,
|
|
559
552
|
numerals_format: typing.Optional[NumeralsFormat] = OMIT,
|
|
560
553
|
request_options: typing.Optional[RequestOptions] = None,
|
|
@@ -632,10 +625,6 @@ class AsyncRawTextClient:
|
|
|
632
625
|
- mayura:v1: Supports 12 languages with all modes, output scripts, and automatic language detection.
|
|
633
626
|
- sarvam-translate:v1: Supports all 22 scheduled languages of India, formal mode only.
|
|
634
627
|
|
|
635
|
-
enable_preprocessing : typing.Optional[bool]
|
|
636
|
-
This will enable custom preprocessing of the input text which can result in better translations.
|
|
637
|
-
Recommendation- You can switch on whenever there is some complex text with difficult vocabulary and sentences, for which you want simple translations that people can understand.
|
|
638
|
-
|
|
639
628
|
output_script : typing.Optional[TransliterateMode]
|
|
640
629
|
**output_script**: This is an optional parameter which controls the transliteration style applied to the output text.
|
|
641
630
|
|
|
@@ -684,7 +673,6 @@ class AsyncRawTextClient:
|
|
|
684
673
|
"speaker_gender": speaker_gender,
|
|
685
674
|
"mode": mode,
|
|
686
675
|
"model": model,
|
|
687
|
-
"enable_preprocessing": enable_preprocessing,
|
|
688
676
|
"output_script": output_script,
|
|
689
677
|
"numerals_format": numerals_format,
|
|
690
678
|
},
|
|
@@ -708,9 +696,9 @@ class AsyncRawTextClient:
|
|
|
708
696
|
raise BadRequestError(
|
|
709
697
|
headers=dict(_response.headers),
|
|
710
698
|
body=typing.cast(
|
|
711
|
-
typing.
|
|
699
|
+
typing.Any,
|
|
712
700
|
parse_obj_as(
|
|
713
|
-
type_=typing.
|
|
701
|
+
type_=typing.Any, # type: ignore
|
|
714
702
|
object_=_response.json(),
|
|
715
703
|
),
|
|
716
704
|
),
|
|
@@ -719,9 +707,9 @@ class AsyncRawTextClient:
|
|
|
719
707
|
raise ForbiddenError(
|
|
720
708
|
headers=dict(_response.headers),
|
|
721
709
|
body=typing.cast(
|
|
722
|
-
typing.
|
|
710
|
+
typing.Any,
|
|
723
711
|
parse_obj_as(
|
|
724
|
-
type_=typing.
|
|
712
|
+
type_=typing.Any, # type: ignore
|
|
725
713
|
object_=_response.json(),
|
|
726
714
|
),
|
|
727
715
|
),
|
|
@@ -730,9 +718,9 @@ class AsyncRawTextClient:
|
|
|
730
718
|
raise UnprocessableEntityError(
|
|
731
719
|
headers=dict(_response.headers),
|
|
732
720
|
body=typing.cast(
|
|
733
|
-
typing.
|
|
721
|
+
typing.Any,
|
|
734
722
|
parse_obj_as(
|
|
735
|
-
type_=typing.
|
|
723
|
+
type_=typing.Any, # type: ignore
|
|
736
724
|
object_=_response.json(),
|
|
737
725
|
),
|
|
738
726
|
),
|
|
@@ -741,9 +729,9 @@ class AsyncRawTextClient:
|
|
|
741
729
|
raise TooManyRequestsError(
|
|
742
730
|
headers=dict(_response.headers),
|
|
743
731
|
body=typing.cast(
|
|
744
|
-
typing.
|
|
732
|
+
typing.Any,
|
|
745
733
|
parse_obj_as(
|
|
746
|
-
type_=typing.
|
|
734
|
+
type_=typing.Any, # type: ignore
|
|
747
735
|
object_=_response.json(),
|
|
748
736
|
),
|
|
749
737
|
),
|
|
@@ -752,9 +740,9 @@ class AsyncRawTextClient:
|
|
|
752
740
|
raise InternalServerError(
|
|
753
741
|
headers=dict(_response.headers),
|
|
754
742
|
body=typing.cast(
|
|
755
|
-
typing.
|
|
743
|
+
typing.Any,
|
|
756
744
|
parse_obj_as(
|
|
757
|
-
type_=typing.
|
|
745
|
+
type_=typing.Any, # type: ignore
|
|
758
746
|
object_=_response.json(),
|
|
759
747
|
),
|
|
760
748
|
),
|
|
@@ -810,9 +798,9 @@ class AsyncRawTextClient:
|
|
|
810
798
|
raise BadRequestError(
|
|
811
799
|
headers=dict(_response.headers),
|
|
812
800
|
body=typing.cast(
|
|
813
|
-
typing.
|
|
801
|
+
typing.Any,
|
|
814
802
|
parse_obj_as(
|
|
815
|
-
type_=typing.
|
|
803
|
+
type_=typing.Any, # type: ignore
|
|
816
804
|
object_=_response.json(),
|
|
817
805
|
),
|
|
818
806
|
),
|
|
@@ -821,9 +809,9 @@ class AsyncRawTextClient:
|
|
|
821
809
|
raise ForbiddenError(
|
|
822
810
|
headers=dict(_response.headers),
|
|
823
811
|
body=typing.cast(
|
|
824
|
-
typing.
|
|
812
|
+
typing.Any,
|
|
825
813
|
parse_obj_as(
|
|
826
|
-
type_=typing.
|
|
814
|
+
type_=typing.Any, # type: ignore
|
|
827
815
|
object_=_response.json(),
|
|
828
816
|
),
|
|
829
817
|
),
|
|
@@ -832,9 +820,9 @@ class AsyncRawTextClient:
|
|
|
832
820
|
raise UnprocessableEntityError(
|
|
833
821
|
headers=dict(_response.headers),
|
|
834
822
|
body=typing.cast(
|
|
835
|
-
typing.
|
|
823
|
+
typing.Any,
|
|
836
824
|
parse_obj_as(
|
|
837
|
-
type_=typing.
|
|
825
|
+
type_=typing.Any, # type: ignore
|
|
838
826
|
object_=_response.json(),
|
|
839
827
|
),
|
|
840
828
|
),
|
|
@@ -843,9 +831,9 @@ class AsyncRawTextClient:
|
|
|
843
831
|
raise TooManyRequestsError(
|
|
844
832
|
headers=dict(_response.headers),
|
|
845
833
|
body=typing.cast(
|
|
846
|
-
typing.
|
|
834
|
+
typing.Any,
|
|
847
835
|
parse_obj_as(
|
|
848
|
-
type_=typing.
|
|
836
|
+
type_=typing.Any, # type: ignore
|
|
849
837
|
object_=_response.json(),
|
|
850
838
|
),
|
|
851
839
|
),
|
|
@@ -854,9 +842,9 @@ class AsyncRawTextClient:
|
|
|
854
842
|
raise InternalServerError(
|
|
855
843
|
headers=dict(_response.headers),
|
|
856
844
|
body=typing.cast(
|
|
857
|
-
typing.
|
|
845
|
+
typing.Any,
|
|
858
846
|
parse_obj_as(
|
|
859
|
-
type_=typing.
|
|
847
|
+
type_=typing.Any, # type: ignore
|
|
860
848
|
object_=_response.json(),
|
|
861
849
|
),
|
|
862
850
|
),
|
|
@@ -994,9 +982,9 @@ class AsyncRawTextClient:
|
|
|
994
982
|
raise BadRequestError(
|
|
995
983
|
headers=dict(_response.headers),
|
|
996
984
|
body=typing.cast(
|
|
997
|
-
typing.
|
|
985
|
+
typing.Any,
|
|
998
986
|
parse_obj_as(
|
|
999
|
-
type_=typing.
|
|
987
|
+
type_=typing.Any, # type: ignore
|
|
1000
988
|
object_=_response.json(),
|
|
1001
989
|
),
|
|
1002
990
|
),
|
|
@@ -1005,9 +993,9 @@ class AsyncRawTextClient:
|
|
|
1005
993
|
raise ForbiddenError(
|
|
1006
994
|
headers=dict(_response.headers),
|
|
1007
995
|
body=typing.cast(
|
|
1008
|
-
typing.
|
|
996
|
+
typing.Any,
|
|
1009
997
|
parse_obj_as(
|
|
1010
|
-
type_=typing.
|
|
998
|
+
type_=typing.Any, # type: ignore
|
|
1011
999
|
object_=_response.json(),
|
|
1012
1000
|
),
|
|
1013
1001
|
),
|
|
@@ -1016,9 +1004,9 @@ class AsyncRawTextClient:
|
|
|
1016
1004
|
raise UnprocessableEntityError(
|
|
1017
1005
|
headers=dict(_response.headers),
|
|
1018
1006
|
body=typing.cast(
|
|
1019
|
-
typing.
|
|
1007
|
+
typing.Any,
|
|
1020
1008
|
parse_obj_as(
|
|
1021
|
-
type_=typing.
|
|
1009
|
+
type_=typing.Any, # type: ignore
|
|
1022
1010
|
object_=_response.json(),
|
|
1023
1011
|
),
|
|
1024
1012
|
),
|
|
@@ -1027,9 +1015,9 @@ class AsyncRawTextClient:
|
|
|
1027
1015
|
raise TooManyRequestsError(
|
|
1028
1016
|
headers=dict(_response.headers),
|
|
1029
1017
|
body=typing.cast(
|
|
1030
|
-
typing.
|
|
1018
|
+
typing.Any,
|
|
1031
1019
|
parse_obj_as(
|
|
1032
|
-
type_=typing.
|
|
1020
|
+
type_=typing.Any, # type: ignore
|
|
1033
1021
|
object_=_response.json(),
|
|
1034
1022
|
),
|
|
1035
1023
|
),
|
|
@@ -1038,9 +1026,9 @@ class AsyncRawTextClient:
|
|
|
1038
1026
|
raise InternalServerError(
|
|
1039
1027
|
headers=dict(_response.headers),
|
|
1040
1028
|
body=typing.cast(
|
|
1041
|
-
typing.
|
|
1029
|
+
typing.Any,
|
|
1042
1030
|
parse_obj_as(
|
|
1043
|
-
type_=typing.
|
|
1031
|
+
type_=typing.Any, # type: ignore
|
|
1044
1032
|
object_=_response.json(),
|
|
1045
1033
|
),
|
|
1046
1034
|
),
|
|
@@ -53,6 +53,15 @@ class TextToSpeechClient:
|
|
|
53
53
|
Parameters
|
|
54
54
|
----------
|
|
55
55
|
text : str
|
|
56
|
+
The text(s) to be converted into speech.
|
|
57
|
+
|
|
58
|
+
**Features:**
|
|
59
|
+
- Each text should be no longer than 1500 characters
|
|
60
|
+
- Supports code-mixed text (English and Indic languages)
|
|
61
|
+
|
|
62
|
+
**Important Note:**
|
|
63
|
+
- For numbers larger than 4 digits, use commas (e.g., '10,000' instead of '10000')
|
|
64
|
+
- This ensures proper pronunciation as a whole number
|
|
56
65
|
|
|
57
66
|
target_language_code : TextToSpeechLanguage
|
|
58
67
|
The language of the text is BCP-47 format
|
|
@@ -163,6 +172,15 @@ class AsyncTextToSpeechClient:
|
|
|
163
172
|
Parameters
|
|
164
173
|
----------
|
|
165
174
|
text : str
|
|
175
|
+
The text(s) to be converted into speech.
|
|
176
|
+
|
|
177
|
+
**Features:**
|
|
178
|
+
- Each text should be no longer than 1500 characters
|
|
179
|
+
- Supports code-mixed text (English and Indic languages)
|
|
180
|
+
|
|
181
|
+
**Important Note:**
|
|
182
|
+
- For numbers larger than 4 digits, use commas (e.g., '10,000' instead of '10000')
|
|
183
|
+
- This ensures proper pronunciation as a whole number
|
|
166
184
|
|
|
167
185
|
target_language_code : TextToSpeechLanguage
|
|
168
186
|
The language of the text is BCP-47 format
|
|
@@ -50,6 +50,15 @@ class RawTextToSpeechClient:
|
|
|
50
50
|
Parameters
|
|
51
51
|
----------
|
|
52
52
|
text : str
|
|
53
|
+
The text(s) to be converted into speech.
|
|
54
|
+
|
|
55
|
+
**Features:**
|
|
56
|
+
- Each text should be no longer than 1500 characters
|
|
57
|
+
- Supports code-mixed text (English and Indic languages)
|
|
58
|
+
|
|
59
|
+
**Important Note:**
|
|
60
|
+
- For numbers larger than 4 digits, use commas (e.g., '10,000' instead of '10000')
|
|
61
|
+
- This ensures proper pronunciation as a whole number
|
|
53
62
|
|
|
54
63
|
target_language_code : TextToSpeechLanguage
|
|
55
64
|
The language of the text is BCP-47 format
|
|
@@ -131,9 +140,9 @@ class RawTextToSpeechClient:
|
|
|
131
140
|
raise BadRequestError(
|
|
132
141
|
headers=dict(_response.headers),
|
|
133
142
|
body=typing.cast(
|
|
134
|
-
typing.
|
|
143
|
+
typing.Any,
|
|
135
144
|
parse_obj_as(
|
|
136
|
-
type_=typing.
|
|
145
|
+
type_=typing.Any, # type: ignore
|
|
137
146
|
object_=_response.json(),
|
|
138
147
|
),
|
|
139
148
|
),
|
|
@@ -142,9 +151,9 @@ class RawTextToSpeechClient:
|
|
|
142
151
|
raise ForbiddenError(
|
|
143
152
|
headers=dict(_response.headers),
|
|
144
153
|
body=typing.cast(
|
|
145
|
-
typing.
|
|
154
|
+
typing.Any,
|
|
146
155
|
parse_obj_as(
|
|
147
|
-
type_=typing.
|
|
156
|
+
type_=typing.Any, # type: ignore
|
|
148
157
|
object_=_response.json(),
|
|
149
158
|
),
|
|
150
159
|
),
|
|
@@ -153,9 +162,9 @@ class RawTextToSpeechClient:
|
|
|
153
162
|
raise UnprocessableEntityError(
|
|
154
163
|
headers=dict(_response.headers),
|
|
155
164
|
body=typing.cast(
|
|
156
|
-
typing.
|
|
165
|
+
typing.Any,
|
|
157
166
|
parse_obj_as(
|
|
158
|
-
type_=typing.
|
|
167
|
+
type_=typing.Any, # type: ignore
|
|
159
168
|
object_=_response.json(),
|
|
160
169
|
),
|
|
161
170
|
),
|
|
@@ -164,9 +173,9 @@ class RawTextToSpeechClient:
|
|
|
164
173
|
raise TooManyRequestsError(
|
|
165
174
|
headers=dict(_response.headers),
|
|
166
175
|
body=typing.cast(
|
|
167
|
-
typing.
|
|
176
|
+
typing.Any,
|
|
168
177
|
parse_obj_as(
|
|
169
|
-
type_=typing.
|
|
178
|
+
type_=typing.Any, # type: ignore
|
|
170
179
|
object_=_response.json(),
|
|
171
180
|
),
|
|
172
181
|
),
|
|
@@ -175,9 +184,9 @@ class RawTextToSpeechClient:
|
|
|
175
184
|
raise InternalServerError(
|
|
176
185
|
headers=dict(_response.headers),
|
|
177
186
|
body=typing.cast(
|
|
178
|
-
typing.
|
|
187
|
+
typing.Any,
|
|
179
188
|
parse_obj_as(
|
|
180
|
-
type_=typing.
|
|
189
|
+
type_=typing.Any, # type: ignore
|
|
181
190
|
object_=_response.json(),
|
|
182
191
|
),
|
|
183
192
|
),
|
|
@@ -214,6 +223,15 @@ class AsyncRawTextToSpeechClient:
|
|
|
214
223
|
Parameters
|
|
215
224
|
----------
|
|
216
225
|
text : str
|
|
226
|
+
The text(s) to be converted into speech.
|
|
227
|
+
|
|
228
|
+
**Features:**
|
|
229
|
+
- Each text should be no longer than 1500 characters
|
|
230
|
+
- Supports code-mixed text (English and Indic languages)
|
|
231
|
+
|
|
232
|
+
**Important Note:**
|
|
233
|
+
- For numbers larger than 4 digits, use commas (e.g., '10,000' instead of '10000')
|
|
234
|
+
- This ensures proper pronunciation as a whole number
|
|
217
235
|
|
|
218
236
|
target_language_code : TextToSpeechLanguage
|
|
219
237
|
The language of the text is BCP-47 format
|
|
@@ -295,9 +313,9 @@ class AsyncRawTextToSpeechClient:
|
|
|
295
313
|
raise BadRequestError(
|
|
296
314
|
headers=dict(_response.headers),
|
|
297
315
|
body=typing.cast(
|
|
298
|
-
typing.
|
|
316
|
+
typing.Any,
|
|
299
317
|
parse_obj_as(
|
|
300
|
-
type_=typing.
|
|
318
|
+
type_=typing.Any, # type: ignore
|
|
301
319
|
object_=_response.json(),
|
|
302
320
|
),
|
|
303
321
|
),
|
|
@@ -306,9 +324,9 @@ class AsyncRawTextToSpeechClient:
|
|
|
306
324
|
raise ForbiddenError(
|
|
307
325
|
headers=dict(_response.headers),
|
|
308
326
|
body=typing.cast(
|
|
309
|
-
typing.
|
|
327
|
+
typing.Any,
|
|
310
328
|
parse_obj_as(
|
|
311
|
-
type_=typing.
|
|
329
|
+
type_=typing.Any, # type: ignore
|
|
312
330
|
object_=_response.json(),
|
|
313
331
|
),
|
|
314
332
|
),
|
|
@@ -317,9 +335,9 @@ class AsyncRawTextToSpeechClient:
|
|
|
317
335
|
raise UnprocessableEntityError(
|
|
318
336
|
headers=dict(_response.headers),
|
|
319
337
|
body=typing.cast(
|
|
320
|
-
typing.
|
|
338
|
+
typing.Any,
|
|
321
339
|
parse_obj_as(
|
|
322
|
-
type_=typing.
|
|
340
|
+
type_=typing.Any, # type: ignore
|
|
323
341
|
object_=_response.json(),
|
|
324
342
|
),
|
|
325
343
|
),
|
|
@@ -328,9 +346,9 @@ class AsyncRawTextToSpeechClient:
|
|
|
328
346
|
raise TooManyRequestsError(
|
|
329
347
|
headers=dict(_response.headers),
|
|
330
348
|
body=typing.cast(
|
|
331
|
-
typing.
|
|
349
|
+
typing.Any,
|
|
332
350
|
parse_obj_as(
|
|
333
|
-
type_=typing.
|
|
351
|
+
type_=typing.Any, # type: ignore
|
|
334
352
|
object_=_response.json(),
|
|
335
353
|
),
|
|
336
354
|
),
|
|
@@ -339,9 +357,9 @@ class AsyncRawTextToSpeechClient:
|
|
|
339
357
|
raise InternalServerError(
|
|
340
358
|
headers=dict(_response.headers),
|
|
341
359
|
body=typing.cast(
|
|
342
|
-
typing.
|
|
360
|
+
typing.Any,
|
|
343
361
|
parse_obj_as(
|
|
344
|
-
type_=typing.
|
|
362
|
+
type_=typing.Any, # type: ignore
|
|
345
363
|
object_=_response.json(),
|
|
346
364
|
),
|
|
347
365
|
),
|
|
@@ -2,6 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
# isort: skip_file
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import typing
|
|
6
|
+
from importlib import import_module
|
|
7
|
+
|
|
8
|
+
if typing.TYPE_CHECKING:
|
|
9
|
+
from .types import TextToSpeechStreamingSendCompletionEvent
|
|
10
|
+
_dynamic_imports: typing.Dict[str, str] = {"TextToSpeechStreamingSendCompletionEvent": ".types"}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def __getattr__(attr_name: str) -> typing.Any:
|
|
14
|
+
module_name = _dynamic_imports.get(attr_name)
|
|
15
|
+
if module_name is None:
|
|
16
|
+
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
|
|
17
|
+
try:
|
|
18
|
+
module = import_module(module_name, __package__)
|
|
19
|
+
if module_name == f".{attr_name}":
|
|
20
|
+
return module
|
|
21
|
+
else:
|
|
22
|
+
return getattr(module, attr_name)
|
|
23
|
+
except ImportError as e:
|
|
24
|
+
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
|
|
25
|
+
except AttributeError as e:
|
|
26
|
+
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def __dir__():
|
|
30
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
|
31
|
+
return sorted(lazy_attrs)
|
|
32
|
+
|
|
6
33
|
|
|
7
34
|
__all__ = ["TextToSpeechStreamingSendCompletionEvent"]
|
|
@@ -2,6 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
# isort: skip_file
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import typing
|
|
6
|
+
from importlib import import_module
|
|
7
|
+
|
|
8
|
+
if typing.TYPE_CHECKING:
|
|
9
|
+
from .text_to_speech_streaming_send_completion_event import TextToSpeechStreamingSendCompletionEvent
|
|
10
|
+
_dynamic_imports: typing.Dict[str, str] = {
|
|
11
|
+
"TextToSpeechStreamingSendCompletionEvent": ".text_to_speech_streaming_send_completion_event"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def __getattr__(attr_name: str) -> typing.Any:
|
|
16
|
+
module_name = _dynamic_imports.get(attr_name)
|
|
17
|
+
if module_name is None:
|
|
18
|
+
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
|
|
19
|
+
try:
|
|
20
|
+
module = import_module(module_name, __package__)
|
|
21
|
+
if module_name == f".{attr_name}":
|
|
22
|
+
return module
|
|
23
|
+
else:
|
|
24
|
+
return getattr(module, attr_name)
|
|
25
|
+
except ImportError as e:
|
|
26
|
+
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
|
|
27
|
+
except AttributeError as e:
|
|
28
|
+
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def __dir__():
|
|
32
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
|
33
|
+
return sorted(lazy_attrs)
|
|
34
|
+
|
|
6
35
|
|
|
7
36
|
__all__ = ["TextToSpeechStreamingSendCompletionEvent"]
|