@@ -79,15 +79,9 @@ def __init__(
79
79
@overload
80
80
def speech_to_text (self , params : SpeechToTextParams ) -> SpeechToTextResponse : ...
81
81
@overload
82
- def speech_to_text (
83
- self , file : bytes , options : Optional [SpeechToTextParams ] = None
84
- ) -> SpeechToTextResponse : ...
82
+ def speech_to_text (self , file : bytes , options : Optional [SpeechToTextParams ] = None ) -> SpeechToTextResponse : ...
85
83
86
- def speech_to_text (
87
- self ,
88
- blob : Union [SpeechToTextParams , bytes ],
89
- options : Optional [SpeechToTextParams ] = None ,
90
- ) -> SpeechToTextResponse :
84
+ def speech_to_text (self , blob : Union [SpeechToTextParams , bytes ], options : Optional [SpeechToTextParams ] = None ) -> SpeechToTextResponse :
91
85
if isinstance (
92
86
blob , dict
93
87
): # If params is provided as a dict, we assume it's the first argument
@@ -104,14 +98,7 @@ def speech_to_text(
104
98
content_type = options .get ("content_type" , "application/octet-stream" )
105
99
headers = {"Content-Type" : content_type }
106
100
107
- resp = Request (
108
- config = self .config ,
109
- path = path ,
110
- params = options ,
111
- data = blob ,
112
- headers = headers ,
113
- verb = "post" ,
114
- ).perform_with_content ()
101
+ resp = Request (config = self .config , path = path , params = options , data = blob , headers = headers , verb = "post" ).perform_with_content ()
115
102
return resp
116
103
117
104
def text_to_speech (self , params : TextToSpeechParams ) -> TextToSpeechResponse :
@@ -126,43 +113,23 @@ def text_to_speech(self, params: TextToSpeechParams) -> TextToSpeechResponse:
126
113
127
114
def speaker_voice_accents (self ) -> TextToSpeechResponse :
128
115
path = "/ai/tts"
129
- resp = Request (
130
- config = self .config ,
131
- path = path ,
132
- params = {},
133
- verb = "get" ,
134
- ).perform_with_content ()
116
+ resp = Request (config = self .config , path = path , params = {}, verb = "get" ).perform_with_content ()
135
117
return resp
136
118
137
119
def create_clone (self , params : TTSCloneParams ) -> TextToSpeechResponse :
138
120
path = "/ai/tts/clone"
139
- resp = Request (
140
- config = self .config ,
141
- path = path ,
142
- params = cast (Dict [Any , Any ], params ),
143
- verb = "post" ,
144
- ).perform_with_content ()
121
+ resp = Request (config = self .config , path = path , params = cast (Dict [Any , Any ], params ), verb = "post" ).perform_with_content ()
145
122
146
123
return resp
147
124
148
125
def get_clones (self , params : GetTTSVoiceClonesParams ) -> TextToSpeechResponse :
149
126
path = "/ai/tts/clone"
150
- resp = Request (
151
- config = self .config ,
152
- path = path ,
153
- params = cast (Dict [Any , Any ], params ),
154
- verb = "get" ,
155
- ).perform_with_content ()
127
+ resp = Request (config = self .config , path = path , params = cast (Dict [Any , Any ], params ), verb = "get" ).perform_with_content ()
156
128
return resp
157
129
158
130
def delete_clone (self , voice_id : str ) -> TextToSpeechResponse :
159
131
path = f"/ai/tts/clone/{ voice_id } "
160
- resp = Request (
161
- config = self .config ,
162
- path = path ,
163
- params = {},
164
- verb = "delete" ,
165
- ).perform_with_content ()
132
+ resp = Request (config = self .config , path = path , params = {}, verb = "delete" ).perform_with_content ()
166
133
return resp
167
134
168
135
@@ -183,9 +150,7 @@ def __init__(
183
150
)
184
151
185
152
@overload
186
- async def speech_to_text (
187
- self , params : SpeechToTextParams
188
- ) -> SpeechToTextResponse : ...
153
+ async def speech_to_text (self , params : SpeechToTextParams ) -> SpeechToTextResponse : ...
189
154
@overload
190
155
async def speech_to_text (
191
156
self , file : bytes , options : Optional [SpeechToTextParams ] = None
@@ -239,3 +204,33 @@ async def speaker_voice_accents(self) -> TextToSpeechResponse:
239
204
verb = "get" ,
240
205
).perform_with_content ()
241
206
return resp
207
+
208
+ async def create_clone (self , params : TTSCloneParams ) -> TextToSpeechResponse :
209
+ path = "/ai/tts/clone"
210
+ resp = await AsyncRequest (
211
+ config = self .config ,
212
+ path = path ,
213
+ params = cast (Dict [Any , Any ], params ),
214
+ verb = "post"
215
+ ).perform_with_content ()
216
+ return resp
217
+
218
+ async def get_clones (self , params : GetTTSVoiceClonesParams ) -> TextToSpeechResponse :
219
+ path = "/ai/tts/clone"
220
+ resp = await AsyncRequest (
221
+ config = self .config ,
222
+ path = path ,
223
+ params = cast (Dict [Any , Any ], params ),
224
+ verb = "get"
225
+ ).perform_with_content ()
226
+ return resp
227
+
228
+ async def delete_clone (self , voice_id : str ) -> TextToSpeechResponse :
229
+ path = f"/ai/tts/clone/{ voice_id } "
230
+ resp = await AsyncRequest (
231
+ config = self .config ,
232
+ path = path ,
233
+ params = {},
234
+ verb = "delete"
235
+ ).perform_with_content ()
236
+ return resp
0 commit comments