Skip to content

Commit

Permalink
updated extract_output_by_name
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan committed May 28, 2024
1 parent 3a64d30 commit 0451eab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
12 changes: 4 additions & 8 deletions llm_eval/judge.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,11 @@ def __init__(self, config, df):
def extract_output_by_name(self, name, value):
if isinstance(value, float) and np.isnan(value):
return ''

match1 = re.search(r'### Output ###(.*)', value, re.DOTALL)
match1 = re.search(rf'{name}\s?:\s*.*?(\w+.*)', value, re.DOTALL)
if match1:
new_value = match1.group(1)
match2 = re.search(rf'{name}\s?:\s*.*?(\w+.*)', new_value, re.DOTALL)
if match2:
return match2.group(1).strip()
else:
return new_value
return match1.group(1).strip()
else:
return value
return ''

def evaluate(self):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "llm-eval"
version = "0.5.7"
version = "0.5.8"
authors = [
{name = "Jonathan Eisenzopf", email = "[email protected]"},
]
Expand Down

0 comments on commit 0451eab

Please sign in to comment.