Repository navigation
Apply the llm pattern number as a confidence threshold; handle models that reject temperature - #38
Merged
Merged
Conversation
The number on a quoted llm pattern, as in `$check = "prompt" (0.7)`, is documented as the confidence the LLM needs to trigger a match. The engine sent it to the model as the sampling temperature instead and never compared the reported confidence to it, so any yes matched and a higher "threshold" only made verdicts more random. The matcher and the decision engine now match a pattern only when the model answers yes at or above the threshold, and no longer pass the number to the evaluator. Checks run at the evaluators' fixed 0.1 temperature. A pattern without a number uses 0.6 whether it is parsed from a rule file or built in code. A yes that comes without a usable confidence fails closed with a warning unless the threshold is 0.0, and reported confidences are clamped to 0-1 on every provider. Models that accept only their default sampling settings answer a custom temperature with HTTP 400, which made every LLM rule fail closed. The OpenAI, OpenRouter, Azure and Anthropic evaluators now retry once without the field and stop sending it for that evaluator. The Anthropic evaluator reads the verdict from the text blocks rather than the first content block, so a leading thinking block is not parsed as an empty non-match, reports a response with no text as an error, and allows 1024 output tokens. Supersedes #33. Co-authored-by: Marco Pedrinazzi <marcopedrinazzi.mp@gmail.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This was referenced Nov 29, 2026
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.
Summary
The number on a quoted
llm:pattern is now the confidence threshold the documentation describes, and LLM rules work again on models that reject a custom temperature. Supersedes #33 and builds on its retry idea.The problem
$check = "prompt" (0.7)is documented as "how confident the LLM must be to trigger a match". Since v0.1.4 the engine has sent that number to the model as its temperature and never checked the reported confidence. Any yes matched, and raising the number only made the model more random.Changes
NovaMatcherand in the decision engine (quoted checks inside typed rules). The number is no longer sent to the model.0.0. Confidences are clamped to 0-1 on every provider.0.1. On a 400 that namestemperature, the OpenAI, OpenRouter, Azure and Anthropic evaluators retry once without it and stop sending it for that evaluator.content[0], so a leading thinking block is not parsed as an empty non-match. A response with no text is an error.max_tokensgoes from 200 to 1024.yes at 0.9800 (a yes needs 0.7).docs/decision.md, the layered example and the changelog no longer call the number a temperature.Behaviour changes
(0.0)accepts any yes.0.6. That was already the parser default;LLMPatternobjects built in code previously defaulted to0.1.Verification
twine check,verify_artifacts.py, the dependency audit and the wheel smoke test pass. 35 new tests cover the threshold and the fallback.gpt-5-mini, which rejects a custom temperature: before, an "ignore all previous instructions" prompt failed closed; after, it matches at 0.98 through the CLI, the SDK parallel scan and the decision-engine path, and a benign prompt does not match.gpt-4o-mini, OpenRouter and Groq: the 0.1 temperature is kept and verdicts are returned.nova-rulespack (42 LLM patterns × 8 prompts,gpt-4o-mini), all 100 yes verdicts had confidence ≥ 0.8, so no outcome changed.Not tested live
🤖 Generated with Claude Code