Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(utils.py): fix linting error

Krrish Dholakia574f5056c857
diff --git a/litellm/types/utils.py b/litellm/types/utils.py
index dbc555b0c20..4af88100faf 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):