camb-sdk 1.5.4__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 (167) hide show
  1. camb/__init__.py +335 -0
  2. camb/audio_separation/__init__.py +4 -0
  3. camb/audio_separation/client.py +406 -0
  4. camb/audio_separation/raw_client.py +534 -0
  5. camb/client.py +717 -0
  6. camb/core/__init__.py +105 -0
  7. camb/core/api_error.py +23 -0
  8. camb/core/client_wrapper.py +113 -0
  9. camb/core/datetime_utils.py +28 -0
  10. camb/core/file.py +67 -0
  11. camb/core/force_multipart.py +18 -0
  12. camb/core/http_client.py +663 -0
  13. camb/core/http_response.py +55 -0
  14. camb/core/http_sse/__init__.py +42 -0
  15. camb/core/http_sse/_api.py +112 -0
  16. camb/core/http_sse/_decoders.py +61 -0
  17. camb/core/http_sse/_exceptions.py +7 -0
  18. camb/core/http_sse/_models.py +17 -0
  19. camb/core/jsonable_encoder.py +100 -0
  20. camb/core/pydantic_utilities.py +260 -0
  21. camb/core/query_encoder.py +58 -0
  22. camb/core/remove_none_from_dict.py +11 -0
  23. camb/core/request_options.py +35 -0
  24. camb/core/serialization.py +276 -0
  25. camb/deprecated_streaming/__init__.py +4 -0
  26. camb/deprecated_streaming/client.py +532 -0
  27. camb/deprecated_streaming/raw_client.py +639 -0
  28. camb/dictionaries/__init__.py +4 -0
  29. camb/dictionaries/client.py +785 -0
  30. camb/dictionaries/raw_client.py +1048 -0
  31. camb/dub/__init__.py +49 -0
  32. camb/dub/client.py +846 -0
  33. camb/dub/raw_client.py +1194 -0
  34. camb/dub/types/__init__.py +53 -0
  35. camb/dub/types/dubbed_output_in_alt_format_request_payload_output_format.py +8 -0
  36. camb/dub/types/get_dubbed_output_in_alt_format_dub_alt_format_run_id_language_post_response.py +9 -0
  37. camb/dub/types/get_dubbed_run_info_dub_result_run_id_get_response.py +7 -0
  38. camb/dub/types/get_dubbing_runs_results_dubbing_results_post_response_value.py +7 -0
  39. camb/environment.py +7 -0
  40. camb/errors/__init__.py +34 -0
  41. camb/errors/unprocessable_entity_error.py +11 -0
  42. camb/folders/__init__.py +4 -0
  43. camb/folders/client.py +213 -0
  44. camb/folders/raw_client.py +278 -0
  45. camb/languages/__init__.py +4 -0
  46. camb/languages/client.py +168 -0
  47. camb/languages/raw_client.py +223 -0
  48. camb/project_setup/__init__.py +4 -0
  49. camb/project_setup/client.py +537 -0
  50. camb/project_setup/raw_client.py +655 -0
  51. camb/py.typed +0 -0
  52. camb/raw_client.py +236 -0
  53. camb/story/__init__.py +37 -0
  54. camb/story/client.py +579 -0
  55. camb/story/raw_client.py +743 -0
  56. camb/story/types/__init__.py +38 -0
  57. camb/story/types/create_story_story_post_response.py +8 -0
  58. camb/story/types/setup_story_story_setup_post_response.py +8 -0
  59. camb/streaming/__init__.py +4 -0
  60. camb/streaming/client.py +645 -0
  61. camb/streaming/raw_client.py +796 -0
  62. camb/text_to_audio/__init__.py +4 -0
  63. camb/text_to_audio/client.py +469 -0
  64. camb/text_to_audio/raw_client.py +610 -0
  65. camb/text_to_speech/__init__.py +49 -0
  66. camb/text_to_speech/baseten.py +214 -0
  67. camb/text_to_speech/client.py +742 -0
  68. camb/text_to_speech/raw_client.py +995 -0
  69. camb/text_to_speech/types/__init__.py +47 -0
  70. camb/text_to_speech/types/create_stream_tts_request_payload_language.py +71 -0
  71. camb/text_to_speech/types/create_stream_tts_request_payload_speech_model.py +7 -0
  72. camb/text_to_speech/types/get_tts_results_tts_results_post_response_value.py +7 -0
  73. camb/text_to_speech/types/get_tts_run_info_tts_result_run_id_get_response.py +7 -0
  74. camb/text_to_voice/__init__.py +4 -0
  75. camb/text_to_voice/client.py +329 -0
  76. camb/text_to_voice/raw_client.py +405 -0
  77. camb/transcription/__init__.py +4 -0
  78. camb/transcription/client.py +465 -0
  79. camb/transcription/raw_client.py +587 -0
  80. camb/translated_story/__init__.py +4 -0
  81. camb/translated_story/client.py +309 -0
  82. camb/translated_story/raw_client.py +381 -0
  83. camb/translated_tts/__init__.py +4 -0
  84. camb/translated_tts/client.py +313 -0
  85. camb/translated_tts/raw_client.py +357 -0
  86. camb/translation/__init__.py +4 -0
  87. camb/translation/client.py +631 -0
  88. camb/translation/raw_client.py +787 -0
  89. camb/types/__init__.py +236 -0
  90. camb/types/add_target_language_out.py +20 -0
  91. camb/types/audio_output_type.py +5 -0
  92. camb/types/audio_stream.py +31 -0
  93. camb/types/config_stream.py +22 -0
  94. camb/types/config_stream_pipeline.py +28 -0
  95. camb/types/create_custom_voice_out.py +19 -0
  96. camb/types/create_project_setup_out.py +19 -0
  97. camb/types/create_stream_out.py +22 -0
  98. camb/types/create_stream_request_payload.py +70 -0
  99. camb/types/create_translated_tts_out.py +19 -0
  100. camb/types/create_tts_out.py +19 -0
  101. camb/types/data_stream.py +24 -0
  102. camb/types/demixing_option.py +10 -0
  103. camb/types/dictionary_term.py +21 -0
  104. camb/types/dictionary_with_terms.py +28 -0
  105. camb/types/dubbing_result.py +22 -0
  106. camb/types/exception_reasons.py +30 -0
  107. camb/types/folder.py +20 -0
  108. camb/types/formalities.py +3 -0
  109. camb/types/gender.py +3 -0
  110. camb/types/get_audio_separation_result_out.py +20 -0
  111. camb/types/get_create_project_setup_response.py +21 -0
  112. camb/types/get_probe_stream_in.py +21 -0
  113. camb/types/get_probe_stream_out.py +24 -0
  114. camb/types/get_setup_story_result_response.py +21 -0
  115. camb/types/get_text_to_voice_result_out.py +19 -0
  116. camb/types/get_tts_result_out_file_url.py +19 -0
  117. camb/types/http_validation_error.py +20 -0
  118. camb/types/language_enums.py +154 -0
  119. camb/types/language_pydantic_model.py +21 -0
  120. camb/types/languages.py +3 -0
  121. camb/types/orchestrator_pipeline_call_result.py +19 -0
  122. camb/types/orchestrator_pipeline_result.py +25 -0
  123. camb/types/orchestrator_pipeline_result_exception_reason.py +7 -0
  124. camb/types/orchestrator_pipeline_result_message.py +5 -0
  125. camb/types/output_format.py +10 -0
  126. camb/types/overdub_config.py +37 -0
  127. camb/types/project_details.py +28 -0
  128. camb/types/revoicing_option.py +5 -0
  129. camb/types/run_i_ds_request_payload.py +19 -0
  130. camb/types/segmenting_option.py +5 -0
  131. camb/types/source_stream.py +30 -0
  132. camb/types/story_details.py +27 -0
  133. camb/types/stream_category.py +3 -0
  134. camb/types/stream_tts_inference_options.py +38 -0
  135. camb/types/stream_tts_output_configuration.py +33 -0
  136. camb/types/stream_tts_voice_settings.py +28 -0
  137. camb/types/stream_type.py +3 -0
  138. camb/types/stream_url_for_languages.py +21 -0
  139. camb/types/target_stream.py +34 -0
  140. camb/types/task_status.py +5 -0
  141. camb/types/term_translation_input.py +21 -0
  142. camb/types/term_translation_output.py +20 -0
  143. camb/types/text_to_audio_result.py +19 -0
  144. camb/types/text_to_audio_type.py +5 -0
  145. camb/types/transcribing_option.py +5 -0
  146. camb/types/transcript.py +22 -0
  147. camb/types/transcript_data_type.py +5 -0
  148. camb/types/transcript_file_format.py +5 -0
  149. camb/types/transcription_result.py +20 -0
  150. camb/types/translating_option.py +5 -0
  151. camb/types/translation_result.py +19 -0
  152. camb/types/tts_provider.py +3 -0
  153. camb/types/validation_error.py +22 -0
  154. camb/types/validation_error_loc_item.py +5 -0
  155. camb/types/video_output_type_without_avi.py +5 -0
  156. camb/types/video_stream.py +28 -0
  157. camb/types/voice.py +28 -0
  158. camb/voice_cloning/__init__.py +34 -0
  159. camb/voice_cloning/client.py +265 -0
  160. camb/voice_cloning/raw_client.py +320 -0
  161. camb/voice_cloning/types/__init__.py +36 -0
  162. camb/voice_cloning/types/list_voices_list_voices_get_response_item.py +7 -0
  163. camb_sdk-1.5.4.dist-info/METADATA +282 -0
  164. camb_sdk-1.5.4.dist-info/RECORD +167 -0
  165. camb_sdk-1.5.4.dist-info/WHEEL +5 -0
  166. camb_sdk-1.5.4.dist-info/licenses/LICENSE +21 -0
  167. camb_sdk-1.5.4.dist-info/top_level.txt +1 -0
