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,631 @@
|
|
|
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.formalities import Formalities
|
|
8
|
+
from ..types.gender import Gender
|
|
9
|
+
from ..types.languages import Languages
|
|
10
|
+
from ..types.orchestrator_pipeline_result import OrchestratorPipelineResult
|
|
11
|
+
from ..types.translation_result import TranslationResult
|
|
12
|
+
from .raw_client import AsyncRawTranslationClient, RawTranslationClient
|
|
13
|
+
|
|
14
|
+
# this is used as the default value for optional parameters
|
|
15
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class TranslationClient:
|
|
19
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
20
|
+
self._raw_client = RawTranslationClient(client_wrapper=client_wrapper)
|
|
21
|
+
|
|
22
|
+
@property
|
|
23
|
+
def with_raw_response(self) -> RawTranslationClient:
|
|
24
|
+
"""
|
|
25
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
26
|
+
|
|
27
|
+
Returns
|
|
28
|
+
-------
|
|
29
|
+
RawTranslationClient
|
|
30
|
+
"""
|
|
31
|
+
return self._raw_client
|
|
32
|
+
|
|
33
|
+
def translation_stream(
|
|
34
|
+
self,
|
|
35
|
+
*,
|
|
36
|
+
source_language: Languages,
|
|
37
|
+
target_language: Languages,
|
|
38
|
+
text: str,
|
|
39
|
+
traceparent: typing.Optional[str] = None,
|
|
40
|
+
formality: typing.Optional[Formalities] = OMIT,
|
|
41
|
+
gender: typing.Optional[Gender] = OMIT,
|
|
42
|
+
team_id: typing.Optional[int] = OMIT,
|
|
43
|
+
project_name: typing.Optional[str] = OMIT,
|
|
44
|
+
project_description: typing.Optional[str] = OMIT,
|
|
45
|
+
folder_id: typing.Optional[int] = OMIT,
|
|
46
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
47
|
+
) -> typing.Any:
|
|
48
|
+
"""
|
|
49
|
+
Parameters
|
|
50
|
+
----------
|
|
51
|
+
source_language : Languages
|
|
52
|
+
|
|
53
|
+
target_language : Languages
|
|
54
|
+
|
|
55
|
+
text : str
|
|
56
|
+
|
|
57
|
+
traceparent : typing.Optional[str]
|
|
58
|
+
|
|
59
|
+
formality : typing.Optional[Formalities]
|
|
60
|
+
|
|
61
|
+
gender : typing.Optional[Gender]
|
|
62
|
+
|
|
63
|
+
team_id : typing.Optional[int]
|
|
64
|
+
|
|
65
|
+
project_name : typing.Optional[str]
|
|
66
|
+
|
|
67
|
+
project_description : typing.Optional[str]
|
|
68
|
+
|
|
69
|
+
folder_id : typing.Optional[int]
|
|
70
|
+
|
|
71
|
+
request_options : typing.Optional[RequestOptions]
|
|
72
|
+
Request-specific configuration.
|
|
73
|
+
|
|
74
|
+
Returns
|
|
75
|
+
-------
|
|
76
|
+
typing.Any
|
|
77
|
+
Text translation stream
|
|
78
|
+
|
|
79
|
+
Examples
|
|
80
|
+
--------
|
|
81
|
+
from camb import CambApi
|
|
82
|
+
|
|
83
|
+
client = CambApi(
|
|
84
|
+
api_key="YOUR_API_KEY",
|
|
85
|
+
)
|
|
86
|
+
client.translation.translation_stream(
|
|
87
|
+
source_language=1,
|
|
88
|
+
target_language=1,
|
|
89
|
+
text="text",
|
|
90
|
+
)
|
|
91
|
+
"""
|
|
92
|
+
_response = self._raw_client.translation_stream(
|
|
93
|
+
source_language=source_language,
|
|
94
|
+
target_language=target_language,
|
|
95
|
+
text=text,
|
|
96
|
+
traceparent=traceparent,
|
|
97
|
+
formality=formality,
|
|
98
|
+
gender=gender,
|
|
99
|
+
team_id=team_id,
|
|
100
|
+
project_name=project_name,
|
|
101
|
+
project_description=project_description,
|
|
102
|
+
folder_id=folder_id,
|
|
103
|
+
request_options=request_options,
|
|
104
|
+
)
|
|
105
|
+
return _response.data
|
|
106
|
+
|
|
107
|
+
def create_translation(
|
|
108
|
+
self,
|
|
109
|
+
*,
|
|
110
|
+
texts: typing.Sequence[str],
|
|
111
|
+
source_language: Languages,
|
|
112
|
+
target_language: Languages,
|
|
113
|
+
run_id: typing.Optional[int] = None,
|
|
114
|
+
project_name: typing.Optional[str] = OMIT,
|
|
115
|
+
project_description: typing.Optional[str] = OMIT,
|
|
116
|
+
folder_id: typing.Optional[int] = OMIT,
|
|
117
|
+
age: typing.Optional[int] = OMIT,
|
|
118
|
+
formality: typing.Optional[Formalities] = OMIT,
|
|
119
|
+
gender: typing.Optional[Gender] = OMIT,
|
|
120
|
+
chosen_dictionaries: typing.Optional[typing.Sequence[int]] = OMIT,
|
|
121
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
122
|
+
) -> typing.Any:
|
|
123
|
+
"""
|
|
124
|
+
Parameters
|
|
125
|
+
----------
|
|
126
|
+
texts : typing.Sequence[str]
|
|
127
|
+
|
|
128
|
+
source_language : Languages
|
|
129
|
+
|
|
130
|
+
target_language : Languages
|
|
131
|
+
|
|
132
|
+
run_id : typing.Optional[int]
|
|
133
|
+
|
|
134
|
+
project_name : typing.Optional[str]
|
|
135
|
+
|
|
136
|
+
project_description : typing.Optional[str]
|
|
137
|
+
|
|
138
|
+
folder_id : typing.Optional[int]
|
|
139
|
+
|
|
140
|
+
age : typing.Optional[int]
|
|
141
|
+
|
|
142
|
+
formality : typing.Optional[Formalities]
|
|
143
|
+
|
|
144
|
+
gender : typing.Optional[Gender]
|
|
145
|
+
|
|
146
|
+
chosen_dictionaries : typing.Optional[typing.Sequence[int]]
|
|
147
|
+
|
|
148
|
+
request_options : typing.Optional[RequestOptions]
|
|
149
|
+
Request-specific configuration.
|
|
150
|
+
|
|
151
|
+
Returns
|
|
152
|
+
-------
|
|
153
|
+
typing.Any
|
|
154
|
+
Successful Response
|
|
155
|
+
|
|
156
|
+
Examples
|
|
157
|
+
--------
|
|
158
|
+
from camb import CambApi
|
|
159
|
+
|
|
160
|
+
client = CambApi(
|
|
161
|
+
api_key="YOUR_API_KEY",
|
|
162
|
+
)
|
|
163
|
+
client.translation.create_translation(
|
|
164
|
+
texts=["texts"],
|
|
165
|
+
source_language=1,
|
|
166
|
+
target_language=1,
|
|
167
|
+
)
|
|
168
|
+
"""
|
|
169
|
+
_response = self._raw_client.create_translation(
|
|
170
|
+
texts=texts,
|
|
171
|
+
source_language=source_language,
|
|
172
|
+
target_language=target_language,
|
|
173
|
+
run_id=run_id,
|
|
174
|
+
project_name=project_name,
|
|
175
|
+
project_description=project_description,
|
|
176
|
+
folder_id=folder_id,
|
|
177
|
+
age=age,
|
|
178
|
+
formality=formality,
|
|
179
|
+
gender=gender,
|
|
180
|
+
chosen_dictionaries=chosen_dictionaries,
|
|
181
|
+
request_options=request_options,
|
|
182
|
+
)
|
|
183
|
+
return _response.data
|
|
184
|
+
|
|
185
|
+
def get_translation_task_status(
|
|
186
|
+
self,
|
|
187
|
+
task_id: str,
|
|
188
|
+
*,
|
|
189
|
+
run_id: typing.Optional[int] = None,
|
|
190
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
191
|
+
) -> OrchestratorPipelineResult:
|
|
192
|
+
"""
|
|
193
|
+
Parameters
|
|
194
|
+
----------
|
|
195
|
+
task_id : str
|
|
196
|
+
|
|
197
|
+
run_id : typing.Optional[int]
|
|
198
|
+
|
|
199
|
+
request_options : typing.Optional[RequestOptions]
|
|
200
|
+
Request-specific configuration.
|
|
201
|
+
|
|
202
|
+
Returns
|
|
203
|
+
-------
|
|
204
|
+
OrchestratorPipelineResult
|
|
205
|
+
Successful Response
|
|
206
|
+
|
|
207
|
+
Examples
|
|
208
|
+
--------
|
|
209
|
+
from camb import CambApi
|
|
210
|
+
|
|
211
|
+
client = CambApi(
|
|
212
|
+
api_key="YOUR_API_KEY",
|
|
213
|
+
)
|
|
214
|
+
client.translation.get_translation_task_status(
|
|
215
|
+
task_id="task_id",
|
|
216
|
+
)
|
|
217
|
+
"""
|
|
218
|
+
_response = self._raw_client.get_translation_task_status(
|
|
219
|
+
task_id, run_id=run_id, request_options=request_options
|
|
220
|
+
)
|
|
221
|
+
return _response.data
|
|
222
|
+
|
|
223
|
+
def get_translation_result(
|
|
224
|
+
self,
|
|
225
|
+
run_id: typing.Optional[int],
|
|
226
|
+
*,
|
|
227
|
+
traceparent: typing.Optional[str] = None,
|
|
228
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
229
|
+
) -> TranslationResult:
|
|
230
|
+
"""
|
|
231
|
+
NOTE: This endpoint should be called only by the users to get values for their runs via API.
|
|
232
|
+
Further we need to validate if the user has access to the run_id, otherwise we should not return the output urls.
|
|
233
|
+
|
|
234
|
+
Parameters
|
|
235
|
+
----------
|
|
236
|
+
run_id : typing.Optional[int]
|
|
237
|
+
|
|
238
|
+
traceparent : typing.Optional[str]
|
|
239
|
+
|
|
240
|
+
request_options : typing.Optional[RequestOptions]
|
|
241
|
+
Request-specific configuration.
|
|
242
|
+
|
|
243
|
+
Returns
|
|
244
|
+
-------
|
|
245
|
+
TranslationResult
|
|
246
|
+
Successful Response
|
|
247
|
+
|
|
248
|
+
Examples
|
|
249
|
+
--------
|
|
250
|
+
from camb import CambApi
|
|
251
|
+
|
|
252
|
+
client = CambApi(
|
|
253
|
+
api_key="YOUR_API_KEY",
|
|
254
|
+
)
|
|
255
|
+
client.translation.get_translation_result(
|
|
256
|
+
run_id=1,
|
|
257
|
+
)
|
|
258
|
+
"""
|
|
259
|
+
_response = self._raw_client.get_translation_result(
|
|
260
|
+
run_id, traceparent=traceparent, request_options=request_options
|
|
261
|
+
)
|
|
262
|
+
return _response.data
|
|
263
|
+
|
|
264
|
+
def get_translation_results(
|
|
265
|
+
self,
|
|
266
|
+
*,
|
|
267
|
+
run_ids: typing.Sequence[int],
|
|
268
|
+
run_id: typing.Optional[int] = None,
|
|
269
|
+
traceparent: typing.Optional[str] = None,
|
|
270
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
271
|
+
) -> typing.Dict[str, TranslationResult]:
|
|
272
|
+
"""
|
|
273
|
+
Parameters
|
|
274
|
+
----------
|
|
275
|
+
run_ids : typing.Sequence[int]
|
|
276
|
+
|
|
277
|
+
run_id : typing.Optional[int]
|
|
278
|
+
|
|
279
|
+
traceparent : typing.Optional[str]
|
|
280
|
+
|
|
281
|
+
request_options : typing.Optional[RequestOptions]
|
|
282
|
+
Request-specific configuration.
|
|
283
|
+
|
|
284
|
+
Returns
|
|
285
|
+
-------
|
|
286
|
+
typing.Dict[str, TranslationResult]
|
|
287
|
+
Successful Response
|
|
288
|
+
|
|
289
|
+
Examples
|
|
290
|
+
--------
|
|
291
|
+
from camb import CambApi
|
|
292
|
+
|
|
293
|
+
client = CambApi(
|
|
294
|
+
api_key="YOUR_API_KEY",
|
|
295
|
+
)
|
|
296
|
+
client.translation.get_translation_results(
|
|
297
|
+
run_ids=[1],
|
|
298
|
+
)
|
|
299
|
+
"""
|
|
300
|
+
_response = self._raw_client.get_translation_results(
|
|
301
|
+
run_ids=run_ids, run_id=run_id, traceparent=traceparent, request_options=request_options
|
|
302
|
+
)
|
|
303
|
+
return _response.data
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
class AsyncTranslationClient:
|
|
307
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
308
|
+
self._raw_client = AsyncRawTranslationClient(client_wrapper=client_wrapper)
|
|
309
|
+
|
|
310
|
+
@property
|
|
311
|
+
def with_raw_response(self) -> AsyncRawTranslationClient:
|
|
312
|
+
"""
|
|
313
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
314
|
+
|
|
315
|
+
Returns
|
|
316
|
+
-------
|
|
317
|
+
AsyncRawTranslationClient
|
|
318
|
+
"""
|
|
319
|
+
return self._raw_client
|
|
320
|
+
|
|
321
|
+
async def translation_stream(
|
|
322
|
+
self,
|
|
323
|
+
*,
|
|
324
|
+
source_language: Languages,
|
|
325
|
+
target_language: Languages,
|
|
326
|
+
text: str,
|
|
327
|
+
traceparent: typing.Optional[str] = None,
|
|
328
|
+
formality: typing.Optional[Formalities] = OMIT,
|
|
329
|
+
gender: typing.Optional[Gender] = OMIT,
|
|
330
|
+
team_id: typing.Optional[int] = OMIT,
|
|
331
|
+
project_name: typing.Optional[str] = OMIT,
|
|
332
|
+
project_description: typing.Optional[str] = OMIT,
|
|
333
|
+
folder_id: typing.Optional[int] = OMIT,
|
|
334
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
335
|
+
) -> typing.Any:
|
|
336
|
+
"""
|
|
337
|
+
Parameters
|
|
338
|
+
----------
|
|
339
|
+
source_language : Languages
|
|
340
|
+
|
|
341
|
+
target_language : Languages
|
|
342
|
+
|
|
343
|
+
text : str
|
|
344
|
+
|
|
345
|
+
traceparent : typing.Optional[str]
|
|
346
|
+
|
|
347
|
+
formality : typing.Optional[Formalities]
|
|
348
|
+
|
|
349
|
+
gender : typing.Optional[Gender]
|
|
350
|
+
|
|
351
|
+
team_id : typing.Optional[int]
|
|
352
|
+
|
|
353
|
+
project_name : typing.Optional[str]
|
|
354
|
+
|
|
355
|
+
project_description : typing.Optional[str]
|
|
356
|
+
|
|
357
|
+
folder_id : typing.Optional[int]
|
|
358
|
+
|
|
359
|
+
request_options : typing.Optional[RequestOptions]
|
|
360
|
+
Request-specific configuration.
|
|
361
|
+
|
|
362
|
+
Returns
|
|
363
|
+
-------
|
|
364
|
+
typing.Any
|
|
365
|
+
Text translation stream
|
|
366
|
+
|
|
367
|
+
Examples
|
|
368
|
+
--------
|
|
369
|
+
import asyncio
|
|
370
|
+
|
|
371
|
+
from camb import AsyncCambApi
|
|
372
|
+
|
|
373
|
+
client = AsyncCambApi(
|
|
374
|
+
api_key="YOUR_API_KEY",
|
|
375
|
+
)
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
async def main() -> None:
|
|
379
|
+
await client.translation.translation_stream(
|
|
380
|
+
source_language=1,
|
|
381
|
+
target_language=1,
|
|
382
|
+
text="text",
|
|
383
|
+
)
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
asyncio.run(main())
|
|
387
|
+
"""
|
|
388
|
+
_response = await self._raw_client.translation_stream(
|
|
389
|
+
source_language=source_language,
|
|
390
|
+
target_language=target_language,
|
|
391
|
+
text=text,
|
|
392
|
+
traceparent=traceparent,
|
|
393
|
+
formality=formality,
|
|
394
|
+
gender=gender,
|
|
395
|
+
team_id=team_id,
|
|
396
|
+
project_name=project_name,
|
|
397
|
+
project_description=project_description,
|
|
398
|
+
folder_id=folder_id,
|
|
399
|
+
request_options=request_options,
|
|
400
|
+
)
|
|
401
|
+
return _response.data
|
|
402
|
+
|
|
403
|
+
async def create_translation(
|
|
404
|
+
self,
|
|
405
|
+
*,
|
|
406
|
+
texts: typing.Sequence[str],
|
|
407
|
+
source_language: Languages,
|
|
408
|
+
target_language: Languages,
|
|
409
|
+
run_id: typing.Optional[int] = None,
|
|
410
|
+
project_name: typing.Optional[str] = OMIT,
|
|
411
|
+
project_description: typing.Optional[str] = OMIT,
|
|
412
|
+
folder_id: typing.Optional[int] = OMIT,
|
|
413
|
+
age: typing.Optional[int] = OMIT,
|
|
414
|
+
formality: typing.Optional[Formalities] = OMIT,
|
|
415
|
+
gender: typing.Optional[Gender] = OMIT,
|
|
416
|
+
chosen_dictionaries: typing.Optional[typing.Sequence[int]] = OMIT,
|
|
417
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
418
|
+
) -> typing.Any:
|
|
419
|
+
"""
|
|
420
|
+
Parameters
|
|
421
|
+
----------
|
|
422
|
+
texts : typing.Sequence[str]
|
|
423
|
+
|
|
424
|
+
source_language : Languages
|
|
425
|
+
|
|
426
|
+
target_language : Languages
|
|
427
|
+
|
|
428
|
+
run_id : typing.Optional[int]
|
|
429
|
+
|
|
430
|
+
project_name : typing.Optional[str]
|
|
431
|
+
|
|
432
|
+
project_description : typing.Optional[str]
|
|
433
|
+
|
|
434
|
+
folder_id : typing.Optional[int]
|
|
435
|
+
|
|
436
|
+
age : typing.Optional[int]
|
|
437
|
+
|
|
438
|
+
formality : typing.Optional[Formalities]
|
|
439
|
+
|
|
440
|
+
gender : typing.Optional[Gender]
|
|
441
|
+
|
|
442
|
+
chosen_dictionaries : typing.Optional[typing.Sequence[int]]
|
|
443
|
+
|
|
444
|
+
request_options : typing.Optional[RequestOptions]
|
|
445
|
+
Request-specific configuration.
|
|
446
|
+
|
|
447
|
+
Returns
|
|
448
|
+
-------
|
|
449
|
+
typing.Any
|
|
450
|
+
Successful Response
|
|
451
|
+
|
|
452
|
+
Examples
|
|
453
|
+
--------
|
|
454
|
+
import asyncio
|
|
455
|
+
|
|
456
|
+
from camb import AsyncCambApi
|
|
457
|
+
|
|
458
|
+
client = AsyncCambApi(
|
|
459
|
+
api_key="YOUR_API_KEY",
|
|
460
|
+
)
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
async def main() -> None:
|
|
464
|
+
await client.translation.create_translation(
|
|
465
|
+
texts=["texts"],
|
|
466
|
+
source_language=1,
|
|
467
|
+
target_language=1,
|
|
468
|
+
)
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
asyncio.run(main())
|
|
472
|
+
"""
|
|
473
|
+
_response = await self._raw_client.create_translation(
|
|
474
|
+
texts=texts,
|
|
475
|
+
source_language=source_language,
|
|
476
|
+
target_language=target_language,
|
|
477
|
+
run_id=run_id,
|
|
478
|
+
project_name=project_name,
|
|
479
|
+
project_description=project_description,
|
|
480
|
+
folder_id=folder_id,
|
|
481
|
+
age=age,
|
|
482
|
+
formality=formality,
|
|
483
|
+
gender=gender,
|
|
484
|
+
chosen_dictionaries=chosen_dictionaries,
|
|
485
|
+
request_options=request_options,
|
|
486
|
+
)
|
|
487
|
+
return _response.data
|
|
488
|
+
|
|
489
|
+
async def get_translation_task_status(
|
|
490
|
+
self,
|
|
491
|
+
task_id: str,
|
|
492
|
+
*,
|
|
493
|
+
run_id: typing.Optional[int] = None,
|
|
494
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
495
|
+
) -> OrchestratorPipelineResult:
|
|
496
|
+
"""
|
|
497
|
+
Parameters
|
|
498
|
+
----------
|
|
499
|
+
task_id : str
|
|
500
|
+
|
|
501
|
+
run_id : typing.Optional[int]
|
|
502
|
+
|
|
503
|
+
request_options : typing.Optional[RequestOptions]
|
|
504
|
+
Request-specific configuration.
|
|
505
|
+
|
|
506
|
+
Returns
|
|
507
|
+
-------
|
|
508
|
+
OrchestratorPipelineResult
|
|
509
|
+
Successful Response
|
|
510
|
+
|
|
511
|
+
Examples
|
|
512
|
+
--------
|
|
513
|
+
import asyncio
|
|
514
|
+
|
|
515
|
+
from camb import AsyncCambApi
|
|
516
|
+
|
|
517
|
+
client = AsyncCambApi(
|
|
518
|
+
api_key="YOUR_API_KEY",
|
|
519
|
+
)
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
async def main() -> None:
|
|
523
|
+
await client.translation.get_translation_task_status(
|
|
524
|
+
task_id="task_id",
|
|
525
|
+
)
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
asyncio.run(main())
|
|
529
|
+
"""
|
|
530
|
+
_response = await self._raw_client.get_translation_task_status(
|
|
531
|
+
task_id, run_id=run_id, request_options=request_options
|
|
532
|
+
)
|
|
533
|
+
return _response.data
|
|
534
|
+
|
|
535
|
+
async def get_translation_result(
|
|
536
|
+
self,
|
|
537
|
+
run_id: typing.Optional[int],
|
|
538
|
+
*,
|
|
539
|
+
traceparent: typing.Optional[str] = None,
|
|
540
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
541
|
+
) -> TranslationResult:
|
|
542
|
+
"""
|
|
543
|
+
NOTE: This endpoint should be called only by the users to get values for their runs via API.
|
|
544
|
+
Further we need to validate if the user has access to the run_id, otherwise we should not return the output urls.
|
|
545
|
+
|
|
546
|
+
Parameters
|
|
547
|
+
----------
|
|
548
|
+
run_id : typing.Optional[int]
|
|
549
|
+
|
|
550
|
+
traceparent : typing.Optional[str]
|
|
551
|
+
|
|
552
|
+
request_options : typing.Optional[RequestOptions]
|
|
553
|
+
Request-specific configuration.
|
|
554
|
+
|
|
555
|
+
Returns
|
|
556
|
+
-------
|
|
557
|
+
TranslationResult
|
|
558
|
+
Successful Response
|
|
559
|
+
|
|
560
|
+
Examples
|
|
561
|
+
--------
|
|
562
|
+
import asyncio
|
|
563
|
+
|
|
564
|
+
from camb import AsyncCambApi
|
|
565
|
+
|
|
566
|
+
client = AsyncCambApi(
|
|
567
|
+
api_key="YOUR_API_KEY",
|
|
568
|
+
)
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
async def main() -> None:
|
|
572
|
+
await client.translation.get_translation_result(
|
|
573
|
+
run_id=1,
|
|
574
|
+
)
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
asyncio.run(main())
|
|
578
|
+
"""
|
|
579
|
+
_response = await self._raw_client.get_translation_result(
|
|
580
|
+
run_id, traceparent=traceparent, request_options=request_options
|
|
581
|
+
)
|
|
582
|
+
return _response.data
|
|
583
|
+
|
|
584
|
+
async def get_translation_results(
|
|
585
|
+
self,
|
|
586
|
+
*,
|
|
587
|
+
run_ids: typing.Sequence[int],
|
|
588
|
+
run_id: typing.Optional[int] = None,
|
|
589
|
+
traceparent: typing.Optional[str] = None,
|
|
590
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
591
|
+
) -> typing.Dict[str, TranslationResult]:
|
|
592
|
+
"""
|
|
593
|
+
Parameters
|
|
594
|
+
----------
|
|
595
|
+
run_ids : typing.Sequence[int]
|
|
596
|
+
|
|
597
|
+
run_id : typing.Optional[int]
|
|
598
|
+
|
|
599
|
+
traceparent : typing.Optional[str]
|
|
600
|
+
|
|
601
|
+
request_options : typing.Optional[RequestOptions]
|
|
602
|
+
Request-specific configuration.
|
|
603
|
+
|
|
604
|
+
Returns
|
|
605
|
+
-------
|
|
606
|
+
typing.Dict[str, TranslationResult]
|
|
607
|
+
Successful Response
|
|
608
|
+
|
|
609
|
+
Examples
|
|
610
|
+
--------
|
|
611
|
+
import asyncio
|
|
612
|
+
|
|
613
|
+
from camb import AsyncCambApi
|
|
614
|
+
|
|
615
|
+
client = AsyncCambApi(
|
|
616
|
+
api_key="YOUR_API_KEY",
|
|
617
|
+
)
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
async def main() -> None:
|
|
621
|
+
await client.translation.get_translation_results(
|
|
622
|
+
run_ids=[1],
|
|
623
|
+
)
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
asyncio.run(main())
|
|
627
|
+
"""
|
|
628
|
+
_response = await self._raw_client.get_translation_results(
|
|
629
|
+
run_ids=run_ids, run_id=run_id, traceparent=traceparent, request_options=request_options
|
|
630
|
+
)
|
|
631
|
+
return _response.data
|