router

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 8 Imported by: 1 module, 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

This section is empty.

Functions

This section is empty.

Types

type Combo

type Combo struct {
	Name     string
	Strategy string // "failover", "round_robin"
	Targets  []Target
	// contains filtered or unexported fields
}

type Router

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

func NewRouter

func NewRouter() *Router

func (*Router) Execute

func (r *Router) Execute(ctx context.Context, req *providers.ChatRequest) (io.ReadCloser, bool, int, error)

Execute routes the request, executing automatic failover or load balancing

func (*Router) ExecuteEmbeddings added in v0.2.0

func (r *Router) ExecuteEmbeddings(ctx context.Context, req *providers.EmbeddingRequest) (*providers.EmbeddingResponse, error)

func (*Router) ListModels

func (r *Router) ListModels(ctx context.Context) ([]providers.ModelInfo, error)

func (*Router) RegisterCombo

func (r *Router) RegisterCombo(name, strategy string, targets []Target)

func (*Router) RegisterProvider

func (r *Router) RegisterProvider(p providers.Provider)

type Target

type Target struct {
	ProviderID string
	Model      string
}

Jump to

Keyboard shortcuts

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