We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f2ef07d commit 31e3903Copy full SHA for 31e3903
1 file changed
src/writerai/_streaming.py
@@ -76,9 +76,8 @@ def __stream__(self) -> Iterator[_T]:
76
response=self.response,
77
)
78
79
- # Ensure the entire stream is consumed
80
- for _sse in iterator:
81
- ...
+ # As we might not fully consume the response stream, we need to close it explicitly
+ response.close()
82
83
def __enter__(self) -> Self:
84
return self
@@ -159,9 +158,8 @@ async def __stream__(self) -> AsyncIterator[_T]:
159
158
160
161
162
163
- async for _sse in iterator:
164
+ await response.aclose()
165
166
async def __aenter__(self) -> Self:
167
0 commit comments