cartesia 1.4.0__py3-none-any.whl → 2.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.
- cartesia/__init__.py +302 -3
- cartesia/api_status/__init__.py +6 -0
- cartesia/api_status/client.py +104 -0
- cartesia/api_status/requests/__init__.py +5 -0
- cartesia/api_status/requests/api_info.py +8 -0
- cartesia/api_status/types/__init__.py +5 -0
- cartesia/api_status/types/api_info.py +20 -0
- cartesia/base_client.py +156 -0
- cartesia/client.py +163 -40
- cartesia/core/__init__.py +50 -0
- cartesia/core/api_error.py +15 -0
- cartesia/core/client_wrapper.py +55 -0
- cartesia/core/datetime_utils.py +28 -0
- cartesia/core/file.py +67 -0
- cartesia/core/http_client.py +499 -0
- cartesia/core/jsonable_encoder.py +101 -0
- cartesia/core/pagination.py +88 -0
- cartesia/core/pydantic_utilities.py +296 -0
- cartesia/core/query_encoder.py +58 -0
- cartesia/core/remove_none_from_dict.py +11 -0
- cartesia/core/request_options.py +35 -0
- cartesia/core/serialization.py +272 -0
- cartesia/datasets/__init__.py +24 -0
- cartesia/datasets/requests/__init__.py +15 -0
- cartesia/datasets/requests/create_dataset_request.py +7 -0
- cartesia/datasets/requests/dataset.py +9 -0
- cartesia/datasets/requests/dataset_file.py +9 -0
- cartesia/datasets/requests/paginated_dataset_files.py +10 -0
- cartesia/datasets/requests/paginated_datasets.py +10 -0
- cartesia/datasets/types/__init__.py +17 -0
- cartesia/datasets/types/create_dataset_request.py +19 -0
- cartesia/datasets/types/dataset.py +21 -0
- cartesia/datasets/types/dataset_file.py +21 -0
- cartesia/datasets/types/file_purpose.py +5 -0
- cartesia/datasets/types/paginated_dataset_files.py +21 -0
- cartesia/datasets/types/paginated_datasets.py +21 -0
- cartesia/embedding/__init__.py +5 -0
- cartesia/embedding/types/__init__.py +5 -0
- cartesia/embedding/types/embedding.py +201 -0
- cartesia/environment.py +7 -0
- cartesia/infill/__init__.py +2 -0
- cartesia/infill/client.py +318 -0
- cartesia/tts/__init__.py +167 -0
- cartesia/{_async_websocket.py → tts/_async_websocket.py} +212 -85
- cartesia/tts/_websocket.py +479 -0
- cartesia/tts/client.py +407 -0
- cartesia/tts/requests/__init__.py +76 -0
- cartesia/tts/requests/cancel_context_request.py +17 -0
- cartesia/tts/requests/controls.py +11 -0
- cartesia/tts/requests/generation_request.py +58 -0
- cartesia/tts/requests/mp_3_output_format.py +11 -0
- cartesia/tts/requests/output_format.py +30 -0
- cartesia/tts/requests/phoneme_timestamps.py +10 -0
- cartesia/tts/requests/raw_output_format.py +11 -0
- cartesia/tts/requests/speed.py +7 -0
- cartesia/tts/requests/tts_request.py +24 -0
- cartesia/tts/requests/tts_request_embedding_specifier.py +16 -0
- cartesia/tts/requests/tts_request_id_specifier.py +16 -0
- cartesia/tts/requests/tts_request_voice_specifier.py +7 -0
- cartesia/tts/requests/wav_output_format.py +7 -0
- cartesia/tts/requests/web_socket_base_response.py +11 -0
- cartesia/tts/requests/web_socket_chunk_response.py +11 -0
- cartesia/tts/requests/web_socket_done_response.py +7 -0
- cartesia/tts/requests/web_socket_error_response.py +7 -0
- cartesia/tts/requests/web_socket_flush_done_response.py +9 -0
- cartesia/tts/requests/web_socket_phoneme_timestamps_response.py +9 -0
- cartesia/tts/requests/web_socket_raw_output_format.py +11 -0
- cartesia/tts/requests/web_socket_request.py +7 -0
- cartesia/tts/requests/web_socket_response.py +70 -0
- cartesia/tts/requests/web_socket_stream_options.py +8 -0
- cartesia/tts/requests/web_socket_timestamps_response.py +9 -0
- cartesia/tts/requests/web_socket_tts_output.py +18 -0
- cartesia/tts/requests/web_socket_tts_request.py +25 -0
- cartesia/tts/requests/word_timestamps.py +10 -0
- cartesia/tts/socket_client.py +302 -0
- cartesia/tts/types/__init__.py +90 -0
- cartesia/tts/types/cancel_context_request.py +28 -0
- cartesia/tts/types/context_id.py +3 -0
- cartesia/tts/types/controls.py +22 -0
- cartesia/tts/types/emotion.py +34 -0
- cartesia/tts/types/flush_id.py +3 -0
- cartesia/tts/types/generation_request.py +71 -0
- cartesia/tts/types/mp_3_output_format.py +23 -0
- cartesia/tts/types/natural_specifier.py +5 -0
- cartesia/tts/types/numerical_specifier.py +3 -0
- cartesia/tts/types/output_format.py +58 -0
- cartesia/tts/types/phoneme_timestamps.py +21 -0
- cartesia/tts/types/raw_encoding.py +5 -0
- cartesia/tts/types/raw_output_format.py +22 -0
- cartesia/tts/types/speed.py +7 -0
- cartesia/tts/types/supported_language.py +7 -0
- cartesia/tts/types/tts_request.py +35 -0
- cartesia/tts/types/tts_request_embedding_specifier.py +27 -0
- cartesia/tts/types/tts_request_id_specifier.py +27 -0
- cartesia/tts/types/tts_request_voice_specifier.py +7 -0
- cartesia/tts/types/wav_output_format.py +17 -0
- cartesia/tts/types/web_socket_base_response.py +22 -0
- cartesia/tts/types/web_socket_chunk_response.py +22 -0
- cartesia/tts/types/web_socket_done_response.py +17 -0
- cartesia/tts/types/web_socket_error_response.py +19 -0
- cartesia/tts/types/web_socket_flush_done_response.py +21 -0
- cartesia/tts/types/web_socket_phoneme_timestamps_response.py +20 -0
- cartesia/tts/types/web_socket_raw_output_format.py +22 -0
- cartesia/tts/types/web_socket_request.py +7 -0
- cartesia/tts/types/web_socket_response.py +125 -0
- cartesia/tts/types/web_socket_stream_options.py +19 -0
- cartesia/tts/types/web_socket_timestamps_response.py +20 -0
- cartesia/tts/types/web_socket_tts_output.py +29 -0
- cartesia/tts/types/web_socket_tts_request.py +37 -0
- cartesia/tts/types/word_timestamps.py +21 -0
- cartesia/{_constants.py → tts/utils/constants.py} +2 -2
- cartesia/tts/utils/tts.py +64 -0
- cartesia/tts/utils/types.py +70 -0
- cartesia/version.py +3 -1
- cartesia/voice_changer/__init__.py +27 -0
- cartesia/voice_changer/client.py +395 -0
- cartesia/voice_changer/requests/__init__.py +15 -0
- cartesia/voice_changer/requests/streaming_response.py +38 -0
- cartesia/voice_changer/types/__init__.py +17 -0
- cartesia/voice_changer/types/output_format_container.py +5 -0
- cartesia/voice_changer/types/streaming_response.py +64 -0
- cartesia/voices/__init__.py +81 -0
- cartesia/voices/client.py +1218 -0
- cartesia/voices/requests/__init__.py +29 -0
- cartesia/voices/requests/create_voice_request.py +23 -0
- cartesia/voices/requests/embedding_response.py +8 -0
- cartesia/voices/requests/embedding_specifier.py +10 -0
- cartesia/voices/requests/get_voices_response.py +24 -0
- cartesia/voices/requests/id_specifier.py +10 -0
- cartesia/voices/requests/localize_dialect.py +11 -0
- cartesia/voices/requests/localize_voice_request.py +28 -0
- cartesia/voices/requests/mix_voice_specifier.py +7 -0
- cartesia/voices/requests/mix_voices_request.py +9 -0
- cartesia/voices/requests/update_voice_request.py +15 -0
- cartesia/voices/requests/voice.py +43 -0
- cartesia/voices/requests/voice_metadata.py +36 -0
- cartesia/voices/types/__init__.py +53 -0
- cartesia/voices/types/base_voice_id.py +5 -0
- cartesia/voices/types/clone_mode.py +5 -0
- cartesia/voices/types/create_voice_request.py +34 -0
- cartesia/voices/types/embedding_response.py +20 -0
- cartesia/voices/types/embedding_specifier.py +22 -0
- cartesia/voices/types/gender.py +5 -0
- cartesia/voices/types/gender_presentation.py +5 -0
- cartesia/voices/types/get_voices_response.py +34 -0
- cartesia/voices/types/id_specifier.py +22 -0
- cartesia/voices/types/localize_dialect.py +11 -0
- cartesia/voices/types/localize_english_dialect.py +5 -0
- cartesia/voices/types/localize_french_dialect.py +5 -0
- cartesia/voices/types/localize_portuguese_dialect.py +5 -0
- cartesia/voices/types/localize_spanish_dialect.py +5 -0
- cartesia/voices/types/localize_target_language.py +7 -0
- cartesia/voices/types/localize_voice_request.py +39 -0
- cartesia/voices/types/mix_voice_specifier.py +7 -0
- cartesia/voices/types/mix_voices_request.py +20 -0
- cartesia/voices/types/update_voice_request.py +27 -0
- cartesia/voices/types/voice.py +54 -0
- cartesia/voices/types/voice_expand_options.py +5 -0
- cartesia/voices/types/voice_id.py +3 -0
- cartesia/voices/types/voice_metadata.py +48 -0
- cartesia/voices/types/weight.py +3 -0
- cartesia-2.0.0.dist-info/METADATA +414 -0
- cartesia-2.0.0.dist-info/RECORD +165 -0
- {cartesia-1.4.0.dist-info → cartesia-2.0.0.dist-info}/WHEEL +1 -1
- cartesia/_async_sse.py +0 -95
- cartesia/_logger.py +0 -3
- cartesia/_sse.py +0 -143
- cartesia/_types.py +0 -70
- cartesia/_websocket.py +0 -358
- cartesia/async_client.py +0 -82
- cartesia/async_tts.py +0 -176
- cartesia/resource.py +0 -44
- cartesia/tts.py +0 -292
- cartesia/utils/deprecated.py +0 -55
- cartesia/utils/retry.py +0 -87
- cartesia/utils/tts.py +0 -78
- cartesia/voices.py +0 -204
- cartesia-1.4.0.dist-info/METADATA +0 -663
- cartesia-1.4.0.dist-info/RECORD +0 -23
- cartesia-1.4.0.dist-info/licenses/LICENSE.md +0 -21
- /cartesia/{utils/__init__.py → py.typed} +0 -0
cartesia/__init__.py
CHANGED
@@ -1,4 +1,303 @@
|
|
1
|
-
from
|
2
|
-
from cartesia.client import Cartesia
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
3
2
|
|
4
|
-
|
3
|
+
from . import api_status, datasets, embedding, infill, tts, voice_changer, voices
|
4
|
+
from .api_status import ApiInfo, ApiInfoParams
|
5
|
+
from .client import AsyncCartesia, Cartesia
|
6
|
+
from .datasets import (
|
7
|
+
CreateDatasetRequest,
|
8
|
+
CreateDatasetRequestParams,
|
9
|
+
Dataset,
|
10
|
+
DatasetFile,
|
11
|
+
DatasetFileParams,
|
12
|
+
DatasetParams,
|
13
|
+
FilePurpose,
|
14
|
+
PaginatedDatasetFiles,
|
15
|
+
PaginatedDatasetFilesParams,
|
16
|
+
PaginatedDatasets,
|
17
|
+
PaginatedDatasetsParams,
|
18
|
+
)
|
19
|
+
from .embedding import Embedding
|
20
|
+
from .environment import CartesiaEnvironment
|
21
|
+
from .tts import (
|
22
|
+
CancelContextRequest,
|
23
|
+
CancelContextRequestParams,
|
24
|
+
ContextId,
|
25
|
+
Controls,
|
26
|
+
ControlsParams,
|
27
|
+
Emotion,
|
28
|
+
FlushId,
|
29
|
+
GenerationRequest,
|
30
|
+
GenerationRequestParams,
|
31
|
+
Mp3OutputFormat,
|
32
|
+
Mp3OutputFormatParams,
|
33
|
+
NaturalSpecifier,
|
34
|
+
NumericalSpecifier,
|
35
|
+
OutputFormat,
|
36
|
+
OutputFormatParams,
|
37
|
+
OutputFormat_Mp3,
|
38
|
+
OutputFormat_Mp3Params,
|
39
|
+
OutputFormat_Raw,
|
40
|
+
OutputFormat_RawParams,
|
41
|
+
OutputFormat_Wav,
|
42
|
+
OutputFormat_WavParams,
|
43
|
+
PhonemeTimestamps,
|
44
|
+
PhonemeTimestampsParams,
|
45
|
+
RawEncoding,
|
46
|
+
RawOutputFormat,
|
47
|
+
RawOutputFormatParams,
|
48
|
+
Speed,
|
49
|
+
SpeedParams,
|
50
|
+
SupportedLanguage,
|
51
|
+
TtsRequest,
|
52
|
+
TtsRequestEmbeddingSpecifier,
|
53
|
+
TtsRequestEmbeddingSpecifierParams,
|
54
|
+
TtsRequestIdSpecifier,
|
55
|
+
TtsRequestIdSpecifierParams,
|
56
|
+
TtsRequestParams,
|
57
|
+
TtsRequestVoiceSpecifier,
|
58
|
+
TtsRequestVoiceSpecifierParams,
|
59
|
+
WavOutputFormat,
|
60
|
+
WavOutputFormatParams,
|
61
|
+
WebSocketBaseResponse,
|
62
|
+
WebSocketBaseResponseParams,
|
63
|
+
WebSocketChunkResponse,
|
64
|
+
WebSocketChunkResponseParams,
|
65
|
+
WebSocketDoneResponse,
|
66
|
+
WebSocketDoneResponseParams,
|
67
|
+
WebSocketErrorResponse,
|
68
|
+
WebSocketErrorResponseParams,
|
69
|
+
WebSocketFlushDoneResponse,
|
70
|
+
WebSocketFlushDoneResponseParams,
|
71
|
+
WebSocketPhonemeTimestampsResponse,
|
72
|
+
WebSocketPhonemeTimestampsResponseParams,
|
73
|
+
WebSocketRawOutputFormat,
|
74
|
+
WebSocketRawOutputFormatParams,
|
75
|
+
WebSocketRequest,
|
76
|
+
WebSocketRequestParams,
|
77
|
+
WebSocketResponse,
|
78
|
+
WebSocketResponseParams,
|
79
|
+
WebSocketResponse_Chunk,
|
80
|
+
WebSocketResponse_ChunkParams,
|
81
|
+
WebSocketResponse_Done,
|
82
|
+
WebSocketResponse_DoneParams,
|
83
|
+
WebSocketResponse_Error,
|
84
|
+
WebSocketResponse_ErrorParams,
|
85
|
+
WebSocketResponse_FlushDone,
|
86
|
+
WebSocketResponse_FlushDoneParams,
|
87
|
+
WebSocketResponse_PhonemeTimestamps,
|
88
|
+
WebSocketResponse_PhonemeTimestampsParams,
|
89
|
+
WebSocketResponse_Timestamps,
|
90
|
+
WebSocketResponse_TimestampsParams,
|
91
|
+
WebSocketStreamOptions,
|
92
|
+
WebSocketStreamOptionsParams,
|
93
|
+
WebSocketTimestampsResponse,
|
94
|
+
WebSocketTimestampsResponseParams,
|
95
|
+
WebSocketTtsOutput,
|
96
|
+
WebSocketTtsOutputParams,
|
97
|
+
WebSocketTtsRequest,
|
98
|
+
WebSocketTtsRequestParams,
|
99
|
+
WordTimestamps,
|
100
|
+
WordTimestampsParams,
|
101
|
+
)
|
102
|
+
from .version import __version__
|
103
|
+
from .voice_changer import (
|
104
|
+
OutputFormatContainer,
|
105
|
+
StreamingResponse,
|
106
|
+
StreamingResponseParams,
|
107
|
+
StreamingResponse_Chunk,
|
108
|
+
StreamingResponse_ChunkParams,
|
109
|
+
StreamingResponse_Done,
|
110
|
+
StreamingResponse_DoneParams,
|
111
|
+
StreamingResponse_Error,
|
112
|
+
StreamingResponse_ErrorParams,
|
113
|
+
)
|
114
|
+
from .voices import (
|
115
|
+
BaseVoiceId,
|
116
|
+
CloneMode,
|
117
|
+
CreateVoiceRequest,
|
118
|
+
CreateVoiceRequestParams,
|
119
|
+
EmbeddingResponse,
|
120
|
+
EmbeddingResponseParams,
|
121
|
+
EmbeddingSpecifier,
|
122
|
+
EmbeddingSpecifierParams,
|
123
|
+
Gender,
|
124
|
+
GenderPresentation,
|
125
|
+
GetVoicesResponse,
|
126
|
+
GetVoicesResponseParams,
|
127
|
+
IdSpecifier,
|
128
|
+
IdSpecifierParams,
|
129
|
+
LocalizeDialect,
|
130
|
+
LocalizeDialectParams,
|
131
|
+
LocalizeEnglishDialect,
|
132
|
+
LocalizeFrenchDialect,
|
133
|
+
LocalizePortugueseDialect,
|
134
|
+
LocalizeSpanishDialect,
|
135
|
+
LocalizeTargetLanguage,
|
136
|
+
LocalizeVoiceRequest,
|
137
|
+
LocalizeVoiceRequestParams,
|
138
|
+
MixVoiceSpecifier,
|
139
|
+
MixVoiceSpecifierParams,
|
140
|
+
MixVoicesRequest,
|
141
|
+
MixVoicesRequestParams,
|
142
|
+
UpdateVoiceRequest,
|
143
|
+
UpdateVoiceRequestParams,
|
144
|
+
Voice,
|
145
|
+
VoiceExpandOptions,
|
146
|
+
VoiceId,
|
147
|
+
VoiceMetadata,
|
148
|
+
VoiceMetadataParams,
|
149
|
+
VoiceParams,
|
150
|
+
Weight,
|
151
|
+
)
|
152
|
+
|
153
|
+
__all__ = [
|
154
|
+
"ApiInfo",
|
155
|
+
"ApiInfoParams",
|
156
|
+
"AsyncCartesia",
|
157
|
+
"BaseVoiceId",
|
158
|
+
"CancelContextRequest",
|
159
|
+
"CancelContextRequestParams",
|
160
|
+
"Cartesia",
|
161
|
+
"CartesiaEnvironment",
|
162
|
+
"CloneMode",
|
163
|
+
"ContextId",
|
164
|
+
"Controls",
|
165
|
+
"ControlsParams",
|
166
|
+
"CreateDatasetRequest",
|
167
|
+
"CreateDatasetRequestParams",
|
168
|
+
"CreateVoiceRequest",
|
169
|
+
"CreateVoiceRequestParams",
|
170
|
+
"Dataset",
|
171
|
+
"DatasetFile",
|
172
|
+
"DatasetFileParams",
|
173
|
+
"DatasetParams",
|
174
|
+
"Embedding",
|
175
|
+
"EmbeddingResponse",
|
176
|
+
"EmbeddingResponseParams",
|
177
|
+
"EmbeddingSpecifier",
|
178
|
+
"EmbeddingSpecifierParams",
|
179
|
+
"Emotion",
|
180
|
+
"FilePurpose",
|
181
|
+
"FlushId",
|
182
|
+
"Gender",
|
183
|
+
"GenderPresentation",
|
184
|
+
"GenerationRequest",
|
185
|
+
"GenerationRequestParams",
|
186
|
+
"GetVoicesResponse",
|
187
|
+
"GetVoicesResponseParams",
|
188
|
+
"IdSpecifier",
|
189
|
+
"IdSpecifierParams",
|
190
|
+
"LocalizeDialect",
|
191
|
+
"LocalizeDialectParams",
|
192
|
+
"LocalizeEnglishDialect",
|
193
|
+
"LocalizeFrenchDialect",
|
194
|
+
"LocalizePortugueseDialect",
|
195
|
+
"LocalizeSpanishDialect",
|
196
|
+
"LocalizeTargetLanguage",
|
197
|
+
"LocalizeVoiceRequest",
|
198
|
+
"LocalizeVoiceRequestParams",
|
199
|
+
"MixVoiceSpecifier",
|
200
|
+
"MixVoiceSpecifierParams",
|
201
|
+
"MixVoicesRequest",
|
202
|
+
"MixVoicesRequestParams",
|
203
|
+
"Mp3OutputFormat",
|
204
|
+
"Mp3OutputFormatParams",
|
205
|
+
"NaturalSpecifier",
|
206
|
+
"NumericalSpecifier",
|
207
|
+
"OutputFormat",
|
208
|
+
"OutputFormatContainer",
|
209
|
+
"OutputFormatParams",
|
210
|
+
"OutputFormat_Mp3",
|
211
|
+
"OutputFormat_Mp3Params",
|
212
|
+
"OutputFormat_Raw",
|
213
|
+
"OutputFormat_RawParams",
|
214
|
+
"OutputFormat_Wav",
|
215
|
+
"OutputFormat_WavParams",
|
216
|
+
"PaginatedDatasetFiles",
|
217
|
+
"PaginatedDatasetFilesParams",
|
218
|
+
"PaginatedDatasets",
|
219
|
+
"PaginatedDatasetsParams",
|
220
|
+
"PhonemeTimestamps",
|
221
|
+
"PhonemeTimestampsParams",
|
222
|
+
"RawEncoding",
|
223
|
+
"RawOutputFormat",
|
224
|
+
"RawOutputFormatParams",
|
225
|
+
"Speed",
|
226
|
+
"SpeedParams",
|
227
|
+
"StreamingResponse",
|
228
|
+
"StreamingResponseParams",
|
229
|
+
"StreamingResponse_Chunk",
|
230
|
+
"StreamingResponse_ChunkParams",
|
231
|
+
"StreamingResponse_Done",
|
232
|
+
"StreamingResponse_DoneParams",
|
233
|
+
"StreamingResponse_Error",
|
234
|
+
"StreamingResponse_ErrorParams",
|
235
|
+
"SupportedLanguage",
|
236
|
+
"TtsRequest",
|
237
|
+
"TtsRequestEmbeddingSpecifier",
|
238
|
+
"TtsRequestEmbeddingSpecifierParams",
|
239
|
+
"TtsRequestIdSpecifier",
|
240
|
+
"TtsRequestIdSpecifierParams",
|
241
|
+
"TtsRequestParams",
|
242
|
+
"TtsRequestVoiceSpecifier",
|
243
|
+
"TtsRequestVoiceSpecifierParams",
|
244
|
+
"UpdateVoiceRequest",
|
245
|
+
"UpdateVoiceRequestParams",
|
246
|
+
"Voice",
|
247
|
+
"VoiceExpandOptions",
|
248
|
+
"VoiceId",
|
249
|
+
"VoiceMetadata",
|
250
|
+
"VoiceMetadataParams",
|
251
|
+
"VoiceParams",
|
252
|
+
"WavOutputFormat",
|
253
|
+
"WavOutputFormatParams",
|
254
|
+
"WebSocketBaseResponse",
|
255
|
+
"WebSocketBaseResponseParams",
|
256
|
+
"WebSocketChunkResponse",
|
257
|
+
"WebSocketChunkResponseParams",
|
258
|
+
"WebSocketDoneResponse",
|
259
|
+
"WebSocketDoneResponseParams",
|
260
|
+
"WebSocketErrorResponse",
|
261
|
+
"WebSocketErrorResponseParams",
|
262
|
+
"WebSocketFlushDoneResponse",
|
263
|
+
"WebSocketFlushDoneResponseParams",
|
264
|
+
"WebSocketPhonemeTimestampsResponse",
|
265
|
+
"WebSocketPhonemeTimestampsResponseParams",
|
266
|
+
"WebSocketRawOutputFormat",
|
267
|
+
"WebSocketRawOutputFormatParams",
|
268
|
+
"WebSocketRequest",
|
269
|
+
"WebSocketRequestParams",
|
270
|
+
"WebSocketResponse",
|
271
|
+
"WebSocketResponseParams",
|
272
|
+
"WebSocketResponse_Chunk",
|
273
|
+
"WebSocketResponse_ChunkParams",
|
274
|
+
"WebSocketResponse_Done",
|
275
|
+
"WebSocketResponse_DoneParams",
|
276
|
+
"WebSocketResponse_Error",
|
277
|
+
"WebSocketResponse_ErrorParams",
|
278
|
+
"WebSocketResponse_FlushDone",
|
279
|
+
"WebSocketResponse_FlushDoneParams",
|
280
|
+
"WebSocketResponse_PhonemeTimestamps",
|
281
|
+
"WebSocketResponse_PhonemeTimestampsParams",
|
282
|
+
"WebSocketResponse_Timestamps",
|
283
|
+
"WebSocketResponse_TimestampsParams",
|
284
|
+
"WebSocketStreamOptions",
|
285
|
+
"WebSocketStreamOptionsParams",
|
286
|
+
"WebSocketTimestampsResponse",
|
287
|
+
"WebSocketTimestampsResponseParams",
|
288
|
+
"WebSocketTtsOutput",
|
289
|
+
"WebSocketTtsOutputParams",
|
290
|
+
"WebSocketTtsRequest",
|
291
|
+
"WebSocketTtsRequestParams",
|
292
|
+
"Weight",
|
293
|
+
"WordTimestamps",
|
294
|
+
"WordTimestampsParams",
|
295
|
+
"__version__",
|
296
|
+
"api_status",
|
297
|
+
"datasets",
|
298
|
+
"embedding",
|
299
|
+
"infill",
|
300
|
+
"tts",
|
301
|
+
"voice_changer",
|
302
|
+
"voices",
|
303
|
+
]
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
from ..core.client_wrapper import SyncClientWrapper
|
4
|
+
import typing
|
5
|
+
from ..core.request_options import RequestOptions
|
6
|
+
from .types.api_info import ApiInfo
|
7
|
+
from ..core.pydantic_utilities import parse_obj_as
|
8
|
+
from json.decoder import JSONDecodeError
|
9
|
+
from ..core.api_error import ApiError
|
10
|
+
from ..core.client_wrapper import AsyncClientWrapper
|
11
|
+
|
12
|
+
|
13
|
+
class ApiStatusClient:
|
14
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
15
|
+
self._client_wrapper = client_wrapper
|
16
|
+
|
17
|
+
def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> ApiInfo:
|
18
|
+
"""
|
19
|
+
Parameters
|
20
|
+
----------
|
21
|
+
request_options : typing.Optional[RequestOptions]
|
22
|
+
Request-specific configuration.
|
23
|
+
|
24
|
+
Returns
|
25
|
+
-------
|
26
|
+
ApiInfo
|
27
|
+
|
28
|
+
Examples
|
29
|
+
--------
|
30
|
+
from cartesia import Cartesia
|
31
|
+
|
32
|
+
client = Cartesia(
|
33
|
+
api_key="YOUR_API_KEY",
|
34
|
+
)
|
35
|
+
client.api_status.get()
|
36
|
+
"""
|
37
|
+
_response = self._client_wrapper.httpx_client.request(
|
38
|
+
method="GET",
|
39
|
+
request_options=request_options,
|
40
|
+
)
|
41
|
+
try:
|
42
|
+
if 200 <= _response.status_code < 300:
|
43
|
+
return typing.cast(
|
44
|
+
ApiInfo,
|
45
|
+
parse_obj_as(
|
46
|
+
type_=ApiInfo, # type: ignore
|
47
|
+
object_=_response.json(),
|
48
|
+
),
|
49
|
+
)
|
50
|
+
_response_json = _response.json()
|
51
|
+
except JSONDecodeError:
|
52
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
53
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
54
|
+
|
55
|
+
|
56
|
+
class AsyncApiStatusClient:
|
57
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
58
|
+
self._client_wrapper = client_wrapper
|
59
|
+
|
60
|
+
async def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> ApiInfo:
|
61
|
+
"""
|
62
|
+
Parameters
|
63
|
+
----------
|
64
|
+
request_options : typing.Optional[RequestOptions]
|
65
|
+
Request-specific configuration.
|
66
|
+
|
67
|
+
Returns
|
68
|
+
-------
|
69
|
+
ApiInfo
|
70
|
+
|
71
|
+
Examples
|
72
|
+
--------
|
73
|
+
import asyncio
|
74
|
+
|
75
|
+
from cartesia import AsyncCartesia
|
76
|
+
|
77
|
+
client = AsyncCartesia(
|
78
|
+
api_key="YOUR_API_KEY",
|
79
|
+
)
|
80
|
+
|
81
|
+
|
82
|
+
async def main() -> None:
|
83
|
+
await client.api_status.get()
|
84
|
+
|
85
|
+
|
86
|
+
asyncio.run(main())
|
87
|
+
"""
|
88
|
+
_response = await self._client_wrapper.httpx_client.request(
|
89
|
+
method="GET",
|
90
|
+
request_options=request_options,
|
91
|
+
)
|
92
|
+
try:
|
93
|
+
if 200 <= _response.status_code < 300:
|
94
|
+
return typing.cast(
|
95
|
+
ApiInfo,
|
96
|
+
parse_obj_as(
|
97
|
+
type_=ApiInfo, # type: ignore
|
98
|
+
object_=_response.json(),
|
99
|
+
),
|
100
|
+
)
|
101
|
+
_response_json = _response.json()
|
102
|
+
except JSONDecodeError:
|
103
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
104
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
from ...core.pydantic_utilities import UniversalBaseModel
|
4
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
5
|
+
import typing
|
6
|
+
import pydantic
|
7
|
+
|
8
|
+
|
9
|
+
class ApiInfo(UniversalBaseModel):
|
10
|
+
ok: bool
|
11
|
+
version: str
|
12
|
+
|
13
|
+
if IS_PYDANTIC_V2:
|
14
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
15
|
+
else:
|
16
|
+
|
17
|
+
class Config:
|
18
|
+
frozen = True
|
19
|
+
smart_union = True
|
20
|
+
extra = pydantic.Extra.allow
|
cartesia/base_client.py
ADDED
@@ -0,0 +1,156 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import typing
|
4
|
+
from .environment import CartesiaEnvironment
|
5
|
+
import httpx
|
6
|
+
from .core.client_wrapper import SyncClientWrapper
|
7
|
+
from .api_status.client import ApiStatusClient
|
8
|
+
from .infill.client import InfillClient
|
9
|
+
from .tts.client import TtsClient
|
10
|
+
from .voice_changer.client import VoiceChangerClient
|
11
|
+
from .voices.client import VoicesClient
|
12
|
+
from .core.client_wrapper import AsyncClientWrapper
|
13
|
+
from .api_status.client import AsyncApiStatusClient
|
14
|
+
from .infill.client import AsyncInfillClient
|
15
|
+
from .tts.client import AsyncTtsClient
|
16
|
+
from .voice_changer.client import AsyncVoiceChangerClient
|
17
|
+
from .voices.client import AsyncVoicesClient
|
18
|
+
|
19
|
+
|
20
|
+
class BaseCartesia:
|
21
|
+
"""
|
22
|
+
Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
|
23
|
+
|
24
|
+
Parameters
|
25
|
+
----------
|
26
|
+
base_url : typing.Optional[str]
|
27
|
+
The base url to use for requests from the client.
|
28
|
+
|
29
|
+
environment : CartesiaEnvironment
|
30
|
+
The environment to use for requests from the client. from .environment import CartesiaEnvironment
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
Defaults to CartesiaEnvironment.PRODUCTION
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
api_key : str
|
39
|
+
timeout : typing.Optional[float]
|
40
|
+
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
|
41
|
+
|
42
|
+
follow_redirects : typing.Optional[bool]
|
43
|
+
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
|
44
|
+
|
45
|
+
httpx_client : typing.Optional[httpx.Client]
|
46
|
+
The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
|
47
|
+
|
48
|
+
Examples
|
49
|
+
--------
|
50
|
+
from cartesia import Cartesia
|
51
|
+
|
52
|
+
client = Cartesia(
|
53
|
+
api_key="YOUR_API_KEY",
|
54
|
+
)
|
55
|
+
"""
|
56
|
+
|
57
|
+
def __init__(
|
58
|
+
self,
|
59
|
+
*,
|
60
|
+
base_url: typing.Optional[str] = None,
|
61
|
+
environment: CartesiaEnvironment = CartesiaEnvironment.PRODUCTION,
|
62
|
+
api_key: str,
|
63
|
+
timeout: typing.Optional[float] = None,
|
64
|
+
follow_redirects: typing.Optional[bool] = True,
|
65
|
+
httpx_client: typing.Optional[httpx.Client] = None,
|
66
|
+
):
|
67
|
+
_defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
|
68
|
+
self._client_wrapper = SyncClientWrapper(
|
69
|
+
base_url=_get_base_url(base_url=base_url, environment=environment),
|
70
|
+
api_key=api_key,
|
71
|
+
httpx_client=httpx_client
|
72
|
+
if httpx_client is not None
|
73
|
+
else httpx.Client(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
|
74
|
+
if follow_redirects is not None
|
75
|
+
else httpx.Client(timeout=_defaulted_timeout),
|
76
|
+
timeout=_defaulted_timeout,
|
77
|
+
)
|
78
|
+
self.api_status = ApiStatusClient(client_wrapper=self._client_wrapper)
|
79
|
+
self.infill = InfillClient(client_wrapper=self._client_wrapper)
|
80
|
+
self.tts = TtsClient(client_wrapper=self._client_wrapper)
|
81
|
+
self.voice_changer = VoiceChangerClient(client_wrapper=self._client_wrapper)
|
82
|
+
self.voices = VoicesClient(client_wrapper=self._client_wrapper)
|
83
|
+
|
84
|
+
|
85
|
+
class AsyncBaseCartesia:
|
86
|
+
"""
|
87
|
+
Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
|
88
|
+
|
89
|
+
Parameters
|
90
|
+
----------
|
91
|
+
base_url : typing.Optional[str]
|
92
|
+
The base url to use for requests from the client.
|
93
|
+
|
94
|
+
environment : CartesiaEnvironment
|
95
|
+
The environment to use for requests from the client. from .environment import CartesiaEnvironment
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
Defaults to CartesiaEnvironment.PRODUCTION
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
api_key : str
|
104
|
+
timeout : typing.Optional[float]
|
105
|
+
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
|
106
|
+
|
107
|
+
follow_redirects : typing.Optional[bool]
|
108
|
+
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
|
109
|
+
|
110
|
+
httpx_client : typing.Optional[httpx.AsyncClient]
|
111
|
+
The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
|
112
|
+
|
113
|
+
Examples
|
114
|
+
--------
|
115
|
+
from cartesia import AsyncCartesia
|
116
|
+
|
117
|
+
client = AsyncCartesia(
|
118
|
+
api_key="YOUR_API_KEY",
|
119
|
+
)
|
120
|
+
"""
|
121
|
+
|
122
|
+
def __init__(
|
123
|
+
self,
|
124
|
+
*,
|
125
|
+
base_url: typing.Optional[str] = None,
|
126
|
+
environment: CartesiaEnvironment = CartesiaEnvironment.PRODUCTION,
|
127
|
+
api_key: str,
|
128
|
+
timeout: typing.Optional[float] = None,
|
129
|
+
follow_redirects: typing.Optional[bool] = True,
|
130
|
+
httpx_client: typing.Optional[httpx.AsyncClient] = None,
|
131
|
+
):
|
132
|
+
_defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
|
133
|
+
self._client_wrapper = AsyncClientWrapper(
|
134
|
+
base_url=_get_base_url(base_url=base_url, environment=environment),
|
135
|
+
api_key=api_key,
|
136
|
+
httpx_client=httpx_client
|
137
|
+
if httpx_client is not None
|
138
|
+
else httpx.AsyncClient(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
|
139
|
+
if follow_redirects is not None
|
140
|
+
else httpx.AsyncClient(timeout=_defaulted_timeout),
|
141
|
+
timeout=_defaulted_timeout,
|
142
|
+
)
|
143
|
+
self.api_status = AsyncApiStatusClient(client_wrapper=self._client_wrapper)
|
144
|
+
self.infill = AsyncInfillClient(client_wrapper=self._client_wrapper)
|
145
|
+
self.tts = AsyncTtsClient(client_wrapper=self._client_wrapper)
|
146
|
+
self.voice_changer = AsyncVoiceChangerClient(client_wrapper=self._client_wrapper)
|
147
|
+
self.voices = AsyncVoicesClient(client_wrapper=self._client_wrapper)
|
148
|
+
|
149
|
+
|
150
|
+
def _get_base_url(*, base_url: typing.Optional[str] = None, environment: CartesiaEnvironment) -> str:
|
151
|
+
if base_url is not None:
|
152
|
+
return base_url
|
153
|
+
elif environment is not None:
|
154
|
+
return environment.value
|
155
|
+
else:
|
156
|
+
raise Exception("Please pass in either base_url or environment to construct the client")
|