Skip to content

Commit

Permalink
Merge pull request #25 from reworkd/fix-none
Browse files Browse the repository at this point in the history
d✨ Ignore none
  • Loading branch information
asim-shrestha authored Nov 28, 2023
2 parents cd21b67 + 8481434 commit 6dec68a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions bananalyzer/runner/evals.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ def validate_field_match(expected: Result, actual: Result, field: str) -> None:
expected_value = expected.get(field, None)
actual_value = actual.get(field, None)

# Treat empty string as none
if actual_value is "":
actual_value = None

matcher = get_matcher(expected_value, actual_value)
if not matcher(actual_value, expected_value):
pytest.fail(f"{expected_value} != {actual_value}")
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[tool.poetry]
name = "bananalyzer"
version = "0.6.2"
version = "0.6.3"

description = "Open source AI Agent evaluation framework for web tasks 🐒🍌"
authors = ["asim-shrestha <[email protected]>"]
readme = "README.md"
Expand Down
1 change: 1 addition & 0 deletions tests/test_evals.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def test_is_string_similar(actual, expected, tolerance, expected_result):
({"field": "test"}, {"field": "test!!"}, "field"),
({"field": 123}, {"field": 123}, "field"),
({"field": [1, 2, 3]}, {"field": [1, 2, 3]}, "field"),
({"field": None}, {"field": ""}, "field"), # None == ""
],
)
def test_validate_field_match_pass(expected, actual, field):
Expand Down

0 comments on commit 6dec68a

Please sign in to comment.