camb-sdk 1.0.1__py3-none-any.whl → 1.0.3__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.

Potentially problematic release.


This version of camb-sdk might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: camb-sdk
3
- Version: 1.0.1
3
+ Version: 1.0.3
4
4
  Summary: Camb AI Python SDK for Text-to-Speech, Voice Generation, and Audio APIs
5
5
  Author-email: Camb AI <support@camb.ai>
6
6
  License: MIT
@@ -162,9 +162,10 @@ output_file = "generated_voice_output.mp3"
162
162
  try:
163
163
  print("Generating a new voice and speech...")
164
164
  # The 'text_to_voice' method returns a dict consisting of 3 sample URLs
165
+ # Description and Text should be atleast 100 Characters.
165
166
  result = client.text_to_voice(
166
- text="Crafting a unique voice with a hint of mystery and warmth.",
167
- voice_description="A smooth, baritone voice with a slight echo, perfect for storytelling.",
167
+ text="Crafting a truly unique and captivating voice that carries a subtle air of mystery, depth, and gentle warmth.",
168
+ voice_description="A smooth, rich baritone voice layered with a soft echo, ideal for immersive storytelling and emotional depth.",
168
169
  verbose=True
169
170
  )
170
171
  print(result)
@@ -190,7 +191,7 @@ output_file = "generated_sound_effect.mp3"
190
191
  try:
191
192
  print(f"Generating sound effect and saving to {output_file}...")
192
193
 
