camb-sdk 1.0.0__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.
- camb_sdk-1.0.0.dist-info/METADATA +266 -0
- camb_sdk-1.0.0.dist-info/RECORD +64 -0
- camb_sdk-1.0.0.dist-info/WHEEL +5 -0
- camb_sdk-1.0.0.dist-info/licenses/LICENSE +21 -0
- camb_sdk-1.0.0.dist-info/top_level.txt +1 -0
- cambai/__init__.py +145 -0
- cambai/api/__init__.py +12 -0
- cambai/api/apis_api.py +10291 -0
- cambai/api/audio_separation_api.py +837 -0
- cambai/api/dictionaries_api.py +286 -0
- cambai/api/dub_api.py +906 -0
- cambai/api/stories_api.py +1511 -0
- cambai/api/text_to_audio_api.py +835 -0
- cambai/api/text_to_speech_api.py +574 -0
- cambai/api/text_to_voice_api.py +840 -0
- cambai/api_client.py +801 -0
- cambai/api_response.py +21 -0
- cambai/configuration.py +603 -0
- cambai/exceptions.py +216 -0
- cambai/models/__init__.py +58 -0
- cambai/models/audio_output_file_url_response.py +87 -0
- cambai/models/audio_output_type.py +39 -0
- cambai/models/audio_separation_run_info_response.py +89 -0
- cambai/models/body_translate_translate_post.py +103 -0
- cambai/models/create_api_key_request_payload.py +89 -0
- cambai/models/create_custom_voice_out.py +87 -0
- cambai/models/create_text_to_audio_request_payload.py +89 -0
- cambai/models/create_text_to_voice_request_payload.py +89 -0
- cambai/models/create_translated_story_request_payload.py +88 -0
- cambai/models/create_translated_tts_request_payload.py +120 -0
- cambai/models/create_translation_stream_request_payload.py +108 -0
- cambai/models/create_tts_request_payload.py +102 -0
- cambai/models/create_tts_stream_request_payload.py +100 -0
- cambai/models/dialogue_item.py +93 -0
- cambai/models/dictionary.py +96 -0
- cambai/models/dub_alt_format_response_body.py +92 -0
- cambai/models/dubbed_output_in_alt_format_request_payload.py +91 -0
- cambai/models/end_to_end_dubbing_request_payload.py +99 -0
- cambai/models/expire_api_key_request_payload.py +87 -0
- cambai/models/formalities.py +37 -0
- cambai/models/gender.py +39 -0
- cambai/models/http_validation_error.py +95 -0
- cambai/models/language_item.py +91 -0
- cambai/models/languages.py +183 -0
- cambai/models/orchestrator_pipeline_result.py +95 -0
- cambai/models/output_api_key.py +105 -0
- cambai/models/output_format.py +134 -0
- cambai/models/output_type.py +37 -0
- cambai/models/request_dubbed_output_in_alt_format200_response.py +137 -0
- cambai/models/run_info_response.py +101 -0
- cambai/models/story_run_info_response.py +99 -0
- cambai/models/task_id.py +87 -0
- cambai/models/task_status.py +40 -0
- cambai/models/text_to_voice_run_info_response.py +87 -0
- cambai/models/transcript_data_type.py +37 -0
- cambai/models/transcript_file_format.py +38 -0
- cambai/models/translation_result.py +87 -0
- cambai/models/tts_stream_output_format.py +40 -0
- cambai/models/validation_error.py +99 -0
- cambai/models/validation_error_loc_inner.py +138 -0
- cambai/models/video_output_type_without_avi.py +38 -0
- cambai/models/voice_item.py +102 -0
- cambai/py.typed +0 -0
- cambai/rest.py +258 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
FastAPI
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
from inspect import getfullargspec
|
|
17
|
+
import json
|
|
18
|
+
import pprint
|
|
19
|
+
import re # noqa: F401
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
21
|
+
from typing import Optional
|
|
22
|
+
from cambai.models.audio_output_type import AudioOutputType
|
|
23
|
+
from cambai.models.video_output_type_without_avi import VideoOutputTypeWithoutAVI
|
|
24
|
+
from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
|
|
25
|
+
from typing_extensions import Literal, Self
|
|
26
|
+
from pydantic import Field
|
|
27
|
+
|
|
28
|
+
OUTPUTFORMAT_ANY_OF_SCHEMAS = ["AudioOutputType", "VideoOutputTypeWithoutAVI"]
|
|
29
|
+
|
|
30
|
+
class OutputFormat(BaseModel):
|
|
31
|
+
"""
|
|
32
|
+
OutputFormat
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
# data type: AudioOutputType
|
|
36
|
+
anyof_schema_1_validator: Optional[AudioOutputType] = None
|
|
37
|
+
# data type: VideoOutputTypeWithoutAVI
|
|
38
|
+
anyof_schema_2_validator: Optional[VideoOutputTypeWithoutAVI] = None
|
|
39
|
+
if TYPE_CHECKING:
|
|
40
|
+
actual_instance: Optional[Union[AudioOutputType, VideoOutputTypeWithoutAVI]] = None
|
|
41
|
+
else:
|
|
42
|
+
actual_instance: Any = None
|
|
43
|
+
any_of_schemas: Set[str] = { "AudioOutputType", "VideoOutputTypeWithoutAVI" }
|
|
44
|
+
|
|
45
|
+
model_config = {
|
|
46
|
+
"validate_assignment": True,
|
|
47
|
+
"protected_namespaces": (),
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
51
|
+
if args:
|
|
52
|
+
if len(args) > 1:
|
|
53
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
54
|
+
if kwargs:
|
|
55
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
56
|
+
super().__init__(actual_instance=args[0])
|
|
57
|
+
else:
|
|
58
|
+
super().__init__(**kwargs)
|
|
59
|
+
|
|
60
|
+
@field_validator('actual_instance')
|
|
61
|
+
def actual_instance_must_validate_anyof(cls, v):
|
|
62
|
+
instance = OutputFormat.model_construct()
|
|
63
|
+
error_messages = []
|
|
64
|
+
# validate data type: AudioOutputType
|
|
65
|
+
if not isinstance(v, AudioOutputType):
|
|
66
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `AudioOutputType`")
|
|
67
|
+
else:
|
|
68
|
+
return v
|
|
69
|
+
|
|
70
|
+
# validate data type: VideoOutputTypeWithoutAVI
|
|
71
|
+
if not isinstance(v, VideoOutputTypeWithoutAVI):
|
|
72
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `VideoOutputTypeWithoutAVI`")
|
|
73
|
+
else:
|
|
74
|
+
return v
|
|
75
|
+
|
|
76
|
+
if error_messages:
|
|
77
|
+
# no match
|
|
78
|
+
raise ValueError("No match found when setting the actual_instance in OutputFormat with anyOf schemas: AudioOutputType, VideoOutputTypeWithoutAVI. Details: " + ", ".join(error_messages))
|
|
79
|
+
else:
|
|
80
|
+
return v
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def from_dict(cls, obj: Dict[str, Any]) -> Self:
|
|
84
|
+
return cls.from_json(json.dumps(obj))
|
|
85
|
+
|
|
86
|
+
@classmethod
|
|
87
|
+
def from_json(cls, json_str: str) -> Self:
|
|
88
|
+
"""Returns the object represented by the json string"""
|
|
89
|
+
instance = cls.model_construct()
|
|
90
|
+
error_messages = []
|
|
91
|
+
# anyof_schema_1_validator: Optional[AudioOutputType] = None
|
|
92
|
+
try:
|
|
93
|
+
instance.actual_instance = AudioOutputType.from_json(json_str)
|
|
94
|
+
return instance
|
|
95
|
+
except (ValidationError, ValueError) as e:
|
|
96
|
+
error_messages.append(str(e))
|
|
97
|
+
# anyof_schema_2_validator: Optional[VideoOutputTypeWithoutAVI] = None
|
|
98
|
+
try:
|
|
99
|
+
instance.actual_instance = VideoOutputTypeWithoutAVI.from_json(json_str)
|
|
100
|
+
return instance
|
|
101
|
+
except (ValidationError, ValueError) as e:
|
|
102
|
+
error_messages.append(str(e))
|
|
103
|
+
|
|
104
|
+
if error_messages:
|
|
105
|
+
# no match
|
|
106
|
+
raise ValueError("No match found when deserializing the JSON string into OutputFormat with anyOf schemas: AudioOutputType, VideoOutputTypeWithoutAVI. Details: " + ", ".join(error_messages))
|
|
107
|
+
else:
|
|
108
|
+
return instance
|
|
109
|
+
|
|
110
|
+
def to_json(self) -> str:
|
|
111
|
+
"""Returns the JSON representation of the actual instance"""
|
|
112
|
+
if self.actual_instance is None:
|
|
113
|
+
return "null"
|
|
114
|
+
|
|
115
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
116
|
+
return self.actual_instance.to_json()
|
|
117
|
+
else:
|
|
118
|
+
return json.dumps(self.actual_instance)
|
|
119
|
+
|
|
120
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], AudioOutputType, VideoOutputTypeWithoutAVI]]:
|
|
121
|
+
"""Returns the dict representation of the actual instance"""
|
|
122
|
+
if self.actual_instance is None:
|
|
123
|
+
return None
|
|
124
|
+
|
|
125
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
126
|
+
return self.actual_instance.to_dict()
|
|
127
|
+
else:
|
|
128
|
+
return self.actual_instance
|
|
129
|
+
|
|
130
|
+
def to_str(self) -> str:
|
|
131
|
+
"""Returns the string representation of the actual instance"""
|
|
132
|
+
return pprint.pformat(self.model_dump())
|
|
133
|
+
|
|
134
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
FastAPI
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import json
|
|
17
|
+
from enum import Enum
|
|
18
|
+
from typing_extensions import Self
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class OutputType(str, Enum):
|
|
22
|
+
"""
|
|
23
|
+
OutputType
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
"""
|
|
27
|
+
allowed enum values
|
|
28
|
+
"""
|
|
29
|
+
RAW_BYTES = 'raw_bytes'
|
|
30
|
+
FILE_URL = 'file_url'
|
|
31
|
+
|
|
32
|
+
@classmethod
|
|
33
|
+
def from_json(cls, json_str: str) -> Self:
|
|
34
|
+
"""Create an instance of OutputType from a JSON string"""
|
|
35
|
+
return cls(json.loads(json_str))
|
|
36
|
+
|
|
37
|
+
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
FastAPI
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
19
|
+
from typing import Any, List, Optional
|
|
20
|
+
from cambai.models.dub_alt_format_response_body import DubAltFormatResponseBody
|
|
21
|
+
from cambai.models.task_id import TaskID
|
|
22
|
+
from pydantic import StrictStr, Field
|
|
23
|
+
from typing import Union, List, Set, Optional, Dict
|
|
24
|
+
from typing_extensions import Literal, Self
|
|
25
|
+
|
|
26
|
+
REQUESTDUBBEDOUTPUTINALTFORMAT200RESPONSE_ONE_OF_SCHEMAS = ["DubAltFormatResponseBody", "TaskID"]
|
|
27
|
+
|
|
28
|
+
class RequestDubbedOutputInAltFormat200Response(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
RequestDubbedOutputInAltFormat200Response
|
|
31
|
+
"""
|
|
32
|
+
# data type: DubAltFormatResponseBody
|
|
33
|
+
oneof_schema_1_validator: Optional[DubAltFormatResponseBody] = Field(default=None, description="A JSON that contains the presigned url of the output file.")
|
|
34
|
+
# data type: TaskID
|
|
35
|
+
oneof_schema_2_validator: Optional[TaskID] = Field(default=None, description="A JSON that contains the unique identifier for the task. This is used to query the status of the exporting dubbed output to alt format task that is running. It is returned when a create request is made for fetching the dubbed output in an alt file format, in case it does not exist.")
|
|
36
|
+
actual_instance: Optional[Union[DubAltFormatResponseBody, TaskID]] = None
|
|
37
|
+
one_of_schemas: Set[str] = { "DubAltFormatResponseBody", "TaskID" }
|
|
38
|
+
|
|
39
|
+
model_config = ConfigDict(
|
|
40
|
+
validate_assignment=True,
|
|
41
|
+
protected_namespaces=(),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
46
|
+
if args:
|
|
47
|
+
if len(args) > 1:
|
|
48
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
49
|
+
if kwargs:
|
|
50
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
51
|
+
super().__init__(actual_instance=args[0])
|
|
52
|
+
else:
|
|
53
|
+
super().__init__(**kwargs)
|
|
54
|
+
|
|
55
|
+
@field_validator('actual_instance')
|
|
56
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
57
|
+
instance = RequestDubbedOutputInAltFormat200Response.model_construct()
|
|
58
|
+
error_messages = []
|
|
59
|
+
match = 0
|
|
60
|
+
# validate data type: DubAltFormatResponseBody
|
|
61
|
+
if not isinstance(v, DubAltFormatResponseBody):
|
|
62
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `DubAltFormatResponseBody`")
|
|
63
|
+
else:
|
|
64
|
+
match += 1
|
|
65
|
+
# validate data type: TaskID
|
|
66
|
+
if not isinstance(v, TaskID):
|
|
67
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `TaskID`")
|
|
68
|
+
else:
|
|
69
|
+
match += 1
|
|
70
|
+
if match > 1:
|
|
71
|
+
# more than 1 match
|
|
72
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in RequestDubbedOutputInAltFormat200Response with oneOf schemas: DubAltFormatResponseBody, TaskID. Details: " + ", ".join(error_messages))
|
|
73
|
+
elif match == 0:
|
|
74
|
+
# no match
|
|
75
|
+
raise ValueError("No match found when setting `actual_instance` in RequestDubbedOutputInAltFormat200Response with oneOf schemas: DubAltFormatResponseBody, TaskID. Details: " + ", ".join(error_messages))
|
|
76
|
+
else:
|
|
77
|
+
return v
|
|
78
|
+
|
|
79
|
+
@classmethod
|
|
80
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
81
|
+
return cls.from_json(json.dumps(obj))
|
|
82
|
+
|
|
83
|
+
@classmethod
|
|
84
|
+
def from_json(cls, json_str: str) -> Self:
|
|
85
|
+
"""Returns the object represented by the json string"""
|
|
86
|
+
instance = cls.model_construct()
|
|
87
|
+
error_messages = []
|
|
88
|
+
match = 0
|
|
89
|
+
|
|
90
|
+
# deserialize data into DubAltFormatResponseBody
|
|
91
|
+
try:
|
|
92
|
+
instance.actual_instance = DubAltFormatResponseBody.from_json(json_str)
|
|
93
|
+
match += 1
|
|
94
|
+
except (ValidationError, ValueError) as e:
|
|
95
|
+
error_messages.append(str(e))
|
|
96
|
+
# deserialize data into TaskID
|
|
97
|
+
try:
|
|
98
|
+
instance.actual_instance = TaskID.from_json(json_str)
|
|
99
|
+
match += 1
|
|
100
|
+
except (ValidationError, ValueError) as e:
|
|
101
|
+
error_messages.append(str(e))
|
|
102
|
+
|
|
103
|
+
if match > 1:
|
|
104
|
+
# more than 1 match
|
|
105
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into RequestDubbedOutputInAltFormat200Response with oneOf schemas: DubAltFormatResponseBody, TaskID. Details: " + ", ".join(error_messages))
|
|
106
|
+
elif match == 0:
|
|
107
|
+
# no match
|
|
108
|
+
raise ValueError("No match found when deserializing the JSON string into RequestDubbedOutputInAltFormat200Response with oneOf schemas: DubAltFormatResponseBody, TaskID. Details: " + ", ".join(error_messages))
|
|
109
|
+
else:
|
|
110
|
+
return instance
|
|
111
|
+
|
|
112
|
+
def to_json(self) -> str:
|
|
113
|
+
"""Returns the JSON representation of the actual instance"""
|
|
114
|
+
if self.actual_instance is None:
|
|
115
|
+
return "null"
|
|
116
|
+
|
|
117
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
118
|
+
return self.actual_instance.to_json()
|
|
119
|
+
else:
|
|
120
|
+
return json.dumps(self.actual_instance)
|
|
121
|
+
|
|
122
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], DubAltFormatResponseBody, TaskID]]:
|
|
123
|
+
"""Returns the dict representation of the actual instance"""
|
|
124
|
+
if self.actual_instance is None:
|
|
125
|
+
return None
|
|
126
|
+
|
|
127
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
128
|
+
return self.actual_instance.to_dict()
|
|
129
|
+
else:
|
|
130
|
+
# primitive type
|
|
131
|
+
return self.actual_instance
|
|
132
|
+
|
|
133
|
+
def to_str(self) -> str:
|
|
134
|
+
"""Returns the string representation of the actual instance"""
|
|
135
|
+
return pprint.pformat(self.model_dump())
|
|
136
|
+
|
|
137
|
+
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
FastAPI
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from cambai.models.dialogue_item import DialogueItem
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class RunInfoResponse(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
RunInfoResponse
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
run_id: Optional[StrictInt] = Field(default=None, description="The unique identifier for the run, which was generated during the end to end dub creation process and returned upon task completion.")
|
|
31
|
+
output_video_url: Optional[StrictStr] = Field(default=None, description="The URL pointing to the generated dubbed video file.")
|
|
32
|
+
output_audio_url: Optional[StrictStr] = Field(default=None, description="The URL pointing to the generated dubbed audio file.")
|
|
33
|
+
transcript: Optional[List[DialogueItem]] = Field(default=None, description="A collection of dialogue items representing the textual transcript of the dubbed output.")
|
|
34
|
+
__properties: ClassVar[List[str]] = ["run_id", "output_video_url", "output_audio_url", "transcript"]
|
|
35
|
+
|
|
36
|
+
model_config = ConfigDict(
|
|
37
|
+
populate_by_name=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
50
|
+
return json.dumps(self.to_dict())
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
54
|
+
"""Create an instance of RunInfoResponse from a JSON string"""
|
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
|
56
|
+
|
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
|
59
|
+
|
|
60
|
+
This has the following differences from calling pydantic's
|
|
61
|
+
`self.model_dump(by_alias=True)`:
|
|
62
|
+
|
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
|
64
|
+
were set at model initialization. Other fields with value `None`
|
|
65
|
+
are ignored.
|
|
66
|
+
"""
|
|
67
|
+
excluded_fields: Set[str] = set([
|
|
68
|
+
])
|
|
69
|
+
|
|
70
|
+
_dict = self.model_dump(
|
|
71
|
+
by_alias=True,
|
|
72
|
+
exclude=excluded_fields,
|
|
73
|
+
exclude_none=True,
|
|
74
|
+
)
|
|
75
|
+
# override the default output from pydantic by calling `to_dict()` of each item in transcript (list)
|
|
76
|
+
_items = []
|
|
77
|
+
if self.transcript:
|
|
78
|
+
for _item_transcript in self.transcript:
|
|
79
|
+
if _item_transcript:
|
|
80
|
+
_items.append(_item_transcript.to_dict())
|
|
81
|
+
_dict['transcript'] = _items
|
|
82
|
+
return _dict
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
86
|
+
"""Create an instance of RunInfoResponse from a dict"""
|
|
87
|
+
if obj is None:
|
|
88
|
+
return None
|
|
89
|
+
|
|
90
|
+
if not isinstance(obj, dict):
|
|
91
|
+
return cls.model_validate(obj)
|
|
92
|
+
|
|
93
|
+
_obj = cls.model_validate({
|
|
94
|
+
"run_id": obj.get("run_id"),
|
|
95
|
+
"output_video_url": obj.get("output_video_url"),
|
|
96
|
+
"output_audio_url": obj.get("output_audio_url"),
|
|
97
|
+
"transcript": [DialogueItem.from_dict(_item) for _item in obj["transcript"]] if obj.get("transcript") is not None else None
|
|
98
|
+
})
|
|
99
|
+
return _obj
|
|
100
|
+
|
|
101
|
+
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
FastAPI
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from cambai.models.dialogue_item import DialogueItem
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class StoryRunInfoResponse(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
StoryRunInfoResponse
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
audio_url: Optional[StrictStr] = Field(default=None, description="The URL pointing to the generated audio file for the story.")
|
|
31
|
+
dialogue_url: Optional[StrictStr] = Field(default=None, description="The URL pointing to the audio file that contains the story's dialogue.")
|
|
32
|
+
transcript: Optional[List[DialogueItem]] = Field(default=None, description="A collection of dialogue items representing the textual transcript of the story.")
|
|
33
|
+
__properties: ClassVar[List[str]] = ["audio_url", "dialogue_url", "transcript"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
populate_by_name=True,
|
|
37
|
+
validate_assignment=True,
|
|
38
|
+
protected_namespaces=(),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
49
|
+
return json.dumps(self.to_dict())
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of StoryRunInfoResponse from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
# override the default output from pydantic by calling `to_dict()` of each item in transcript (list)
|
|
75
|
+
_items = []
|
|
76
|
+
if self.transcript:
|
|
77
|
+
for _item_transcript in self.transcript:
|
|
78
|
+
if _item_transcript:
|
|
79
|
+
_items.append(_item_transcript.to_dict())
|
|
80
|
+
_dict['transcript'] = _items
|
|
81
|
+
return _dict
|
|
82
|
+
|
|
83
|
+
@classmethod
|
|
84
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
85
|
+
"""Create an instance of StoryRunInfoResponse from a dict"""
|
|
86
|
+
if obj is None:
|
|
87
|
+
return None
|
|
88
|
+
|
|
89
|
+
if not isinstance(obj, dict):
|
|
90
|
+
return cls.model_validate(obj)
|
|
91
|
+
|
|
92
|
+
_obj = cls.model_validate({
|
|
93
|
+
"audio_url": obj.get("audio_url"),
|
|
94
|
+
"dialogue_url": obj.get("dialogue_url"),
|
|
95
|
+
"transcript": [DialogueItem.from_dict(_item) for _item in obj["transcript"]] if obj.get("transcript") is not None else None
|
|
96
|
+
})
|
|
97
|
+
return _obj
|
|
98
|
+
|
|
99
|
+
|
cambai/models/task_id.py
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
FastAPI
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class TaskID(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
TaskID
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
task_id: Optional[StrictStr] = None
|
|
30
|
+
__properties: ClassVar[List[str]] = ["task_id"]
|
|
31
|
+
|
|
32
|
+
model_config = ConfigDict(
|
|
33
|
+
populate_by_name=True,
|
|
34
|
+
validate_assignment=True,
|
|
35
|
+
protected_namespaces=(),
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def to_str(self) -> str:
|
|
40
|
+
"""Returns the string representation of the model using alias"""
|
|
41
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
42
|
+
|
|
43
|
+
def to_json(self) -> str:
|
|
44
|
+
"""Returns the JSON representation of the model using alias"""
|
|
45
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
46
|
+
return json.dumps(self.to_dict())
|
|
47
|
+
|
|
48
|
+
@classmethod
|
|
49
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
50
|
+
"""Create an instance of TaskID from a JSON string"""
|
|
51
|
+
return cls.from_dict(json.loads(json_str))
|
|
52
|
+
|
|
53
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
54
|
+
"""Return the dictionary representation of the model using alias.
|
|
55
|
+
|
|
56
|
+
This has the following differences from calling pydantic's
|
|
57
|
+
`self.model_dump(by_alias=True)`:
|
|
58
|
+
|
|
59
|
+
* `None` is only added to the output dict for nullable fields that
|
|
60
|
+
were set at model initialization. Other fields with value `None`
|
|
61
|
+
are ignored.
|
|
62
|
+
"""
|
|
63
|
+
excluded_fields: Set[str] = set([
|
|
64
|
+
])
|
|
65
|
+
|
|
66
|
+
_dict = self.model_dump(
|
|
67
|
+
by_alias=True,
|
|
68
|
+
exclude=excluded_fields,
|
|
69
|
+
exclude_none=True,
|
|
70
|
+
)
|
|
71
|
+
return _dict
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
75
|
+
"""Create an instance of TaskID from a dict"""
|
|
76
|
+
if obj is None:
|
|
77
|
+
return None
|
|
78
|
+
|
|
79
|
+
if not isinstance(obj, dict):
|
|
80
|
+
return cls.model_validate(obj)
|
|
81
|
+
|
|
82
|
+
_obj = cls.model_validate({
|
|
83
|
+
"task_id": obj.get("task_id")
|
|
84
|
+
})
|
|
85
|
+
return _obj
|
|
86
|
+
|
|
87
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
FastAPI
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import json
|
|
17
|
+
from enum import Enum
|
|
18
|
+
from typing_extensions import Self
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class TaskStatus(str, Enum):
|
|
22
|
+
"""
|
|
23
|
+
TaskStatus
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
"""
|
|
27
|
+
allowed enum values
|
|
28
|
+
"""
|
|
29
|
+
SUCCESS = 'SUCCESS'
|
|
30
|
+
PENDING = 'PENDING'
|
|
31
|
+
TIMEOUT = 'TIMEOUT'
|
|
32
|
+
ERROR = 'ERROR'
|
|
33
|
+
PAYMENT_REQUIRED = 'PAYMENT_REQUIRED'
|
|
34
|
+
|
|
35
|
+
@classmethod
|
|
36
|
+
def from_json(cls, json_str: str) -> Self:
|
|
37
|
+
"""Create an instance of TaskStatus from a JSON string"""
|
|
38
|
+
return cls(json.loads(json_str))
|
|
39
|
+
|
|
40
|
+
|