provider

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 17 Imported by: 0 modules, 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 AnthropicProvider

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

func NewAnthropicProvider

func NewAnthropicProvider(cfg config.GatewayConfig) *AnthropicProvider

func (*AnthropicProvider) Models

func (p *AnthropicProvider) Models(ctx context.Context) ([]string, error)

func (*AnthropicProvider) Name

func (p *AnthropicProvider) Name() string

func (*AnthropicProvider) Stream

func (p *AnthropicProvider) Stream(ctx context.Context, model string, history []Message, tools []ToolSpec) (<-chan StreamChunk, error)

type GatewayProxyProvider

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

func NewGatewayProxyProvider

func NewGatewayProxyProvider(name string, cfg config.GatewayConfig) *GatewayProxyProvider

func (*GatewayProxyProvider) BaseURL

func (p *GatewayProxyProvider) BaseURL() string

func (*GatewayProxyProvider) DefaultModel

func (p *GatewayProxyProvider) DefaultModel() string

func (*GatewayProxyProvider) Models

func (p *GatewayProxyProvider) Models(ctx context.Context) ([]string, error)

func (*GatewayProxyProvider) Name

func (p *GatewayProxyProvider) Name() string

func (*GatewayProxyProvider) Stream

func (p *GatewayProxyProvider) Stream(ctx context.Context, model string, history []Message, tools []ToolSpec) (<-chan StreamChunk, error)

type Message

type Message struct {
	Role       string     `json:"role"`
	Content    string     `json:"content"`
	ToolCalls  []ToolCall `json:"tool_calls,omitempty"`
	ToolCallID string     `json:"tool_call_id,omitempty"`
}

type OllamaProvider

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

func NewOllamaProvider

func NewOllamaProvider(host string) (*OllamaProvider, error)

func (*OllamaProvider) Models

func (o *OllamaProvider) Models(ctx context.Context) ([]string, error)

func (*OllamaProvider) Name

func (o *OllamaProvider) Name() string

func (*OllamaProvider) Stream

func (o *OllamaProvider) Stream(ctx context.Context, model string, history []Message, tools []ToolSpec) (<-chan StreamChunk, error)

type Provider

type Provider interface {
	Name() string
	Models(ctx context.Context) ([]string, error)
	Stream(ctx context.Context, model string, history []Message, tools []ToolSpec) (<-chan StreamChunk, error)
}

type Registry

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

func NewRegistry

func NewRegistry() *Registry

func (*Registry) Active

func (r *Registry) Active() (Provider, error)

func (*Registry) ActiveName

func (r *Registry) ActiveName() string

func (*Registry) AllModels added in v0.2.0

func (r *Registry) AllModels(ctx context.Context) map[string][]string

func (*Registry) Get added in v0.2.0

func (r *Registry) Get(name string) Provider

func (*Registry) List

func (r *Registry) List() []string

func (*Registry) Register

func (r *Registry) Register(p Provider)

func (*Registry) Switch

func (r *Registry) Switch(name string) error

type RetryTransport added in v0.4.0

type RetryTransport struct {
	Base         http.RoundTripper
	MaxRetries   int
	InitialDelay time.Duration
	MaxDelay     time.Duration
}

RetryTransport wraps an http.RoundTripper with retry logic for transient errors.

func NewRetryTransport added in v0.4.0

func NewRetryTransport(base http.RoundTripper) *RetryTransport

NewRetryTransport creates a new RetryTransport with sensible defaults.

func (*RetryTransport) RoundTrip added in v0.4.0

func (t *RetryTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip executes the HTTP request, retrying on 429, 500, 502, 503, 504.

type StreamChunk

type StreamChunk struct {
	Delta     string
	ToolCalls []ToolCall
	Done      bool
	Err       error
}

type ToolCall

type ToolCall struct {
	ID   string          `json:"id"`
	Name string          `json:"name"`
	Args json.RawMessage `json:"args"`
}

type ToolSpec

type ToolSpec struct {
	Name        string          `json:"name"`
	Description string          `json:"description"`
	Parameters  json.RawMessage `json:"parameters"`
}

Jump to

Keyboard shortcuts

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