Repository navigation
Conversation
An empty answer divided by a zero length produced NaN. Negative thresholds also produced negative scores. The sample runner duplicated pattern matching already implemented by the scenario scorer.
A negative ms or output_tokens budget gave max_latency_ms and token_budget a negative score in ActiveAgent::Evals::Scorer, the same defect the previous commit fixed in the dashboard's sample runner. Clamp both thresholds at zero, and describe the change in the changelog as the file's other entries are written.
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What this does
Rule criteria are documented to score 0.0–1.0. Two thresholds broke that:
min_lengthwithchars: 0in a dashboard evaluation over sampled traffic (EvaluationRunnerService#score_sample) divided an empty answer's length by zero, and[NaN, 1.0].minraisedArgumentError: comparison of Float with NaN failed, which marks the whole runfailed. The scenario scorer already divides by[min, 1].max.msoroutput_tokensgavemax_latency_msandtoken_budgeta negative score (budget / duration), in the sample runner and inActiveAgent::Evals::Scoreralike:ms: -100with a 500 ms answer scored-0.2.Both scorers now clamp:
min_lengthdivides by at least 1, and the two budgets are floored at 0, so an impossible budget scores 0.0.The sample runner also had its own
contains/not_containsmatcher, which tried the pattern as a regex first, case-insensitively, and had no match timeout. It now callsActiveAgent::Evals::Scorer.matches_pattern?, so sampled and scenario evaluations agree: literal text first, then a regex withPATTERN_TIMEOUT. Onmain,contains "V(2)"against"Version v(2)"scored 0.0 in a sampled evaluation and 1.0 in a scenario evaluation.Tests
actionagent/test/evaluation_runner_service_test.rb: an empty answer withchars: 0scores 0.0 instead of failing the run; negativechars,msandoutput_tokensgive 1.0, 0.0 and 0.0;contains/not_containsfind literal text that is not a matching regex.test/evals/scorer_test.rb: negativemsandoutput_tokensscore 0.0 in a scenario evaluation.All four fail on
mainand pass with the change.Type of change
Scope check
Related issue
Fixes #751
Quality check
bin/rubocopon the changed files)gemfiles/rails8.gemfile: 4730 runs, 0 failures, 11 errors, 66 skips. The 11 errors are all inactionagent/test/cli_contract_test.rband are the same on unmodifiedmainin my environment (NoMethodError: undefined methodid' for an instance of Hashin rack-session under WebMock'sto_rack`), so they are unrelated to this change)Ownership
API changes
Not changed: neither scorer rejects a negative threshold when an evaluation is saved. Validating criteria config would be a separate change.