cartesia 1.3.1__py3-none-any.whl → 2.0.0a0__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.
Files changed (174) hide show
  1. cartesia/__init__.py +288 -3
  2. cartesia/api_status/__init__.py +6 -0
  3. cartesia/api_status/client.py +104 -0
  4. cartesia/api_status/requests/__init__.py +5 -0
  5. cartesia/api_status/requests/api_info.py +8 -0
  6. cartesia/api_status/types/__init__.py +5 -0
  7. cartesia/api_status/types/api_info.py +20 -0
  8. cartesia/base_client.py +160 -0
  9. cartesia/client.py +163 -40
  10. cartesia/core/__init__.py +47 -0
  11. cartesia/core/api_error.py +15 -0
  12. cartesia/core/client_wrapper.py +55 -0
  13. cartesia/core/datetime_utils.py +28 -0
  14. cartesia/core/file.py +67 -0
  15. cartesia/core/http_client.py +499 -0
  16. cartesia/core/jsonable_encoder.py +101 -0
  17. cartesia/core/pydantic_utilities.py +296 -0
  18. cartesia/core/query_encoder.py +58 -0
  19. cartesia/core/remove_none_from_dict.py +11 -0
  20. cartesia/core/request_options.py +35 -0
  21. cartesia/core/serialization.py +272 -0
  22. cartesia/datasets/__init__.py +24 -0
  23. cartesia/datasets/client.py +422 -0
  24. cartesia/datasets/requests/__init__.py +15 -0
  25. cartesia/datasets/requests/create_dataset_request.py +7 -0
  26. cartesia/datasets/requests/dataset.py +9 -0
  27. cartesia/datasets/requests/dataset_file.py +9 -0
  28. cartesia/datasets/requests/paginated_dataset_files.py +10 -0
  29. cartesia/datasets/requests/paginated_datasets.py +10 -0
  30. cartesia/datasets/types/__init__.py +17 -0
  31. cartesia/datasets/types/create_dataset_request.py +19 -0
  32. cartesia/datasets/types/dataset.py +21 -0
  33. cartesia/datasets/types/dataset_file.py +21 -0
  34. cartesia/datasets/types/file_purpose.py +5 -0
  35. cartesia/datasets/types/paginated_dataset_files.py +21 -0
  36. cartesia/datasets/types/paginated_datasets.py +21 -0
  37. cartesia/embedding/__init__.py +5 -0
  38. cartesia/embedding/types/__init__.py +5 -0
  39. cartesia/embedding/types/embedding.py +201 -0
  40. cartesia/environment.py +7 -0
  41. cartesia/infill/__init__.py +2 -0
  42. cartesia/infill/client.py +294 -0
  43. cartesia/tts/__init__.py +167 -0
  44. cartesia/{_async_websocket.py → tts/_async_websocket.py} +159 -84
  45. cartesia/tts/_websocket.py +430 -0
  46. cartesia/tts/client.py +407 -0
  47. cartesia/tts/requests/__init__.py +76 -0
  48. cartesia/tts/requests/cancel_context_request.py +17 -0
  49. cartesia/tts/requests/controls.py +11 -0
  50. cartesia/tts/requests/generation_request.py +53 -0
  51. cartesia/tts/requests/mp_3_output_format.py +11 -0
  52. cartesia/tts/requests/output_format.py +30 -0
  53. cartesia/tts/requests/phoneme_timestamps.py +10 -0
  54. cartesia/tts/requests/raw_output_format.py +11 -0
  55. cartesia/tts/requests/speed.py +7 -0
  56. cartesia/tts/requests/tts_request.py +24 -0
  57. cartesia/tts/requests/tts_request_embedding_specifier.py +16 -0
  58. cartesia/tts/requests/tts_request_id_specifier.py +16 -0
  59. cartesia/tts/requests/tts_request_voice_specifier.py +7 -0
  60. cartesia/tts/requests/wav_output_format.py +7 -0
  61. cartesia/tts/requests/web_socket_base_response.py +11 -0
  62. cartesia/tts/requests/web_socket_chunk_response.py +8 -0
  63. cartesia/tts/requests/web_socket_done_response.py +7 -0
  64. cartesia/tts/requests/web_socket_error_response.py +7 -0
  65. cartesia/tts/requests/web_socket_flush_done_response.py +9 -0
  66. cartesia/tts/requests/web_socket_phoneme_timestamps_response.py +9 -0
  67. cartesia/tts/requests/web_socket_raw_output_format.py +11 -0
  68. cartesia/tts/requests/web_socket_request.py +7 -0
  69. cartesia/tts/requests/web_socket_response.py +69 -0
  70. cartesia/tts/requests/web_socket_stream_options.py +8 -0
  71. cartesia/tts/requests/web_socket_timestamps_response.py +9 -0
  72. cartesia/tts/requests/web_socket_tts_output.py +18 -0
  73. cartesia/tts/requests/web_socket_tts_request.py +24 -0
  74. cartesia/tts/requests/word_timestamps.py +10 -0
  75. cartesia/tts/socket_client.py +302 -0
  76. cartesia/tts/types/__init__.py +90 -0
  77. cartesia/tts/types/cancel_context_request.py +28 -0
  78. cartesia/tts/types/context_id.py +3 -0
  79. cartesia/tts/types/controls.py +22 -0
  80. cartesia/tts/types/emotion.py +29 -0
  81. cartesia/tts/types/flush_id.py +3 -0
  82. cartesia/tts/types/generation_request.py +66 -0
  83. cartesia/tts/types/mp_3_output_format.py +23 -0
  84. cartesia/tts/types/natural_specifier.py +5 -0
  85. cartesia/tts/types/numerical_specifier.py +3 -0
  86. cartesia/tts/types/output_format.py +58 -0
  87. cartesia/tts/types/phoneme_timestamps.py +21 -0
  88. cartesia/tts/types/raw_encoding.py +5 -0
  89. cartesia/tts/types/raw_output_format.py +22 -0
  90. cartesia/tts/types/speed.py +7 -0
  91. cartesia/tts/types/supported_language.py +7 -0
  92. cartesia/tts/types/tts_request.py +35 -0
  93. cartesia/tts/types/tts_request_embedding_specifier.py +27 -0
  94. cartesia/tts/types/tts_request_id_specifier.py +27 -0
  95. cartesia/tts/types/tts_request_voice_specifier.py +7 -0
  96. cartesia/tts/types/wav_output_format.py +17 -0
  97. cartesia/tts/types/web_socket_base_response.py +22 -0
  98. cartesia/tts/types/web_socket_chunk_response.py +20 -0
  99. cartesia/tts/types/web_socket_done_response.py +17 -0
  100. cartesia/tts/types/web_socket_error_response.py +19 -0
  101. cartesia/tts/types/web_socket_flush_done_response.py +21 -0
  102. cartesia/tts/types/web_socket_phoneme_timestamps_response.py +20 -0
  103. cartesia/tts/types/web_socket_raw_output_format.py +22 -0
  104. cartesia/tts/types/web_socket_request.py +7 -0
  105. cartesia/tts/types/web_socket_response.py +124 -0
  106. cartesia/tts/types/web_socket_stream_options.py +19 -0
  107. cartesia/tts/types/web_socket_timestamps_response.py +20 -0
  108. cartesia/tts/types/web_socket_tts_output.py +27 -0
  109. cartesia/tts/types/web_socket_tts_request.py +36 -0
  110. cartesia/tts/types/word_timestamps.py +21 -0
  111. cartesia/tts/utils/tts.py +64 -0
  112. cartesia/tts/utils/types.py +70 -0
  113. cartesia/version.py +3 -1
  114. cartesia/voice_changer/__init__.py +27 -0
  115. cartesia/voice_changer/client.py +395 -0
  116. cartesia/voice_changer/requests/__init__.py +15 -0
  117. cartesia/voice_changer/requests/streaming_response.py +36 -0
  118. cartesia/voice_changer/types/__init__.py +17 -0
  119. cartesia/voice_changer/types/output_format_container.py +5 -0
  120. cartesia/voice_changer/types/streaming_response.py +62 -0
  121. cartesia/voices/__init__.py +67 -0
  122. cartesia/voices/client.py +1812 -0
  123. cartesia/voices/requests/__init__.py +27 -0
  124. cartesia/voices/requests/create_voice_request.py +21 -0
  125. cartesia/voices/requests/embedding_response.py +8 -0
  126. cartesia/voices/requests/embedding_specifier.py +10 -0
  127. cartesia/voices/requests/id_specifier.py +10 -0
  128. cartesia/voices/requests/localize_dialect.py +6 -0
  129. cartesia/voices/requests/localize_voice_request.py +15 -0
  130. cartesia/voices/requests/mix_voice_specifier.py +7 -0
  131. cartesia/voices/requests/mix_voices_request.py +9 -0
  132. cartesia/voices/requests/update_voice_request.py +15 -0
  133. cartesia/voices/requests/voice.py +39 -0
  134. cartesia/voices/requests/voice_metadata.py +36 -0
  135. cartesia/voices/types/__init__.py +41 -0
  136. cartesia/voices/types/base_voice_id.py +5 -0
  137. cartesia/voices/types/clone_mode.py +5 -0
  138. cartesia/voices/types/create_voice_request.py +32 -0
  139. cartesia/voices/types/embedding_response.py +20 -0
  140. cartesia/voices/types/embedding_specifier.py +22 -0
  141. cartesia/voices/types/gender.py +5 -0
  142. cartesia/voices/types/id_specifier.py +22 -0
  143. cartesia/voices/types/localize_dialect.py +6 -0
  144. cartesia/voices/types/localize_english_dialect.py +5 -0
  145. cartesia/voices/types/localize_target_language.py +7 -0
  146. cartesia/voices/types/localize_voice_request.py +26 -0
  147. cartesia/voices/types/mix_voice_specifier.py +7 -0
  148. cartesia/voices/types/mix_voices_request.py +20 -0
  149. cartesia/voices/types/update_voice_request.py +27 -0
  150. cartesia/voices/types/voice.py +50 -0
  151. cartesia/voices/types/voice_id.py +3 -0
  152. cartesia/voices/types/voice_metadata.py +48 -0
  153. cartesia/voices/types/weight.py +3 -0
  154. cartesia-2.0.0a0.dist-info/METADATA +306 -0
  155. cartesia-2.0.0a0.dist-info/RECORD +158 -0
  156. {cartesia-1.3.1.dist-info → cartesia-2.0.0a0.dist-info}/WHEEL +1 -1
  157. cartesia/_async_sse.py +0 -95
  158. cartesia/_logger.py +0 -3
  159. cartesia/_sse.py +0 -143
  160. cartesia/_types.py +0 -70
  161. cartesia/_websocket.py +0 -358
  162. cartesia/async_client.py +0 -82
  163. cartesia/async_tts.py +0 -63
  164. cartesia/resource.py +0 -44
  165. cartesia/tts.py +0 -137
  166. cartesia/utils/deprecated.py +0 -55
  167. cartesia/utils/retry.py +0 -87
  168. cartesia/utils/tts.py +0 -78
  169. cartesia/voices.py +0 -208
  170. cartesia-1.3.1.dist-info/METADATA +0 -661
  171. cartesia-1.3.1.dist-info/RECORD +0 -23
  172. cartesia-1.3.1.dist-info/licenses/LICENSE.md +0 -21
  173. /cartesia/{utils/__init__.py → py.typed} +0 -0
  174. /cartesia/{_constants.py → tts/utils/constants.py} +0 -0
