Skip to content

Commit

Permalink
Updates to extract_output_by_name in judge.py to parse JSON.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan committed May 29, 2024
1 parent 0451eab commit 9511737
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion llm_eval/judge.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ 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(rf'{name}\s?:\s*.*?(\w+.*)', value, re.DOTALL)
#match1 = re.search(rf'{name}\s?:\s*.*?(\w+.*)', value, re.DOTALL)
#match1 = re.search(r'\{\s*"(.+?)"\s*:\s*"(.+?)"\s*\}')
match1 = re.search(r'\{\s*"' + name + r'"\s*:\s*"(.+?)"\s*\}')
if match1:
return match1.group(1).strip()
else:
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.8"
version = "0.5.9"
authors = [
{name = "Jonathan Eisenzopf", email = "[email protected]"},
]
Expand Down

0 comments on commit 9511737

Please sign in to comment.