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,469 @@
|
|
|
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.orchestrator_pipeline_call_result import OrchestratorPipelineCallResult
|
|
8
|
+
from ..types.orchestrator_pipeline_result import OrchestratorPipelineResult
|
|
9
|
+
from ..types.text_to_audio_result import TextToAudioResult
|
|
10
|
+
from ..types.text_to_audio_type import TextToAudioType
|
|
11
|
+
from .raw_client import AsyncRawTextToAudioClient, RawTextToAudioClient
|
|
12
|
+
|
|
13
|
+
# this is used as the default value for optional parameters
|
|
14
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class TextToAudioClient:
|
|
18
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
19
|
+
self._raw_client = RawTextToAudioClient(client_wrapper=client_wrapper)
|
|
20
|
+
|
|
21
|
+
@property
|
|
22
|
+
def with_raw_response(self) -> RawTextToAudioClient:
|
|
23
|
+
"""
|
|
24
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
25
|
+
|
|
26
|
+
Returns
|
|
27
|
+
-------
|
|
28
|
+
RawTextToAudioClient
|
|
29
|
+
"""
|
|
30
|
+
return self._raw_client
|
|
31
|
+
|
|
32
|
+
def create_text_to_audio(
|
|
33
|
+
self,
|
|
34
|
+
*,
|
|
35
|
+
prompt: str,
|
|
36
|
+
run_id: typing.Optional[int] = None,
|
|
37
|
+
traceparent: typing.Optional[str] = None,
|
|
38
|
+
project_name: typing.Optional[str] = OMIT,
|
|
39
|
+
project_description: typing.Optional[str] = OMIT,
|
|
40
|
+
folder_id: typing.Optional[int] = OMIT,
|
|
41
|
+
duration: typing.Optional[float] = OMIT,
|
|
42
|
+
audio_type: typing.Optional[TextToAudioType] = OMIT,
|
|
43
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
44
|
+
) -> OrchestratorPipelineCallResult:
|
|
45
|
+
"""
|
|
46
|
+
Parameters
|
|
47
|
+
----------
|
|
48
|
+
prompt : str
|
|
49
|
+
The text to be converted to audio.
|
|
50
|
+
|
|
51
|
+
run_id : typing.Optional[int]
|
|
52
|
+
|
|
53
|
+
traceparent : typing.Optional[str]
|
|
54
|
+
|
|
55
|
+
project_name : typing.Optional[str]
|
|
56
|
+
|
|
57
|
+
project_description : typing.Optional[str]
|
|
58
|
+
|
|
59
|
+
folder_id : typing.Optional[int]
|
|
60
|
+
|
|
61
|
+
duration : typing.Optional[float]
|
|
62
|
+
The desired duration of the audio.
|
|
63
|
+
|
|
64
|
+
audio_type : typing.Optional[TextToAudioType]
|
|
65
|
+
The audio type preference.
|
|
66
|
+
|
|
67
|
+
request_options : typing.Optional[RequestOptions]
|
|
68
|
+
Request-specific configuration.
|
|
69
|
+
|
|
70
|
+
Returns
|
|
71
|
+
-------
|
|
72
|
+
OrchestratorPipelineCallResult
|
|
73
|
+
Successful Response
|
|
74
|
+
|
|
75
|
+
Examples
|
|
76
|
+
--------
|
|
77
|
+
from camb import CambApi
|
|
78
|
+
|
|
79
|
+
client = CambApi(
|
|
80
|
+
api_key="YOUR_API_KEY",
|
|
81
|
+
)
|
|
82
|
+
client.text_to_audio.create_text_to_audio(
|
|
83
|
+
prompt="prompt",
|
|
84
|
+
)
|
|
85
|
+
"""
|
|
86
|
+
_response = self._raw_client.create_text_to_audio(
|
|
87
|
+
prompt=prompt,
|
|
88
|
+
run_id=run_id,
|
|
89
|
+
traceparent=traceparent,
|
|
90
|
+
project_name=project_name,
|
|
91
|
+
project_description=project_description,
|
|
92
|
+
folder_id=folder_id,
|
|
93
|
+
duration=duration,
|
|
94
|
+
audio_type=audio_type,
|
|
95
|
+
request_options=request_options,
|
|
96
|
+
)
|
|
97
|
+
return _response.data
|
|
98
|
+
|
|
99
|
+
def get_text_to_audio_status(
|
|
100
|
+
self,
|
|
101
|
+
task_id: str,
|
|
102
|
+
*,
|
|
103
|
+
run_id: typing.Optional[int] = None,
|
|
104
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
105
|
+
) -> OrchestratorPipelineResult:
|
|
106
|
+
"""
|
|
107
|
+
Parameters
|
|
108
|
+
----------
|
|
109
|
+
task_id : str
|
|
110
|
+
|
|
111
|
+
run_id : typing.Optional[int]
|
|
112
|
+
|
|
113
|
+
request_options : typing.Optional[RequestOptions]
|
|
114
|
+
Request-specific configuration.
|
|
115
|
+
|
|
116
|
+
Returns
|
|
117
|
+
-------
|
|
118
|
+
OrchestratorPipelineResult
|
|
119
|
+
Successful Response
|
|
120
|
+
|
|
121
|
+
Examples
|
|
122
|
+
--------
|
|
123
|
+
from camb import CambApi
|
|
124
|
+
|
|
125
|
+
client = CambApi(
|
|
126
|
+
api_key="YOUR_API_KEY",
|
|
127
|
+
)
|
|
128
|
+
client.text_to_audio.get_text_to_audio_status(
|
|
129
|
+
task_id="task_id",
|
|
130
|
+
)
|
|
131
|
+
"""
|
|
132
|
+
_response = self._raw_client.get_text_to_audio_status(task_id, run_id=run_id, request_options=request_options)
|
|
133
|
+
return _response.data
|
|
134
|
+
|
|
135
|
+
def get_text_to_audio_result(
|
|
136
|
+
self,
|
|
137
|
+
run_id: typing.Optional[int],
|
|
138
|
+
*,
|
|
139
|
+
output_type: typing.Optional[str] = None,
|
|
140
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
141
|
+
) -> typing.Iterator[bytes]:
|
|
142
|
+
"""
|
|
143
|
+
Retrieve the Text-to-Audio (TTA) result for a given run.
|
|
144
|
+
|
|
145
|
+
This endpoint validates the provided run ID and retrieves the associated
|
|
146
|
+
Text-to-Audio output. It supports two output formats:
|
|
147
|
+
- RAW_BYTES: Streams the audio file in WAV format.
|
|
148
|
+
- FILE_URL: Returns a pre-signed URL for downloading the audio file.
|
|
149
|
+
|
|
150
|
+
The endpoint ensures that the run type is valid for Text-to-Audio processing
|
|
151
|
+
and that the storage preferences are applied accordingly.
|
|
152
|
+
|
|
153
|
+
Args:
|
|
154
|
+
run_id (int): Unique identifier for the TTA run.
|
|
155
|
+
traceparent (Optional[str]): Trace header for distributed tracing.
|
|
156
|
+
api_key_obj (dict): API key object containing authentication and storage preferences.
|
|
157
|
+
output_type (OutputType): Desired output format. Defaults to RAW_BYTES.
|
|
158
|
+
|
|
159
|
+
Returns:
|
|
160
|
+
StreamingResponse | GetTTAOut:
|
|
161
|
+
- StreamingResponse: If output_type is RAW_BYTES, a streaming response with the audio in WAV format.
|
|
162
|
+
- GetTTAOut: If output_type is FILE_URL, a pre-signed URL to access the audio file.
|
|
163
|
+
|
|
164
|
+
Raises:
|
|
165
|
+
HTTPException:
|
|
166
|
+
- 400 BAD REQUEST: If the run type is invalid for a TTA run.
|
|
167
|
+
- 500 INTERNAL SERVER ERROR: If the audio file cannot be fetched or streamed.
|
|
168
|
+
|
|
169
|
+
Parameters
|
|
170
|
+
----------
|
|
171
|
+
run_id : typing.Optional[int]
|
|
172
|
+
|
|
173
|
+
output_type : typing.Optional[str]
|
|
174
|
+
Output format for the Text To Speech result
|
|
175
|
+
|
|
176
|
+
request_options : typing.Optional[RequestOptions]
|
|
177
|
+
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
178
|
+
|
|
179
|
+
Returns
|
|
180
|
+
-------
|
|
181
|
+
typing.Iterator[bytes]
|
|
182
|
+
Successful Response
|
|
183
|
+
"""
|
|
184
|
+
with self._raw_client.get_text_to_audio_result(
|
|
185
|
+
run_id, output_type=output_type, request_options=request_options
|
|
186
|
+
) as r:
|
|
187
|
+
yield from r.data
|
|
188
|
+
|
|
189
|
+
def get_text_to_sound_results(
|
|
190
|
+
self,
|
|
191
|
+
*,
|
|
192
|
+
run_ids: typing.Sequence[int],
|
|
193
|
+
run_id: typing.Optional[int] = None,
|
|
194
|
+
traceparent: typing.Optional[str] = None,
|
|
195
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
196
|
+
) -> typing.Dict[str, TextToAudioResult]:
|
|
197
|
+
"""
|
|
198
|
+
Parameters
|
|
199
|
+
----------
|
|
200
|
+
run_ids : typing.Sequence[int]
|
|
201
|
+
|
|
202
|
+
run_id : typing.Optional[int]
|
|
203
|
+
|
|
204
|
+
traceparent : typing.Optional[str]
|
|
205
|
+
|
|
206
|
+
request_options : typing.Optional[RequestOptions]
|
|
207
|
+
Request-specific configuration.
|
|
208
|
+
|
|
209
|
+
Returns
|
|
210
|
+
-------
|
|
211
|
+
typing.Dict[str, TextToAudioResult]
|
|
212
|
+
Successful Response
|
|
213
|
+
|
|
214
|
+
Examples
|
|
215
|
+
--------
|
|
216
|
+
from camb import CambApi
|
|
217
|
+
|
|
218
|
+
client = CambApi(
|
|
219
|
+
api_key="YOUR_API_KEY",
|
|
220
|
+
)
|
|
221
|
+
client.text_to_audio.get_text_to_sound_results(
|
|
222
|
+
run_ids=[1],
|
|
223
|
+
)
|
|
224
|
+
"""
|
|
225
|
+
_response = self._raw_client.get_text_to_sound_results(
|
|
226
|
+
run_ids=run_ids, run_id=run_id, traceparent=traceparent, request_options=request_options
|
|
227
|
+
)
|
|
228
|
+
return _response.data
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
class AsyncTextToAudioClient:
|
|
232
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
233
|
+
self._raw_client = AsyncRawTextToAudioClient(client_wrapper=client_wrapper)
|
|
234
|
+
|
|
235
|
+
@property
|
|
236
|
+
def with_raw_response(self) -> AsyncRawTextToAudioClient:
|
|
237
|
+
"""
|
|
238
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
239
|
+
|
|
240
|
+
Returns
|
|
241
|
+
-------
|
|
242
|
+
AsyncRawTextToAudioClient
|
|
243
|
+
"""
|
|
244
|
+
return self._raw_client
|
|
245
|
+
|
|
246
|
+
async def create_text_to_audio(
|
|
247
|
+
self,
|
|
248
|
+
*,
|
|
249
|
+
prompt: str,
|
|
250
|
+
run_id: typing.Optional[int] = None,
|
|
251
|
+
traceparent: typing.Optional[str] = None,
|
|
252
|
+
project_name: typing.Optional[str] = OMIT,
|
|
253
|
+
project_description: typing.Optional[str] = OMIT,
|
|
254
|
+
folder_id: typing.Optional[int] = OMIT,
|
|
255
|
+
duration: typing.Optional[float] = OMIT,
|
|
256
|
+
audio_type: typing.Optional[TextToAudioType] = OMIT,
|
|
257
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
258
|
+
) -> OrchestratorPipelineCallResult:
|
|
259
|
+
"""
|
|
260
|
+
Parameters
|
|
261
|
+
----------
|
|
262
|
+
prompt : str
|
|
263
|
+
The text to be converted to audio.
|
|
264
|
+
|
|
265
|
+
run_id : typing.Optional[int]
|
|
266
|
+
|
|
267
|
+
traceparent : typing.Optional[str]
|
|
268
|
+
|
|
269
|
+
project_name : typing.Optional[str]
|
|
270
|
+
|
|
271
|
+
project_description : typing.Optional[str]
|
|
272
|
+
|
|
273
|
+
folder_id : typing.Optional[int]
|
|
274
|
+
|
|
275
|
+
duration : typing.Optional[float]
|
|
276
|
+
The desired duration of the audio.
|
|
277
|
+
|
|
278
|
+
audio_type : typing.Optional[TextToAudioType]
|
|
279
|
+
The audio type preference.
|
|
280
|
+
|
|
281
|
+
request_options : typing.Optional[RequestOptions]
|
|
282
|
+
Request-specific configuration.
|
|
283
|
+
|
|
284
|
+
Returns
|
|
285
|
+
-------
|
|
286
|
+
OrchestratorPipelineCallResult
|
|
287
|
+
Successful Response
|
|
288
|
+
|
|
289
|
+
Examples
|
|
290
|
+
--------
|
|
291
|
+
import asyncio
|
|
292
|
+
|
|
293
|
+
from camb import AsyncCambApi
|
|
294
|
+
|
|
295
|
+
client = AsyncCambApi(
|
|
296
|
+
api_key="YOUR_API_KEY",
|
|
297
|
+
)
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
async def main() -> None:
|
|
301
|
+
await client.text_to_audio.create_text_to_audio(
|
|
302
|
+
prompt="prompt",
|
|
303
|
+
)
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
asyncio.run(main())
|
|
307
|
+
"""
|
|
308
|
+
_response = await self._raw_client.create_text_to_audio(
|
|
309
|
+
prompt=prompt,
|
|
310
|
+
run_id=run_id,
|
|
311
|
+
traceparent=traceparent,
|
|
312
|
+
project_name=project_name,
|
|
313
|
+
project_description=project_description,
|
|
314
|
+
folder_id=folder_id,
|
|
315
|
+
duration=duration,
|
|
316
|
+
audio_type=audio_type,
|
|
317
|
+
request_options=request_options,
|
|
318
|
+
)
|
|
319
|
+
return _response.data
|
|
320
|
+
|
|
321
|
+
async def get_text_to_audio_status(
|
|
322
|
+
self,
|
|
323
|
+
task_id: str,
|
|
324
|
+
*,
|
|
325
|
+
run_id: typing.Optional[int] = None,
|
|
326
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
327
|
+
) -> OrchestratorPipelineResult:
|
|
328
|
+
"""
|
|
329
|
+
Parameters
|
|
330
|
+
----------
|
|
331
|
+
task_id : str
|
|
332
|
+
|
|
333
|
+
run_id : typing.Optional[int]
|
|
334
|
+
|
|
335
|
+
request_options : typing.Optional[RequestOptions]
|
|
336
|
+
Request-specific configuration.
|
|
337
|
+
|
|
338
|
+
Returns
|
|
339
|
+
-------
|
|
340
|
+
OrchestratorPipelineResult
|
|
341
|
+
Successful Response
|
|
342
|
+
|
|
343
|
+
Examples
|
|
344
|
+
--------
|
|
345
|
+
import asyncio
|
|
346
|
+
|
|
347
|
+
from camb import AsyncCambApi
|
|
348
|
+
|
|
349
|
+
client = AsyncCambApi(
|
|
350
|
+
api_key="YOUR_API_KEY",
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
async def main() -> None:
|
|
355
|
+
await client.text_to_audio.get_text_to_audio_status(
|
|
356
|
+
task_id="task_id",
|
|
357
|
+
)
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
asyncio.run(main())
|
|
361
|
+
"""
|
|
362
|
+
_response = await self._raw_client.get_text_to_audio_status(
|
|
363
|
+
task_id, run_id=run_id, request_options=request_options
|
|
364
|
+
)
|
|
365
|
+
return _response.data
|
|
366
|
+
|
|
367
|
+
async def get_text_to_audio_result(
|
|
368
|
+
self,
|
|
369
|
+
run_id: typing.Optional[int],
|
|
370
|
+
*,
|
|
371
|
+
output_type: typing.Optional[str] = None,
|
|
372
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
373
|
+
) -> typing.AsyncIterator[bytes]:
|
|
374
|
+
"""
|
|
375
|
+
Retrieve the Text-to-Audio (TTA) result for a given run.
|
|
376
|
+
|
|
377
|
+
This endpoint validates the provided run ID and retrieves the associated
|
|
378
|
+
Text-to-Audio output. It supports two output formats:
|
|
379
|
+
- RAW_BYTES: Streams the audio file in WAV format.
|
|
380
|
+
- FILE_URL: Returns a pre-signed URL for downloading the audio file.
|
|
381
|
+
|
|
382
|
+
The endpoint ensures that the run type is valid for Text-to-Audio processing
|
|
383
|
+
and that the storage preferences are applied accordingly.
|
|
384
|
+
|
|
385
|
+
Args:
|
|
386
|
+
run_id (int): Unique identifier for the TTA run.
|
|
387
|
+
traceparent (Optional[str]): Trace header for distributed tracing.
|
|
388
|
+
api_key_obj (dict): API key object containing authentication and storage preferences.
|
|
389
|
+
output_type (OutputType): Desired output format. Defaults to RAW_BYTES.
|
|
390
|
+
|
|
391
|
+
Returns:
|
|
392
|
+
StreamingResponse | GetTTAOut:
|
|
393
|
+
- StreamingResponse: If output_type is RAW_BYTES, a streaming response with the audio in WAV format.
|
|
394
|
+
- GetTTAOut: If output_type is FILE_URL, a pre-signed URL to access the audio file.
|
|
395
|
+
|
|
396
|
+
Raises:
|
|
397
|
+
HTTPException:
|
|
398
|
+
- 400 BAD REQUEST: If the run type is invalid for a TTA run.
|
|
399
|
+
- 500 INTERNAL SERVER ERROR: If the audio file cannot be fetched or streamed.
|
|
400
|
+
|
|
401
|
+
Parameters
|
|
402
|
+
----------
|
|
403
|
+
run_id : typing.Optional[int]
|
|
404
|
+
|
|
405
|
+
output_type : typing.Optional[str]
|
|
406
|
+
Output format for the Text To Speech result
|
|
407
|
+
|
|
408
|
+
request_options : typing.Optional[RequestOptions]
|
|
409
|
+
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
410
|
+
|
|
411
|
+
Returns
|
|
412
|
+
-------
|
|
413
|
+
typing.AsyncIterator[bytes]
|
|
414
|
+
Successful Response
|
|
415
|
+
"""
|
|
416
|
+
async with self._raw_client.get_text_to_audio_result(
|
|
417
|
+
run_id, output_type=output_type, request_options=request_options
|
|
418
|
+
) as r:
|
|
419
|
+
async for _chunk in r.data:
|
|
420
|
+
yield _chunk
|
|
421
|
+
|
|
422
|
+
async def get_text_to_sound_results(
|
|
423
|
+
self,
|
|
424
|
+
*,
|
|
425
|
+
run_ids: typing.Sequence[int],
|
|
426
|
+
run_id: typing.Optional[int] = None,
|
|
427
|
+
traceparent: typing.Optional[str] = None,
|
|
428
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
429
|
+
) -> typing.Dict[str, TextToAudioResult]:
|
|
430
|
+
"""
|
|
431
|
+
Parameters
|
|
432
|
+
----------
|
|
433
|
+
run_ids : typing.Sequence[int]
|
|
434
|
+
|
|
435
|
+
run_id : typing.Optional[int]
|
|
436
|
+
|
|
437
|
+
traceparent : typing.Optional[str]
|
|
438
|
+
|
|
439
|
+
request_options : typing.Optional[RequestOptions]
|
|
440
|
+
Request-specific configuration.
|
|
441
|
+
|
|
442
|
+
Returns
|
|
443
|
+
-------
|
|
444
|
+
typing.Dict[str, TextToAudioResult]
|
|
445
|
+
Successful Response
|
|
446
|
+
|
|
447
|
+
Examples
|
|
448
|
+
--------
|
|
449
|
+
import asyncio
|
|
450
|
+
|
|
451
|
+
from camb import AsyncCambApi
|
|
452
|
+
|
|
453
|
+
client = AsyncCambApi(
|
|
454
|
+
api_key="YOUR_API_KEY",
|
|
455
|
+
)
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
async def main() -> None:
|
|
459
|
+
await client.text_to_audio.get_text_to_sound_results(
|
|
460
|
+
run_ids=[1],
|
|
461
|
+
)
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
asyncio.run(main())
|
|
465
|
+
"""
|
|
466
|
+
_response = await self._raw_client.get_text_to_sound_results(
|
|
467
|
+
run_ids=run_ids, run_id=run_id, traceparent=traceparent, request_options=request_options
|
|
468
|
+
)
|
|
469
|
+
return _response.data
|