diff --git a/src/zai/api_resource/audio/audio.py b/src/zai/api_resource/audio/audio.py index 92fe520..2de7b47 100644 --- a/src/zai/api_resource/audio/audio.py +++ b/src/zai/api_resource/audio/audio.py @@ -3,6 +3,7 @@ from typing import TYPE_CHECKING, Mapping, Optional, cast import httpx +from httpx import stream from zai.core import ( NOT_GIVEN, @@ -55,8 +56,10 @@ def speech( extra_headers: Headers | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + encode_format: str = None, speed: float | None = 1.0, volume: float | None = 1.0, + stream: bool | None = False ) -> HttpxBinaryResponseContent: """ Generate speech audio from text input @@ -79,11 +82,13 @@ def speech( 'input': input, 'voice': voice, 'response_format': response_format, + 'encode_format': encode_format, 'sensitive_word_check': sensitive_word_check, 'request_id': request_id, 'user_id': user_id, 'speed': speed, 'volume': volume, + 'stream': stream } ) return self._post( diff --git a/tests/integration_tests/test_audio.py b/tests/integration_tests/test_audio.py index 420f19b..e9ef33c 100644 --- a/tests/integration_tests/test_audio.py +++ b/tests/integration_tests/test_audio.py @@ -16,7 +16,8 @@ def test_audio_speech(logging_conf): input='Hello, welcome to Z.ai Open Platform', voice='female', response_format='pcm', - encode_format='hex', + encode_format='base64', + stream=False, speed=1.0, volume=1.0, )