sarvamai 0.1.5a5__py3-none-any.whl → 0.1.5a6__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 (93) hide show
  1. sarvamai/__init__.py +1 -45
  2. sarvamai/chat/__init__.py +0 -2
  3. sarvamai/chat/client.py +10 -9
  4. sarvamai/chat/raw_client.py +37 -48
  5. sarvamai/client.py +31 -13
  6. sarvamai/core/__init__.py +0 -5
  7. sarvamai/core/api_error.py +5 -13
  8. sarvamai/core/client_wrapper.py +20 -17
  9. sarvamai/core/http_client.py +24 -70
  10. sarvamai/core/http_response.py +11 -19
  11. sarvamai/core/pydantic_utilities.py +108 -69
  12. sarvamai/environment.py +3 -10
  13. sarvamai/errors/__init__.py +0 -2
  14. sarvamai/errors/bad_request_error.py +3 -4
  15. sarvamai/errors/forbidden_error.py +3 -4
  16. sarvamai/errors/internal_server_error.py +3 -4
  17. sarvamai/errors/service_unavailable_error.py +2 -4
  18. sarvamai/errors/too_many_requests_error.py +3 -4
  19. sarvamai/errors/unprocessable_entity_error.py +3 -4
  20. sarvamai/requests/__init__.py +0 -18
  21. sarvamai/requests/chat_completion_request_message.py +1 -3
  22. sarvamai/requests/create_chat_completion_response.py +2 -2
  23. sarvamai/requests/diarized_transcript.py +1 -2
  24. sarvamai/requests/error_details.py +1 -0
  25. sarvamai/requests/language_identification_response.py +1 -0
  26. sarvamai/requests/speech_to_text_response.py +2 -1
  27. sarvamai/requests/speech_to_text_translate_response.py +1 -0
  28. sarvamai/requests/text_to_speech_response.py +2 -2
  29. sarvamai/requests/timestamps_model.py +1 -2
  30. sarvamai/requests/translation_response.py +1 -0
  31. sarvamai/requests/transliteration_response.py +1 -0
  32. sarvamai/speech_to_text/__init__.py +0 -2
  33. sarvamai/speech_to_text/client.py +14 -13
  34. sarvamai/speech_to_text/raw_client.py +68 -99
  35. sarvamai/text/__init__.py +0 -2
  36. sarvamai/text/client.py +25 -24
  37. sarvamai/text/raw_client.py +91 -126
  38. sarvamai/text_to_speech/__init__.py +0 -2
  39. sarvamai/text_to_speech/client.py +11 -10
  40. sarvamai/text_to_speech/raw_client.py +38 -49
  41. sarvamai/types/__init__.py +0 -24
  42. sarvamai/types/chat_completion_request_assistant_message.py +3 -3
  43. sarvamai/types/chat_completion_request_message.py +2 -3
  44. sarvamai/types/chat_completion_request_system_message.py +3 -3
  45. sarvamai/types/chat_completion_request_user_message.py +3 -3
  46. sarvamai/types/chat_completion_response_message.py +3 -3
  47. sarvamai/types/choice.py +4 -4
  48. sarvamai/types/completion_usage.py +3 -3
  49. sarvamai/types/create_chat_completion_response.py +3 -3
  50. sarvamai/types/diarized_entry.py +3 -3
  51. sarvamai/types/diarized_transcript.py +3 -3
  52. sarvamai/types/error_details.py +3 -3
  53. sarvamai/types/error_message.py +4 -4
  54. sarvamai/types/language_identification_response.py +2 -2
  55. sarvamai/types/speech_to_text_response.py +3 -3
  56. sarvamai/types/speech_to_text_translate_response.py +3 -3
  57. sarvamai/types/text_to_speech_response.py +2 -2
  58. sarvamai/types/timestamps_model.py +2 -2
  59. sarvamai/types/translation_response.py +2 -2
  60. sarvamai/types/transliteration_response.py +2 -2
  61. sarvamai-0.1.5a6.dist-info/METADATA +174 -0
  62. sarvamai-0.1.5a6.dist-info/RECORD +106 -0
  63. sarvamai/core/events.py +0 -30
  64. sarvamai/core/force_multipart.py +0 -16
  65. sarvamai/requests/audio_data.py +0 -21
  66. sarvamai/requests/audio_message.py +0 -8
  67. sarvamai/requests/error_data.py +0 -15
  68. sarvamai/requests/events_data.py +0 -17
  69. sarvamai/requests/speech_to_text_streaming_response.py +0 -10
  70. sarvamai/requests/speech_to_text_streaming_response_data.py +0 -9
  71. sarvamai/requests/transcription_data.py +0 -35
  72. sarvamai/requests/transcription_metrics.py +0 -15
  73. sarvamai/speech_to_text_streaming/__init__.py +0 -7
  74. sarvamai/speech_to_text_streaming/client.py +0 -189
  75. sarvamai/speech_to_text_streaming/raw_client.py +0 -166
  76. sarvamai/speech_to_text_streaming/socket_client.py +0 -129
  77. sarvamai/speech_to_text_streaming/types/__init__.py +0 -8
  78. sarvamai/speech_to_text_streaming/types/speech_to_text_streaming_language_code.py +0 -8
  79. sarvamai/speech_to_text_streaming/types/speech_to_text_streaming_model.py +0 -5
  80. sarvamai/types/audio_data.py +0 -33
  81. sarvamai/types/audio_data_encoding.py +0 -5
  82. sarvamai/types/audio_message.py +0 -20
  83. sarvamai/types/error_data.py +0 -27
  84. sarvamai/types/events_data.py +0 -28
  85. sarvamai/types/format.py +0 -5
  86. sarvamai/types/speech_to_text_streaming_response.py +0 -22
  87. sarvamai/types/speech_to_text_streaming_response_data.py +0 -9
  88. sarvamai/types/speech_to_text_streaming_response_type.py +0 -5
  89. sarvamai/types/transcription_data.py +0 -45
  90. sarvamai/types/transcription_metrics.py +0 -27
  91. sarvamai-0.1.5a5.dist-info/METADATA +0 -28
  92. sarvamai-0.1.5a5.dist-info/RECORD +0 -134
  93. {sarvamai-0.1.5a5.dist-info → sarvamai-0.1.5a6.dist-info}/WHEEL +0 -0