@@ -0,0 +1,28 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ...core.pydantic_utilities import UniversalBaseModel
4
+ from .context_id import ContextId
5
+ import pydantic
6
+ import typing
7
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2
8
+
9
+
10
+ class CancelContextRequest(UniversalBaseModel):
11
+ context_id: ContextId = pydantic.Field()
12
+ """
13
+ The ID of the context to cancel.
14
+ """
15
+
16
+ cancel: typing.Literal[True] = pydantic.Field(default=True)
17
+ """
18
+ Whether to cancel the context, so that no more messages are generated for that context.
19
+ """
20
+
21
+ if IS_PYDANTIC_V2:
22
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
23
+ else:
24
+
25
+ class Config:
26
+ frozen = True
27
+ smart_union = True
28
+ extra = pydantic.Extra.allow
@@ -0,0 +1,3 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ ContextId = str
@@ -0,0 +1,22 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ...core.pydantic_utilities import UniversalBaseModel
4
+ from .speed import Speed
5
+ import typing
6
+ from .emotion import Emotion
7
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2
8
+ import pydantic
9
+
10
+
11
+ class Controls(UniversalBaseModel):
12
+ speed: Speed
13
+ emotion: typing.List[Emotion]
14
+
15
+ if IS_PYDANTIC_V2:
16
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
17
+ else:
18
+
19
+ class Config:
20
+ frozen = True
21
+ smart_union = True
22
+ extra = pydantic.Extra.allow
@@ -0,0 +1,29 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ Emotion = typing.Union[
6
+ typing.Literal[
7
+ "anger:lowest",
8
+ "anger:low",
9
+ "anger:high",
10
+ "anger:highest",
11
+ "positivity:lowest",
12
+ "positivity:low",
13
+ "positivity:high",
14
+ "positivity:highest",
15
+ "surprise:lowest",
16
+ "surprise:low",
17
+ "surprise:high",
18
+ "surprise:highest",
19
+ "sadness:lowest",
20
+ "sadness:low",
21
+ "sadness:high",
22
+ "sadness:highest",
23
+ "curiosity:lowest",
24
+ "curiosity:low",
25
+ "curiosity:high",
26
+ "curiosity:highest",
27
+ ],
28
+ typing.Any,
29
+ ]
@@ -0,0 +1,3 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ FlushId = int
@@ -0,0 +1,66 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ...core.pydantic_utilities import UniversalBaseModel
4
+ import pydantic
5
+ import typing
6
+ from .tts_request_voice_specifier import TtsRequestVoiceSpecifier
7
+ from .supported_language import SupportedLanguage
8
+ from .web_socket_raw_output_format import WebSocketRawOutputFormat
9
+ from .context_id import ContextId
10
+ import typing_extensions
11
+ from ...core.serialization import FieldMetadata
12
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2
13
+
14
+
15
+ class GenerationRequest(UniversalBaseModel):
16
+ model_id: str = pydantic.Field()
17
+ """
18
+ The ID of the model to use for the generation. See [Models](/build-with-sonic/models) for available models.
19
+ """
20
+
21
+ transcript: typing.Optional[typing.Any] = pydantic.Field(default=None)
22
+ """
23
+ The transcript to generate speech for. This can be a string or an iterator over strings.
24
+ """
25
+
26
+ voice: TtsRequestVoiceSpecifier
27
+ language: typing.Optional[SupportedLanguage] = None
28
+ output_format: WebSocketRawOutputFormat
29
+ duration: typing.Optional[float] = pydantic.Field(default=None)
30
+ """
31
+ The maximum duration of the audio in seconds. You do not usually need to specify this.
32
+ If the duration is not appropriate for the length of the transcript, the output audio may be truncated.
33
+ """
34
+
35
+ context_id: typing.Optional[ContextId] = None
36
+ continue_: typing_extensions.Annotated[typing.Optional[bool], FieldMetadata(alias="continue")] = pydantic.Field(
37
+ default=None
38
+ )
39
+ """
40
+ Whether this input may be followed by more inputs.
41
+ If not specified, this defaults to `false`.
42
+ """
43
+
44
+ flush: typing.Optional[bool] = pydantic.Field(default=None)
45
+ """
46
+ Whether to flush the context.
47
+ """
48
+
49
+ add_timestamps: typing.Optional[bool] = pydantic.Field(default=None)
50
+ """
51
+ Whether to return word-level timestamps.
52
+ """
53
+
54
+ add_phoneme_timestamps: typing.Optional[bool] = pydantic.Field(default=None)
55
+ """
56
+ Whether to return phoneme-level timestamps.
57
+ """
58
+
59
+ if IS_PYDANTIC_V2:
60
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
61
+ else:
62
+
63
+ class Config:
64
+ frozen = True
65
+ smart_union = True
66
+ extra = pydantic.Extra.allow
@@ -0,0 +1,23 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ...core.pydantic_utilities import UniversalBaseModel
4
+ import pydantic
5
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2
6
+ import typing
7
+
8
+
9
+ class Mp3OutputFormat(UniversalBaseModel):
10
+ sample_rate: int
11
+ bit_rate: int = pydantic.Field()
12
+ """
13
+ The bit rate of the audio in bits per second. Supported bit rates are 32000, 64000, 96000, 128000, 192000.
14
+ """
15
+
16
+ if IS_PYDANTIC_V2:
17
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
18
+ else:
19
+
20
+ class Config:
21
+ frozen = True
22
+ smart_union = True
23
+ extra = pydantic.Extra.allow
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ NaturalSpecifier = typing.Union[typing.Literal["slowest", "slow", "normal", "fast", "fastest"], typing.Any]
@@ -0,0 +1,3 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ NumericalSpecifier = float
@@ -0,0 +1,58 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from __future__ import annotations
4
+ from ...core.pydantic_utilities import UniversalBaseModel
5
+ import typing
6
+ from .raw_encoding import RawEncoding
7
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2
8
+ import pydantic
9
+
10
+
11
+ class OutputFormat_Raw(UniversalBaseModel):
12
+ container: typing.Literal["raw"] = "raw"
13
+ encoding: RawEncoding
14
+ sample_rate: int
15
+ bit_rate: typing.Optional[int] = None
16
+
17
+ if IS_PYDANTIC_V2:
18
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
19
+ else:
20
+
21
+ class Config:
22
+ frozen = True
23
+ smart_union = True
24
+ extra = pydantic.Extra.allow
25
+
26
+
27
+ class OutputFormat_Wav(UniversalBaseModel):
28
+ container: typing.Literal["wav"] = "wav"
29
+ encoding: RawEncoding
30
+ sample_rate: int
31
+ bit_rate: typing.Optional[int] = None
32
+
33
+ if IS_PYDANTIC_V2:
34
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
35
+ else:
36
+
37
+ class Config:
38
+ frozen = True
39
+ smart_union = True
40
+ extra = pydantic.Extra.allow
41
+
42
+
43
+ class OutputFormat_Mp3(UniversalBaseModel):
44
+ container: typing.Literal["mp3"] = "mp3"
45
+ sample_rate: int
46
+ bit_rate: int
47
+
48
+ if IS_PYDANTIC_V2:
49
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
50
+ else:
51
+
52
+ class Config:
53
+ frozen = True
54
+ smart_union = True
55
+ extra = pydantic.Extra.allow
56
+
57
+
58
+ OutputFormat = typing.Union[OutputFormat_Raw, OutputFormat_Wav, OutputFormat_Mp3]
@@ -0,0 +1,21 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ...core.pydantic_utilities import UniversalBaseModel
4
+ import typing
5
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2
6
+ import pydantic
7
+
8
+
9
+ class PhonemeTimestamps(UniversalBaseModel):
10
+ phonemes: typing.List[str]
11
+ start: typing.List[float]
12
+ end: typing.List[float]
13
+
14
+ if IS_PYDANTIC_V2:
15
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
16
+ else:
17
+
18
+ class Config:
19
+ frozen = True
20
+ smart_union = True
21
+ extra = pydantic.Extra.allow
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ RawEncoding = typing.Union[typing.Literal["pcm_f32le", "pcm_s16le", "pcm_mulaw", "pcm_alaw"], typing.Any]
@@ -0,0 +1,22 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ...core.pydantic_utilities import UniversalBaseModel
4
+ from .raw_encoding import RawEncoding
5
+ import typing
6
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2
7
+ import pydantic
8
+
9
+
10
+ class RawOutputFormat(UniversalBaseModel):
11
+ encoding: RawEncoding
12
+ sample_rate: int
13
+ bit_rate: typing.Optional[int] = None
14
+
15
+ if IS_PYDANTIC_V2:
16
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
17
+ else:
18
+
19
+ class Config:
20
+ frozen = True
21
+ smart_union = True
22
+ extra = pydantic.Extra.allow
@@ -0,0 +1,7 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from .numerical_specifier import NumericalSpecifier
5
+ from .natural_specifier import NaturalSpecifier
6
+
7
+ Speed = typing.Union[NumericalSpecifier, NaturalSpecifier]
@@ -0,0 +1,7 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ SupportedLanguage = typing.Union[
6
+ typing.Literal["en", "fr", "de", "es", "pt", "zh", "ja", "hi", "it", "ko", "nl", "pl", "ru", "sv", "tr"], typing.Any
7
+ ]
@@ -0,0 +1,35 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ...core.pydantic_utilities import UniversalBaseModel
4
+ import pydantic
5
+ from .tts_request_voice_specifier import TtsRequestVoiceSpecifier
6
+ import typing
7
+ from .supported_language import SupportedLanguage
8
+ from .output_format import OutputFormat
9
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2
10
+
11
+
12
+ class TtsRequest(UniversalBaseModel):
13
+ model_id: str = pydantic.Field()
14
+ """
15
+ The ID of the model to use for the generation. See [Models](/build-with-sonic/models) for available models.
16
+ """
17
+
18
+ transcript: str
19
+ voice: TtsRequestVoiceSpecifier
20
+ language: typing.Optional[SupportedLanguage] = None
21
+ output_format: OutputFormat
22
+ duration: typing.Optional[float] = pydantic.Field(default=None)
23
+ """
24
+ The maximum duration of the audio in seconds. You do not usually need to specify this.
25
+ If the duration is not appropriate for the length of the transcript, the output audio may be truncated.
26
+ """
27
+
28
+ if IS_PYDANTIC_V2:
29
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
30
+ else:
31
+
32
+ class Config:
33
+ frozen = True
34
+ smart_union = True
35
+ extra = pydantic.Extra.allow
@@ -0,0 +1,27 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ...core.pydantic_utilities import UniversalBaseModel
4
+ import typing
5
+ from ...embedding.types.embedding import Embedding
6
+ import typing_extensions
7
+ from .controls import Controls
8
+ from ...core.serialization import FieldMetadata
9
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2
10
+ import pydantic
11
+
12
+
13
+ class TtsRequestEmbeddingSpecifier(UniversalBaseModel):
14
+ mode: typing.Literal["embedding"] = "embedding"
15
+ embedding: Embedding
16
+ experimental_controls: typing_extensions.Annotated[
17
+ typing.Optional[Controls], FieldMetadata(alias="__experimental_controls")
18
+ ] = None
19
+
20
+ if IS_PYDANTIC_V2:
21
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
22
+ else:
23
+
24
+ class Config:
25
+ frozen = True
26
+ smart_union = True
27
+ extra = pydantic.Extra.allow
@@ -0,0 +1,27 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ...core.pydantic_utilities import UniversalBaseModel
4
+ import typing
5
+ from ...voices.types.voice_id import VoiceId
6
+ import typing_extensions
7
+ from .controls import Controls
8
+ from ...core.serialization import FieldMetadata
9
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2
10
+ import pydantic
11
+
12
+
13
+ class TtsRequestIdSpecifier(UniversalBaseModel):
14
+ mode: typing.Literal["id"] = "id"
15
+ id: VoiceId
16
+ experimental_controls: typing_extensions.Annotated[
17
+ typing.Optional[Controls], FieldMetadata(alias="__experimental_controls")
18
+ ] = None
19
+
20
+ if IS_PYDANTIC_V2:
21
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
22
+ else:
23
+
24
+ class Config:
25
+ frozen = True
26
+ smart_union = True
27
+ extra = pydantic.Extra.allow
@@ -0,0 +1,7 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from .tts_request_id_specifier import TtsRequestIdSpecifier
5
+ from .tts_request_embedding_specifier import TtsRequestEmbeddingSpecifier
6
+
7
+ TtsRequestVoiceSpecifier = typing.Union[TtsRequestIdSpecifier, TtsRequestEmbeddingSpecifier]
@@ -0,0 +1,17 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .raw_output_format import RawOutputFormat
4
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2
5
+ import typing
6
+ import pydantic
7
+
8
+
9
+ class WavOutputFormat(RawOutputFormat):
10
+ if IS_PYDANTIC_V2:
11
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
12
+ else:
13
+
14
+ class Config:
15
+ frozen = True
16
+ smart_union = True
17
+ extra = pydantic.Extra.allow
@@ -0,0 +1,22 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ...core.pydantic_utilities import UniversalBaseModel
4
+ import typing
5
+ from .context_id import ContextId
6
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2
7
+ import pydantic
8
+
9
+
10
+ class WebSocketBaseResponse(UniversalBaseModel):
11
+ context_id: typing.Optional[ContextId] = None
12
+ status_code: int
13
+ done: bool
14
+
15
+ if IS_PYDANTIC_V2:
16
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
17
+ else:
18
+
19
+ class Config:
20
+ frozen = True
21
+ smart_union = True
22
+ extra = pydantic.Extra.allow
@@ -0,0 +1,20 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .web_socket_base_response import WebSocketBaseResponse
4
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2
5
+ import typing
6
+ import pydantic
7
+
8
+
9
+ class WebSocketChunkResponse(WebSocketBaseResponse):
10
+ data: str
11
+ step_time: float
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
@@ -0,0 +1,17 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .web_socket_base_response import WebSocketBaseResponse
4
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2
5
+ import typing
6
+ import pydantic
7
+
8
+
9
+ class WebSocketDoneResponse(WebSocketBaseResponse):
10
+ if IS_PYDANTIC_V2:
11
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
12
+ else:
13
+
14
+ class Config:
15
+ frozen = True
16
+ smart_union = True
17
+ extra = pydantic.Extra.allow
@@ -0,0 +1,19 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .web_socket_base_response import WebSocketBaseResponse
4
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2
5
+ import typing
6
+ import pydantic
7
+
8
+
9
+ class WebSocketErrorResponse(WebSocketBaseResponse):
10
+ error: str
11
+
12
+ if IS_PYDANTIC_V2:
13
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
14
+ else:
15
+
16
+ class Config:
17
+ frozen = True
18
+ smart_union = True
19
+ extra = pydantic.Extra.allow
@@ -0,0 +1,21 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .web_socket_base_response import WebSocketBaseResponse
4
+ from .flush_id import FlushId
5
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2
6
+ import typing
7
+ import pydantic
8
+
9
+
10
+ class WebSocketFlushDoneResponse(WebSocketBaseResponse):
11
+ flush_id: FlushId
12
+ flush_done: bool
13
+
14
+ if IS_PYDANTIC_V2:
15
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
16
+ else:
17
+
18
+ class Config:
19
+ frozen = True
20
+ smart_union = True
21
+ extra = pydantic.Extra.allow
@@ -0,0 +1,20 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .web_socket_base_response import WebSocketBaseResponse
4
+ import typing
5
+ from .phoneme_timestamps import PhonemeTimestamps
6
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2
7
+ import pydantic
8
+
9
+
10
+ class WebSocketPhonemeTimestampsResponse(WebSocketBaseResponse):
11
+ phoneme_timestamps: typing.Optional[PhonemeTimestamps] = None
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
@@ -0,0 +1,22 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ...core.pydantic_utilities import UniversalBaseModel
4
+ import typing
5
+ from .raw_encoding import RawEncoding
6
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2
7
+ import pydantic
8
+
9
+
10
+ class WebSocketRawOutputFormat(UniversalBaseModel):
11
+ container: typing.Literal["raw"] = "raw"
12
+ encoding: RawEncoding
13
+ sample_rate: int
14
+
15
+ if IS_PYDANTIC_V2:
16
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
17
+ else:
18
+
19
+ class Config:
20
+ frozen = True
21
+ smart_union = True
22
+ extra = pydantic.Extra.allow
@@ -0,0 +1,7 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from .generation_request import GenerationRequest
5
+ from .cancel_context_request import CancelContextRequest
6
+
7
+ WebSocketRequest = typing.Union[GenerationRequest, CancelContextRequest]