From d8a5bd9e0f7c364ad1a22c9aae8dd9672f128ff0 Mon Sep 17 00:00:00 2001 From: Iguchi Tomokatsu Date: Thu, 15 May 2025 14:45:14 +0900 Subject: [PATCH] AttributeError: 'Message' object has no attribute 'audio' (#10814) --- litellm/types/utils.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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)