Skip to main content

Module provider

Module provider 

Source
Expand description

Provider layer. The Brain trait and the model adapters (Anthropic, OpenAI-compatible, Ollama, Responses) live in the sparrow-providers crate so the heavy adapter code compiles once and is cached — touching the engine no longer recompiles them. Re-exported here so existing crate::provider::* imports keep working unchanged.

detect (first-run provider detection) stays in the binary crate because it depends on the config provider registry and the onboarding wizard.

Modules§

anthropic
detect
Provider auto-detection: scan environment for API keys, test connectivity with lightweight API calls, rank providers by cost tier (free > paid), and return a list of ready-to-use providers.
discovery
ollama
openai_compat
responses
sse_buffer
Reassemble newline-delimited frames across arbitrary network chunks.
tool_markup
Fallback parser for tool calls emitted as inline markup instead of the provider’s native function-calling JSON.

Structs§

BrainRequest
ModelCaps
Msg
PromptCacheConfig
ToolSpec

Enums§

BrainError
BrainEvent
ContentBlock
ImageSource
LatencyClass
PromptCacheTtl

Traits§

Brain
Uniform interface over every model vendor. Normalizes messages, streaming, and tool-calling so the rest of the system is vendor-agnostic.

Type Aliases§

BrainStream