scripted

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package scripted is a scripted model for the tests that run a real agent: a Streamer that answers each request with the next of its steps, built on the emitter, offline and deterministic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

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

Model answers request i with step i, and fails a request past the last. It also keeps the requests it saw.

func New

func New(steps ...Step) *Model

New returns a model that plays steps in order.

func (*Model) CreateStream

func (m *Model) CreateStream(ctx context.Context, req openresponses.Request, sink openresponses.EventSink) error

CreateStream implements openresponses.Streamer.

func (*Model) Requests

func (m *Model) Requests() []openresponses.Request

Requests returns the requests the model has received.

type Step

type Step func(ctx context.Context, em *openresponses.Emitter) error

Step is one model response.

func Call

func Call(callID, name, args string) Step

Call streams one function call.

func Say

func Say(chunks ...string) Step

Say streams a final-answer message in chunks.

func SayThenBlock

func SayThenBlock(chunk string) Step

SayThenBlock streams one chunk and then waits for the request's context to end, as a model that never finishes does.

Jump to

Keyboard shortcuts

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