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 ¶
- type Adapter
- func (a *Adapter) Complete(ctx context.Context, creds []*models.Credential, ...) (*models.ChatCompletionResponse, error)
- func (a *Adapter) CompleteStream(ctx context.Context, creds []*models.Credential, ...) error
- func (a *Adapter) GetModelInfos(ctx context.Context, cred *models.Credential, _ map[string]any) ([]models.ModelInfo, error)
- func (a *Adapter) NeedsRefresh(cred *models.Credential) bool
- func (a *Adapter) RefreshCredential(ctx context.Context, cred *models.Credential) (map[string]any, error)
- func (a *Adapter) SubmitVideo(ctx context.Context, _ []*models.Credential, ...) (*models.VideoGenerationResponse, error)
- func (a *Adapter) TypeKey() string
- func (a *Adapter) ValidateCredentials(data map[string]any) error
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
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 (a *Adapter) Complete( ctx context.Context, creds []*models.Credential, req *models.ChatCompletionRequest, _ map[string]any, ) (*models.ChatCompletionResponse, error)
func (*Adapter) CompleteStream ¶
func (*Adapter) GetModelInfos ¶
func (*Adapter) NeedsRefresh ¶
func (a *Adapter) NeedsRefresh(cred *models.Credential) bool
func (*Adapter) RefreshCredential ¶
func (*Adapter) SubmitVideo ¶ added in v0.3.8
func (a *Adapter) SubmitVideo( ctx context.Context, _ []*models.Credential, req *models.VideoGenerationRequest, _ map[string]any, ) (*models.VideoGenerationResponse, error)
SubmitVideo fans one video generation submit out over the member queue (healthy members first, exhausted members last). The first success wins and its router-side job row (keyed by the winning member model) is returned as-is: later polls authorize against that member model and route to it directly. Otherwise the last error is returned as-is.