From c4a9dc52f1d3db368b3fc821196298e89beeb945 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Tue, 14 May 2024 01:57:17 +0200 Subject: [PATCH] upgraded --- lollms/personality.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lollms/personality.py b/lollms/personality.py index 3747fca..f92d908 100644 --- a/lollms/personality.py +++ b/lollms/personality.py @@ -3373,8 +3373,10 @@ The AI should respond in this format using data from actions_list: '"function_parameters": a list of parameter values', "}", "```", - "You can call multiple functions in one generation. If you need the output of a function to proceed, then use the keyword @@ at the end of your message.", + "You can call multiple functions in one generation.", + "Each function call needs to be in a separate function markdown tag.", "Do not add status of the execution as it will be added automatically by the system.", + "If you want to get the output of the function before answering the user, then use the keyword @@ at the end of your message.", "!@>List of possible functions to be called:\n"] for function in functions: description = f"{function['function_name']}: {function['function_description']}\nparameters:{function['function_parameters']}" @@ -3407,7 +3409,10 @@ The AI should respond in this format using data from actions_list: try: # Attempt to parse the JSON content of the code block. function_call = json.loads(content) - function_calls.append(function_call) + if type(function_call)==dict: + function_calls.append(function_call) + elif type(function_call)==list: + function_calls+=function_call except json.JSONDecodeError: # If the content is not valid JSON, skip it. continue