agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
27 lines (26 loc) • 1.41 kB
TypeScript
import type { Embedder, EvidenceInput, InfluenceScore, InfluenceWeights } from './types.js';
export interface ScoreContrastiveInfluenceArgs {
/** Evidence items (context sources) with their reasoning ancestors. */
readonly evidence: readonly EvidenceInput[];
/** The ACTUAL (e.g. buggy) output the evidence is scored against. */
readonly answerText: string;
/** A REFERENCE output to contrast against — a known-good / expected / prior
* run. The shared-with-both similarity (topical innocents) cancels out. */
readonly referenceText: string;
/** Injected embedder. Wrap in an `EmbeddingCache` to share embeddings. */
readonly embedder: Embedder;
/** Composite weights. Default: paper priors 0.40/0.30/0.20/0.10. */
readonly weights?: InfluenceWeights;
/** PERSIST threshold T. Default 0.3. */
readonly persistenceThreshold?: number;
readonly signal?: AbortSignal;
}
/**
* Score evidence by CONTRASTIVE influence: `sim(e, answer) − sim(e, reference)`
* for the FA term, the four-signal composite otherwise. Returns `InfluenceScore[]`
* sorted descending — drop-in compatible with `scoreInfluence` consumers
* (`rankingConfidence`, etc.).
*
* @throws when an evidence id is duplicated (same contract as `scoreInfluence`).
*/
export declare function scoreContrastiveInfluence(args: ScoreContrastiveInfluenceArgs): Promise<InfluenceScore[]>;