Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add chunk_size to (a)iter_bytes #369

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/elevenlabs/text_to_speech/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def convert(
) as _response:
try:
if 200 <= _response.status_code < 300:
for _chunk in _response.iter_bytes():
for _chunk in _response.iter_bytes(chunk_size=1024): # 1 MB
yield _chunk
return
_response.read()
Expand Down Expand Up @@ -436,7 +436,7 @@ def convert_as_stream(
) as _response:
try:
if 200 <= _response.status_code < 300:
for _chunk in _response.iter_bytes():
for _chunk in _response.iter_bytes(chunk_size=1024): # 1 MB
yield _chunk
return
_response.read()
Expand Down Expand Up @@ -728,7 +728,7 @@ async def main() -> None:
) as _response:
try:
if 200 <= _response.status_code < 300:
async for _chunk in _response.aiter_bytes():
async for _chunk in _response.aiter_bytes(chunk_size=1024): # 1 MB
yield _chunk
return
await _response.aread()
Expand Down Expand Up @@ -1030,7 +1030,7 @@ async def main() -> None:
) as _response:
try:
if 200 <= _response.status_code < 300:
async for _chunk in _response.aiter_bytes():
async for _chunk in _response.aiter_bytes(chunk_size=1024): # 1 MB
yield _chunk
return
await _response.aread()
Expand Down