grounding

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package grounding is the harness's free, deterministic quality check: did the model invent values not present in the source? No inference, sub-millisecond string ops. It is the keystone label generator for the self-learning loop (conformal calibration, health monitoring, router training all train on it).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(task core.TaskType, input string, data []byte) (grounded bool, ok bool)

Check reports whether structured output is grounded in the source input. ok=false means grounding does not apply (classify/triage are grammar-pinned to a label set, nothing to verify; or the output has no checkable values).

  • extract: every leaf string/number value must appear in the source (extraction is verbatim — a value not in the source is a hallucination).
  • summarize: every NUMBER in the summary must appear in the source (the clearest invented-fact signal; entity paraphrasing is intentionally not flagged to avoid false positives).

The pipeline ACTS on a false result only for extract (retry/escalate); for summarize it is logged as a quality signal but not actioned.

func CheckFields

func CheckFields(task core.TaskType, input string, data []byte) (ungrounded []string, ok bool)

CheckFields is the per-field variant of Check for extract: it returns the list of TOP-LEVEL field names whose value is not grounded in the source. ok=false means grounding does not apply (non-extract task). Nested values are attributed to their top-level key. Used to name offenders in a targeted corrective re-prompt (lightweight atomic-claim verification).

Types

This section is empty.

Jump to

Keyboard shortcuts

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