@@ -1,31 +1,32 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
3
  import typing
4
- from json.decoder import JSONDecodeError
5
-
6
- from ..core.api_error import ApiError
7
- from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
- from ..core.http_response import AsyncHttpResponse, HttpResponse
9
- from ..core.pydantic_utilities import parse_obj_as
4
+ from ..core.client_wrapper import SyncClientWrapper
5
+ from ..types.translate_source_language import TranslateSourceLanguage
6
+ from ..types.translate_target_language import TranslateTargetLanguage
7
+ from ..types.translate_speaker_gender import TranslateSpeakerGender
8
+ from ..types.translate_mode import TranslateMode
9
+ from ..types.translate_model import TranslateModel
10
+ from ..types.transliterate_mode import TransliterateMode
11
+ from ..types.numerals_format import NumeralsFormat
10
12
  from ..core.request_options import RequestOptions
13
+ from ..core.http_response import HttpResponse
14
+ from ..types.translation_response import TranslationResponse
15
+ from ..core.pydantic_utilities import parse_obj_as
11
16
  from ..errors.bad_request_error import BadRequestError
12
17
  from ..errors.forbidden_error import ForbiddenError
13
- from ..errors.internal_server_error import InternalServerError
14
- from ..errors.too_many_requests_error import TooManyRequestsError
15
18
  from ..errors.unprocessable_entity_error import UnprocessableEntityError
19
+ from ..errors.too_many_requests_error import TooManyRequestsError
20
+ from ..errors.internal_server_error import InternalServerError
21
+ from json.decoder import JSONDecodeError
22
+ from ..core.api_error import ApiError
16
23
  from ..types.language_identification_response import LanguageIdentificationResponse
17
- from ..types.numerals_format import NumeralsFormat
18
- from ..types.spoken_form_numerals_format import SpokenFormNumeralsFormat
19
- from ..types.translate_mode import TranslateMode
20
- from ..types.translate_model import TranslateModel
21
- from ..types.translate_source_language import TranslateSourceLanguage
22
- from ..types.translate_speaker_gender import TranslateSpeakerGender
23
- from ..types.translate_target_language import TranslateTargetLanguage
24
- from ..types.translation_response import TranslationResponse
25
- from ..types.translatiterate_target_language import TranslatiterateTargetLanguage
26
- from ..types.transliterate_mode import TransliterateMode
27
24
  from ..types.transliterate_source_language import TransliterateSourceLanguage
