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 ¶
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) (result *QueryResult, err error)
}
Query is a provider that allows to query a model directly.
type QueryResult ¶ added in v1.0.7
type QueryResult struct {
// ResponseID holds the response ID.
ResponseID string
// Message holds the response message.
Message string
// Duration holds the duration of the result.
Duration time.Duration
// Usage holds the usage metrics of the query.
Usage openai.Usage
}
QueryResult holds the result of a query.
Click to show internal directories.
Click to hide internal directories.