File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
src/zai/api_resource/audio Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,8 @@ def speech(
5555 extra_headers : Headers | None = None ,
5656 extra_body : Body | None = None ,
5757 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
58+ speed : float | None = 1.0 ,
59+ volume : float | None = 1.0 ,
5860 ) -> HttpxBinaryResponseContent :
5961 """
6062 Generate speech audio from text input
@@ -80,6 +82,8 @@ def speech(
8082 'sensitive_word_check' : sensitive_word_check ,
8183 'request_id' : request_id ,
8284 'user_id' : user_id ,
85+ 'speed' : speed ,
86+ 'volume' : volume ,
8387 }
8488 )
8589 return self ._post (
Original file line number Diff line number Diff line change @@ -10,12 +10,15 @@ def test_audio_speech(logging_conf):
1010 logging .config .dictConfig (logging_conf ) # type: ignore
1111 client = ZaiClient () # Fill in your own API Key
1212 try :
13- speech_file_path = Path (__file__ ).parent / 'asr1.wav '
13+ speech_file_path = Path (__file__ ).parent / 'asr1.pcm '
1414 response = client .audio .speech (
1515 model = 'cogtts' ,
1616 input = 'Hello, welcome to Z.ai Open Platform' ,
1717 voice = 'female' ,
18- response_format = 'wav' ,
18+ response_format = 'pcm' ,
19+ encode_format = 'hex' ,
20+ speed = 1.0 ,
21+ volume = 1.0 ,
1922 )
2023 response .stream_to_file (speech_file_path )
2124
You can’t perform that action at this time.
0 commit comments