25
+ from ..types.translatiterate_target_language import TranslatiterateTargetLanguage
26
+ from ..types.spoken_form_numerals_format import SpokenFormNumeralsFormat
28
27
  from ..types.transliteration_response import TransliterationResponse
28
+ from ..core.client_wrapper import AsyncClientWrapper
29
+ from ..core.http_response import AsyncHttpResponse
29
30
 
30
31
  # this is used as the default value for optional parameters
31
32
  OMIT = typing.cast(typing.Any, ...)
@@ -165,7 +166,6 @@ class RawTextClient:
165
166
  """
166
167
  _response = self._client_wrapper.httpx_client.request(
167
168
  "translate",
168
- base_url=self._client_wrapper.get_environment().base,
169
169
  method="POST",
170
170
  json={
171
171
  "input": input,
@@ -196,63 +196,58 @@ class RawTextClient:
196
196
  return HttpResponse(response=_response, data=_data)
197
197
  if _response.status_code == 400:
198
198
  raise BadRequestError(
199
- headers=dict(_response.headers),
200
- body=typing.cast(
199
+ typing.cast(
201
200
  typing.Optional[typing.Any],
202
201
  parse_obj_as(
203
202
  type_=typing.Optional[typing.Any], # type: ignore
204
203
  object_=_response.json(),
205
204
  ),
206
- ),
205
+ )
207
206
  )
208
207
  if _response.status_code == 403:
209
208
  raise ForbiddenError(
210
- headers=dict(_response.headers),
211
- body=typing.cast(
209
+ typing.cast(
212
210
  typing.Optional[typing.Any],
213
211
  parse_obj_as(
214
212
  type_=typing.Optional[typing.Any], # type: ignore
215
213
  object_=_response.json(),
216
214
  ),
217
- ),
215
+ )
218
216
  )
219
217
  if _response.status_code == 422:
220
218
  raise UnprocessableEntityError(
221
- headers=dict(_response.headers),
222
- body=typing.cast(
219
+ typing.cast(
223
220
  typing.Optional[typing.Any],
224
221
  parse_obj_as(
225
222
  type_=typing.Optional[typing.Any], # type: ignore
226
223
  object_=_response.json(),
227
224
  ),
228
- ),
225
+ )
229
226
  )
230
227
  if _response.status_code == 429:
231
228
  raise TooManyRequestsError(
232
- headers=dict(_response.headers),
233
- body=typing.cast(
229
+ typing.cast(
234
230
  typing.Optional[typing.Any],
235
231
  parse_obj_as(
236
232
  type_=typing.Optional[typing.Any], # type: ignore
237
233
  object_=_response.json(),
238
234
  ),
239
- ),
235
+ )
240
236
  )
241
237
  if _response.status_code == 500:
242
238
  raise InternalServerError(
243
- headers=dict(_response.headers),
244
- body=typing.cast(
239
+ typing.cast(
245
240
  typing.Optional[typing.Any],
246
241
  parse_obj_as(
247
242
  type_=typing.Optional[typing.Any], # type: ignore
248
243
  object_=_response.json(),
249
244
  ),
250
- ),
245
+ )
251
246
  )
252
247
  _response_json = _response.json()
253
248
  except JSONDecodeError:
254
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
255
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
249
+ raise ApiError(status_code=_response.status_code, body=_response.text)
250
+ raise ApiError(status_code=_response.status_code, body=_response_json)
256
251
 
257
252
  def identify_language(
258
253
  self, *, input: str, request_options: typing.Optional[RequestOptions] = None
@@ -275,7 +270,6 @@ class RawTextClient:
275
270
  """
