provider

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 3 Imported by: 0

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 Provider

type Provider interface {
	// 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 QueryProvider

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

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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