target

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package target provides deterministic eval.Target fixtures for offline pack tests. A Scripted target answers each scenario from a canned script and emits typed eval evidence, always stamping the scenario's revision on the subject (eval.Sample.Validate requires the match).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Script

type Script struct {
	Reply         string
	Duration      time.Duration // emitted as timing evidence when > 0
	ToolCalls     []ToolCall
	Structured    *Structured
	StructuredErr *StructuredErr
	Err           error // returned verbatim from Observe (target-stage failure)
}

Script is the canned behavior for one scenario ID.

type Scripted

type Scripted struct {
	// contains filtered or unexported fields
}

Scripted is a deterministic eval.Target. The zero value is unusable; use NewScripted.

func NewScripted

func NewScripted(name string, scripts map[string]Script) *Scripted

NewScripted builds a Scripted target named name with one script per scenario ID.

func (*Scripted) Name

func (s *Scripted) Name() string

Name implements eval.Target.

func (*Scripted) Observe

func (s *Scripted) Observe(_ context.Context, sc eval.Scenario) (eval.Observation, error)

Observe implements eval.Target. The scenario is read-only per the Target contract; input messages are copied, never mutated.

type Structured

type Structured struct {
	SchemaName     eval.Name
	SchemaRevision eval.Revision
}

Structured marks the script as having produced schema-conformant structured output.

type StructuredErr

type StructuredErr struct {
	Schema eval.Revision
	Reason eval.StructuredErrorReason
}

StructuredErr marks the script as having produced a classified structured output failure.

type ToolCall

type ToolCall struct {
	Name    eval.Name
	ID      string
	IsError bool
}

ToolCall is one scripted tool invocation surfaced as tool_operation evidence plus a tool operation span.

type UnscriptedScenarioError

type UnscriptedScenarioError struct{}

UnscriptedScenarioError reports an Observe call for a scenario the fixture has no script for. Per convention the scenario ID is withheld.

func (*UnscriptedScenarioError) Error

func (e *UnscriptedScenarioError) Error() string

Jump to

Keyboard shortcuts

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