@@ -79,15 +79,9 @@ def __init__(
7979 @overload
8080 def speech_to_text (self , params : SpeechToTextParams ) -> SpeechToTextResponse : ...
8181 @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 : ...
8583
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 :
9185 if isinstance (
9286 blob , dict
9387 ): # If params is provided as a dict, we assume it's the first argument
@@ -104,14 +98,7 @@ def speech_to_text(
10498 content_type = options .get ("content_type" , "application/octet-stream" )
10599 headers = {"Content-Type" : content_type }
106100
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 ()
115102 return resp
116103
117104 def text_to_speech (self , params : TextToSpeechParams ) -> TextToSpeechResponse :
@@ -126,43 +113,23 @@ def text_to_speech(self, params: TextToSpeechParams) -> TextToSpeechResponse:
126113
127114 def speaker_voice_accents (self ) -> TextToSpeechResponse :
128115 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 ()
135117 return resp
136118
137119 def create_clone (self , params : TTSCloneParams ) -> TextToSpeechResponse :
138120 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 ()
145122
146123 return resp
147124
148125 def get_clones (self , params : GetTTSVoiceClonesParams ) -> TextToSpeechResponse :
149126 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 ()
156128 return resp
157129
158130 def delete_clone (self , voice_id : str ) -> TextToSpeechResponse :
159131 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 ()
166133 return resp
167134
168135
@@ -183,9 +150,7 @@ def __init__(
183150 )
184151
185152 @overload
186- async def speech_to_text (
187- self , params : SpeechToTextParams
188- ) -> SpeechToTextResponse : ...
153+ async def speech_to_text (self , params : SpeechToTextParams ) -> SpeechToTextResponse : ...
189154 @overload
190155 async def speech_to_text (
191156 self , file : bytes , options : Optional [SpeechToTextParams ] = None
@@ -239,3 +204,33 @@ async def speaker_voice_accents(self) -> TextToSpeechResponse:
239204 verb = "get" ,
240205 ).perform_with_content ()
241206 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