From c6ddcd8ff43352124b3dc19734c44cf1b6859a79 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Sun, 9 Mar 2025 20:47:12 -0700 Subject: [PATCH] fix(utils.py): fix linting error --- litellm/types/utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/litellm/types/utils.py b/litellm/types/utils.py index dbc555b0c2..4af88100fa 100644 --- a/litellm/types/utils.py +++ b/litellm/types/utils.py @@ -829,6 +829,9 @@ class StreamingChoices(OpenAIObject): enhancements=None, **params, ): + # Fix Perplexity return both delta and message cause OpenWebUI repect text + # https://github.com/BerriAI/litellm/issues/8455 + params.pop("message", None) super(StreamingChoices, self).__init__(**params) if finish_reason: self.finish_reason = map_finish_reason(finish_reason) @@ -836,10 +839,7 @@ class StreamingChoices(OpenAIObject): self.finish_reason = None self.index = index if delta is not None: - # Fix Perplexity return both delta and message cause OpenWebUI repect text - # https://github.com/BerriAI/litellm/issues/8455 - if 'message' in params: - del self.message + if isinstance(delta, Delta): self.delta = delta elif isinstance(delta, dict):