@@ -0,0 +1,265 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from .. import core
6
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
7
+ from ..core.request_options import RequestOptions
8
+ from ..types.create_custom_voice_out import CreateCustomVoiceOut
9
+ from ..types.gender import Gender
10
+ from ..types.languages import Languages
11
+ from .raw_client import AsyncRawVoiceCloningClient, RawVoiceCloningClient
12
+ from .types.list_voices_list_voices_get_response_item import ListVoicesListVoicesGetResponseItem
13
+
14
+ # this is used as the default value for optional parameters
15
+ OMIT = typing.cast(typing.Any, ...)
16
+
17
+
18
+ class VoiceCloningClient:
19
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
20
+ self._raw_client = RawVoiceCloningClient(client_wrapper=client_wrapper)
21
+
22
+ @property
23
+ def with_raw_response(self) -> RawVoiceCloningClient:
24
+ """
25
+ Retrieves a raw implementation of this client that returns raw responses.
26
+
27
+ Returns
28
+ -------
29
+ RawVoiceCloningClient
30
+ """
31
+ return self._raw_client
32
+
33
+ def list_voices(
34
+ self, *, run_id: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
35
+ ) -> typing.List[ListVoicesListVoicesGetResponseItem]:
36
+ """
37
+ Parameters
38
+ ----------
39
+ run_id : typing.Optional[int]
40
+
41
+ request_options : typing.Optional[RequestOptions]
42
+ Request-specific configuration.
43
+
44
+ Returns
45
+ -------
46
+ typing.List[ListVoicesListVoicesGetResponseItem]
47
+ Successful Response
48
+
49
+ Examples
50
+ --------
51
+ from camb import CambApi
52
+
53
+ client = CambApi(
54
+ api_key="YOUR_API_KEY",
55
+ )
56
+ client.voice_cloning.list_voices()
57
+ """
58
+ _response = self._raw_client.list_voices(run_id=run_id, request_options=request_options)
59
+ return _response.data
60
+
61
+ def create_custom_voice(
62
+ self,
63
+ *,
64
+ voice_name: str,
65
+ gender: Gender,
66
+ file: core.File,
67
+ run_id: typing.Optional[int] = None,
68
+ description: typing.Optional[str] = OMIT,
69
+ publish_voice_to_market_place: typing.Optional[bool] = OMIT,
70
+ age: typing.Optional[int] = OMIT,
71
+ language: typing.Optional[Languages] = OMIT,
72
+ enhance_audio: typing.Optional[bool] = OMIT,
73
+ request_options: typing.Optional[RequestOptions] = None,
74
+ ) -> CreateCustomVoiceOut:
75
+ """
76
+ Parameters
77
+ ----------
78
+ voice_name : str
79
+
80
+ gender : Gender
81
+
82
+ file : core.File
83
+ See core.File for more documentation
84
+
85
+ run_id : typing.Optional[int]
86
+
87
+ description : typing.Optional[str]
88
+
89
+ publish_voice_to_market_place : typing.Optional[bool]
90
+ By setting true, you consent to making this voice available for other users in the marketplace.
91
+
92
+ age : typing.Optional[int]
93
+
94
+ language : typing.Optional[Languages]
95
+ Language of the voice
96
+
97
+ enhance_audio : typing.Optional[bool]
98
+ Enables advanced audio processing to enhance the clarity and quality of the cloned voice output. When set to `true`, additional processing is applied to improve the overall sound experience.
99
+
100
+ request_options : typing.Optional[RequestOptions]
101
+ Request-specific configuration.
102
+
103
+ Returns
104
+ -------
105
+ CreateCustomVoiceOut
106
+ Successful Response
107
+
108
+ Examples
109
+ --------
110
+ from camb import CambApi
111
+
112
+ client = CambApi(
113
+ api_key="YOUR_API_KEY",
114
+ )
115
+ client.voice_cloning.create_custom_voice(
116
+ voice_name="voice_name",
117
+ gender=1,
118
+ )
119
+ """
120
+ _response = self._raw_client.create_custom_voice(
121
+ voice_name=voice_name,
122
+ gender=gender,
123
+ file=file,
124
+ run_id=run_id,
125
+ description=description,
126
+ publish_voice_to_market_place=publish_voice_to_market_place,
127
+ age=age,
128
+ language=language,
129
+ enhance_audio=enhance_audio,
130
+ request_options=request_options,
131
+ )
132
+ return _response.data
133
+
134
+
135
+ class AsyncVoiceCloningClient:
136
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
137
+ self._raw_client = AsyncRawVoiceCloningClient(client_wrapper=client_wrapper)
138
+
139
+ @property
140
+ def with_raw_response(self) -> AsyncRawVoiceCloningClient:
141
+ """
142
+ Retrieves a raw implementation of this client that returns raw responses.
143
+
144
+ Returns
145
+ -------
146
+ AsyncRawVoiceCloningClient
147
+ """
148
+ return self._raw_client
149
+
150
+ async def list_voices(
151
+ self, *, run_id: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
152
+ ) -> typing.List[ListVoicesListVoicesGetResponseItem]:
153
+ """
154
+ Parameters
155
+ ----------
156
+ run_id : typing.Optional[int]
157
+
158
+ request_options : typing.Optional[RequestOptions]
159
+ Request-specific configuration.
160
+
161
+ Returns
162
+ -------
163
+ typing.List[ListVoicesListVoicesGetResponseItem]
164
+ Successful Response
165
+
166
+ Examples
167
+ --------
168
+ import asyncio
169
+
170
+ from camb import AsyncCambApi
171
+
172
+ client = AsyncCambApi(
173
+ api_key="YOUR_API_KEY",
174
+ )
175
+
176
+
177
+ async def main() -> None:
178
+ await client.voice_cloning.list_voices()
179
+
180
+
181
+ asyncio.run(main())
182
+ """
183
+ _response = await self._raw_client.list_voices(run_id=run_id, request_options=request_options)
184
+ return _response.data
185
+
186
+ async def create_custom_voice(
187
+ self,
188
+ *,
189
+ voice_name: str,
190
+ gender: Gender,
191
+ file: core.File,
192
+ run_id: typing.Optional[int] = None,
193
+ description: typing.Optional[str] = OMIT,
194
+ publish_voice_to_market_place: typing.Optional[bool] = OMIT,
195
+ age: typing.Optional[int] = OMIT,
196
+ language: typing.Optional[Languages] = OMIT,
197
+ enhance_audio: typing.Optional[bool] = OMIT,
198
+ request_options: typing.Optional[RequestOptions] = None,
199
+ ) -> CreateCustomVoiceOut:
200
+ """
201
+ Parameters
202
+ ----------
203
+ voice_name : str
204
+
205
+ gender : Gender
206
+
207
+ file : core.File
208
+ See core.File for more documentation
209
+
210
+ run_id : typing.Optional[int]
211
+
212
+ description : typing.Optional[str]
213
+
214
+ publish_voice_to_market_place : typing.Optional[bool]
215
+ By setting true, you consent to making this voice available for other users in the marketplace.
216
+
217
+ age : typing.Optional[int]
218
+
219
+ language : typing.Optional[Languages]
220
+ Language of the voice
221
+
222
+ enhance_audio : typing.Optional[bool]
223
+ Enables advanced audio processing to enhance the clarity and quality of the cloned voice output. When set to `true`, additional processing is applied to improve the overall sound experience.
224
+
225
+ request_options : typing.Optional[RequestOptions]
226
+ Request-specific configuration.
227
+
228
+ Returns
229
+ -------
230
+ CreateCustomVoiceOut
231
+ Successful Response
232
+
233
+ Examples
234
+ --------
235
+ import asyncio
236
+
237
+ from camb import AsyncCambApi
238
+
239
+ client = AsyncCambApi(
240
+ api_key="YOUR_API_KEY",
241
+ )
242
+
243
+
244
+ async def main() -> None:
245
+ await client.voice_cloning.create_custom_voice(
246
+ voice_name="voice_name",
247
+ gender=1,
248
+ )
249
+
250
+
251
+ asyncio.run(main())
252
+ """
253
+ _response = await self._raw_client.create_custom_voice(
254
+ voice_name=voice_name,
255
+ gender=gender,
256
+ file=file,
257
+ run_id=run_id,
258
+ description=description,
259
+ publish_voice_to_market_place=publish_voice_to_market_place,
260
+ age=age,
261
+ language=language,
262
+ enhance_audio=enhance_audio,
263
+ request_options=request_options,
264
+ )
265
+ return _response.data
@@ -0,0 +1,320 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from .. import core
7
+ from ..core.api_error import ApiError
8
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
10
+ from ..core.pydantic_utilities import parse_obj_as
11
+ from ..core.request_options import RequestOptions
12
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
13
+ from ..types.create_custom_voice_out import CreateCustomVoiceOut
14
+ from ..types.gender import Gender
15
+ from ..types.http_validation_error import HttpValidationError
16
+ from ..types.languages import Languages
17
+ from .types.list_voices_list_voices_get_response_item import ListVoicesListVoicesGetResponseItem
18
+
19
+ # this is used as the default value for optional parameters
20
+ OMIT = typing.cast(typing.Any, ...)
21
+
22
+
23
+ class RawVoiceCloningClient:
24
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
25
+ self._client_wrapper = client_wrapper
26
+
27
+ def list_voices(
28
+ self, *, run_id: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
29
+ ) -> HttpResponse[typing.List[ListVoicesListVoicesGetResponseItem]]:
30
+ """
31
+ Parameters
32
+ ----------
33
+ run_id : typing.Optional[int]
34
+
35
+ request_options : typing.Optional[RequestOptions]
36
+ Request-specific configuration.
37
+
38
+ Returns
39
+ -------
40
+ HttpResponse[typing.List[ListVoicesListVoicesGetResponseItem]]
41
+ Successful Response
42
+ """
43
+ _response = self._client_wrapper.httpx_client.request(
44
+ "list-voices",
45
+ method="GET",
46
+ params={
47
+ "run_id": run_id,
48
+ },
49
+ request_options=request_options,
50
+ )
51
+ try:
52
+ if 200 <= _response.status_code < 300:
53
+ _data = typing.cast(
54
+ typing.List[ListVoicesListVoicesGetResponseItem],
55
+ parse_obj_as(
56
+ type_=typing.List[ListVoicesListVoicesGetResponseItem], # type: ignore
57
+ object_=_response.json(),
58
+ ),
59
+ )
60
+ return HttpResponse(response=_response, data=_data)
61
+ if _response.status_code == 422:
62
+ raise UnprocessableEntityError(
63
+ headers=dict(_response.headers),
64
+ body=typing.cast(
65
+ HttpValidationError,
66
+ parse_obj_as(
67
+ type_=HttpValidationError, # type: ignore
68
+ object_=_response.json(),
69
+ ),
70
+ ),
71
+ )
72
+ _response_json = _response.json()
73
+ except JSONDecodeError:
74
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
75
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
76
+
77
+ def create_custom_voice(
78
+ self,
79
+ *,
80
+ voice_name: str,
81
+ gender: Gender,
82
+ file: core.File,
83
+ run_id: typing.Optional[int] = None,
84
+ description: typing.Optional[str] = OMIT,
85
+ publish_voice_to_market_place: typing.Optional[bool] = OMIT,
86
+ age: typing.Optional[int] = OMIT,
87
+ language: typing.Optional[Languages] = OMIT,
88
+ enhance_audio: typing.Optional[bool] = OMIT,
89
+ request_options: typing.Optional[RequestOptions] = None,
90
+ ) -> HttpResponse[CreateCustomVoiceOut]:
91
+ """
92
+ Parameters
93
+ ----------
94
+ voice_name : str
95
+
96
+ gender : Gender
97
+
98
+ file : core.File
99
+ See core.File for more documentation
100
+
101
+ run_id : typing.Optional[int]
102
+
103
+ description : typing.Optional[str]
104
+
105
+ publish_voice_to_market_place : typing.Optional[bool]
106
+ By setting true, you consent to making this voice available for other users in the marketplace.
107
+
108
+ age : typing.Optional[int]
109
+
110
+ language : typing.Optional[Languages]
111
+ Language of the voice
112
+
113
+ enhance_audio : typing.Optional[bool]
114
+ Enables advanced audio processing to enhance the clarity and quality of the cloned voice output. When set to `true`, additional processing is applied to improve the overall sound experience.
115
+
116
+ request_options : typing.Optional[RequestOptions]
117
+ Request-specific configuration.
118
+
119
+ Returns
120
+ -------
121
+ HttpResponse[CreateCustomVoiceOut]
122
+ Successful Response
123
+ """
124
+ _response = self._client_wrapper.httpx_client.request(
125
+ "create-custom-voice",
126
+ method="POST",
127
+ params={
128
+ "run_id": run_id,
129
+ },
130
+ data={
131
+ "voice_name": voice_name,
132
+ "gender": gender,
133
+ "description": description,
134
+ "publish_voice_to_market_place": publish_voice_to_market_place,
135
+ "age": age,
136
+ "language": language,
137
+ "enhance_audio": enhance_audio,
138
+ },
139
+ files={
140
+ "file": file,
141
+ },
142
+ request_options=request_options,
143
+ omit=OMIT,
144
+ force_multipart=True,
145
+ )
146
+ try:
147
+ if 200 <= _response.status_code < 300:
148
+ _data = typing.cast(
149
+ CreateCustomVoiceOut,
150
+ parse_obj_as(
151
+ type_=CreateCustomVoiceOut, # type: ignore
152
+ object_=_response.json(),
153
+ ),
154
+ )
155
+ return HttpResponse(response=_response, data=_data)
156
+ if _response.status_code == 422:
157
+ raise UnprocessableEntityError(
158
+ headers=dict(_response.headers),
159
+ body=typing.cast(
160
+ HttpValidationError,
161
+ parse_obj_as(
162
+ type_=HttpValidationError, # type: ignore
163
+ object_=_response.json(),
164
+ ),
165
+ ),
166
+ )
167
+ _response_json = _response.json()
168
+ except JSONDecodeError:
169
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
170
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
171
+
172
+
173
+ class AsyncRawVoiceCloningClient:
174
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
175
+ self._client_wrapper = client_wrapper
176
+
177
+ async def list_voices(
178
+ self, *, run_id: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
179
+ ) -> AsyncHttpResponse[typing.List[ListVoicesListVoicesGetResponseItem]]:
180
+ """
181
+ Parameters
182
+ ----------
183
+ run_id : typing.Optional[int]
184
+
185
+ request_options : typing.Optional[RequestOptions]
186
+ Request-specific configuration.
187
+
188
+ Returns
189
+ -------
190
+ AsyncHttpResponse[typing.List[ListVoicesListVoicesGetResponseItem]]
191
+ Successful Response
192
+ """
193
+ _response = await self._client_wrapper.httpx_client.request(
194
+ "list-voices",
195
+ method="GET",
196
+ params={
197
+ "run_id": run_id,
198
+ },
199
+ request_options=request_options,
200
+ )
201
+ try:
202
+ if 200 <= _response.status_code < 300:
203
+ _data = typing.cast(
204
+ typing.List[ListVoicesListVoicesGetResponseItem],
205
+ parse_obj_as(
206
+ type_=typing.List[ListVoicesListVoicesGetResponseItem], # type: ignore
207
+ object_=_response.json(),
208
+ ),
209
+ )
210
+ return AsyncHttpResponse(response=_response, data=_data)
211
+ if _response.status_code == 422:
212
+ raise UnprocessableEntityError(
213
+ headers=dict(_response.headers),
214
+ body=typing.cast(
215
+ HttpValidationError,
216
+ parse_obj_as(
217
+ type_=HttpValidationError, # type: ignore
218
+ object_=_response.json(),
219
+ ),
220
+ ),
221
+ )
222
+ _response_json = _response.json()
223
+ except JSONDecodeError:
224
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
225
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
226
+
227
+ async def create_custom_voice(
228
+ self,
229
+ *,
230
+ voice_name: str,
231
+ gender: Gender,
232
+ file: core.File,
233
+ run_id: typing.Optional[int] = None,
234
+ description: typing.Optional[str] = OMIT,
235
+ publish_voice_to_market_place: typing.Optional[bool] = OMIT,
236
+ age: typing.Optional[int] = OMIT,
237
+ language: typing.Optional[Languages] = OMIT,
238
+ enhance_audio: typing.Optional[bool] = OMIT,
239
+ request_options: typing.Optional[RequestOptions] = None,
240
+ ) -> AsyncHttpResponse[CreateCustomVoiceOut]:
241
+ """
242
+ Parameters
243
+ ----------
244
+ voice_name : str
245
+
246
+ gender : Gender
247
+
248
+ file : core.File
249
+ See core.File for more documentation
250
+
251
+ run_id : typing.Optional[int]
252
+
253
+ description : typing.Optional[str]
254
+
255
+ publish_voice_to_market_place : typing.Optional[bool]
256
+ By setting true, you consent to making this voice available for other users in the marketplace.
257
+
258
+ age : typing.Optional[int]
259
+
260
+ language : typing.Optional[Languages]
261
+ Language of the voice
262
+
263
+ enhance_audio : typing.Optional[bool]
264
+ Enables advanced audio processing to enhance the clarity and quality of the cloned voice output. When set to `true`, additional processing is applied to improve the overall sound experience.
265
+
266
+ request_options : typing.Optional[RequestOptions]
267
+ Request-specific configuration.
268
+
269
+ Returns
270
+ -------
271
+ AsyncHttpResponse[CreateCustomVoiceOut]
272
+ Successful Response
273
+ """
274
+ _response = await self._client_wrapper.httpx_client.request(
275
+ "create-custom-voice",
276
+ method="POST",
277
+ params={
278
+ "run_id": run_id,
279
+ },
280
+ data={
281
+ "voice_name": voice_name,
282
+ "gender": gender,
283
+ "description": description,
284
+ "publish_voice_to_market_place": publish_voice_to_market_place,
285
+ "age": age,
286
+ "language": language,
287
+ "enhance_audio": enhance_audio,
288
+ },
289
+ files={
290
+ "file": file,
291
+ },
292
+ request_options=request_options,
293
+ omit=OMIT,
294
+ force_multipart=True,
295
+ )
296
+ try:
297
+ if 200 <= _response.status_code < 300:
298
+ _data = typing.cast(
299
+ CreateCustomVoiceOut,
300
+ parse_obj_as(
301
+ type_=CreateCustomVoiceOut, # type: ignore
302
+ object_=_response.json(),
303
+ ),
304
+ )
305
+ return AsyncHttpResponse(response=_response, data=_data)
306
+ if _response.status_code == 422:
307
+ raise UnprocessableEntityError(
308
+ headers=dict(_response.headers),
309
+ body=typing.cast(
310
+ HttpValidationError,
311
+ parse_obj_as(
312
+ type_=HttpValidationError, # type: ignore
313
+ object_=_response.json(),
314
+ ),
315
+ ),
316
+ )
317
+ _response_json = _response.json()
318
+ except JSONDecodeError:
319
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
320
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
@@ -0,0 +1,36 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ import typing
6
+ from importlib import import_module
7
+
8
+ if typing.TYPE_CHECKING:
9
+ from .list_voices_list_voices_get_response_item import ListVoicesListVoicesGetResponseItem
10
+ _dynamic_imports: typing.Dict[str, str] = {
11
+ "ListVoicesListVoicesGetResponseItem": ".list_voices_list_voices_get_response_item"
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
+
35
+
36
+ __all__ = ["ListVoicesListVoicesGetResponseItem"]
@@ -0,0 +1,7 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ...types.voice import Voice
6
+
7
+ ListVoicesListVoicesGetResponseItem = typing.Union[typing.Dict[str, typing.Any], Voice]