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