router

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BackoffDelay

func BackoffDelay(attempt int, cfg RetryConfig) time.Duration

func IsTransient

func IsTransient(err error) bool

Types

type RetryConfig

type RetryConfig struct {
	MaxRetries int
	BaseDelay  time.Duration
	MaxDelay   time.Duration
	OnRetry    func(RetryEvent)
}

func DefaultRetryConfig

func DefaultRetryConfig() RetryConfig

type RetryEvent

type RetryEvent struct {
	Err        error
	Attempt    int
	MaxRetries int
	Delay      time.Duration
}

type RouteEntry

type RouteEntry struct {
	Provider client.Provider
	Weight   int
	Retry    *RetryConfig
}

type Router

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

func New

func New(entries []RouteEntry, fallback []client.Provider, defaultRetry *RetryConfig) *Router

func (*Router) Chat

func (r *Router) Chat(ctx context.Context, messages []client.EyrieMessage, opts client.ChatOptions) (*client.EyrieResponse, error)

func (*Router) Name

func (r *Router) Name() string

func (*Router) Ping

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

func (*Router) Stats

func (r *Router) Stats() map[string]int64

func (*Router) StreamChat

func (r *Router) StreamChat(ctx context.Context, messages []client.EyrieMessage, opts client.ChatOptions) (*client.StreamResult, error)

type ToolFilter

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

func NewToolFilter

func NewToolFilter(modelTools map[string][]string) *ToolFilter

func (*ToolFilter) FilterTools

func (f *ToolFilter) FilterTools(model string, tools []client.EyrieTool) []client.EyrieTool

Jump to

Keyboard shortcuts

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