File tree Expand file tree Collapse file tree
tests/manual/speak/v1/audio/generate Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,14 +18,12 @@ async def main() -> None:
1818 try :
1919 text = "Hello, this is a sample text to speech conversion."
2020 print (f"Sending async text-to-speech generation request - Text: { text [:50 ]} ..." )
21- response = await client .speak .v1 .audio .generate (
21+ response = client .speak .v1 .audio .generate (
2222 text = text ,
2323 )
2424 print ("Response received successfully" )
25- print (f"Response type: { type (response )} " )
26- if hasattr (response , "audio" ):
27- print (f"Audio data length: { len (response .audio ) if response .audio else 0 } bytes" )
28- print (f"Response body: { response } " )
25+ audio_bytes = b"" .join ([chunk async for chunk in response ])
26+ print (f"Audio data length: { len (audio_bytes )} bytes" )
2927 except Exception as e :
3028 print (f"Error occurred: { type (e ).__name__ } " )
3129 # Log request headers if available
Original file line number Diff line number Diff line change 1919 text = text ,
2020 )
2121 print ("Response received successfully" )
22- print (f"Response type: { type (response )} " )
23- if hasattr (response , "audio" ):
24- print (f"Audio data length: { len (response .audio ) if response .audio else 0 } bytes" )
25- print (f"Response body: { response } " )
22+ audio_bytes = b"" .join (response )
23+ print (f"Audio data length: { len (audio_bytes )} bytes" )
2624except Exception as e :
2725 print (f"Error occurred: { type (e ).__name__ } " )
2826 # Log request headers if available
Load Diff Large diffs are not rendered by default.
You can’t perform that action at this time.
0 commit comments