provider

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const ProviderModelSeparator = "/"

ProviderModelSeparator is the the separator between a provider and a model.

Variables

View Source
var Providers = map[string]Provider{}

Providers holds a register of all providers.

Functions

func Register

func Register(provider Provider)

Register adds a provider to the common provider list.

Types

type InjectToken

type InjectToken interface {
	// SetToken sets an access token to be used to authenticate a remote API.
	SetToken(token string)
}

InjectToken is a provider that needs an access token to authenticate a remote API.

type Loader added in v0.5.0

type Loader interface {
	// Load loads the given model.
	Load(modelIdentifier string) (err error)
	// Unload unloads the given model.
	Unload(modelIdentifier string) (err error)
}

Loader is a provider that is able to load and unload models.

type Provider

type Provider interface {
	// Available checks if the provider is ready to be used.
	// This might include checking for an installation or making sure an API access token is valid.
	Available(logger *log.Logger) (err error)
	// ID returns the unique ID of this provider.
	ID() (id string)
	// Models returns which models are available to be queried via this provider.
	Models() (models []model.Model, err error)
}

Provider defines a provider to query models such as LLMs.

type Puller added in v0.6.0

type Puller interface {
	// Pull downloads the given model.
	Pull(logger *log.Logger, modelIdentifier string) (err error)
}

Puller is a provider that is capable of pulling models.

type Query added in v0.5.0

type Query interface {
	// Query queries the provider with the given model name.
	Query(ctx context.Context, model model.Model, promptText string) (response string, err error)
}

Query is a provider that allows to query a model directly.

type Service added in v0.5.0

type Service interface {
	// Start starts necessary background services to use this provider and returns a shutdown function.
	Start(logger *log.Logger) (shutdown func() (err error), err error)
}

Service is a provider that requires background services.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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