virtual

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package virtual implements the virtual-model provider backend: a virtual model routes each request to its models in list order (fall-through) and fails only when every model failed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

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

Adapter implements the provider.GoAdapter interface for virtual models.

func New added in v0.1.2

func New(completer provider.Completer, virtualSvc *virtual.Service, logger *slog.Logger) *Adapter

New constructs an Adapter with all dependencies. The router dependency enters as the narrow provider.Completer port, so construction order is explicit and no setter injection is needed.

func (*Adapter) Complete

func (*Adapter) CompleteStream

func (a *Adapter) CompleteStream(
	ctx context.Context,
	creds []*models.Credential,
	req *models.ChatCompletionRequest,
	w io.Writer,
	_ map[string]any,
) error

func (*Adapter) GetModelInfos

func (a *Adapter) GetModelInfos(ctx context.Context, cred *models.Credential, _ map[string]any) ([]models.ModelInfo, error)

func (*Adapter) NeedsRefresh

func (a *Adapter) NeedsRefresh(cred *models.Credential) bool

func (*Adapter) RefreshCredential

func (a *Adapter) RefreshCredential(ctx context.Context, cred *models.Credential) (map[string]any, error)

func (*Adapter) TypeKey

func (a *Adapter) TypeKey() string

func (*Adapter) ValidateCredentials

func (a *Adapter) ValidateCredentials(data map[string]any) error

Jump to

Keyboard shortcuts

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