@@ -320,6 +320,7 @@ async def synthesize(self, text: str, voice: str, **kwargs):
320320 - `return_durations` (bool): If `True`, the response will include word durations detail. Defaults to `False`.
321321 - `return_seed` (bool): If `True`, the response will include the seed used for synthesis. Defaults to `False`.
322322 - `language` (str): The desired language of the synthesized speech. Two letter ISO 639-1 code. Defaults to `en`.
323+ - `conversational` (bool): If `True`, the synthesized speech will be more conversational. Defaults to `False`.
323324 - `length` (int): The desired target length of the output speech in seconds. Maximum 300.0 (5 minutes)
324325
325326 Deprecated parameters:
@@ -365,6 +366,8 @@ async def synthesize(self, text: str, voice: str, **kwargs):
365366 return_seed = kwargs .get ('return_seed' , False )
366367 if 'language' in kwargs :
367368 form_data .add_field ('language' , kwargs .get ('language' ))
369+ if 'conversational' in kwargs :
370+ form_data .add_field ('conversational' , kwargs .get ('conversational' ))
368371 async with self ._session .post (url , data = form_data , headers = self ._build_headers ()) as resp :
369372 await self ._handle_response_errors (resp , 'Speech.synthesize' )
370373 response_data = await resp .json ()
@@ -387,6 +390,7 @@ async def synthesize_streaming(self, voice: str, return_extras: bool = False, **
387390 - `speed` (float): The speed to use for synthesis. Defaults to 1.0.
388391 - `return_extras` (bool): If `True`, the response will include word durations detail. Defaults to `False`.
389392 - `language` (str): The desired language of the synthesized speech. Two letter ISO 639-1 code. Defaults to `en`.
393+ - `conversational` (bool): If `True`, the synthesized speech will be more conversational. Defaults to `False`.
390394
391395 Returns:
392396 - `StreamingSynthesisConnection`: The streaming connection object.
@@ -411,6 +415,8 @@ async def synthesize_streaming(self, voice: str, return_extras: bool = False, **
411415 init_msg ['send_extras' ] = return_extras
412416 if 'language' in kwargs :
413417 init_msg ['language' ] = kwargs ['language' ]
418+ if 'conversational' in kwargs :
419+ init_msg ['conversational' ] = kwargs ['conversational' ]
414420 ws = await self ._session .ws_connect (f'{ self ._base_url } { _SYNTHESIZE_STREAMING_ENDPOINT } ' )
415421 await ws .send_str (json .dumps (init_msg ))
416422 return StreamingSynthesisConnection (ws , return_extras )
0 commit comments