provider

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package provider implements LLM provider management functionality.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoHealthyProvider indicates that no healthy provider is available
	ErrNoHealthyProvider = errors.New("no healthy provider available")
)

Functions

This section is empty.

Types

type HealthStatus

type HealthStatus struct {
	Healthy          bool
	LastCheck        time.Time
	ConsecutiveFails int
	Latency          time.Duration
	ErrorCount       int64
	RequestCount     int64
}

HealthStatus represents the current health state of a provider

type Manager

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

Manager handles LLM provider management, including: - Health monitoring - Failover handling - Provider configuration

func NewManager

func NewManager(cfg *config.Config, logger *zap.Logger) (*Manager, error)

NewManager creates a new provider manager instance

func NewManagerWithProviders

func NewManagerWithProviders(cfg *config.Config, logger *zap.Logger, providers map[string]gollm.LLM) *Manager

NewManagerWithProviders creates a manager with pre-configured providers (for testing)

func (*Manager) GetHealthyProvider

func (m *Manager) GetHealthyProvider() (gollm.LLM, error)

GetHealthyProvider returns a healthy provider, implementing failover if needed

func (*Manager) StartHealthChecks

func (m *Manager) StartHealthChecks(ctx context.Context)

StartHealthChecks begins monitoring all providers

Jump to

Keyboard shortcuts

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