Expand description
LLM provider abstraction.
A provider takes a transcript plus tool specs and returns either
free-form content, structured tool calls, or both. The ChatProvider
trait is the only thing the agent depends on; everything beyond it
(HTTP, retries, mocking) lives in adapters.
§Sub-modules
Re-exports§
pub use chat::estimate_tokens;pub use chat::Completion;pub use chat::ContextBreakdown;pub use chat::StreamChunk;pub use chat::StreamSender;pub use chat::StructuredRequest;pub use chat::TokenUsage;pub use chat::ToolCall;pub use chat::ToolSpec;pub use pricing::context_window_tokens_for_model;pub use pricing::context_window_tokens_for_model_effective;pub use pricing::default_compact_threshold_chars;pub use pricing::default_compact_threshold_tokens;pub use pricing::pricing_for;pub use pricing::ModelPricing;pub use pricing::RetryPolicy;pub use anthropic::AnthropicProvider;pub use openai::OpenAiProvider;
Modules§
- anthropic
- Anthropic Messages API adapter.
- chat
- Chat completion data types.
- mock
- Deterministic LLM for tests and offline development.
- openai
- OpenAI-compatible chat-completions adapter.
- pricing
- LLM pricing and retry policy.
- search
- Tool search engine: keyword-based discovery of deferred tools.
Constants§
- DEFAULT_
MAX_ TOKENS - Default per-response output token cap used when neither the
RECURSIVE_MAX_TOKENSenv var, the active provider preset’sModelSpec.max_tokens, nor the config-fileagent.max_tokensis set.
Traits§
- Chat
Provider - Core trait for LLM chat-completion providers.