scoring

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package scoring implements the consistency scorers used to detect whether an agent's arguments contradict each other under cross-examination.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LLMScorer

type LLMScorer struct {
	Model  model.BaseModel[*schema.Message]
	Logger *slog.Logger
	// NLIProbe builds the evaluation prompt. When nil, the built-in template
	// is used.
	NLIProbe func(question, r1, r2 string) string
}

LLMScorer implements core.ConsistencyScorer by having a model run a logical entailment / contradiction check between two arguments.

func (*LLMScorer) Score

func (s *LLMScorer) Score(ctx context.Context, question, r1, r2 string) (float64, error)

Score runs the entailment probe and parses the consistency_score. It falls back to a neutral 0.5 on any parse failure.

type LexicalScorer

type LexicalScorer struct{}

LexicalScorer implements core.ConsistencyScorer deterministically with zero extra model calls: it returns the Jaccard similarity of the two arguments' word sets. It is best used as a cheap approximation when an LLM evaluator is not available, e.g. while debugging the pipeline.

func (*LexicalScorer) Score

func (s *LexicalScorer) Score(ctx context.Context, question, r1, r2 string) (float64, error)

Score returns the lexical overlap between the two arguments as a consistency proxy.

Jump to

Keyboard shortcuts

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