You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
HTTP TTS read fails after partial audio iteration #312
HTTP TTS streams cannot continue after partial iteration. read() and aread()
promise to read the rest of the audio, but they raise httpx.StreamConsumed.
Replacement iteration fails for the same reason.
asyncwithtts.stream("Hello.") asspeech:
chunks=speech.aiter_bytes()
first=awaitchunks.__anext__()
awaitchunks.aclose() # closes the wrapper, not the speech streamremaining=awaitspeech.aread() # raises StreamConsumed
The synchronous iter_bytes() followed by read() has the same failure.
Each SDK wrapper starts a new httpx response iterator; streamed response bodies
are single-use. The expected result is the remaining bytes, without replaying
the first chunk or making another request.
Reproduction and validation
Reproduced at upstream 0ba094c through the public sync/async SDK APIs and a
loopback chunked HTTP server. The server sends head, waits for the caller, then
sends tail. Five regression cases fail with StreamConsumed; two controls pass.
Retaining one body cursor per speech stream makes all seven pass.
Verified on Python 3.12/httpx 0.28.1/pydantic 2.14.4 and Python
3.11/httpx 0.22.0/pydantic 1.10.17/websockets 11.0.3.
This concerns successful HTTP responses, not the refused-response cleanup in #281. It does not
promise resumption after transport cancellation/failure or concurrent reads
of the same stream.
Activity