Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUnknownProvider = errors.New("provider: unknown provider") ErrRateLimit = errors.New("provider: rate limit exceeded") ErrContextTooLong = errors.New("provider: input exceeds model context window") ErrModelNotSupported = errors.New("provider: model not supported by this provider") ErrTimeout = errors.New("provider: request timed out") )
Functions ¶
Types ¶
type Pricing ¶
type Provider ¶
type Provider interface {
Name() string
DefaultModel() string
ContextWindow(model string) int
EstimateTokens(text string) int
Pricing(model string) Pricing
Review(ctx context.Context, req Request) (Response, error)
ReviewStream(ctx context.Context, req Request) (<-chan Event, error)
TestConnection(ctx context.Context) error
}
type Request ¶
type Request struct {
Model string
SystemPrompt string
UserPrompt string
Lang string
MaxTokens int
// ProviderOpts is an escape hatch (ADR-0001 risk #1) for features that
// don't fit the common interface, e.g. Anthropic prompt caching or
// OpenAI logprobs. Providers cast to their expected type; unknown values
// are ignored.
ProviderOpts any
}
Click to show internal directories.
Click to hide internal directories.