Skip to content

Commit 0bba1e9

Browse files
feat: [STG-1607] Yield finished SSE event instead of silently dropping it
1 parent 1d33bbf commit 0bba1e9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 8
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-573d364768ac1902ee5ed8b2485d3b293bda0ea8ff7898aef1a3fd6be79b594a.yml
33
openapi_spec_hash: 107ec840f4330885dd2232a05a66fed7
4-
config_hash: 0209737a4ab2a71afececb0ff7459998
4+
config_hash: ab1c1122e862f9bdb6db4df36d489701

src/stagehand/_streaming.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def __stream__(self) -> Iterator[_T]:
6060
try:
6161
for sse in iterator:
6262
if sse.data.startswith('{"data":{"status":"finished"'):
63-
break
63+
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
6464

6565
if sse.data.startswith("error"):
6666
body = sse.data
@@ -145,7 +145,7 @@ async def __stream__(self) -> AsyncIterator[_T]:
145145
try:
146146
async for sse in iterator:
147147
if sse.data.startswith('{"data":{"status":"finished"'):
148-
break
148+
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
149149

150150
if sse.data.startswith("error"):
151151
body = sse.data

0 commit comments

Comments
 (0)