fake

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package fake provides a canned-response implementation of llms.Model for tests, in the spirit of testing/fstest's MapFS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LLM

type LLM struct {
	// contains filtered or unexported fields
}

func NewFakeLLM

func NewFakeLLM(responses []string) *LLM

func (*LLM) AddResponse

func (f *LLM) AddResponse(response string)

AddResponse adds a response to the list of responses.

func (*LLM) Call

func (f *LLM) Call(ctx context.Context, prompt string, options ...llms.CallOption) (string, error)

Call the model with a prompt.

func (*LLM) GenerateContent

func (f *LLM) GenerateContent(ctx context.Context, _ []llms.MessageContent, options ...llms.CallOption) (*llms.ContentResponse, error)

GenerateContent returns the next configured response. It honors context cancellation and, when llms.WithStreamingFunc is set, streams the response to the callback before returning it; a callback error aborts the request.

func (*LLM) Reset

func (f *LLM) Reset()

Reset the index to 0.

Jump to

Keyboard shortcuts

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