add: comment above optimization
For anybody that would change this value for whatever reason, the comment makes the tradeoff clear.
This commit is contained in:
parent
f1895265e6
commit
7241b4e9b5
@ -5236,6 +5236,10 @@ async def moderations(
|
||||
async def _audio_speech_chunk_generator(
|
||||
_response: HttpxBinaryResponseContent,
|
||||
) -> AsyncGenerator[bytes, None]:
|
||||
# chunk_size has a big impact on latency, it can't be too small or too large
|
||||
# too small: latency is high
|
||||
# too large: latency is low, but memory usage is high
|
||||
# 8192 is a good compromise
|
||||
_generator = await _response.aiter_bytes(chunk_size=8192)
|
||||
async for chunk in _generator:
|
||||
yield chunk
|
||||
|
||||
Loading…
Reference in New Issue
Block a user