From 8e3f6c8753e2856600cd81d5502876ae14929c31 Mon Sep 17 00:00:00 2001 From: Zvonimir Sabljic Date: Wed, 2 Aug 2023 14:24:43 +0200 Subject: [PATCH] Get the correct response when returning tuples (REMOVE LATER ON) --- euclid/helpers/AgentConvo.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/euclid/helpers/AgentConvo.py b/euclid/helpers/AgentConvo.py index 6e8b170..58499b6 100644 --- a/euclid/helpers/AgentConvo.py +++ b/euclid/helpers/AgentConvo.py @@ -41,15 +41,15 @@ class AgentConvo: response = self.postprocess_response(response, function_calls) # TODO remove this once the database is set up properly - message_content = response - if isinstance(response, list): - if isinstance(response[0], dict): + message_content = response[0] if type(response) == tuple else response + if isinstance(message_content, list): + if isinstance(message_content[0], dict): string_response = [ f'#{i + 1}\n' + array_of_objects_to_string(d) - for i, d in enumerate(response) + for i, d in enumerate(message_content) ] else: - string_response = ['- ' + r for r in response] + string_response = ['- ' + r for r in message_content] message_content = '\n'.join(string_response) # TODO END