Merge pull request #4152 from vpalmisano/vpalmisano-patch-1
Fix audio transcript check in base_llm.py
This commit is contained in:
1
changelog/4152.fixed.md
Normal file
1
changelog/4152.fixed.md
Normal 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.
|
||||||
@@ -545,8 +545,10 @@ class BaseOpenAILLMService(LLMService):
|
|||||||
|
|
||||||
# When gpt-4o-audio / gpt-4o-mini-audio is used for llm or stt+llm
|
# When gpt-4o-audio / gpt-4o-mini-audio is used for llm or stt+llm
|
||||||
# we need to get LLMTextFrame for the transcript
|
# we need to get LLMTextFrame for the transcript
|
||||||
elif hasattr(chunk.choices[0].delta, "audio") and chunk.choices[0].delta.audio.get(
|
elif (
|
||||||
"transcript"
|
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"]))
|
await self.push_frame(LLMTextFrame(chunk.choices[0].delta.audio["transcript"]))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user