Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

d✨ Ignore none #25

Merged
merged 2 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading