fake

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Example
ctx := context.Background()
p := NewProvider()

stream, err := p.CreateStream(ctx, llm.Request{
	Model:    "fake-model",
	Messages: llm.Messages{llm.User("Hello!")},
})
if err != nil {
	panic(err)
}

for event := range stream {
	switch event.Type {
	case llm.StreamEventDelta:
		_ = event.Data
	case llm.StreamEventToolCall:
		_ = event.Data
	case llm.StreamEventCompleted:
		return
	case llm.StreamEventError:
		panic(event.Data)
	}
}

Index

Examples

Constants

View Source
const (
	ProviderName      = "fake"
	Model1ID          = "fake/model-1"
	Model1DisplayName = "Fake Model 1"
)

Variables

This section is empty.

Functions

func NewProvider

func NewProvider(opts ...llm.ProviderOpt) llm.Provider

NewProvider returns a test-only provider.

Types

type Provider

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

Provider is a test-only provider that returns a single tool call on the first request and a text-only response on subsequent requests.

func (*Provider) CreateStream

func (f *Provider) CreateStream(_ context.Context, _ llm.Buildable) (llm.Stream, error)

Jump to

Keyboard shortcuts

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