|
9 | 9 | from .helpers import build_path |
10 | 10 |
|
11 | 11 |
|
12 | | -class TextToSpeechParams(TypedDict): |
13 | | - text: str |
14 | | - accent: NotRequired[SupportedAccents] |
15 | | - speaker_clone_url: NotRequired[str] |
16 | | - speaker_clone_file_store_key: NotRequired[str] |
17 | | - return_type: NotRequired[Literal["url", "binary", "base64"]] |
18 | | - |
19 | | - |
20 | | -class TTSCloneParams(TypedDict): |
21 | | - url: NotRequired[str] |
22 | | - file_store_key: NotRequired[str] |
23 | | - name: str |
24 | | - |
25 | | - |
26 | | -class ListTTSVoiceClonesParams(TypedDict): |
27 | | - limit: NotRequired[int] |
28 | | - page: NotRequired[int] |
29 | | - |
30 | | - |
31 | | -class TextToSpeechResponse(TypedDict): |
32 | | - success: bool |
33 | | - text: str |
34 | | - chunks: List[object] |
35 | | - |
36 | 12 |
|
37 | 13 | class SpeechToTextParams(TypedDict): |
38 | 14 | url: NotRequired[str] |
@@ -115,51 +91,6 @@ def speech_to_text( |
115 | 91 | ).perform_with_content() |
116 | 92 | return resp |
117 | 93 |
|
118 | | - def text_to_speech(self, params: TextToSpeechParams) -> TextToSpeechResponse: |
119 | | - path = "/ai/tts" |
120 | | - resp = Request( |
121 | | - config=self.config, |
122 | | - path=path, |
123 | | - params=cast(Dict[Any, Any], params), |
124 | | - verb="post", |
125 | | - ).perform_with_content() |
126 | | - return resp |
127 | | - |
128 | | - def speaker_voice_accents(self) -> TextToSpeechResponse: |
129 | | - path = "/ai/tts" |
130 | | - resp = Request( |
131 | | - config=self.config, path=path, params={}, verb="get" |
132 | | - ).perform_with_content() |
133 | | - return resp |
134 | | - |
135 | | - def create_clone(self, params: TTSCloneParams) -> TextToSpeechResponse: |
136 | | - path = "/ai/tts/clone" |
137 | | - resp = Request( |
138 | | - config=self.config, |
139 | | - path=path, |
140 | | - params=cast(Dict[Any, Any], params), |
141 | | - verb="post", |
142 | | - ).perform_with_content() |
143 | | - |
144 | | - return resp |
145 | | - |
146 | | - def list_clones(self, params: ListTTSVoiceClonesParams) -> TextToSpeechResponse: |
147 | | - path = "/ai/tts/clone" |
148 | | - resp = Request( |
149 | | - config=self.config, |
150 | | - path=path, |
151 | | - params=cast(Dict[Any, Any], params), |
152 | | - verb="get", |
153 | | - ).perform_with_content() |
154 | | - return resp |
155 | | - |
156 | | - def delete_clone(self, voice_id: str) -> TextToSpeechResponse: |
157 | | - path = f"/ai/tts/clone/{voice_id}" |
158 | | - resp = Request( |
159 | | - config=self.config, path=path, params={}, verb="delete" |
160 | | - ).perform_with_content() |
161 | | - return resp |
162 | | - |
163 | 94 |
|
164 | 95 | class AsyncAudio(ClientConfig): |
165 | 96 | config: AsyncRequestConfig |
@@ -215,51 +146,3 @@ async def speech_to_text( |
215 | 146 | ).perform_with_content() |
216 | 147 | return resp |
217 | 148 |
|
218 | | - async def text_to_speech(self, params: TextToSpeechParams) -> TextToSpeechResponse: |
219 | | - path = "/ai/tts" |
220 | | - resp = await AsyncRequest( |
221 | | - config=self.config, |
222 | | - path=path, |
223 | | - params=cast(Dict[Any, Any], params), |
224 | | - verb="post", |
225 | | - ).perform_with_content() |
226 | | - return resp |
227 | | - |
228 | | - async def speaker_voice_accents(self) -> TextToSpeechResponse: |
229 | | - path = "/ai/tts" |
230 | | - resp = await AsyncRequest( |
231 | | - config=self.config, |
232 | | - path=path, |
233 | | - params={}, |
234 | | - verb="get", |
235 | | - ).perform_with_content() |
236 | | - return resp |
237 | | - |
238 | | - async def create_clone(self, params: TTSCloneParams) -> TextToSpeechResponse: |
239 | | - path = "/ai/tts/clone" |
240 | | - resp = await AsyncRequest( |
241 | | - config=self.config, |
242 | | - path=path, |
243 | | - params=cast(Dict[Any, Any], params), |
244 | | - verb="post", |
245 | | - ).perform_with_content() |
246 | | - return resp |
247 | | - |
248 | | - async def list_clones( |
249 | | - self, params: ListTTSVoiceClonesParams |
250 | | - ) -> TextToSpeechResponse: |
251 | | - path = "/ai/tts/clone" |
252 | | - resp = await AsyncRequest( |
253 | | - config=self.config, |
254 | | - path=path, |
255 | | - params=cast(Dict[Any, Any], params), |
256 | | - verb="get", |
257 | | - ).perform_with_content() |
258 | | - return resp |
259 | | - |
260 | | - async def delete_clone(self, voice_id: str) -> TextToSpeechResponse: |
261 | | - path = f"/ai/tts/clone/{voice_id}" |
262 | | - resp = await AsyncRequest( |
263 | | - config=self.config, path=path, params={}, verb="delete" |
264 | | - ).perform_with_content() |
265 | | - return resp |
0 commit comments