From 825d22980461d2c98ff95e09810f5f8faf7dd4e4 Mon Sep 17 00:00:00 2001 From: blingblin-g Date: Tue, 4 Feb 2025 12:02:24 +0900 Subject: [PATCH] fix(internal): handle leading whitespace in message content --- src/openai/lib/streaming/chat/_completions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) ):