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,587 @@
|
|
|
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.jsonable_encoder import jsonable_encoder
|
|
11
|
+
from ..core.pydantic_utilities import parse_obj_as
|
|
12
|
+
from ..core.request_options import RequestOptions
|
|
13
|
+
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
14
|
+
from ..types.http_validation_error import HttpValidationError
|
|
15
|
+
from ..types.languages import Languages
|
|
16
|
+
from ..types.orchestrator_pipeline_call_result import OrchestratorPipelineCallResult
|
|
17
|
+
from ..types.orchestrator_pipeline_result import OrchestratorPipelineResult
|
|
18
|
+
from ..types.transcription_result import TranscriptionResult
|
|
19
|
+
|
|
20
|
+
# this is used as the default value for optional parameters
|
|
21
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class RawTranscriptionClient:
|
|
25
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
26
|
+
self._client_wrapper = client_wrapper
|
|
27
|
+
|
|
28
|
+
def create_transcription(
|
|
29
|
+
self,
|
|
30
|
+
*,
|
|
31
|
+
language: Languages,
|
|
32
|
+
run_id: typing.Optional[int] = None,
|
|
33
|
+
media_file: typing.Optional[core.File] = OMIT,
|
|
34
|
+
media_url: typing.Optional[str] = OMIT,
|
|
35
|
+
file: typing.Optional[core.File] = OMIT,
|
|
36
|
+
audio_url: typing.Optional[str] = OMIT,
|
|
37
|
+
project_name: typing.Optional[str] = OMIT,
|
|
38
|
+
project_description: typing.Optional[str] = OMIT,
|
|
39
|
+
folder_id: typing.Optional[int] = OMIT,
|
|
40
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
41
|
+
) -> HttpResponse[OrchestratorPipelineCallResult]:
|
|
42
|
+
"""
|
|
43
|
+
Parameters
|
|
44
|
+
----------
|
|
45
|
+
language : Languages
|
|
46
|
+
Signed URL to audio file for transcription
|
|
47
|
+
|
|
48
|
+
run_id : typing.Optional[int]
|
|
49
|
+
|
|
50
|
+
media_file : typing.Optional[core.File]
|
|
51
|
+
See core.File for more documentation
|
|
52
|
+
|
|
53
|
+
media_url : typing.Optional[str]
|
|
54
|
+
Signed URL to media file for transcription
|
|
55
|
+
|
|
56
|
+
file : typing.Optional[core.File]
|
|
57
|
+
See core.File for more documentation
|
|
58
|
+
|
|
59
|
+
audio_url : typing.Optional[str]
|
|
60
|
+
[DEPRECATED] Use 'audio_url' instead
|
|
61
|
+
|
|
62
|
+
project_name : typing.Optional[str]
|
|
63
|
+
|
|
64
|
+
project_description : typing.Optional[str]
|
|
65
|
+
|
|
66
|
+
folder_id : typing.Optional[int]
|
|
67
|
+
|
|
68
|
+
request_options : typing.Optional[RequestOptions]
|
|
69
|
+
Request-specific configuration.
|
|
70
|
+
|
|
71
|
+
Returns
|
|
72
|
+
-------
|
|
73
|
+
HttpResponse[OrchestratorPipelineCallResult]
|
|
74
|
+
Successful Response
|
|
75
|
+
"""
|
|
76
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
77
|
+
"transcribe",
|
|
78
|
+
method="POST",
|
|
79
|
+
params={
|
|
80
|
+
"run_id": run_id,
|
|
81
|
+
},
|
|
82
|
+
data={
|
|
83
|
+
"language": language,
|
|
84
|
+
"media_url": media_url,
|
|
85
|
+
"audio_url": audio_url,
|
|
86
|
+
"project_name": project_name,
|
|
87
|
+
"project_description": project_description,
|
|
88
|
+
"folder_id": folder_id,
|
|
89
|
+
},
|
|
90
|
+
files={
|
|
91
|
+
**({"media_file": media_file} if media_file is not None else {}),
|
|
92
|
+
**({"file": file} if file is not None else {}),
|
|
93
|
+
},
|
|
94
|
+
request_options=request_options,
|
|
95
|
+
omit=OMIT,
|
|
96
|
+
force_multipart=True,
|
|
97
|
+
)
|
|
98
|
+
try:
|
|
99
|
+
if 200 <= _response.status_code < 300:
|
|
100
|
+
_data = typing.cast(
|
|
101
|
+
OrchestratorPipelineCallResult,
|
|
102
|
+
parse_obj_as(
|
|
103
|
+
type_=OrchestratorPipelineCallResult, # type: ignore
|
|
104
|
+
object_=_response.json(),
|
|
105
|
+
),
|
|
106
|
+
)
|
|
107
|
+
return HttpResponse(response=_response, data=_data)
|
|
108
|
+
if _response.status_code == 422:
|
|
109
|
+
raise UnprocessableEntityError(
|
|
110
|
+
headers=dict(_response.headers),
|
|
111
|
+
body=typing.cast(
|
|
112
|
+
HttpValidationError,
|
|
113
|
+
parse_obj_as(
|
|
114
|
+
type_=HttpValidationError, # type: ignore
|
|
115
|
+
object_=_response.json(),
|
|
116
|
+
),
|
|
117
|
+
),
|
|
118
|
+
)
|
|
119
|
+
_response_json = _response.json()
|
|
120
|
+
except JSONDecodeError:
|
|
121
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
122
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
123
|
+
|
|
124
|
+
def get_transcription_task_status(
|
|
125
|
+
self,
|
|
126
|
+
task_id: str,
|
|
127
|
+
*,
|
|
128
|
+
run_id: typing.Optional[int] = None,
|
|
129
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
130
|
+
) -> HttpResponse[OrchestratorPipelineResult]:
|
|
131
|
+
"""
|
|
132
|
+
Parameters
|
|
133
|
+
----------
|
|
134
|
+
task_id : str
|
|
135
|
+
|
|
136
|
+
run_id : typing.Optional[int]
|
|
137
|
+
|
|
138
|
+
request_options : typing.Optional[RequestOptions]
|
|
139
|
+
Request-specific configuration.
|
|
140
|
+
|
|
141
|
+
Returns
|
|
142
|
+
-------
|
|
143
|
+
HttpResponse[OrchestratorPipelineResult]
|
|
144
|
+
Successful Response
|
|
145
|
+
"""
|
|
146
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
147
|
+
f"transcribe/{jsonable_encoder(task_id)}",
|
|
148
|
+
method="GET",
|
|
149
|
+
params={
|
|
150
|
+
"run_id": run_id,
|
|
151
|
+
},
|
|
152
|
+
request_options=request_options,
|
|
153
|
+
)
|
|
154
|
+
try:
|
|
155
|
+
if 200 <= _response.status_code < 300:
|
|
156
|
+
_data = typing.cast(
|
|
157
|
+
OrchestratorPipelineResult,
|
|
158
|
+
parse_obj_as(
|
|
159
|
+
type_=OrchestratorPipelineResult, # type: ignore
|
|
160
|
+
object_=_response.json(),
|
|
161
|
+
),
|
|
162
|
+
)
|
|
163
|
+
return HttpResponse(response=_response, data=_data)
|
|
164
|
+
if _response.status_code == 422:
|
|
165
|
+
raise UnprocessableEntityError(
|
|
166
|
+
headers=dict(_response.headers),
|
|
167
|
+
body=typing.cast(
|
|
168
|
+
HttpValidationError,
|
|
169
|
+
parse_obj_as(
|
|
170
|
+
type_=HttpValidationError, # type: ignore
|
|
171
|
+
object_=_response.json(),
|
|
172
|
+
),
|
|
173
|
+
),
|
|
174
|
+
)
|
|
175
|
+
_response_json = _response.json()
|
|
176
|
+
except JSONDecodeError:
|
|
177
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
178
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
179
|
+
|
|
180
|
+
def get_transcription_result(
|
|
181
|
+
self,
|
|
182
|
+
run_id: typing.Optional[int],
|
|
183
|
+
*,
|
|
184
|
+
word_level_timestamps: typing.Optional[bool] = None,
|
|
185
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
186
|
+
) -> HttpResponse[TranscriptionResult]:
|
|
187
|
+
"""
|
|
188
|
+
NOTE: This endpoint should be called only by the users to get values for their runs via API.
|
|
189
|
+
Further we need to validate if the user has access to the run_id, otherwise we should not return the output urls.
|
|
190
|
+
|
|
191
|
+
Parameters
|
|
192
|
+
----------
|
|
193
|
+
run_id : typing.Optional[int]
|
|
194
|
+
|
|
195
|
+
word_level_timestamps : typing.Optional[bool]
|
|
196
|
+
|
|
197
|
+
request_options : typing.Optional[RequestOptions]
|
|
198
|
+
Request-specific configuration.
|
|
199
|
+
|
|
200
|
+
Returns
|
|
201
|
+
-------
|
|
202
|
+
HttpResponse[TranscriptionResult]
|
|
203
|
+
Successful Response
|
|
204
|
+
"""
|
|
205
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
206
|
+
f"transcription-result/{jsonable_encoder(run_id)}",
|
|
207
|
+
method="GET",
|
|
208
|
+
params={
|
|
209
|
+
"word_level_timestamps": word_level_timestamps,
|
|
210
|
+
},
|
|
211
|
+
request_options=request_options,
|
|
212
|
+
)
|
|
213
|
+
try:
|
|
214
|
+
if 200 <= _response.status_code < 300:
|
|
215
|
+
_data = typing.cast(
|
|
216
|
+
TranscriptionResult,
|
|
217
|
+
parse_obj_as(
|
|
218
|
+
type_=TranscriptionResult, # type: ignore
|
|
219
|
+
object_=_response.json(),
|
|
220
|
+
),
|
|
221
|
+
)
|
|
222
|
+
return HttpResponse(response=_response, data=_data)
|
|
223
|
+
if _response.status_code == 422:
|
|
224
|
+
raise UnprocessableEntityError(
|
|
225
|
+
headers=dict(_response.headers),
|
|
226
|
+
body=typing.cast(
|
|
227
|
+
HttpValidationError,
|
|
228
|
+
parse_obj_as(
|
|
229
|
+
type_=HttpValidationError, # type: ignore
|
|
230
|
+
object_=_response.json(),
|
|
231
|
+
),
|
|
232
|
+
),
|
|
233
|
+
)
|
|
234
|
+
_response_json = _response.json()
|
|
235
|
+
except JSONDecodeError:
|
|
236
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
237
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
238
|
+
|
|
239
|
+
def get_transcription_results(
|
|
240
|
+
self,
|
|
241
|
+
*,
|
|
242
|
+
run_ids: typing.Sequence[int],
|
|
243
|
+
run_id: typing.Optional[int] = None,
|
|
244
|
+
traceparent: typing.Optional[str] = None,
|
|
245
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
246
|
+
) -> HttpResponse[typing.Dict[str, TranscriptionResult]]:
|
|
247
|
+
"""
|
|
248
|
+
Parameters
|
|
249
|
+
----------
|
|
250
|
+
run_ids : typing.Sequence[int]
|
|
251
|
+
|
|
252
|
+
run_id : typing.Optional[int]
|
|
253
|
+
|
|
254
|
+
traceparent : typing.Optional[str]
|
|
255
|
+
|
|
256
|
+
request_options : typing.Optional[RequestOptions]
|
|
257
|
+
Request-specific configuration.
|
|
258
|
+
|
|
259
|
+
Returns
|
|
260
|
+
-------
|
|
261
|
+
HttpResponse[typing.Dict[str, TranscriptionResult]]
|
|
262
|
+
Successful Response
|
|
263
|
+
"""
|
|
264
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
265
|
+
"transcription-results",
|
|
266
|
+
method="POST",
|
|
267
|
+
params={
|
|
268
|
+
"run_id": run_id,
|
|
269
|
+
},
|
|
270
|
+
json={
|
|
271
|
+
"run_ids": run_ids,
|
|
272
|
+
},
|
|
273
|
+
headers={
|
|
274
|
+
"content-type": "application/json",
|
|
275
|
+
"traceparent": str(traceparent) if traceparent is not None else None,
|
|
276
|
+
},
|
|
277
|
+
request_options=request_options,
|
|
278
|
+
omit=OMIT,
|
|
279
|
+
)
|
|
280
|
+
try:
|
|
281
|
+
if 200 <= _response.status_code < 300:
|
|
282
|
+
_data = typing.cast(
|
|
283
|
+
typing.Dict[str, TranscriptionResult],
|
|
284
|
+
parse_obj_as(
|
|
285
|
+
type_=typing.Dict[str, TranscriptionResult], # type: ignore
|
|
286
|
+
object_=_response.json(),
|
|
287
|
+
),
|
|
288
|
+
)
|
|
289
|
+
return HttpResponse(response=_response, data=_data)
|
|
290
|
+
if _response.status_code == 422:
|
|
291
|
+
raise UnprocessableEntityError(
|
|
292
|
+
headers=dict(_response.headers),
|
|
293
|
+
body=typing.cast(
|
|
294
|
+
HttpValidationError,
|
|
295
|
+
parse_obj_as(
|
|
296
|
+
type_=HttpValidationError, # type: ignore
|
|
297
|
+
object_=_response.json(),
|
|
298
|
+
),
|
|
299
|
+
),
|
|
300
|
+
)
|
|
301
|
+
_response_json = _response.json()
|
|
302
|
+
except JSONDecodeError:
|
|
303
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
304
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
class AsyncRawTranscriptionClient:
|
|
308
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
309
|
+
self._client_wrapper = client_wrapper
|
|
310
|
+
|
|
311
|
+
async def create_transcription(
|
|
312
|
+
self,
|
|
313
|
+
*,
|
|
314
|
+
language: Languages,
|
|
315
|
+
run_id: typing.Optional[int] = None,
|
|
316
|
+
media_file: typing.Optional[core.File] = OMIT,
|
|
317
|
+
media_url: typing.Optional[str] = OMIT,
|
|
318
|
+
file: typing.Optional[core.File] = OMIT,
|
|
319
|
+
audio_url: typing.Optional[str] = OMIT,
|
|
320
|
+
project_name: typing.Optional[str] = OMIT,
|
|
321
|
+
project_description: typing.Optional[str] = OMIT,
|
|
322
|
+
folder_id: typing.Optional[int] = OMIT,
|
|
323
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
324
|
+
) -> AsyncHttpResponse[OrchestratorPipelineCallResult]:
|
|
325
|
+
"""
|
|
326
|
+
Parameters
|
|
327
|
+
----------
|
|
328
|
+
language : Languages
|
|
329
|
+
Signed URL to audio file for transcription
|
|
330
|
+
|
|
331
|
+
run_id : typing.Optional[int]
|
|
332
|
+
|
|
333
|
+
media_file : typing.Optional[core.File]
|
|
334
|
+
See core.File for more documentation
|
|
335
|
+
|
|
336
|
+
media_url : typing.Optional[str]
|
|
337
|
+
Signed URL to media file for transcription
|
|
338
|
+
|
|
339
|
+
file : typing.Optional[core.File]
|
|
340
|
+
See core.File for more documentation
|
|
341
|
+
|
|
342
|
+
audio_url : typing.Optional[str]
|
|
343
|
+
[DEPRECATED] Use 'audio_url' instead
|
|
344
|
+
|
|
345
|
+
project_name : typing.Optional[str]
|
|
346
|
+
|
|
347
|
+
project_description : typing.Optional[str]
|
|
348
|
+
|
|
349
|
+
folder_id : typing.Optional[int]
|
|
350
|
+
|
|
351
|
+
request_options : typing.Optional[RequestOptions]
|
|
352
|
+
Request-specific configuration.
|
|
353
|
+
|
|
354
|
+
Returns
|
|
355
|
+
-------
|
|
356
|
+
AsyncHttpResponse[OrchestratorPipelineCallResult]
|
|
357
|
+
Successful Response
|
|
358
|
+
"""
|
|
359
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
360
|
+
"transcribe",
|
|
361
|
+
method="POST",
|
|
362
|
+
params={
|
|
363
|
+
"run_id": run_id,
|
|
364
|
+
},
|
|
365
|
+
data={
|
|
366
|
+
"language": language,
|
|
367
|
+
"media_url": media_url,
|
|
368
|
+
"audio_url": audio_url,
|
|
369
|
+
"project_name": project_name,
|
|
370
|
+
"project_description": project_description,
|
|
371
|
+
"folder_id": folder_id,
|
|
372
|
+
},
|
|
373
|
+
files={
|
|
374
|
+
**({"media_file": media_file} if media_file is not None else {}),
|
|
375
|
+
**({"file": file} if file is not None else {}),
|
|
376
|
+
},
|
|
377
|
+
request_options=request_options,
|
|
378
|
+
omit=OMIT,
|
|
379
|
+
force_multipart=True,
|
|
380
|
+
)
|
|
381
|
+
try:
|
|
382
|
+
if 200 <= _response.status_code < 300:
|
|
383
|
+
_data = typing.cast(
|
|
384
|
+
OrchestratorPipelineCallResult,
|
|
385
|
+
parse_obj_as(
|
|
386
|
+
type_=OrchestratorPipelineCallResult, # type: ignore
|
|
387
|
+
object_=_response.json(),
|
|
388
|
+
),
|
|
389
|
+
)
|
|
390
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
391
|
+
if _response.status_code == 422:
|
|
392
|
+
raise UnprocessableEntityError(
|
|
393
|
+
headers=dict(_response.headers),
|
|
394
|
+
body=typing.cast(
|
|
395
|
+
HttpValidationError,
|
|
396
|
+
parse_obj_as(
|
|
397
|
+
type_=HttpValidationError, # type: ignore
|
|
398
|
+
object_=_response.json(),
|
|
399
|
+
),
|
|
400
|
+
),
|
|
401
|
+
)
|
|
402
|
+
_response_json = _response.json()
|
|
403
|
+
except JSONDecodeError:
|
|
404
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
405
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
406
|
+
|
|
407
|
+
async def get_transcription_task_status(
|
|
408
|
+
self,
|
|
409
|
+
task_id: str,
|
|
410
|
+
*,
|
|
411
|
+
run_id: typing.Optional[int] = None,
|
|
412
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
413
|
+
) -> AsyncHttpResponse[OrchestratorPipelineResult]:
|
|
414
|
+
"""
|
|
415
|
+
Parameters
|
|
416
|
+
----------
|
|
417
|
+
task_id : str
|
|
418
|
+
|
|
419
|
+
run_id : typing.Optional[int]
|
|
420
|
+
|
|
421
|
+
request_options : typing.Optional[RequestOptions]
|
|
422
|
+
Request-specific configuration.
|
|
423
|
+
|
|
424
|
+
Returns
|
|
425
|
+
-------
|
|
426
|
+
AsyncHttpResponse[OrchestratorPipelineResult]
|
|
427
|
+
Successful Response
|
|
428
|
+
"""
|
|
429
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
430
|
+
f"transcribe/{jsonable_encoder(task_id)}",
|
|
431
|
+
method="GET",
|
|
432
|
+
params={
|
|
433
|
+
"run_id": run_id,
|
|
434
|
+
},
|
|
435
|
+
request_options=request_options,
|
|
436
|
+
)
|
|
437
|
+
try:
|
|
438
|
+
if 200 <= _response.status_code < 300:
|
|
439
|
+
_data = typing.cast(
|
|
440
|
+
OrchestratorPipelineResult,
|
|
441
|
+
parse_obj_as(
|
|
442
|
+
type_=OrchestratorPipelineResult, # type: ignore
|
|
443
|
+
object_=_response.json(),
|
|
444
|
+
),
|
|
445
|
+
)
|
|
446
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
447
|
+
if _response.status_code == 422:
|
|
448
|
+
raise UnprocessableEntityError(
|
|
449
|
+
headers=dict(_response.headers),
|
|
450
|
+
body=typing.cast(
|
|
451
|
+
HttpValidationError,
|
|
452
|
+
parse_obj_as(
|
|
453
|
+
type_=HttpValidationError, # type: ignore
|
|
454
|
+
object_=_response.json(),
|
|
455
|
+
),
|
|
456
|
+
),
|
|
457
|
+
)
|
|
458
|
+
_response_json = _response.json()
|
|
459
|
+
except JSONDecodeError:
|
|
460
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
461
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
462
|
+
|
|
463
|
+
async def get_transcription_result(
|
|
464
|
+
self,
|
|
465
|
+
run_id: typing.Optional[int],
|
|
466
|
+
*,
|
|
467
|
+
word_level_timestamps: typing.Optional[bool] = None,
|
|
468
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
469
|
+
) -> AsyncHttpResponse[TranscriptionResult]:
|
|
470
|
+
"""
|
|
471
|
+
NOTE: This endpoint should be called only by the users to get values for their runs via API.
|
|
472
|
+
Further we need to validate if the user has access to the run_id, otherwise we should not return the output urls.
|
|
473
|
+
|
|
474
|
+
Parameters
|
|
475
|
+
----------
|
|
476
|
+
run_id : typing.Optional[int]
|
|
477
|
+
|
|
478
|
+
word_level_timestamps : typing.Optional[bool]
|
|
479
|
+
|
|
480
|
+
request_options : typing.Optional[RequestOptions]
|
|
481
|
+
Request-specific configuration.
|
|
482
|
+
|
|
483
|
+
Returns
|
|
484
|
+
-------
|
|
485
|
+
AsyncHttpResponse[TranscriptionResult]
|
|
486
|
+
Successful Response
|
|
487
|
+
"""
|
|
488
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
489
|
+
f"transcription-result/{jsonable_encoder(run_id)}",
|
|
490
|
+
method="GET",
|
|
491
|
+
params={
|
|
492
|
+
"word_level_timestamps": word_level_timestamps,
|
|
493
|
+
},
|
|
494
|
+
request_options=request_options,
|
|
495
|
+
)
|
|
496
|
+
try:
|
|
497
|
+
if 200 <= _response.status_code < 300:
|
|
498
|
+
_data = typing.cast(
|
|
499
|
+
TranscriptionResult,
|
|
500
|
+
parse_obj_as(
|
|
501
|
+
type_=TranscriptionResult, # type: ignore
|
|
502
|
+
object_=_response.json(),
|
|
503
|
+
),
|
|
504
|
+
)
|
|
505
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
506
|
+
if _response.status_code == 422:
|
|
507
|
+
raise UnprocessableEntityError(
|
|
508
|
+
headers=dict(_response.headers),
|
|
509
|
+
body=typing.cast(
|
|
510
|
+
HttpValidationError,
|
|
511
|
+
parse_obj_as(
|
|
512
|
+
type_=HttpValidationError, # type: ignore
|
|
513
|
+
object_=_response.json(),
|
|
514
|
+
),
|
|
515
|
+
),
|
|
516
|
+
)
|
|
517
|
+
_response_json = _response.json()
|
|
518
|
+
except JSONDecodeError:
|
|
519
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
520
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
521
|
+
|
|
522
|
+
async def get_transcription_results(
|
|
523
|
+
self,
|
|
524
|
+
*,
|
|
525
|
+
run_ids: typing.Sequence[int],
|
|
526
|
+
run_id: typing.Optional[int] = None,
|
|
527
|
+
traceparent: typing.Optional[str] = None,
|
|
528
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
529
|
+
) -> AsyncHttpResponse[typing.Dict[str, TranscriptionResult]]:
|
|
530
|
+
"""
|
|
531
|
+
Parameters
|
|
532
|
+
----------
|
|
533
|
+
run_ids : typing.Sequence[int]
|
|
534
|
+
|
|
535
|
+
run_id : typing.Optional[int]
|
|
536
|
+
|
|
537
|
+
traceparent : typing.Optional[str]
|
|
538
|
+
|
|
539
|
+
request_options : typing.Optional[RequestOptions]
|
|
540
|
+
Request-specific configuration.
|
|
541
|
+
|
|
542
|
+
Returns
|
|
543
|
+
-------
|
|
544
|
+
AsyncHttpResponse[typing.Dict[str, TranscriptionResult]]
|
|
545
|
+
Successful Response
|
|
546
|
+
"""
|
|
547
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
548
|
+
"transcription-results",
|
|
549
|
+
method="POST",
|
|
550
|
+
params={
|
|
551
|
+
"run_id": run_id,
|
|
552
|
+
},
|
|
553
|
+
json={
|
|
554
|
+
"run_ids": run_ids,
|
|
555
|
+
},
|
|
556
|
+
headers={
|
|
557
|
+
"content-type": "application/json",
|
|
558
|
+
"traceparent": str(traceparent) if traceparent is not None else None,
|
|
559
|
+
},
|
|
560
|
+
request_options=request_options,
|
|
561
|
+
omit=OMIT,
|
|
562
|
+
)
|
|
563
|
+
try:
|
|
564
|
+
if 200 <= _response.status_code < 300:
|
|
565
|
+
_data = typing.cast(
|
|
566
|
+
typing.Dict[str, TranscriptionResult],
|
|
567
|
+
parse_obj_as(
|
|
568
|
+
type_=typing.Dict[str, TranscriptionResult], # type: ignore
|
|
569
|
+
object_=_response.json(),
|
|
570
|
+
),
|
|
571
|
+
)
|
|
572
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
573
|
+
if _response.status_code == 422:
|
|
574
|
+
raise UnprocessableEntityError(
|
|
575
|
+
headers=dict(_response.headers),
|
|
576
|
+
body=typing.cast(
|
|
577
|
+
HttpValidationError,
|
|
578
|
+
parse_obj_as(
|
|
579
|
+
type_=HttpValidationError, # type: ignore
|
|
580
|
+
object_=_response.json(),
|
|
581
|
+
),
|
|
582
|
+
),
|
|
583
|
+
)
|
|
584
|
+
_response_json = _response.json()
|
|
585
|
+
except JSONDecodeError:
|
|
586
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
587
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|