diff --git a/src/openai/_streaming.py b/src/openai/_streaming.py index 61a742668a..a7cde6e9c9 100644 --- a/src/openai/_streaming.py +++ b/src/openai/_streaming.py @@ -64,7 +64,7 @@ def __stream__(self) -> Iterator[_T]: if sse.event and sse.event.startswith("thread."): data = sse.json() - if sse.event == "error" and is_mapping(data) and data.get("error"): + if is_mapping(data) and data.get("error"): message = None error = data.get("error") if is_mapping(error): @@ -167,7 +167,7 @@ async def __stream__(self) -> AsyncIterator[_T]: if sse.event and sse.event.startswith("thread."): data = sse.json() - if sse.event == "error" and is_mapping(data) and data.get("error"): + if is_mapping(data) and data.get("error"): message = None error = data.get("error") if is_mapping(error):