llmtest

package
v0.34.2 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompletedEvent added in v0.26.0

func CompletedEvent(reason llm.StopReason) llm.Event

func ErrorEvent

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

func ReasoningEvent

func ReasoningEvent(s string) llm.Event

func SendEvents

func SendEvents(evs ...llm.Event) <-chan llm.Envelope

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

ch := llmtest.SendEvents(
    llmtest.TextEvent("hello"),
    llmtest.CompletedEvent(llm.StopReasonEndTurn, nil),
)

func TextEvent

func TextEvent(s string) llm.Event

func ToolEvent

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

func UsageEvent added in v0.26.0

func UsageEvent(u llm.Usage) llm.Event

Types

This section is empty.

Jump to

Keyboard shortcuts

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