33 lines
1.2 KiB
Go
33 lines
1.2 KiB
Go
// Package backend defines the Backend interface and implementations for
|
|
// LLM providers.
|
|
//
|
|
// All backends implement ChatStream for streaming completions. Provider-
|
|
// specific wire formats are handled inside each implementation; the agent
|
|
// loop sees only the canonical Message and StreamEvent types.
|
|
//
|
|
// # Supported Backends
|
|
//
|
|
// - anthropic: Claude models via the Anthropic API
|
|
// - openai: GPT models via the OpenAI API
|
|
// - openrouter: Multi-model routing via OpenRouter
|
|
// - ollama: Local models via Ollama
|
|
// - gemini: Gemini models via Google AI
|
|
// - copilot: GitHub Copilot
|
|
// - kiro: Kiro API
|
|
//
|
|
// # Error Types
|
|
//
|
|
// Backends return typed errors for conditions the caller can handle:
|
|
//
|
|
// - RateLimitError: HTTP 429; includes RetryAfter hint
|
|
// - TransientError: 5xx or network errors; safe to retry
|
|
// - ContextOverflowError: request exceeds context window; compact and retry
|
|
// - ToolUnsupportedError: model doesn't support tool calling
|
|
//
|
|
// # Configuration
|
|
//
|
|
// Backend selection and credentials come from backends.conf. The file
|
|
// format is INI-style with sections per backend. Environment variables
|
|
// provide fallbacks for API keys.
|
|
package backend
|