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

Set default value of evaluation_cost to 0 in BaseMetric class #1263

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rawheel
Copy link

@rawheel rawheel commented Jan 10, 2025

Addresses #1262 The evaluate() method of GEval derived from BaseMetric was raising a TypeError: unsupported operand type(s) for +=: 'NoneType' and 'int/float' when called directly (without a prior call to measure()). This was due to the evaluation_cost attribute being initialized to None in the BaseMetric class.

self.evaluation_cost += cost This throws an error as evaluation_cost is None by default in BaseMetric class and cost is a float.

This PR initializes evaluation_cost to 0 in the BaseMetric attributes, preventing the TypeError and allowing evaluate() to be called directly without issues.

Copy link

vercel bot commented Jan 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
evals-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 10, 2025 7:41am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant