diff --git a/src/openai/lib/streaming/chat/_completions.py b/src/openai/lib/streaming/chat/_completions.py index 2146091354..0e8bd7e833 100644 --- a/src/openai/lib/streaming/chat/_completions.py +++ b/src/openai/lib/streaming/chat/_completions.py @@ -431,7 +431,7 @@ def _accumulate_chunk(self, chunk: ChatCompletionChunk) -> ParsedChatCompletionS raise ContentFilterFinishReasonError() if ( - choice_snapshot.message.content + choice_snapshot.message.content.strip() and not choice_snapshot.message.refusal and is_given(self._rich_response_format) ):