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: ? 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 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