From 061a1cc7901d8623f2ae4f47b6db76a2a1772105 Mon Sep 17 00:00:00 2001 From: seyeong-han Date: Sun, 24 Nov 2024 01:20:04 -0600 Subject: [PATCH] fix: message.content can be None --- llama_stack/providers/utils/inference/openai_compat.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/llama_stack/providers/utils/inference/openai_compat.py b/llama_stack/providers/utils/inference/openai_compat.py index cc3e7a2ce..4123d07d6 100644 --- a/llama_stack/providers/utils/inference/openai_compat.py +++ b/llama_stack/providers/utils/inference/openai_compat.py @@ -47,7 +47,10 @@ def text_from_choice(choice) -> str: return choice.delta.content if hasattr(choice, "message"): - return choice.message.content + try: + return choice.message.content + except: + return choice.text return choice.text