Replies: 2 comments
|
Thanks for raising this idea! We have plans for this on our near term road map (however with a different implementation approach) 👍🏾 |
0 replies
|
Here you go: https://langfuse.com/changelog/2026-05-28-code-evaluators |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Problem
All evaluations currently require an LLM call. Deterministic checks like "output contains disclaimer" or "response is valid JSON" don't need an LLM, they cost money, add latency, hit rate limits, and require API key configuration.
Proposed Solution
A new
RULE_BASEDevaluator type that evaluates JSON-serializable conditions in the worker. No LLM call, no code execution, no new dependencies. Reuses the existingJobConfiguration→JobExecution→ Score pipeline unchanged — only the execution step branches.Rule Schema
Operators mirror
InMemoryFilterService/filterOperators— already battle-tested in the codebase.Example
"Output contains disclaimer AND is valid JSON":
{ "combinator": "and", "conditions": [ { "variable": "output", "operator": "contains", "value": "not financial advice" }, { "variable": "output", "operator": "is_valid_json" } ] }Scoring
value:1.0(all/any conditions pass) or0.0comment: Auto-generated reasoning, e.g."Rule failed: condition 2 — output is not valid JSON"source:EVAL,dataType:NUMERIC(same as LLM evals)Execution Flow
No changes to job creation or queuing. The only branch point is in
evaluate():Same dispatch applies in
observationEvalProcessor.tsfor observation-level evals.Database Changes
Implementation Plan
packages/shared/prisma/EvalTemplateTypeenum,typeandrule_definitioncolumnspackages/shared/src/features/evals/types.tsRuleDefinition/RuleConditionZod schemasworker/src/features/evaluation/executeRuleBasedEvaluation.tsworker/src/features/evaluation/evalService.tsevaluate()based ontemplate.typeworker/src/features/evaluation/observationEval/observationEvalProcessor.tsweb/src/features/evals/server/router.tstype+ruleDefinitionin template CRUDweb/src/features/evals/components/template-form.tsxweb/src/features/evals/components/rule-builder.tsxfilter-builder.tsx)web/src/features/evals/components/inner-evaluator-form.tsxweb/__tests__/async/andworker/src/__tests__/Questions for Maintainers
re2(linear-time, no ReDoS). Alternative: built-inRegExpwith a timeout. Preference?and/oronly, or support nested groups like(A AND B) OR (C AND D)?1.0/0.0, or support proportional scoring (3/5 pass = 0.6)?evalTemplate:CUD/job:CUDscopes?All reactions