testkit

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package testkit provides shared test doubles for harness and server integration tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertStatusMatchesEvent added in v0.5.0

func AssertStatusMatchesEvent(t testing.TB, rt session.Client, id session.ID, ev session.Event)

AssertStatusMatchesEvent checks Runtime.Status against a turn-finished stream event. complete → SessionComplete, error → SessionFailed, yield → running+Waiting.

func ContentTokenEstimate

func ContentTokenEstimate(msgs []*message.Message) int

ContentTokenEstimate is a shared length-based token stand-in for pressure tests.

func CountedHTTPModel added in v0.5.0

func CountedHTTPModel(tb testing.TB, respond func(ctx context.Context, msgs []*message.Message, tools []*tacklr.Tool, ch chan<- tacklr.LLMResponseChunk), count func(msgs []*message.Message) (int, error)) tacklr.Model

CountedHTTPModel is HTTPModel whose provider counts a request's tokens with count. msgs is the request as the provider got it: the system prompt is its first message. The token-count endpoint answers the count, or HTTP 500 when count fails, and each response reports the count as its input tokens.

func HTTPModel added in v0.4.0

func HTTPModel(tb testing.TB, respond func(ctx context.Context, msgs []*message.Message, tools []*tacklr.Tool, ch chan<- tacklr.LLMResponseChunk)) tacklr.Model

HTTPModel is the real OpenAI-compatible client pointed at a local server. respond sees the conversation the client sent and writes chunks. An error chunk becomes the HTTP error the client classifies. Anything else is SSE.

func TextHTTPModel added in v0.4.0

func TextHTTPModel(tb testing.TB, respond func(ctx context.Context, msgs []*message.Message, tools []*tacklr.Tool, ch chan<- tacklr.LLMResponseChunk)) tacklr.Model

TextHTTPModel is HTTPModel on a model id that accepts text only.

func UncountedHTTPModel added in v0.5.0

func UncountedHTTPModel(tb testing.TB, respond func(ctx context.Context, msgs []*message.Message, tools []*tacklr.Tool, ch chan<- tacklr.LLMResponseChunk), count func(msgs []*message.Message) (int, error)) tacklr.Model

UncountedHTTPModel is CountedHTTPModel on a provider with no token-count endpoint (HTTP 404): only each response reports count as its input tokens.

Types

This section is empty.

Jump to

Keyboard shortcuts

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