Commit 4fc52529

Robert Craigie <robert@craigie.dev>
2025-04-30 23:47:27
chore: only strip leading whitespace
1 parent b3f0daf
Changed files (1)
src
openai
lib
streaming
src/openai/lib/streaming/chat/_completions.py
@@ -439,7 +439,7 @@ class ChatCompletionStreamState(Generic[ResponseFormatT]):
                 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()
+                and choice_snapshot.message.content.lstrip()
             ):
                 choice_snapshot.message.parsed = from_json(
                     bytes(choice_snapshot.message.content, "utf-8"),