This commit is contained in:
retoor 2025-01-20 15:08:32 +01:00
parent d364d72e51
commit 68d29bbcea

View File

@ -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(