Skip to content

Commit df3829b

Browse files
author
yuhongxiao
committed
add stream reponse to audio.speech
1 parent 415d551 commit df3829b

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/zai/api_resource/audio/audio.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from typing import TYPE_CHECKING, Mapping, Optional, cast
44

55
import httpx
6+
from httpx import stream
67

78
from zai.core import (
89
NOT_GIVEN,
@@ -58,6 +59,7 @@ def speech(
5859
encode_format: str = None,
5960
speed: float | None = 1.0,
6061
volume: float | None = 1.0,
62+
stream: bool | None = False
6163
) -> HttpxBinaryResponseContent:
6264
"""
6365
Generate speech audio from text input
@@ -86,6 +88,7 @@ def speech(
8688
'user_id': user_id,
8789
'speed': speed,
8890
'volume': volume,
91+
'stream': stream
8992
}
9093
)
9194
return self._post(

tests/integration_tests/test_audio.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def test_audio_speech(logging_conf):
1717
voice='female',
1818
response_format='pcm',
1919
encode_format='base64',
20+
stream=False,
2021
speed=1.0,
2122
volume=1.0,
2223
)

0 commit comments

Comments
 (0)