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]

AttributeError: 'Message' object has no attribute 'audio' (#10814)

Iguchi Tomokatsud8a5bd9e0f7c
diff --git a/litellm/types/utils.py b/litellm/types/utils.py
index 7fa0f6c5582..e6bd2802865 100644
--- a/litellm/types/utils.py
+++ b/litellm/types/utils.py
@@ -633,20 +633,24 @@ class Message(OpenAIObject):
if audio is None:
# delete audio from self
# OpenAI compatible APIs like mistral API will raise an error if audio is passed in
- del self.audio
+ if hasattr(self, 'audio'):
+ del self.audio
if annotations is None:
# ensure default response matches OpenAI spec
# Some OpenAI compatible APIs raise an error if annotations are passed in
- del self.annotations
+ if hasattr(self, 'annotations'):
+ del self.annotations
if reasoning_content is None:
# ensure default response matches OpenAI spec
- del self.reasoning_content
+ if hasattr(self, 'reasoning_content'):
+ del self.reasoning_content
if thinking_blocks is None:
# ensure default response matches OpenAI spec
- del self.thinking_blocks
+ if hasattr(self, 'thinking_blocks'):
+ del self.thinking_blocks
add_provider_specific_fields(self, provider_specific_fields)