registry

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedClient

type CachedClient struct {
	llm.Client
	// contains filtered or unexported fields
}

func NewCachedClient

func NewCachedClient(client llm.Client, ttl time.Duration) *CachedClient

func (*CachedClient) DeleteModel

func (c *CachedClient) DeleteModel(ctx context.Context, model schema.Model) error

func (*CachedClient) DownloadModel

func (c *CachedClient) DownloadModel(ctx context.Context, name string, opts ...opt.Opt) (*schema.Model, error)

func (*CachedClient) GetModel

func (c *CachedClient) GetModel(ctx context.Context, name string) (*schema.Model, error)

GetModel fails fast on cached misses but still defers successful lookups to the provider.

func (*CachedClient) ListModels

func (c *CachedClient) ListModels(ctx context.Context) ([]schema.Model, error)

func (*CachedClient) Self

func (c *CachedClient) Self() llm.Client

Self returns the underlying client implementation.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func New

func New(opts ...client.ClientOpt) *Registry

func (*Registry) Count

func (r *Registry) Count() int

Count returns the number of providers currently loaded in the registry.

func (*Registry) Get

func (r *Registry) Get(name string) llm.Client

Returns a provider client by name, or nil if not found.

func (*Registry) GetModel

func (r *Registry) GetModel(ctx context.Context, provider *schema.Provider, name string) (schema.Model, error)

GetModel returns a single model for a provider when the exact model name matches after include/exclude regex filtering has been applied.

func (*Registry) Ping

func (r *Registry) Ping(ctx context.Context) error

Ping checks the connectivity of all providers and returns any errors

func (*Registry) Set

func (r *Registry) Set(schema *schema.Provider, credentials schema.ProviderCredentials) (bool, bool, error)

Sets or updates a provider client by name, if the provider is enabled, and return boolean flags indicating whether the provider was updated or deleted.

func (*Registry) Sync

func (r *Registry) Sync(schema []*schema.Provider, decrypter func(i int) (schema.ProviderCredentials, error)) (updates []string, deletes []string, err error)

Syncronizes the registry with the provided list of provider schemas and a decrypter function to obtain credentials. It returns lists of updated and deleted provider names, along with any errors encountered during the sync process.

func (*Registry) Validate added in v0.4.5

func (r *Registry) Validate(ctx context.Context, provider schema.Provider, credentials schema.ProviderCredentials) error

Validate checks the connectivity of a provider with a ping

Jump to

Keyboard shortcuts

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