From 26736d4d06b34ca6ccb98d6aab6cb6f4df050075 Mon Sep 17 00:00:00 2001 From: kristjanpeterson Date: Thu, 5 Sep 2024 10:27:22 +0300 Subject: [PATCH] Fix groq message handling on oracle side --- oracles/src/domain/llm/groq_llm.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/oracles/src/domain/llm/groq_llm.py b/oracles/src/domain/llm/groq_llm.py index 2cbe25d..2d1a403 100644 --- a/oracles/src/domain/llm/groq_llm.py +++ b/oracles/src/domain/llm/groq_llm.py @@ -20,8 +20,10 @@ async def execute(chat: Chat) -> Optional[GroqChatCompletion]: timeout=TIMEOUT, ) for message in chat.messages: - if len(message.get("content")) and message.get("content")[0].get("text"): - message["content"] = message.get("content")[0].get("text") + if len(message.get("content")) and message.get("content"): + content = message.get("content") + if type(content) is not str: + message["content"] = message.get("content")[0].get("text") chat_completion: ChatCompletion = await client.chat.completions.create( messages=chat.messages, model=chat.config.model,