@@ -52,7 +52,7 @@ def speech_to_text(self, source: typing.Union[str, io.BytesIO], language_code: s
5252 if self ._is_async :
5353 async def _text_to_speech () -> TextToSpeechResult :
5454 if isinstance (source , str ):
55- js = await self ._client .request ('POST' , '/api/speech/speech-to-text' , params = {'url' : source })
55+ js = await self ._client .request ('POST' , '/api/speech/speech-to-text' , params = {'url' : source , 'language_code' : language_code })
5656 elif isinstance (source , io .BytesIO ):
5757 data = aiohttp .FormData ()
5858 data .add_field ('file' , source )
@@ -66,12 +66,12 @@ async def _text_to_speech() -> TextToSpeechResult:
6666 return _text_to_speech ()
6767 else :
6868 if isinstance (source , str ):
69- js = self ._client .request ('POST' , '/api/speech/speech-to-text' , params = {'url' : source })
69+ js = self ._client .request ('POST' , '/api/speech/speech-to-text' , params = {'url' : source , 'language_code' : language_code })
7070 elif isinstance (source , io .BytesIO ):
7171 data = aiohttp .FormData ()
7272 data .add_field ('file' , source )
7373
74- js = self ._client .request ('POST' , '/api/speech/speech-to-text' , files = {'upload_file' : getattr (source , 'getvalue' , lambda : source )()})
74+ js = self ._client .request ('POST' , '/api/speech/speech-to-text' , files = {'upload_file' : getattr (source , 'getvalue' , lambda : source )()}, params = { 'language_code' : language_code } )
7575 else :
7676 raise OpenRobotAPIError ('source must be a URL or BytesIO.' )
7777
@@ -112,7 +112,7 @@ async def _speech_to_text_support() -> typing.Dict[str, typing.Any]:
112112
113113 return js
114114
115- def text_to_speech (self , text : str , language_code : str , voice_id : str , * , engine : str = 'standard' ) -> typing .Union [typing .Coroutine [None , None , TextToSpeechResult ], TextToSpeechResult ]:
115+ def text_to_speech (self , text : str , language_code : str , voice_id : str , * , engine : typing . Optional [ str ] = 'standard' ) -> typing .Union [typing .Coroutine [None , None , TextToSpeechResult ], TextToSpeechResult ]:
116116 """|maybecoro|
117117
118118 Text to speech.
@@ -128,7 +128,7 @@ def text_to_speech(self, text: str, language_code: str, voice_id: str, *, engine
128128 The language code of the speech.
129129 voice_id: :class:`str`
130130 The voice id of the speech.
131- engine: :class:`str`
131+ engine: Optional[ :class:`str`]
132132 The engine of the speech.
133133
134134 Raises
@@ -158,14 +158,21 @@ async def _text_to_speech() -> TextToSpeechResult:
158158
159159 return TextToSpeechResult (js )
160160
161- def text_to_speech_support (self ) -> typing .Union [typing .Coroutine [None , None , TextToSpeechSupportResult ], TextToSpeechSupportResult ]:
161+ def text_to_speech_support (self , language_code : str , * , engine : typing . Optional [ str ] = 'standard' ) -> typing .Union [typing .Coroutine [None , None , TextToSpeechSupportResult ], TextToSpeechSupportResult ]:
162162 """|maybecoro|
163163
164164 Returns the supported details for Text To Speech.
165165
166166 This function is a coroutine if the client is an
167167 :class:`AsyncClient` object, else it would be a synchronous method.
168168
169+ Parameters
170+ ----------
171+ language_code: :class:`str`
172+ The language code to get the supported details for.
173+ engine: Optional[:class:`str`]
174+ The engine of the speech.
175+
169176 Raises
170177 ------
171178 :exc:`Forbidden`
@@ -183,12 +190,12 @@ def text_to_speech_support(self) -> typing.Union[typing.Coroutine[None, None, Te
183190
184191 if self ._is_async :
185192 async def _text_to_speech_support () -> TextToSpeechSupportResult :
186- js = await self ._client .request ('GET' , '/api/speech/text-to-speech/supports' )
193+ js = await self ._client .request ('GET' , '/api/speech/text-to-speech/supports' , params = { 'language_code' : language_code , 'engine' : engine } )
187194
188195 return TextToSpeechSupportResult (js )
189196
190197 return _text_to_speech_support ()
191198 else :
192- js = self ._client .request ('GET' , '/api/speech/text-to-speech/supports' )
199+ js = self ._client .request ('GET' , '/api/speech/text-to-speech/supports' , params = { 'language_code' : language_code , 'engine' : engine } )
193200
194201 return TextToSpeechSupportResult (js )
0 commit comments