Merge pull request #4152 from vpalmisano/vpalmisano-patch-1

Fix audio transcript check in base_llm.py
This commit is contained in:
Filipi da Silva Fuchter
2026-03-27 08:34:15 -04:00
committed by GitHub
2 changed files with 5 additions and 2 deletions

1
changelog/4152.fixed.md Normal file
View File

@@ -0,0 +1 @@
- Fixed a crash in OpenAI LLM processing when the provider returns `chunk.choices[0].delta.audio = None`, which caused `'NoneType' object has no attribute 'get'` errors during audio transcript handling.

View File

@@ -545,8 +545,10 @@ class BaseOpenAILLMService(LLMService):
# When gpt-4o-audio / gpt-4o-mini-audio is used for llm or stt+llm
# we need to get LLMTextFrame for the transcript
elif hasattr(chunk.choices[0].delta, "audio") and chunk.choices[0].delta.audio.get(
"transcript"
elif (
hasattr(chunk.choices[0].delta, "audio")
and chunk.choices[0].delta.audio
and chunk.choices[0].delta.audio.get("transcript")
):
await self.push_frame(LLMTextFrame(chunk.choices[0].delta.audio["transcript"]))