From 2d0473771c1aa494effb2ec263231bbe3044f0d7 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Fri, 7 Feb 2025 22:07:38 +0100 Subject: [PATCH] fixed multichoice questions --- lollms/personality.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lollms/personality.py b/lollms/personality.py index 71e1963..3537e3d 100644 --- a/lollms/personality.py +++ b/lollms/personality.py @@ -479,7 +479,7 @@ class AIPersonality: return self.multichoice_question(question, ["no","yes"], context, max_answer_length, conditionning=conditionning)>0 - def multichoice_question(self, question: str, possible_answers:list, context:str = "", max_answer_length: int = 50, conditionning="", return_explanation=False) -> int: + def multichoice_question(self, question: str, possible_answers:list, context:str = "", max_answer_length: int = None, conditionning="", return_explanation=False) -> int: """ Interprets a multi-choice question from a users response. This function expects only one choice as true. All other choices are considered false. If none are correct, returns -1. @@ -540,10 +540,11 @@ class AIPersonality: else: return -1 except Exception as ex: + trace_exception(ex) if return_explanation: - return int(code.split('\n')[0]), "" + return -1, "" else: - return int(code.split('\n')[0]) + return -1 def multichoice_ranking(self, question: str, possible_answers:list, context:str = "", max_answer_length: int = 50, conditionning="") -> int: """ Ranks answers for a question from best to worst. returns a list of integers