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