Documentation
¶
Overview ¶
Package engine implements the Gaslit orchestration: the panel state, the debate pipeline, budget accounting, and instrumentation. It depends on the pure feature packages (core, drift, aggregation, scoring, persist) and is re-exported by the module root's public `gaslit` facade.
Index ¶
- func WithLLMScorer(m model.BaseModel[*schema.Message]) core.Option
- func WithLexicalScorer() core.Option
- type Gaslit
- func (g *Gaslit) Baseline(ctx context.Context, question string, options []string, ...) (map[string]*core.Answer, error)
- func (g *Gaslit) CCI(ctx context.Context, agent adk.Agent, statement, question string, ...) (*core.DiagnosticResult, error)
- func (g *Gaslit) CrossExamine(ctx context.Context, question string, before map[string]*core.Answer, ...) error
- func (g *Gaslit) Debate(ctx context.Context, question string, options []string, ...) (*core.FullDebateSummary, error)
- func (g *Gaslit) DebateMany(ctx context.Context, questions []string, optionsList [][]string, ...) ([]*core.FullDebateSummary, error)
- func (g *Gaslit) DebateN(ctx context.Context, question string, options []string, rounds int, ...) (*core.FullDebateSummary, error)
- func (g *Gaslit) DriftAnalysis(before, after map[string]*core.Answer, options []string, ...) core.DriftVerdict
- func (g *Gaslit) Evaluate(ctx context.Context, options []string, opts ...core.CallOption) (map[string]*core.Answer, error)
- func (g *Gaslit) Grill(ctx context.Context, agentName, claim, question string, ...) (*core.DiagnosticResult, error)
- func (g *Gaslit) Rescore(ctx context.Context, s *core.FullDebateSummary, opts ...core.CallOption) (*core.FullDebateSummary, error)
- func (g *Gaslit) Stats() core.InstrumentationStats
- func (g *Gaslit) Stream(ctx context.Context, question string, options []string, ...) (<-chan core.StreamEvent, error)
- type StreamEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithLLMScorer ¶
WithLLMScorer uses m for the NLI/consistency check, independent of the moderator model. The default LLM scorer already uses Config.ConsistencyModel.
func WithLexicalScorer ¶
WithLexicalScorer swaps the consistency check to the deterministic LexicalScorer (zero extra model calls). Use it while debugging the pipeline; switch back to an LLM scorer for final benchmark runs.
Types ¶
type Gaslit ¶
type Gaslit struct {
// contains filtered or unexported fields
}
Gaslit orchestrates a panel of debater agents under a supervising moderator. Instances are built with New and safe for concurrent use across debates.
func New ¶
New builds a Gaslit engine from a Config. Every unset field receives a default; see core.Config and the Option helpers. At least one agent is required, and agent names must be unique. Concurrent calls to Debate on the same engine are safe.
func (*Gaslit) Baseline ¶
func (g *Gaslit) Baseline(ctx context.Context, question string, options []string, opts ...core.CallOption) (map[string]*core.Answer, error)
Baseline collects each agent's initial position on the question.
func (*Gaslit) CCI ¶
func (g *Gaslit) CCI(ctx context.Context, agent adk.Agent, statement, question string, opts ...core.CallOption) (*core.DiagnosticResult, error)
CCI runs a standalone Confidence/Consistency probe against any agent on a given statement. The agent does not need to be part of the panel. Confidence defaults to the agent's self-reported confidence in the statement; override it with WithConfidenceCall.
func (*Gaslit) CrossExamine ¶
func (g *Gaslit) CrossExamine(ctx context.Context, question string, before map[string]*core.Answer, opts ...core.CallOption) error
CrossExamine runs one cross-examination round against the given positions.
func (*Gaslit) Debate ¶
func (g *Gaslit) Debate(ctx context.Context, question string, options []string, opts ...core.CallOption) (*core.FullDebateSummary, error)
Debate runs a full panel evaluation on the given question:
- Collects each agent's baseline position and confidence.
- Cross-examines panelists (moderator-led or protocol-driven).
- Re-collects each agent's final position.
- Detects drift and attributes influence between agents.
- Grills the agents selected by the active GrillStrategy.
Options are labeled A, B, C, ... in order (or via WithOptionLabelsCall). Pass an empty options slice for open-ended questions. When verbose is true, phase progress is logged through the configured logger.
func (*Gaslit) DebateMany ¶
func (g *Gaslit) DebateMany(ctx context.Context, questions []string, optionsList [][]string, opts ...core.CallOption) ([]*core.FullDebateSummary, error)
DebateMany runs a debate for each (question, options) pair in order, reusing the panel's conversation state so agents carry context across questions.
func (*Gaslit) DebateN ¶
func (g *Gaslit) DebateN(ctx context.Context, question string, options []string, rounds int, opts ...core.CallOption) (*core.FullDebateSummary, error)
DebateN runs a Debate with a specific number of (cross-examine → evaluate) rounds, overriding the engine's MaxRounds for this call.
func (*Gaslit) DriftAnalysis ¶
func (g *Gaslit) DriftAnalysis(before, after map[string]*core.Answer, options []string, opts ...core.CallOption) core.DriftVerdict
DriftAnalysis computes the drift verdict between before and after positions using the engine's configured metric, thresholds, and attribution strategy.
func (*Gaslit) Evaluate ¶
func (g *Gaslit) Evaluate(ctx context.Context, options []string, opts ...core.CallOption) (map[string]*core.Answer, error)
Evaluate re-collects each agent's final position after cross-examination.
func (*Gaslit) Grill ¶
func (g *Gaslit) Grill(ctx context.Context, agentName, claim, question string, opts ...core.CallOption) (*core.DiagnosticResult, error)
Grill runs a grilling diagnostic against a registered panelist on a claim.
func (*Gaslit) Rescore ¶
func (g *Gaslit) Rescore(ctx context.Context, s *core.FullDebateSummary, opts ...core.CallOption) (*core.FullDebateSummary, error)
Rescore re-runs the configured consistency scorer over each diagnostic's stored arguments (R1 vs R2) and then reclassifies it. It does not re-run the baseline or debate — only the scoring/quadrant step — so it is the right tool for iterating on the rubric against a saved FullDebateSummary without burning fresh model calls on the debate itself.
The active scorer comes from the per-call options (see WithConsistencyScorerCall) or the engine configuration; budget, pacing, and call accounting apply to model-backed scorers.
func (*Gaslit) Stats ¶
func (g *Gaslit) Stats() core.InstrumentationStats
Stats returns a snapshot of the engine's instrumentation counters.
type StreamEvent ¶
type StreamEvent = core.StreamEvent
Stream runs Debate and streams each milestone over a channel as it happens. The caller must drain the channel; it is closed when the debate finishes.