From 68d29bbcea2d8faa10743d6b48d8baf4b7cac6ae Mon Sep 17 00:00:00 2001 From: retoor Date: Mon, 20 Jan 2025 15:08:32 +0100 Subject: [PATCH] Fix. --- src/ragent/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ragent/__init__.py b/src/ragent/__init__.py index 2e6554a..93f86b7 100644 --- a/src/ragent/__init__.py +++ b/src/ragent/__init__.py @@ -200,12 +200,12 @@ class Agent: def communicate(self, message: str,role:str="user"): log.debug(f"Sending message: {message} to assistant {self.assistant.id} in thread {self.thread.id}.") - messages = isinstance(message, list) and message or [message] + messages = hasattr(message, "__iter__") and message or [message] for message in messages: if isinstance(message, dict): + message_role = message["role"] message = message["content"] - message_role = message["content"] else: message_role = role self.client.beta.threads.messages.create(