mock

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package mock ships a credential-free scripted LLM provider for offline testing of agent flows.

The scripted provider replays a JSONL transcript turn-by-turn. Pair it with a recording captured against a real provider to exercise the agent loop without burning API quota. Construct one with NewScripted; there is no registry and no init-time registration — callers wire the returned model.LLM explicitly.

Tool execution at replay time uses the live environment, so the scripted provider faithfully replays the LLM side but not the wider tool surface — fine for testing prompt construction and loop shape, not for bit-exact session reproduction.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewScripted

func NewScripted(path string, strict bool) (adkmodel.LLM, error)

NewScripted returns a scripted LLM that plays back the JSONL transcript at path. strict toggles request-shape validation per turn (see scriptedLLM for details).

Types

type RecordedTurn

type RecordedTurn struct {
	Request   *adkmodel.LLMRequest    `json:"request"`
	Responses []*adkmodel.LLMResponse `json:"responses"`
}

RecordedTurn is the on-disk shape of a single LLM turn consumed by the scripted provider.

One RecordedTurn is written per JSONL line. Request is a snapshot taken before the inner LLM may have mutated it (Config.Tools is commonly appended to). Responses is the full ordered stream of LLMResponse values yielded for that turn — typically zero or more Partial: true chunks followed by exactly one TurnComplete: true.

Note that adkmodel.LLMRequest.Tools is tagged json:"-" upstream and will silently drop on serialization. That's intentional: the inner LLM provides tool declarations on replay; recorded Tools would be dead weight.

This wire format is shared with core-agent's pkg/recording, whose recording wrapper (recording.NewRecorder) produces transcripts in exactly this shape. If/when the recorder ports to mast, this type and the JSONL read path should be extracted to a mast pkg/recording that both packages consume.

Jump to

Keyboard shortcuts

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