llmresolver

package
v1.0.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 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

This section is empty.

Variables

View Source
var ErrNoAudioCapableModel = fmt.Errorf("%w: no available model supports audio input", ErrNoSatisfactoryModel)
View Source
var ErrNoAvailableModels = errors.New("no models found in runtime state")
View Source
var ErrNoSatisfactoryModel = errors.New("no model matched the requirements")
View Source
var ErrNoVisionCapableModel = fmt.Errorf("%w: no available model supports image input (vision)", ErrNoSatisfactoryModel)
View Source
var ErrPinnedModelLacksAudio = errors.New("explicitly requested model lacks audio capability")
View Source
var ErrPinnedModelLacksVision = errors.New("explicitly requested model lacks vision capability")

Functions

func Chat

func Chat(
	ctx context.Context,
	req Request,
	getModels func(ctx context.Context, backendTypes ...string) ([]modelrepo.Provider, error),
	resolver func(candidates []modelrepo.Provider) (modelrepo.Provider, string, error),
) (modelrepo.LLMChatClient, modelrepo.Provider, string, error)

func Embed

func Embed(
	ctx context.Context,
	embedReq EmbedRequest,
	getModels func(ctx context.Context, backendTypes ...string) ([]modelrepo.Provider, error),
	resolver func(candidates []modelrepo.Provider) (modelrepo.Provider, string, error),
) (modelrepo.LLMEmbedClient, modelrepo.Provider, string, error)

func NormalizeModelName

func NormalizeModelName(modelName string) string

func PromptExecute

func PromptExecute(
	ctx context.Context,
	req Request,
	getModels func(ctx context.Context, backendTypes ...string) ([]modelrepo.Provider, error),
	resolver func(candidates []modelrepo.Provider) (modelrepo.Provider, string, error),
) (modelrepo.LLMPromptExecClient, modelrepo.Provider, string, error)

func Randomly

func Randomly(candidates []modelrepo.Provider) (modelrepo.Provider, string, error)

func Stream

func Stream(
	ctx context.Context,
	req Request,
	getModels func(ctx context.Context, backendTypes ...string) ([]modelrepo.Provider, error),
	resolver func(candidates []modelrepo.Provider) (modelrepo.Provider, string, error),
) (modelrepo.LLMStreamClient, modelrepo.Provider, string, error)

Types

type EmbedRequest

type EmbedRequest struct {
	ModelName    string
	ProviderType string
	Tracker      libtracker.ActivityTracker
}

type Policy

type Policy = func(candidates []modelrepo.Provider) (modelrepo.Provider, string, error)

func StickyOrRandom

func StickyOrRandom(sessionKey string) Policy

type Request

type Request struct {
	ProviderTypes     []string
	ModelNames        []string
	ContextLength     int
	FitContextToModel bool
	RequiresVision    bool
	RequiresAudio     bool
	Tracker           libtracker.ActivityTracker
}

type Selection

type Selection struct {
	Provider modelrepo.Provider
	Backend  string
}

func AutocompleteSelections

func AutocompleteSelections(ctx context.Context, req Request, getModels func(context.Context, ...string) ([]modelrepo.Provider, error), policy Policy) ([]Selection, error)

func ChatSelections

func ChatSelections(
	ctx context.Context,
	req Request,
	getModels func(ctx context.Context, backendTypes ...string) ([]modelrepo.Provider, error),
	policy Policy,
) ([]Selection, error)

func NextEditSelections

func NextEditSelections(ctx context.Context, req Request, getModels func(context.Context, ...string) ([]modelrepo.Provider, error), policy Policy) ([]Selection, error)

func PromptExecuteSelections

func PromptExecuteSelections(
	ctx context.Context,
	req Request,
	getModels func(ctx context.Context, backendTypes ...string) ([]modelrepo.Provider, error),
	policy Policy,
) ([]Selection, error)

func StreamSelections

func StreamSelections(
	ctx context.Context,
	req Request,
	getModels func(ctx context.Context, backendTypes ...string) ([]modelrepo.Provider, error),
	policy Policy,
) ([]Selection, error)

Jump to

Keyboard shortcuts

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