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