From 17aa94e12dcae65d442780072b63425dee8947a4 Mon Sep 17 00:00:00 2001 From: Zvonimir Sabljic Date: Tue, 8 Aug 2023 12:42:51 +0200 Subject: [PATCH] Added functionality to add to_message parameter to a function call to convert objects to strings in a custom way --- euclid/helpers/AgentConvo.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/euclid/helpers/AgentConvo.py b/euclid/helpers/AgentConvo.py index 4b74209..e3e59e4 100644 --- a/euclid/helpers/AgentConvo.py +++ b/euclid/helpers/AgentConvo.py @@ -54,7 +54,9 @@ class AgentConvo: # TODO remove this once the database is set up properly message_content = response[0] if type(response) == tuple else response if isinstance(message_content, list): - if len(message_content) > 0 and isinstance(message_content[0], dict): + if 'to_message' in function_calls: + string_response = function_calls['to_message'](message_content) + elif len(message_content) > 0 and isinstance(message_content[0], dict): string_response = [ f'#{i}\n' + array_of_objects_to_string(d) for i, d in enumerate(message_content)