File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
src/zai/api_resource/audio Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 33from typing import TYPE_CHECKING , Mapping , Optional , cast
44
55import httpx
6+ from httpx import stream
67
78from zai .core import (
89 NOT_GIVEN ,
@@ -55,8 +56,10 @@ def speech(
5556 extra_headers : Headers | None = None ,
5657 extra_body : Body | None = None ,
5758 timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
59+ encode_format : str = None ,
5860 speed : float | None = 1.0 ,
5961 volume : float | None = 1.0 ,
62+ stream : bool | None = False
6063 ) -> HttpxBinaryResponseContent :
6164 """
6265 Generate speech audio from text input
@@ -79,11 +82,13 @@ def speech(
7982 'input' : input ,
8083 'voice' : voice ,
8184 'response_format' : response_format ,
85+ 'encode_format' : encode_format ,
8286 'sensitive_word_check' : sensitive_word_check ,
8387 'request_id' : request_id ,
8488 'user_id' : user_id ,
8589 'speed' : speed ,
8690 'volume' : volume ,
91+ 'stream' : stream
8792 }
8893 )
8994 return self ._post (
Original file line number Diff line number Diff line change @@ -16,7 +16,8 @@ def test_audio_speech(logging_conf):
1616 input = 'Hello, welcome to Z.ai Open Platform' ,
1717 voice = 'female' ,
1818 response_format = 'pcm' ,
19- encode_format = 'hex' ,
19+ encode_format = 'base64' ,
20+ stream = False ,
2021 speed = 1.0 ,
2122 volume = 1.0 ,
2223 )
You can’t perform that action at this time.
0 commit comments