llmtest

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package llmtest provides public test helpers for the llm package.

StubClient is a scriptable llm.Client. Each Stream call consumes one TurnScript; the agent loop tests script multi-turn conversations as a slice of TurnScripts.

Index

Constants

This section is empty.

Variables

View Source
var ErrStubExhausted = errors.New("aikido/llmtest: stub client: script exhausted")

ErrStubExhausted is returned by Stream when no scripts remain.

Functions

This section is empty.

Types

type StubClient

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

StubClient is a scriptable llm.Client.

func NewStubClient

func NewStubClient(turns ...TurnScript) *StubClient

NewStubClient returns a StubClient that plays the given turn scripts in order.

func (*StubClient) Requests

func (s *StubClient) Requests() []llm.Request

Requests returns a snapshot of every llm.Request the stub has been called with, in order. Useful for assertion in tests.

func (*StubClient) Stream

func (s *StubClient) Stream(ctx context.Context, req llm.Request) (<-chan llm.Event, error)

Stream consumes one TurnScript and emits its events.

type TurnScript

type TurnScript struct {
	Events []llm.Event
	// Block, if non-nil, causes Stream's producer to block on receive from this
	// channel before emitting any events. Closing it (or context cancellation)
	// unblocks the goroutine. Useful for timeout tests.
	Block <-chan struct{}
}

TurnScript is the events the stub emits for one Stream call.

Jump to

Keyboard shortcuts

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