providers

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package providers implements the Reviewer interface for each supported LLM provider.

Supported providers: Anthropic (Claude), OpenAI (GPT), Google (Gemini), and Ollama / LMStudio for local models.

All providers share a common retry helper with exponential back-off and rate-limit handling. HTTP clients are injected via a transport field so that tests can redirect calls to local httptest servers without making live API requests.

Use New to obtain a Reviewer by provider name and model string.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultMaxConcurrency added in v0.6.0

func DefaultMaxConcurrency(name string) int

DefaultMaxConcurrency returns the default number of concurrent LLM calls for a named provider. Local providers can handle more concurrency since they are not subject to network rate limits.

func DefaultRPM added in v0.6.0

func DefaultRPM(name string) int

DefaultRPM returns the conservative default requests-per-minute rate limit for a named provider. Returns 0 (unlimited) for local providers.

func IsAuthError

func IsAuthError(err error) bool

IsAuthError checks if an error is an authentication error.

Types

type Anthropic

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

Anthropic implements the Reviewer interface for Anthropic's API.

func NewAnthropic

func NewAnthropic(model string) (*Anthropic, error)

NewAnthropic creates a new Anthropic provider.

func (*Anthropic) Name

func (a *Anthropic) Name() string

func (*Anthropic) Review

func (a *Anthropic) Review(ctx context.Context, req ReviewRequest) (ReviewResponse, error)

type Gemini

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

Gemini implements the Reviewer interface for Google's Gemini API.

func NewGemini

func NewGemini(model string) (*Gemini, error)

NewGemini creates a new Gemini provider.

func (*Gemini) Name

func (g *Gemini) Name() string

func (*Gemini) Review

func (g *Gemini) Review(ctx context.Context, req ReviewRequest) (ReviewResponse, error)

type Ollama

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

Ollama implements the Reviewer interface for Ollama and LM Studio (OpenAI-compatible API).

func NewOllama

func NewOllama(model string) (*Ollama, error)

NewOllama creates a new Ollama provider. No API key is required by default.

func (*Ollama) Name

func (o *Ollama) Name() string

func (*Ollama) Review

func (o *Ollama) Review(ctx context.Context, req ReviewRequest) (ReviewResponse, error)

type OpenAI

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

OpenAI implements the Reviewer interface for OpenAI's API.

func NewOpenAI

func NewOpenAI(model string) (*OpenAI, error)

NewOpenAI creates a new OpenAI provider.

func (*OpenAI) Name

func (o *OpenAI) Name() string

func (*OpenAI) Review

func (o *OpenAI) Review(ctx context.Context, req ReviewRequest) (ReviewResponse, error)

type ReviewRequest

type ReviewRequest struct {
	SystemPrompt string
	UserPrompt   string
	MaxTokens    int
	Temperature  float64
}

ReviewRequest contains the data sent to an LLM for review.

type ReviewResponse

type ReviewResponse struct {
	Content    string
	TokensUsed int
	// Provider identifies the LLM vendor that produced this response
	// (e.g. "anthropic", "openai", "gemini", "ollama").
	Provider string
	// Model identifies the concrete model used (e.g. "claude-opus-4-5").
	Model string
}

ReviewResponse contains the raw response from an LLM.

type Reviewer

type Reviewer interface {
	Review(ctx context.Context, req ReviewRequest) (ReviewResponse, error)
	Name() string
}

Reviewer is the provider abstraction interface.

func New

func New(provider, model string) (Reviewer, error)

New creates a provider by name.

Jump to

Keyboard shortcuts

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