confidence

package
v0.45.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package confidence provides pre-dispatch heuristic scoring for tool-use inputs. The agent uses it to flag tool calls where the model has likely guessed a required parameter — empty strings, placeholder values, "TODO"/"FIXME" tokens, obvious defaults — so the dispatch layer can abstain and ask for clarification instead of acting on shaky arguments.

This is separate from the chain-of-verification (verify_build.go / verifyPayload): verify runs AFTER a tool produces content, checking the output. Confidence runs BEFORE dispatch, checking the input. The two cover different failure modes — verify catches "we built the wrong thing", confidence catches "we're about to act on uncertain inputs".

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Report

type Report struct {
	Score       Score
	MissingKeys []string
	WeakKeys    []string // present but placeholder-like
	Reason      string
}

Report captures the outcome of a confidence evaluation.

func Evaluate

func Evaluate(params map[string]any, required []string) Report

Evaluate scores tool-input params against the required key list. Required keys that are missing or placeholder-like subtract weight proportional to their share of the required set. Optional keys are not scored — the caller already opted to treat them as optional.

With no required keys, the score is always 1.0 (nothing to fail on).

func (Report) ShouldAbstain

func (r Report) ShouldAbstain() bool

ShouldAbstain is true when Score is below AbstainThreshold.

type Score

type Score float64

Score is a confidence value in [0.0, 1.0]. 1.0 = fully grounded inputs, every required field carries a concrete value. 0.0 = the input is unsalvageable (empty required fields, obvious placeholders throughout). The default abstention threshold is 0.5; callers override via Dispatch.

const AbstainThreshold Score = 0.5

Threshold below which dispatch should abstain. Tuned against the adversarial eval scenarios; a future golden query set will let us re-calibrate without touching the heuristics themselves.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL