From 0304c45de5e43e2fd74d733a2d10493943bf880c Mon Sep 17 00:00:00 2001 From: Dillon DuPont Date: Mon, 28 Apr 2025 19:12:32 -0400 Subject: [PATCH] fix endpoint not liking string message content --- .../agent/providers/omni/clients/oaicompat.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/libs/agent/agent/providers/omni/clients/oaicompat.py b/libs/agent/agent/providers/omni/clients/oaicompat.py index 6a95896a..b15515fd 100644 --- a/libs/agent/agent/providers/omni/clients/oaicompat.py +++ b/libs/agent/agent/providers/omni/clients/oaicompat.py @@ -93,7 +93,14 @@ class OAICompatClient(BaseOmniClient): """ headers = {"Content-Type": "application/json", "Authorization": f"Bearer {self.api_key}"} - final_messages = [{"role": "system", "content": system}] + final_messages = [ + { + "role": "system", + "content": [ + { "type": "text", "text": system } + ] + } + ] # Process messages for item in messages: @@ -117,7 +124,10 @@ class OAICompatClient(BaseOmniClient): else: message = { "role": item["role"], - "content": [{"type": "text", "text": item["content"]}], + "content": [{ + "type": "text", + "text": item["content"] + }], } final_messages.append(message) else: