Documentation
¶
Overview ¶
Package recording wraps an adkmodel.LLM with a JSONL transcript recorder for offline observability and scripted-replay testing.
The recording wrapper (NewRecorder) is transparent: callers see the inner LLM's responses unchanged, and one RecordedTurn is appended to the writer per GenerateContent call. The same RecordedTurn type is consumed by models/mock's scripted provider for deterministic replay.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRecorder ¶
NewRecorder wraps inner so every GenerateContent turn is appended to w as a single JSONL line in RecordedTurn shape. The wrapper is transparent: callers see the inner LLM's responses unchanged. The caller owns w's lifecycle (open before, close after).
Errors from the inner LLM pass through to the caller but are not recorded — replay can't reproduce a remote error meaningfully. Partial responses received before an error are still encoded.
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 captured by the recording wrapper and 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.