-
Notifications
You must be signed in to change notification settings - Fork 260
chore(deps-dev): bump autoevals from 0.0.130 to 0.2.0 #1621
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
Open
dependabot
wants to merge
1
commit into
main
Choose a base branch
from
dependabot/uv/autoevals-0.2.0
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟣 Pre-existing:
create_evaluator_from_autoevals()inexperiment.py:1046passesevaluation.scoredirectly toEvaluation(value=...)without aNoneguard; autoevals 0.2.0 formally declaresScore.score: float | None = None(PR #48), making this path more likely to trigger. WhenscoreisNone, it propagates silently through the unenforced type annotation, then is dropped from averages by theisinstance(evaluation.value, (int, float))check atexperiment.py:562-565, resulting in silent data loss.Extended reasoning...
What the bug is and how it manifests
In
langfuse/experiment.py:1046,create_evaluator_from_autoevals()wraps an autoevals evaluator and constructs a LangfuseEvaluationobject. It does so with:In autoevals 0.2.0, the
Scoreclass declaresscore: float | None = Nonewith the docstring: "If the score is None, the evaluation is considered to be skipped." (introduced in autoevals PR #48 — "Updates to track the fact that Scores can be null".) When an LLM-based scorer fails to parse a response or explicitly skips evaluation, it returnsscore=None.The specific code path
autoevals_evaluator()returns aScorewith.score = None.Evaluation(value=None)is constructed — Python does not enforce type annotations at runtime, so this succeeds silently (seeexperiment.py:185:value: Union[int, float, str, bool]with no validation, justself.value = valueat line 205).Evaluationobject flows intoExperimentResult.format()at lines 562–565:isinstance(None, (int, float))isFalse, so the score is silently dropped from averages.create_score(value=None)is called via_create_score_for_scope,ScoreBody(which usesCreateScoreValue = Union[float, str]) raises a PydanticValidationError— but this is caught and only logged inclient.py'sexceptblock, further hiding the failure from the user.Why existing code does not prevent it
Evaluation.__init__has no runtime validation. Theisinstancecheck informat()was designed to skip string/bool values, not to handleNone— there is no warning or logging when aNonescore is silently excluded.What the impact would be
Users employing LLM-based autoevals scorers (e.g.,
Factuality,ClosedQA, etc.) may experience silent omission of scores for items where the LLM evaluation call fails. Average scores reported inExperimentResultwill be computed over fewer items than expected, skewing results upward without any indication that some items were excluded.How to fix it
Add a
Noneguard increate_evaluator_from_autoevals():Alternatively, log a warning and skip score creation explicitly so users are aware when evaluations are skipped.
Step-by-step proof
create_evaluator_from_autoevals(Factuality())to create a Langfuse evaluator.Factuality.eval_async()fails or returns unparseable output.Score(name="Factuality", score=None, metadata=...)instead of raising.langfuse_evaluatorconstructsEvaluation(name="Factuality", value=None)— no exception.ExperimentResult.format()iterates evaluations, hitsisinstance(None, (int, float)) == False, silently skips the item.Pre-existing status
The verifier refutation notes that the phrase "track the fact that Scores can be null" in PR #48 implies null scores may have been possible even in 0.0.130, and the langfuse wrapper was never updated to handle them. This is a valid point — the bug is pre-existing in the wrapper code. This PR does not modify
experiment.py. However, autoevals 0.2.0 formally types and documents the null-score path, making it more likely to occur in practice, making this a reasonable time to address it.