diff --git a/llm_eval/handler.py b/llm_eval/handler.py index 51ddcb7..c5f33d0 100644 --- a/llm_eval/handler.py +++ b/llm_eval/handler.py @@ -74,8 +74,10 @@ def post_process_output(self, prompt, output): if self.current_model == 'meta-llama/Llama-2-7b-chat-hf': output = output[len(prompt)-1:] pattern = re.compile(r'\{\s*"(.+?)"\s*:\s*"(.+?)"\s*\}') - match = re.findall(pattern, output)[-1] - return {match.group(1): match.group(2)} if match else output + matches = re.findall(pattern, output) + if matches: + last_match = matches[-1] + return {last_match[0]: last_match[1]} if last_match else output def prepare_output(self): """Create a DataFrame with the required columns based on the list of dictionaries""" diff --git a/pyproject.toml b/pyproject.toml index 45ed69f..ff944bb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" [project] name = "llm-eval" -version = "0.5.11" +version = "0.5.12" authors = [ {name = "Jonathan Eisenzopf", email = "jonathan.eisenzopf@talkmap.com"}, ]