Documentation
¶
Overview ¶
Package llmtest provides helpers for testing code that consumes llm.Stream channels, following the convention of packages like net/http/httptest.
Index ¶
- func CompletedEvent(reason llm.StopReason) llm.Event
- func ErrorEvent(err *llm.ProviderError) llm.Event
- func ReasoningEvent(s string) llm.Event
- func SendEvents(evs ...llm.Event) <-chan llm.Envelope
- func TextEvent(s string) llm.Event
- func ToolEvent(id, name string, args map[string]any) llm.Event
- func UsageEvent(u llm.Usage) llm.Event
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 SendEvents ¶
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),
)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.