276
271
  _response = self._client_wrapper.httpx_client.request(
277
272
  "text-lid",
278
- base_url=self._client_wrapper.get_environment().base,
279
273
  method="POST",
280
274
  json={
281
275
  "input": input,
@@ -298,63 +292,58 @@ class RawTextClient:
298
292
  return HttpResponse(response=_response, data=_data)
299
293
  if _response.status_code == 400:
300
294
  raise BadRequestError(
301
- headers=dict(_response.headers),
302
- body=typing.cast(
295
+ typing.cast(
303
296
  typing.Optional[typing.Any],
304
297
  parse_obj_as(
305
298
  type_=typing.Optional[typing.Any], # type: ignore
306
299
  object_=_response.json(),
307
300
  ),
308
- ),
301
+ )
309
302
  )
310
303
  if _response.status_code == 403:
311
304
  raise ForbiddenError(
312
- headers=dict(_response.headers),
313
- body=typing.cast(
305
+ typing.cast(
314
306
  typing.Optional[typing.Any],
315
307
  parse_obj_as(
316
308
  type_=typing.Optional[typing.Any], # type: ignore
317
309
  object_=_response.json(),
318
310
  ),
319
- ),
311
+ )
320
312
  )
321
313
  if _response.status_code == 422:
322
314
  raise UnprocessableEntityError(
323
- headers=dict(_response.headers),
324
- body=typing.cast(
315
+ typing.cast(
325
316
  typing.Optional[typing.Any],
326
317
  parse_obj_as(
327
318
  type_=typing.Optional[typing.Any], # type: ignore
328
319
  object_=_response.json(),
329
320
  ),
330
- ),
321
+ )
331
322
  )
332
323
  if _response.status_code == 429:
333
324
  raise TooManyRequestsError(
334
- headers=dict(_response.headers),
335
- body=typing.cast(
325
+ typing.cast(
336
326
  typing.Optional[typing.Any],
337
327
  parse_obj_as(
338
328
  type_=typing.Optional[typing.Any], # type: ignore
339
329
  object_=_response.json(),
340
330
  ),
341
- ),
331
+ )
342
332
  )
343
333
  if _response.status_code == 500:
344
334
  raise InternalServerError(
345
- headers=dict(_response.headers),
346
- body=typing.cast(
335
+ typing.cast(
347
336
  typing.Optional[typing.Any],
348
337
  parse_obj_as(
349
338
  type_=typing.Optional[typing.Any], # type: ignore
350
339
  object_=_response.json(),
351
340
  ),
352
- ),
341
+ )
353
342
  )
354
343
  _response_json = _response.json()
355
344
  except JSONDecodeError:
356
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
357
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
345
+ raise ApiError(status_code=_response.status_code, body=_response.text)
346
+ raise ApiError(status_code=_response.status_code, body=_response_json)
358
347
 
359
348
  def transliterate(
360
349
  self,
@@ -454,7 +443,6 @@ class RawTextClient:
454
443
  """
455
444
  _response = self._client_wrapper.httpx_client.request(
456
445
  "transliterate",
457
- base_url=self._client_wrapper.get_environment().base,
458
446
  method="POST",
459
447
  json={
460
448
  "input": input,
@@ -482,63 +470,58 @@ class RawTextClient:
482
470
  return HttpResponse(response=_response, data=_data)
483
471
  if _response.status_code == 400:
484
472
  raise BadRequestError(
485
- headers=dict(_response.headers),
486
- body=typing.cast(
473
+ typing.cast(
487
474
  typing.Optional[typing.Any],
488
475
  parse_obj_as(
489
476
  type_=typing.Optional[typing.Any], # type: ignore
490
477
  object_=_response.json(),
491
478
  ),
492
- ),
479
+ )
493
480
  )
494
481
  if _response.status_code == 403:
495
482
  raise ForbiddenError(
496
- headers=dict(_response.headers),
497
- body=typing.cast(
483
+ typing.cast(
498
484
  typing.Optional[typing.Any],
499
485
  parse_obj_as(
500
486
  type_=typing.Optional[typing.Any], # type: ignore
501
487
  object_=_response.json(),
502
488
  ),
503
- ),
489
+ )
504
490
  )
505
491
  if _response.status_code == 422:
506
492
  raise UnprocessableEntityError(
507
- headers=dict(_response.headers),
508
- body=typing.cast(
493
+ typing.cast(
509
494
  typing.Optional[typing.Any],
510
495
  parse_obj_as(
511
496
  type_=typing.Optional[typing.Any], # type: ignore
512
497
  object_=_response.json(),
513
498
  ),
514
- ),
499
+ )
515
500
  )
516
501
  if _response.status_code == 429:
517
502
  raise TooManyRequestsError(
518
- headers=dict(_response.headers),
519
- body=typing.cast(
503
+ typing.cast(
520
504
  typing.Optional[typing.Any],
521
505
  parse_obj_as(
522
506
  type_=typing.Optional[typing.Any], # type: ignore
523
507
  object_=_response.json(),
524
508
  ),
525
- ),
509
+ )
526
510
  )
527
511
  if _response.status_code == 500:
528
512
  raise InternalServerError(
529
- headers=dict(_response.headers),
530
- body=typing.cast(
513
+ typing.cast(
531
514
  typing.Optional[typing.Any],
532
515
  parse_obj_as(
533
516
  type_=typing.Optional[typing.Any], # type: ignore
534
517
  object_=_response.json(),
535
518
  ),
536
- ),
519
+ )
537
520
  )
538
521
  _response_json = _response.json()
539
522
  except JSONDecodeError:
540
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
541
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
523
+ raise ApiError(status_code=_response.status_code, body=_response.text)
524
+ raise ApiError(status_code=_response.status_code, body=_response_json)
542
525
 
543
526
 
544
527
  class AsyncRawTextClient:
@@ -675,7 +658,6 @@ class AsyncRawTextClient:
675
658
  """
676
659
  _response = await self._client_wrapper.httpx_client.request(
677
660
  "translate",
678
- base_url=self._client_wrapper.get_environment().base,
679
661
  method="POST",
680
662
  json={
681
663
  "input": input,
@@ -706,63 +688,58 @@ class AsyncRawTextClient:
706
688
  return AsyncHttpResponse(response=_response, data=_data)
707
689
  if _response.status_code == 400:
708
690
  raise BadRequestError(
709
- headers=dict(_response.headers),
710
- body=typing.cast(
691
+ typing.cast(
711
692
  typing.Optional[typing.Any],
712
693
  parse_obj_as(
713
694
  type_=typing.Optional[typing.Any], # type: ignore
714
695
  object_=_response.json(),
715
696
  ),
716
- ),
697
+ )
717
698
  )
718
699
  if _response.status_code == 403:
719
700
  raise ForbiddenError(
720
- headers=dict(_response.headers),
721
- body=typing.cast(
701
+ typing.cast(
722
702
  typing.Optional[typing.Any],
723
703
  parse_obj_as(
724
704
  type_=typing.Optional[typing.Any], # type: ignore
725
705
  object_=_response.json(),
726
706
  ),
727
- ),
707
+ )
728
708
  )
729
709
  if _response.status_code == 422:
730
710
  raise UnprocessableEntityError(
731
- headers=dict(_response.headers),
732
- body=typing.cast(
711
+ typing.cast(
733
712
  typing.Optional[typing.Any],
734
713
  parse_obj_as(
735
714
  type_=typing.Optional[typing.Any], # type: ignore
736
715
  object_=_response.json(),
737
716
  ),
738
- ),
717
+ )
739
718
  )
740
719
  if _response.status_code == 429:
741
720
  raise TooManyRequestsError(
742
- headers=dict(_response.headers),
743
- body=typing.cast(
721
+ typing.cast(
744
722
  typing.Optional[typing.Any],
745
723
  parse_obj_as(
746
724
  type_=typing.Optional[typing.Any], # type: ignore
747
725
  object_=_response.json(),
748
726
  ),
749
- ),
727
+ )
750
728
  )
751
729
  if _response.status_code == 500:
752
730
  raise InternalServerError(
753
- headers=dict(_response.headers),
754
- body=typing.cast(
731
+ typing.cast(
755
732
  typing.Optional[typing.Any],
756
733
  parse_obj_as(
757
734
  type_=typing.Optional[typing.Any], # type: ignore
758
735
  object_=_response.json(),
759
736
  ),
760
- ),
737
+ )
761
738
  )
762
739
  _response_json = _response.json()
763
740
  except JSONDecodeError:
764
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
765
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
741
+ raise ApiError(status_code=_response.status_code, body=_response.text)
742
+ raise ApiError(status_code=_response.status_code, body=_response_json)
766
743
 
767
744
  async def identify_language(
768
745
  self, *, input: str, request_options: typing.Optional[RequestOptions] = None
@@ -785,7 +762,6 @@ class AsyncRawTextClient:
785
762
  """
786
763
  _response = await self._client_wrapper.httpx_client.request(
787
764
  "text-lid",
788
- base_url=self._client_wrapper.get_environment().base,
789
765
  method="POST",
790
766
  json={
791
767
  "input": input,
@@ -808,63 +784,58 @@ class AsyncRawTextClient:
808
784
  return AsyncHttpResponse(response=_response, data=_data)
809
785
  if _response.status_code == 400:
810
786
  raise BadRequestError(
811
- headers=dict(_response.headers),
812
- body=typing.cast(
787
+ typing.cast(
813
788
  typing.Optional[typing.Any],
814
789
  parse_obj_as(
815
790
  type_=typing.Optional[typing.Any], # type: ignore
816
791
  object_=_response.json(),
817
792
  ),
818
- ),
793
+ )
819
794
  )
820
795
  if _response.status_code == 403:
821
796
  raise ForbiddenError(
822
- headers=dict(_response.headers),
823
- body=typing.cast(
797
+ typing.cast(
824
798
  typing.Optional[typing.Any],
825
799
  parse_obj_as(
826
800
  type_=typing.Optional[typing.Any], # type: ignore
827
801
  object_=_response.json(),
828
802
  ),
829
- ),
803
+ )
830
804
  )
831
805
  if _response.status_code == 422:
832
806
  raise UnprocessableEntityError(
833
- headers=dict(_response.headers),
834
- body=typing.cast(
807
+ typing.cast(
835
808
  typing.Optional[typing.Any],
836
809
  parse_obj_as(
837
810
  type_=typing.Optional[typing.Any], # type: ignore
838
811
  object_=_response.json(),
839
812
  ),
840
- ),
813
+ )
841
814
  )
842
815
  if _response.status_code == 429:
843
816
  raise TooManyRequestsError(
844
- headers=dict(_response.headers),
845
- body=typing.cast(
817
+ typing.cast(
846
818
  typing.Optional[typing.Any],
847
819
  parse_obj_as(
848
820
  type_=typing.Optional[typing.Any], # type: ignore
849
821
  object_=_response.json(),
850
822
  ),
851
- ),
823
+ )
852
824
  )
853
825
  if _response.status_code == 500:
854
826
  raise InternalServerError(
855
- headers=dict(_response.headers),
856
- body=typing.cast(
827
+ typing.cast(
857
828
  typing.Optional[typing.Any],
858
829
  parse_obj_as(
859
830
  type_=typing.Optional[typing.Any], # type: ignore
860
831
  object_=_response.json(),
861
832
  ),
862
- ),
833
+ )
863
834
  )
864
835
  _response_json = _response.json()
865
836
  except JSONDecodeError:
866
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
867
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
837
+ raise ApiError(status_code=_response.status_code, body=_response.text)
838
+ raise ApiError(status_code=_response.status_code, body=_response_json)
868
839
 
869
840
  async def transliterate(
870
841
  self,
@@ -964,7 +935,6 @@ class AsyncRawTextClient:
964
935
  """
965
936
  _response = await self._client_wrapper.httpx_client.request(
966
937
  "transliterate",
967
- base_url=self._client_wrapper.get_environment().base,
968
938
  method="POST",
969
939
  json={
970
940
  "input": input,
@@ -992,60 +962,55 @@ class AsyncRawTextClient:
992
962
  return AsyncHttpResponse(response=_response, data=_data)
993
963
  if _response.status_code == 400:
994
964
  raise BadRequestError(
995
- headers=dict(_response.headers),
996
- body=typing.cast(
965
+ typing.cast(
997
966
  typing.Optional[typing.Any],
998
967
  parse_obj_as(
999
968
  type_=typing.Optional[typing.Any], # type: ignore
1000
969
  object_=_response.json(),
1001
970
  ),
1002
- ),
971
+ )
1003
972
  )
1004
973
  if _response.status_code == 403:
1005
974
  raise ForbiddenError(
1006
- headers=dict(_response.headers),
1007
- body=typing.cast(
975
+ typing.cast(
1008
976
  typing.Optional[typing.Any],
1009
977
  parse_obj_as(
1010
978
  type_=typing.Optional[typing.Any], # type: ignore
1011
979
  object_=_response.json(),
1012
980
  ),
1013
- ),
981
+ )
1014
982
  )
1015
983
  if _response.status_code == 422:
1016
984
  raise UnprocessableEntityError(
1017
- headers=dict(_response.headers),
1018
- body=typing.cast(
985
+ typing.cast(
1019
986
  typing.Optional[typing.Any],
1020
987
  parse_obj_as(
1021
988
  type_=typing.Optional[typing.Any], # type: ignore
1022
989
  object_=_response.json(),
1023
990
  ),
1024
- ),
991
+ )
1025
992
  )
1026
993
  if _response.status_code == 429:
1027
994
  raise TooManyRequestsError(
1028
- headers=dict(_response.headers),
1029
- body=typing.cast(
995
+ typing.cast(
1030
996
  typing.Optional[typing.Any],
1031
997
  parse_obj_as(
1032
998
  type_=typing.Optional[typing.Any], # type: ignore
1033
999
  object_=_response.json(),
1034
1000
  ),
1035
- ),
1001
+ )
1036
1002
  )
1037
1003
  if _response.status_code == 500:
1038
1004
  raise InternalServerError(
1039
- headers=dict(_response.headers),
1040
- body=typing.cast(
1005
+ typing.cast(
1041
1006
  typing.Optional[typing.Any],
1042
1007
  parse_obj_as(
1043
1008
  type_=typing.Optional[typing.Any], # type: ignore
1044
1009
  object_=_response.json(),
1045
1010
  ),
1046
- ),
1011
+ )
1047
1012
  )
1048
1013
  _response_json = _response.json()
1049
1014
  except JSONDecodeError:
1050
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1051
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1015
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1016
+ raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -1,4 +1,2 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- # isort: skip_file
4
-
@@ -1,15 +1,16 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
3
  import typing
4
-
5
- from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6
- from ..core.request_options import RequestOptions
7
- from ..types.speech_sample_rate import SpeechSampleRate
4
+ from ..core.client_wrapper import SyncClientWrapper
5
+ from .raw_client import RawTextToSpeechClient
8
6
  from ..types.text_to_speech_language import TextToSpeechLanguage
7
+ from ..types.text_to_speech_speaker import TextToSpeechSpeaker
8
+ from ..types.speech_sample_rate import SpeechSampleRate
9
9
  from ..types.text_to_speech_model import TextToSpeechModel
10
+ from ..core.request_options import RequestOptions
10
11
  from ..types.text_to_speech_response import TextToSpeechResponse
11
- from ..types.text_to_speech_speaker import TextToSpeechSpeaker
12
- from .raw_client import AsyncRawTextToSpeechClient, RawTextToSpeechClient
12
+ from ..core.client_wrapper import AsyncClientWrapper
13
+ from .raw_client import AsyncRawTextToSpeechClient
13
14
 
14
15
  # this is used as the default value for optional parameters
15
16
  OMIT = typing.cast(typing.Any, ...)
@@ -109,7 +110,7 @@ class TextToSpeechClient:
109
110
  target_language_code="bn-IN",
110
111
  )
111
112
  """
112
- _response = self._raw_client.convert(
113
+ response = self._raw_client.convert(
113
114
  text=text,
114
115
  target_language_code=target_language_code,
115
116
  speaker=speaker,
@@ -121,7 +122,7 @@ class TextToSpeechClient:
121
122
  model=model,
122
123
  request_options=request_options,
123
124
  )
124
- return _response.data
125
+ return response.data
125
126
 
126
127
 
127
128
  class AsyncTextToSpeechClient:
@@ -226,7 +227,7 @@ class AsyncTextToSpeechClient:
226
227
 
227
228
  asyncio.run(main())
228
229
  """
229
- _response = await self._raw_client.convert(
230
+ response = await self._raw_client.convert(
230
231
  text=text,
231
232
  target_language_code=target_language_code,
232
233
  speaker=speaker,
@@ -238,4 +239,4 @@ class AsyncTextToSpeechClient:
238
239
  model=model,
239
240
  request_options=request_options,
240
241
  )
241
- return _response.data
242
+ return response.data