Commit b3f0daf3
Changed files (1)
src
openai
lib
streaming
chat
src/openai/lib/streaming/chat/_completions.py
@@ -438,6 +438,8 @@ class ChatCompletionStreamState(Generic[ResponseFormatT]):
choice_snapshot.message.content
and not choice_snapshot.message.refusal
and is_given(self._rich_response_format)
+ # partial parsing fails on white-space
+ and choice_snapshot.message.content.strip()
):
choice_snapshot.message.parsed = from_json(
bytes(choice_snapshot.message.content, "utf-8"),