llmtest

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package llmtest provides helpers for testing code that consumes llm.StreamEvent channels, following the convention of packages like net/http/httptest.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoneEvent

func DoneEvent(usage *llm.Usage) llm.StreamEvent

DoneEvent returns a StreamEventDone with optional usage statistics.

func ErrorEvent

func ErrorEvent(err *llm.ProviderError) llm.StreamEvent

func ReasoningEvent

func ReasoningEvent(s string) llm.StreamEvent

ReasoningEvent returns a StreamEventDelta carrying a reasoning/thinking token.

func SendEvents

func SendEvents(evs ...llm.StreamEvent) <-chan llm.StreamEvent

SendEvents builds a buffered, pre-populated event channel and closes it. Use it to construct a fake stream in tests:

ch := llmtest.SendEvents(
    llmtest.TextEvent("hello"),
    llmtest.DoneEvent(nil),
)

func TextEvent

func TextEvent(s string) llm.StreamEvent

TextEvent returns a StreamEventDelta carrying a text token.

func ToolEvent

func ToolEvent(id, name string, args map[string]any) llm.StreamEvent

ToolEvent returns a StreamEventToolCall for a completed tool call.

Types

This section is empty.

Jump to

Keyboard shortcuts

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