193
- client.text_to_audio(
194
+ client.text_to_sound(
194
195
  prompt="A gentle breeze rustling through autumn leaves in a quiet forest.",
195
196
  duration=10,
196
197
  save_to_file=output_file,
@@ -199,13 +200,13 @@ try:
199
200
  print(f"Success! Sound effect saved to {output_file}")
200
201
 
201
202
  except ApiException as e:
202
- print(f"API Exception when calling text_to_audio: {e}\n")
203
+ print(f"API Exception when calling text_to_sound: {e}\n")
203
204
  ```
204
205
 
205
206
  ---
206
- ### 4. End-to-End Dubbing
207
+ ### 4. Getting Client Source and Target Languages
207
208
 
208
- Dub videos into different languages with voice cloning and translation capabilities.
209
+ Retrieve available source and target languages for translation and dubbing.
209
210
 
210
211
  ```python
211
212
  from cambai import CambAI
@@ -214,12 +215,36 @@ from cambai.rest import ApiException
214
215
  # Initialize client
215
216
  client = CambAI(api_key="YOUR_CAMB_API_KEY")
216
217
 
217
- # Call all target languages
218
- print("Listing target languages...")
219
- target_languages = clinet.get_target_languages()
220
- print(f"Found {len(target_languages)} target languages:")
221
- for language in target_languages:
222
- print(f" - {language}")
218
+ try:
219
+ # Get all available target languages
220
+ print("Listing target languages...")
221
+ target_languages = client.get_target_languages()
222
+ print(f"Found {len(target_languages)} target languages:")
223
+ for language in target_languages:
224
+ print(f" - {language}")
225
+
226
+ # Get all available source languages
227
+ print("\nListing source languages...")
228
+ source_languages = client.get_source_languages()
229
+ print(f"Found {len(source_languages)} source languages:")
230
+ for language in source_languages:
231
+ print(f" - {language}")
232
+
233
+ except ApiException as e:
234
+ print(f"API Exception when getting languages: {e}\n")
235
+ ```
236
+
237
+ ---
238
+ ### 5. End-to-End Dubbing
239
+
240
+ Dub videos into different languages with voice cloning and translation capabilities.
241
+
242
+ ```python
243
+ from cambai import CambAI
244
+ from cambai.rest import ApiException
245
+
246
+ # Initialize client
247
+ client = CambAI(api_key="YOUR_CAMB_API_KEY")
223
248
 
224
249
  try:
225
250
  print("Starting end-to-end dubbing process...")
@@ -1,5 +1,5 @@
1
- camb_sdk-1.0.1.dist-info/licenses/LICENSE,sha256=wVE3pAs9Te7Joa1AmJJ0JVd8CNgNmslblQaNgbozkiU,1063
2
- cambai/__init__.py,sha256=IWEE0yN9dLLq-E1BCVkcOCypzw2XNXX5Ybvk6GAbqnE,7245
1
+ camb_sdk-1.0.3.dist-info/licenses/LICENSE,sha256=wVE3pAs9Te7Joa1AmJJ0JVd8CNgNmslblQaNgbozkiU,1063
2
+ cambai/__init__.py,sha256=W459oGpo1ZtKXehhsAR0eLSAuqwm0nnmagAHaaXK_I8,7247
3
3
  cambai/api_client.py,sha256=YZhog2TzYjTilrhh3QV_mzZU3zdXA1fQcFXOiEYUNVs,27660
4
4
  cambai/api_response.py,sha256=eMxw1mpmJcoGZ3gs9z6jM4oYoZ10Gjk333s9sKxGv7s,652
5
5
  cambai/configuration.py,sha256=CZpW7p_C-4S6S5FtXaI3uQjh8dgpnHyyw2s40E83Tgs,18898
@@ -7,7 +7,7 @@ cambai/exceptions.py,sha256=upZXBQh1bx93N8JIPJh89j67pArS4oxcCmZ_cfdK2XU,6471
7
7
  cambai/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  cambai/rest.py,sha256=n3SSWXErpiSqlEvu6lEkTiJQLxjbrFkhZC1rF7biJJQ,9460
9
9
  cambai/api/__init__.py,sha256=IndnP-ftH1sQhRfojuX4VOhQ33JSFfGYP6Ns6YZ0y6k,460
10
- cambai/api/apis_api.py,sha256=gRaotyB2VQBYq-jMFEN4dvEAuEHxNb0dODU7Rc5TrBA,414232
10
+ cambai/api/apis_api.py,sha256=y29Dye7_V4frccYQJDhjhovMrqFLN5YUI6grCR-9coM,415198
11
11
  cambai/api/audio_separation_api.py,sha256=sN9JsmRsQIk6cAvVY5v5J52oKUcRVxysXfFJ0gwXZTE,32210
12
12
  cambai/api/dictionaries_api.py,sha256=2Sfhiy7hJg8_nyE2zj0jjaKhf4Ze2sWyYmmN1KDqYTU,10548
13
13
  cambai/api/dub_api.py,sha256=iWh7VvFGpqXEvfbpLgdeIavVHXKz5q4prDRLUNSMJLQ,36856
@@ -15,7 +15,7 @@ cambai/api/stories_api.py,sha256=PrhkUR8l0zxx2DGEKNj-V0IeU2ODzzjdJvbPHNWRHHk,620
15
15
  cambai/api/text_to_audio_api.py,sha256=1i6ylgfqcRBl6AthgAFvRqaWRCy1enHqB5De7_61laM,32880
16
16
  cambai/api/text_to_speech_api.py,sha256=ACI2QV9RQ4OMwrq81KLu1GnPMF9DGAUNfar36wWRUdw,21484
17
17
  cambai/api/text_to_voice_api.py,sha256=QXqTSp-9BnQE0JNHJlRj72ILhPXwCY2Zmtvn1zjYw4U,33281
18
- cambai/models/__init__.py,sha256=GsdbPmtg_NZ4YJEboQbQ6t_IMHc3Nf0x9aUw_eMh68s,3423
18
+ cambai/models/__init__.py,sha256=Bvd8KrM8cG-51UQ10lNdCEekfhq_mo2ZVAMllTkEwb0,3425
19
19
  cambai/models/audio_output_file_url_response.py,sha256=QJHmwvf03zIkjUlMppTLMqi-1xU0cg_Y7VkL86ePUmg,2662
20
20
  cambai/models/audio_output_type.py,sha256=WY9zdNlSFpq8GAQH4MnHKxOmNlgOHJ8Z9DSlXIjOUwY,780
21
21
  cambai/models/audio_separation_run_info_response.py,sha256=iqL361fqETtZjOHCAKxhy88slY30rRkNU6A3ezFlWI4,3000
@@ -58,7 +58,7 @@ cambai/models/validation_error.py,sha256=Usdc8EC3OVyDc3KnPaQk_t6CUMVHUVrHltlbJv9
58
58
  cambai/models/validation_error_loc_inner.py,sha256=wHiW_qKw46E2pUdOnesgpdnuqpTX9IQTaEOVDgph5_E,4885
59
59
  cambai/models/video_output_type_without_avi.py,sha256=DvyuKHAv7K-Y_RbO-y2TDI4R7qbsEs_SE_g4f0CpSOs,792
60
60
  cambai/models/voice_item.py,sha256=V-7EmmVLFzISlu2xZVUfQuD-kOg-08DuGyePY7YyWK0,4070
61
- camb_sdk-1.0.1.dist-info/METADATA,sha256=OvJ-wvxKmcqJsLuP3W138CdctGSBJRt0y99Dt8WWIgo,7751
62
- camb_sdk-1.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
63
- camb_sdk-1.0.1.dist-info/top_level.txt,sha256=iqT9vxFBtFsESik9PDn3hFfTRpAl_ULmIbRDX90XaY0,7
64
- camb_sdk-1.0.1.dist-info/RECORD,,
61
+ camb_sdk-1.0.3.dist-info/METADATA,sha256=6lnCgxngpw75Ua9lC3qZ8hywkzuykKA2i05t-lpqB0E,8576
62
+ camb_sdk-1.0.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
63
+ camb_sdk-1.0.3.dist-info/top_level.txt,sha256=iqT9vxFBtFsESik9PDn3hFfTRpAl_ULmIbRDX90XaY0,7
64
+ camb_sdk-1.0.3.dist-info/RECORD,,
cambai/__init__.py CHANGED
@@ -108,7 +108,7 @@ from cambai.models.body_translate_translate_post import BodyTranslateTranslatePo
108
108
  from cambai.models.create_api_key_request_payload import CreateAPIKeyRequestPayload as CreateAPIKeyRequestPayload
109
109
  from cambai.models.create_custom_voice_out import CreateCustomVoiceOut as CreateCustomVoiceOut
110
110
  from cambai.models.create_tts_request_payload import CreateTTSRequestPayload as CreateTTSRequestPayload
111
- from cambai.models.create_tts_stream_request_payload import CreateTTSStreamRequestPayload as CreateTTSStreamRequestPayload
111
+ # from cambai.models.create_tts_stream_request_payload import CreateTTSStreamRequestPayload as CreateTTSStreamRequestPayload
112
112
  from cambai.models.create_text_to_audio_request_payload import CreateTextToAudioRequestPayload as CreateTextToAudioRequestPayload
113
113
  from cambai.models.create_text_to_voice_request_payload import CreateTextToVoiceRequestPayload as CreateTextToVoiceRequestPayload
114
114
  from cambai.models.create_translated_story_request_payload import CreateTranslatedStoryRequestPayload as CreateTranslatedStoryRequestPayload
cambai/api/apis_api.py CHANGED
@@ -15,7 +15,7 @@ import time
15
15
  import warnings
16
16
  import json
17
17
  # Constants for API operations
18
- TIMEOUT = 60
18
+ TIMEOUT = 120
19
19
  POLL_INTERVAL = 5
20
20
 
21
21
  from cambai.configuration import Configuration
@@ -30,7 +30,7 @@ from cambai.models.audio_separation_run_info_response import AudioSeparationRunI
30
30
  from cambai.models.body_translate_translate_post import BodyTranslateTranslatePost
31
31
  from cambai.models.create_custom_voice_out import CreateCustomVoiceOut
32
32
  from cambai.models.create_tts_request_payload import CreateTTSRequestPayload
33
- from cambai.models.create_tts_stream_request_payload import CreateTTSStreamRequestPayload
33
+ # from cambai.models.create_tts_stream_request_payload import CreateTTSStreamRequestPayload
34
34
  from cambai.models.create_text_to_audio_request_payload import CreateTextToAudioRequestPayload
35
35
  from cambai.models.create_text_to_voice_request_payload import CreateTextToVoiceRequestPayload
36
36
  from cambai.models.create_translated_story_request_payload import CreateTranslatedStoryRequestPayload
@@ -74,7 +74,7 @@ class CambAI:
74
74
  self.api_client = api_client
75
75
 
76
76
  @validate_call
77
- def text_to_audio(
77
+ def text_to_sound(
78
78
  self,
79
79
  prompt: str,
80
80
  duration: int,
@@ -90,7 +90,7 @@ class CambAI:
90
90
  Args:
91
91
  prompt: The text prompt to convert to audio
92
92
  duration: The desired duration of the audio in seconds
93
- timeout: Maximum time to wait for processing in seconds (default: 60)
93
+ timeout: Maximum time to wait for processing in seconds (default: 120)
94
94
  save_to_file: Optional file path to save the audio to
95
95
  verbose: Whether to print status updates during processing
96
96
 
@@ -104,7 +104,7 @@ class CambAI:
104
104
  IOError: If there's an error saving the file
105
105
  """
106
106
  from cambai.models.create_text_to_audio_request_payload import CreateTextToAudioRequestPayload
107
-
107
+ assert(len(prompt) <= 30)
108
108
  # Create the request payload
109
109
  request_payload = CreateTextToAudioRequestPayload(
110
110
  prompt=prompt,
@@ -186,7 +186,7 @@ class CambAI:
186
186
  Args:
187
187
  text: The text to convert to speech
188
188
  voice_description: Description of the voice to generate
189
- timeout: Maximum time to wait for processing in seconds (default: 60)
189
+ timeout: Maximum time to wait for processing in seconds (default: 120)
190
190
  verbose: Whether to print status updates during processing
191
191
 
192
192
  Returns:
@@ -197,7 +197,7 @@ class CambAI:
197
197
  TimeoutError: If the processing doesn't complete within the timeout period
198
198
  """
199
199
  from cambai.models.create_text_to_voice_request_payload import CreateTextToVoiceRequestPayload
200
-
200
+ assert(len(text) >= 100)
201
201
  # Create the request payload
202
202
  request_payload = CreateTextToVoiceRequestPayload(
203
203
  text=text,
@@ -272,7 +272,7 @@ class CambAI:
272
272
  text: The text to convert to speech
273
273
  voice_id: The ID of the voice to use
274
274
  language: The language ID (default: 1)
275
- timeout: Maximum time to wait for processing in seconds (default: 60)
275
+ timeout: Maximum time to wait for processing in seconds (default: 120)
276
276
  output_type: Type of output to return (default: FILE_URL)
277
277
  save_to_file: Optional file path to save the audio to (works with BYTES output type)
278
278
  verbose: Whether to print status updates during processing
@@ -385,7 +385,7 @@ class CambAI:
385
385
  target_languages: The list of desired languages that the media file will be dubbed to
386
386
  selected_audio_tracks: Optional array of one or two zero-based audio track indices to dub. Only supported for MXF files. If omitted, the first audio track (index 0) is used by default.
387
387
  add_output_as_an_audio_track: Whether to add the output as an audio track in the MXF file. Only supported for MXF files.
388
- timeout: Maximum time to wait for processing in seconds (default: 60)
388
+ timeout: Maximum time to wait for processing in seconds (default: 180)
389
389
  verbose: Whether to print status updates during processing
390
390
 
391
391
  Returns:
@@ -440,6 +440,12 @@ class CambAI:
440
440
  response = self.get_dubbed_run_info_by_id(result.run_id)
441
441
  return response
442
442
 
443
+ elif result.status == 'FAILED' or result.status == 'ERROR':
444
+ error_msg = f"End-to-end dubbing failed with status: {result.status}"
445
+ if verbose:
446
+ print(error_msg)
447
+ raise RuntimeError(error_msg)
448
+
443
449
  elif verbose:
444
450
  print(f"Still processing... (status: {result.status})")
445
451
 
@@ -447,6 +453,8 @@ class CambAI:
447
453
  except Exception as e:
448
454
  if verbose:
449
455
  print(f"Error checking status: {str(e)}")
456
+ # Re-raise the exception to stop polling on error
457
+ raise
450
458
 
451
459
  # Wait before next poll
452
460
  time.sleep(POLL_INTERVAL)
@@ -3698,283 +3706,283 @@ class CambAI:
3698
3706
 
3699
3707
 
3700
3708
 
3701
- @validate_call
3702
- def create_tts_stream(
3703
- self,
3704
- create_tts_stream_request_payload: CreateTTSStreamRequestPayload,
3705
- _request_timeout: Union[
3706
- None,
3707
- Annotated[StrictFloat, Field(gt=0)],
3708
- Tuple[
3709
- Annotated[StrictFloat, Field(gt=0)],
3710
- Annotated[StrictFloat, Field(gt=0)]
3711
- ]
3712
- ] = None,
3713
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
3714
- _content_type: Optional[StrictStr] = None,
3715
- _headers: Optional[Dict[StrictStr, Any]] = None,
3716
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3717
- ) -> bytearray:
3718
- """Create TTS Stream
3719
-
3720
- Stream text-to-speech audio in real-time
3721
-
3722
- :param create_tts_stream_request_payload: (required)
3723
- :type create_tts_stream_request_payload: CreateTTSStreamRequestPayload
3724
- :param _request_timeout: timeout setting for this request. If one
3725
- number provided, it will be total request
3726
- timeout. It can also be a pair (tuple) of
3727
- (connection, read) timeouts.
3728
- :type _request_timeout: int, tuple(int, int), optional
3729
- :param _request_auth: set to override the auth_settings for an a single
3730
- request; this effectively ignores the
3731
- authentication in the spec for a single request.
3732
- :type _request_auth: dict, optional
3733
- :param _content_type: force content-type for the request.
3734
- :type _content_type: str, Optional
3735
- :param _headers: set to override the headers for a single
3736
- request; this effectively ignores the headers
3737
- in the spec for a single request.
3738
- :type _headers: dict, optional
3739
- :param _host_index: set to override the host_index for a single
3740
- request; this effectively ignores the host_index
3741
- in the spec for a single request.
3742
- :type _host_index: int, optional
3743
- :return: Returns the result object.
3744
- """ # noqa: E501
3745
-
3746
- _param = self._create_tts_stream_serialize(
3747
- create_tts_stream_request_payload=create_tts_stream_request_payload,
3748
- _request_auth=_request_auth,
3749
- _content_type=_content_type,
3750
- _headers=_headers,
3751
- _host_index=_host_index
3752
- )
3753
-
3754
- _response_types_map: Dict[str, Optional[str]] = {
3755
- '200': "bytearray",
3756
- '422': "HTTPValidationError",
3757
- }
3758
- response_data = self.api_client.call_api(
3759
- *_param,
3760
- _request_timeout=_request_timeout
3761
- )
3762
- response_data.read()
3763
- return self.api_client.response_deserialize(
3764
- response_data=response_data,
3765
- response_types_map=_response_types_map,
3766
- ).data
3767
-
3768
-
3769
- @validate_call
3770
- def create_tts_stream_with_http_info(
3771
- self,
3772
- create_tts_stream_request_payload: CreateTTSStreamRequestPayload,
3773
- _request_timeout: Union[
3774
- None,
3775
- Annotated[StrictFloat, Field(gt=0)],
3776
- Tuple[
3777
- Annotated[StrictFloat, Field(gt=0)],
3778
- Annotated[StrictFloat, Field(gt=0)]
3779
- ]
3780
- ] = None,
3781
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
3782
- _content_type: Optional[StrictStr] = None,
3783
- _headers: Optional[Dict[StrictStr, Any]] = None,
3784
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3785
- ) -> ApiResponse[bytearray]:
3786
- """Create TTS Stream
3787
-
3788
- Stream text-to-speech audio in real-time
3789
-
3790
- :param create_tts_stream_request_payload: (required)
3791
- :type create_tts_stream_request_payload: CreateTTSStreamRequestPayload
3792
- :param _request_timeout: timeout setting for this request. If one
3793
- number provided, it will be total request
3794
- timeout. It can also be a pair (tuple) of
3795
- (connection, read) timeouts.
3796
- :type _request_timeout: int, tuple(int, int), optional
3797
- :param _request_auth: set to override the auth_settings for an a single
3798
- request; this effectively ignores the
3799
- authentication in the spec for a single request.
3800
- :type _request_auth: dict, optional
3801
- :param _content_type: force content-type for the request.
3802
- :type _content_type: str, Optional
3803
- :param _headers: set to override the headers for a single
3804
- request; this effectively ignores the headers
3805
- in the spec for a single request.
3806
- :type _headers: dict, optional
3807
- :param _host_index: set to override the host_index for a single
3808
- request; this effectively ignores the host_index
3809
- in the spec for a single request.
3810
- :type _host_index: int, optional
3811
- :return: Returns the result object.
3812
- """ # noqa: E501
3813
-
3814
- _param = self._create_tts_stream_serialize(
3815
- create_tts_stream_request_payload=create_tts_stream_request_payload,
3816
- _request_auth=_request_auth,
3817
- _content_type=_content_type,
3818
- _headers=_headers,
3819
- _host_index=_host_index
3820
- )
3821
-
3822
- _response_types_map: Dict[str, Optional[str]] = {
3823
- '200': "bytearray",
3824
- '422': "HTTPValidationError",
3825
- }
3826
- response_data = self.api_client.call_api(
3827
- *_param,
3828
- _request_timeout=_request_timeout
3829
- )
3830
- response_data.read()
3831
- return self.api_client.response_deserialize(
3832
- response_data=response_data,
3833
- response_types_map=_response_types_map,
3834
- )
3835
-
3836
-
3837
- @validate_call
3838
- def create_tts_stream_without_preload_content(
3839
- self,
3840
- create_tts_stream_request_payload: CreateTTSStreamRequestPayload,
3841
- _request_timeout: Union[
3842
- None,
3843
- Annotated[StrictFloat, Field(gt=0)],
3844
- Tuple[
3845
- Annotated[StrictFloat, Field(gt=0)],
3846
- Annotated[StrictFloat, Field(gt=0)]
3847
- ]
3848
- ] = None,
3849
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
3850
- _content_type: Optional[StrictStr] = None,
3851
- _headers: Optional[Dict[StrictStr, Any]] = None,
3852
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3853
- ) -> RESTResponseType:
3854
- """Create TTS Stream
3855
-
3856
- Stream text-to-speech audio in real-time
3857
-
3858
- :param create_tts_stream_request_payload: (required)
3859
- :type create_tts_stream_request_payload: CreateTTSStreamRequestPayload
3860
- :param _request_timeout: timeout setting for this request. If one
3861
- number provided, it will be total request
3862
- timeout. It can also be a pair (tuple) of
3863
- (connection, read) timeouts.
3864
- :type _request_timeout: int, tuple(int, int), optional
3865
- :param _request_auth: set to override the auth_settings for an a single
3866
- request; this effectively ignores the
3867
- authentication in the spec for a single request.
3868
- :type _request_auth: dict, optional
3869
- :param _content_type: force content-type for the request.
3870
- :type _content_type: str, Optional
3871
- :param _headers: set to override the headers for a single
3872
- request; this effectively ignores the headers
3873
- in the spec for a single request.
3874
- :type _headers: dict, optional
3875
- :param _host_index: set to override the host_index for a single
3876
- request; this effectively ignores the host_index
3877
- in the spec for a single request.
3878
- :type _host_index: int, optional
3879
- :return: Returns the result object.
3880
- """ # noqa: E501
3881
-
3882
- _param = self._create_tts_stream_serialize(
3883
- create_tts_stream_request_payload=create_tts_stream_request_payload,
3884
- _request_auth=_request_auth,
3885
- _content_type=_content_type,
3886
- _headers=_headers,
3887
- _host_index=_host_index
3888
- )
3889
-
3890
- _response_types_map: Dict[str, Optional[str]] = {
3891
- '200': "bytearray",
3892
- '422': "HTTPValidationError",
3893
- }
3894
- response_data = self.api_client.call_api(
3895
- *_param,
3896
- _request_timeout=_request_timeout
3897
- )
3898
- return response_data.response
3899
-
3900
-
3901
- def _create_tts_stream_serialize(
3902
- self,
3903
- create_tts_stream_request_payload,
3904
- _request_auth,
3905
- _content_type,
3906
- _headers,
3907
- _host_index,
3908
- ) -> RequestSerialized:
3909
-
3910
- _host = None
3911
-
3912
- _collection_formats: Dict[str, str] = {
3913
- }
3914
-
3915
- _path_params: Dict[str, str] = {}
3916
- _query_params: List[Tuple[str, str]] = []
3917
- _header_params: Dict[str, Optional[str]] = _headers or {}
3918
- _form_params: List[Tuple[str, str]] = []
3919
- _files: Dict[
3920
- str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
3921
- ] = {}
3922
- _body_params: Optional[bytes] = None
3923
-
3924
- # process the path parameters
3925
- # process the query parameters
3926
- # process the header parameters
3927
- # process the form parameters
3928
- # process the body parameter
3929
- if create_tts_stream_request_payload is not None:
3930
- _body_params = create_tts_stream_request_payload
3931
-
3932
-
3933
- # set the HTTP header `Accept`
3934
- if 'Accept' not in _header_params:
3935
- _header_params['Accept'] = self.api_client.select_header_accept(
3936
- [
3937
- 'audio/flac',
3938
- 'audio/wav',
3939
- 'audio/aac',
3940
- 'audio/x-pcm',
3941
- 'application/json'
3942
- ]
3943
- )
3944
-
3945
- # set the HTTP header `Content-Type`
3946
- if _content_type:
3947
- _header_params['Content-Type'] = _content_type
3948
- else:
3949
- _default_content_type = (
3950
- self.api_client.select_header_content_type(
3951
- [
3952
- 'application/json'
3953
- ]
3954
- )
3955
- )
3956
- if _default_content_type is not None:
3957
- _header_params['Content-Type'] = _default_content_type
3958
-
3959
- # authentication setting
3960
- _auth_settings: List[str] = [
3961
- 'APIKeyHeader'
3962
- ]
3963
-
3964
- return self.api_client.param_serialize(
3965
- method='POST',
3966
- resource_path='/tts-stream',
3967
- path_params=_path_params,
3968
- query_params=_query_params,
3969
- header_params=_header_params,
3970
- body=_body_params,
3971
- post_params=_form_params,
3972
- files=_files,
3973
- auth_settings=_auth_settings,
3974
- collection_formats=_collection_formats,
3975
- _host=_host,
3976
- _request_auth=_request_auth
3977
- )
3709
+ # @validate_call
3710
+ # def create_tts_stream(
3711
+ # self,
3712
+ # create_tts_stream_request_payload: CreateTTSStreamRequestPayload,
3713
+ # _request_timeout: Union[
3714
+ # None,
3715
+ # Annotated[StrictFloat, Field(gt=0)],
3716
+ # Tuple[
3717
+ # Annotated[StrictFloat, Field(gt=0)],
3718
+ # Annotated[StrictFloat, Field(gt=0)]
3719
+ # ]
3720
+ # ] = None,
3721
+ # _request_auth: Optional[Dict[StrictStr, Any]] = None,
3722
+ # _content_type: Optional[StrictStr] = None,
3723
+ # _headers: Optional[Dict[StrictStr, Any]] = None,
3724
+ # _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3725
+ # ) -> bytearray:
3726
+ # """Create TTS Stream
3727
+
3728
+ # Stream text-to-speech audio in real-time
3729
+
3730
+ # :param create_tts_stream_request_payload: (required)
3731
+ # :type create_tts_stream_request_payload: CreateTTSStreamRequestPayload
3732
+ # :param _request_timeout: timeout setting for this request. If one
3733
+ # number provided, it will be total request
3734
+ # timeout. It can also be a pair (tuple) of
3735
+ # (connection, read) timeouts.
3736
+ # :type _request_timeout: int, tuple(int, int), optional
3737
+ # :param _request_auth: set to override the auth_settings for an a single
3738
+ # request; this effectively ignores the
3739
+ # authentication in the spec for a single request.
3740
+ # :type _request_auth: dict, optional
3741
+ # :param _content_type: force content-type for the request.
3742
+ # :type _content_type: str, Optional
3743
+ # :param _headers: set to override the headers for a single
3744
+ # request; this effectively ignores the headers
3745
+ # in the spec for a single request.
3746
+ # :type _headers: dict, optional
3747
+ # :param _host_index: set to override the host_index for a single
3748
+ # request; this effectively ignores the host_index
3749
+ # in the spec for a single request.
3750
+ # :type _host_index: int, optional
3751
+ # :return: Returns the result object.
3752
+ # """ # noqa: E501
3753
+
3754
+ # _param = self._create_tts_stream_serialize(
3755
+ # create_tts_stream_request_payload=create_tts_stream_request_payload,
3756
+ # _request_auth=_request_auth,
3757
+ # _content_type=_content_type,
3758
+ # _headers=_headers,
3759
+ # _host_index=_host_index
3760
+ # )
3761
+
3762
+ # _response_types_map: Dict[str, Optional[str]] = {
3763
+ # '200': "bytearray",
3764
+ # '422': "HTTPValidationError",
3765
+ # }
3766
+ # response_data = self.api_client.call_api(
3767
+ # *_param,
3768
+ # _request_timeout=_request_timeout
3769
+ # )
3770
+ # response_data.read()
3771
+ # return self.api_client.response_deserialize(
3772
+ # response_data=response_data,
3773
+ # response_types_map=_response_types_map,
3774
+ # ).data
3775
+
3776
+
3777
+ # @validate_call
3778
+ # def create_tts_stream_with_http_info(
3779
+ # self,
3780
+ # create_tts_stream_request_payload: CreateTTSStreamRequestPayload,
3781
+ # _request_timeout: Union[
3782
+ # None,
3783
+ # Annotated[StrictFloat, Field(gt=0)],
3784
+ # Tuple[
3785
+ # Annotated[StrictFloat, Field(gt=0)],
3786
+ # Annotated[StrictFloat, Field(gt=0)]
3787
+ # ]
3788
+ # ] = None,
3789
+ # _request_auth: Optional[Dict[StrictStr, Any]] = None,
3790
+ # _content_type: Optional[StrictStr] = None,
3791
+ # _headers: Optional[Dict[StrictStr, Any]] = None,
3792
+ # _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3793
+ # ) -> ApiResponse[bytearray]:
3794
+ # """Create TTS Stream
3795
+
3796
+ # Stream text-to-speech audio in real-time
3797
+
3798
+ # :param create_tts_stream_request_payload: (required)
3799
+ # :type create_tts_stream_request_payload: CreateTTSStreamRequestPayload
3800
+ # :param _request_timeout: timeout setting for this request. If one
3801
+ # number provided, it will be total request
3802
+ # timeout. It can also be a pair (tuple) of
3803
+ # (connection, read) timeouts.
3804
+ # :type _request_timeout: int, tuple(int, int), optional
3805
+ # :param _request_auth: set to override the auth_settings for an a single
3806
+ # request; this effectively ignores the
3807
+ # authentication in the spec for a single request.
3808
+ # :type _request_auth: dict, optional
3809
+ # :param _content_type: force content-type for the request.
3810
+ # :type _content_type: str, Optional
3811
+ # :param _headers: set to override the headers for a single
3812
+ # request; this effectively ignores the headers
3813
+ # in the spec for a single request.
3814
+ # :type _headers: dict, optional
3815
+ # :param _host_index: set to override the host_index for a single
3816
+ # request; this effectively ignores the host_index
3817
+ # in the spec for a single request.
3818
+ # :type _host_index: int, optional
3819
+ # :return: Returns the result object.
3820
+ # """ # noqa: E501
3821
+
3822
+ # _param = self._create_tts_stream_serialize(
3823
+ # create_tts_stream_request_payload=create_tts_stream_request_payload,
3824
+ # _request_auth=_request_auth,
3825
+ # _content_type=_content_type,
3826
+ # _headers=_headers,
3827
+ # _host_index=_host_index
3828
+ # )
3829
+
3830
+ # _response_types_map: Dict[str, Optional[str]] = {
3831
+ # '200': "bytearray",
3832
+ # '422': "HTTPValidationError",
3833
+ # }
3834
+ # response_data = self.api_client.call_api(
3835
+ # *_param,
3836
+ # _request_timeout=_request_timeout
3837
+ # )
3838
+ # response_data.read()
3839
+ # return self.api_client.response_deserialize(
3840
+ # response_data=response_data,
3841
+ # response_types_map=_response_types_map,
3842
+ # )
3843
+
3844
+
3845
+ # @validate_call
3846
+ # def create_tts_stream_without_preload_content(
3847
+ # self,
3848
+ # create_tts_stream_request_payload: CreateTTSStreamRequestPayload,
3849
+ # _request_timeout: Union[
3850
+ # None,
3851
+ # Annotated[StrictFloat, Field(gt=0)],
3852
+ # Tuple[
3853
+ # Annotated[StrictFloat, Field(gt=0)],
3854
+ # Annotated[StrictFloat, Field(gt=0)]
3855
+ # ]
3856
+ # ] = None,
3857
+ # _request_auth: Optional[Dict[StrictStr, Any]] = None,
3858
+ # _content_type: Optional[StrictStr] = None,
3859
+ # _headers: Optional[Dict[StrictStr, Any]] = None,
3860
+ # _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3861
+ # ) -> RESTResponseType:
3862
+ # """Create TTS Stream
3863
+
3864
+ # Stream text-to-speech audio in real-time
3865
+
3866
+ # :param create_tts_stream_request_payload: (required)
3867
+ # :type create_tts_stream_request_payload: CreateTTSStreamRequestPayload
3868
+ # :param _request_timeout: timeout setting for this request. If one
3869
+ # number provided, it will be total request
3870
+ # timeout. It can also be a pair (tuple) of
3871
+ # (connection, read) timeouts.
3872
+ # :type _request_timeout: int, tuple(int, int), optional
3873
+ # :param _request_auth: set to override the auth_settings for an a single
3874
+ # request; this effectively ignores the
3875
+ # authentication in the spec for a single request.
3876
+ # :type _request_auth: dict, optional
3877
+ # :param _content_type: force content-type for the request.
3878
+ # :type _content_type: str, Optional
3879
+ # :param _headers: set to override the headers for a single
3880
+ # request; this effectively ignores the headers
3881
+ # in the spec for a single request.
3882
+ # :type _headers: dict, optional
3883
+ # :param _host_index: set to override the host_index for a single
3884
+ # request; this effectively ignores the host_index
3885
+ # in the spec for a single request.
3886
+ # :type _host_index: int, optional
3887
+ # :return: Returns the result object.
3888
+ # """ # noqa: E501
3889
+
3890
+ # _param = self._create_tts_stream_serialize(
3891
+ # create_tts_stream_request_payload=create_tts_stream_request_payload,
3892
+ # _request_auth=_request_auth,
3893
+ # _content_type=_content_type,
3894
+ # _headers=_headers,
3895
+ # _host_index=_host_index
3896
+ # )
3897
+
3898
+ # _response_types_map: Dict[str, Optional[str]] = {
3899
+ # '200': "bytearray",
3900
+ # '422': "HTTPValidationError",
3901
+ # }
3902
+ # response_data = self.api_client.call_api(
3903
+ # *_param,
3904
+ # _request_timeout=_request_timeout
3905
+ # )
3906
+ # return response_data.response
3907
+
3908
+ # Deprecated
3909
+ # def _create_tts_stream_serialize(
3910
+ # self,
3911
+ # create_tts_stream_request_payload,
3912
+ # _request_auth,
3913
+ # _content_type,
3914
+ # _headers,
3915
+ # _host_index,
3916
+ # ) -> RequestSerialized:
3917
+
3918
+ # _host = None
3919
+
3920
+ # _collection_formats: Dict[str, str] = {
3921
+ # }
3922
+
3923
+ # _path_params: Dict[str, str] = {}
3924
+ # _query_params: List[Tuple[str, str]] = []
3925
+ # _header_params: Dict[str, Optional[str]] = _headers or {}
3926
+ # _form_params: List[Tuple[str, str]] = []
3927
+ # _files: Dict[
3928
+ # str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
3929
+ # ] = {}
3930
+ # _body_params: Optional[bytes] = None
3931
+
3932
+ # # process the path parameters
3933
+ # # process the query parameters
3934
+ # # process the header parameters
3935
+ # # process the form parameters
3936
+ # # process the body parameter
3937
+ # if create_tts_stream_request_payload is not None:
3938
+ # _body_params = create_tts_stream_request_payload
3939
+
3940
+
3941
+ # # set the HTTP header `Accept`
3942
+ # if 'Accept' not in _header_params:
3943
+ # _header_params['Accept'] = self.api_client.select_header_accept(
3944
+ # [
3945
+ # 'audio/flac',
3946
+ # 'audio/wav',
3947
+ # 'audio/aac',
3948
+ # 'audio/x-pcm',
3949
+ # 'application/json'
3950
+ # ]
3951
+ # )
3952
+
3953
+ # # set the HTTP header `Content-Type`
3954
+ # if _content_type:
3955
+ # _header_params['Content-Type'] = _content_type
3956
+ # else:
3957
+ # _default_content_type = (
3958
+ # self.api_client.select_header_content_type(
3959
+ # [
3960
+ # 'application/json'
3961
+ # ]
3962
+ # )
3963
+ # )
3964
+ # if _default_content_type is not None:
3965
+ # _header_params['Content-Type'] = _default_content_type
3966
+
3967
+ # # authentication setting
3968
+ # _auth_settings: List[str] = [
3969
+ # 'APIKeyHeader'
3970
+ # ]
3971
+
3972
+ # return self.api_client.param_serialize(
3973
+ # method='POST',
3974
+ # resource_path='/tts-stream',
3975
+ # path_params=_path_params,
3976
+ # query_params=_query_params,
3977
+ # header_params=_header_params,
3978
+ # body=_body_params,
3979
+ # post_params=_form_params,
3980
+ # files=_files,
3981
+ # auth_settings=_auth_settings,
3982
+ # collection_formats=_collection_formats,
3983
+ # _host=_host,
3984
+ # _request_auth=_request_auth
3985
+ # )
3978
3986
 
3979
3987
 
3980
3988
 
cambai/models/__init__.py CHANGED
@@ -21,7 +21,7 @@ from cambai.models.body_translate_translate_post import BodyTranslateTranslatePo
21
21
  from cambai.models.create_api_key_request_payload import CreateAPIKeyRequestPayload
22
22
  from cambai.models.create_custom_voice_out import CreateCustomVoiceOut
23
23
  from cambai.models.create_tts_request_payload import CreateTTSRequestPayload
24
- from cambai.models.create_tts_stream_request_payload import CreateTTSStreamRequestPayload
24
+ # from cambai.models.create_tts_stream_request_payload import CreateTTSStreamRequestPayload
25
25
  from cambai.models.create_text_to_audio_request_payload import CreateTextToAudioRequestPayload
26
26
  from cambai.models.create_text_to_voice_request_payload import CreateTextToVoiceRequestPayload
27
27
  from cambai.models.create_translated_story_request_payload import CreateTranslatedStoryRequestPayload