Skip to content

Commit b0e8922

Browse files
committed
fix: streaming
1 parent d76a748 commit b0e8922

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

Diff for: src/openai/_streaming.py

-19
Original file line numberDiff line numberDiff line change
@@ -76,25 +76,6 @@ def __stream__(self) -> Iterator[_T]:
7676

7777
yield process_data(data=data, cast_to=cast_to, response=response)
7878

79-
else:
80-
data = sse.json()
81-
82-
if sse.event == "error" and is_mapping(data) and data.get("error"):
83-
message = None
84-
error = data.get("error")
85-
if is_mapping(error):
86-
message = error.get("message")
87-
if not message or not isinstance(message, str):
88-
message = "An error occurred during streaming"
89-
90-
raise APIError(
91-
message=message,
92-
request=self.response.request,
93-
body=data["error"],
94-
)
95-
96-
yield process_data(data={"data": data, "event": sse.event}, cast_to=cast_to, response=response)
97-
9879
# Ensure the entire stream is consumed
9980
for _sse in iterator:
10081
...

0 commit comments

Comments
 (0)