diff --git a/src/openai/_streaming.py b/src/openai/_streaming.py index 45c13cc11d..6630556943 100644 --- a/src/openai/_streaming.py +++ b/src/openai/_streaming.py @@ -67,7 +67,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): @@ -177,7 +177,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):