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

This commit is contained in:
Iguchi Tomokatsu 2025-05-15 14:45:14 +09:00 • committed by GitHub
parent 5146b2903f
commit d8a5bd9e0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)