impl

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSession

func NewSession(model llm.Model, factory MessageFactory, opts ...llm.Opt) *session

Create a new empty session to store a context window

Types

type MessageFactory

type MessageFactory interface {
	// Generate a system prompt
	SystemPrompt(prompt string) llm.Completion

	// Generate a user prompt, with attachments and other options
	UserPrompt(string, ...llm.Opt) (llm.Completion, error)

	// Generate an array of results from calling tools
	ToolResults(...llm.ToolResult) ([]llm.Completion, error)
}

Abstract interface for a message factory

type Model

type Model interface {
	// Additional method for a context object
	Chat(ctx context.Context, completions []llm.Completion, opts ...llm.Opt) (llm.Completion, error)
}

type ModelCache

type ModelCache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewModelCache

func NewModelCache() *ModelCache

func (*ModelCache) Get

func (c *ModelCache) Get(fn ModelLoadFunc, name string) (llm.Model, error)

Return a model by name

func (*ModelCache) Load

func (c *ModelCache) Load(fn ModelLoadFunc) ([]llm.Model, error)

Load models and return them

type ModelLoadFunc

type ModelLoadFunc func() ([]llm.Model, error)

Jump to

Keyboard shortcuts

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