Expand description
LLM provider abstractions for OpenAI, Anthropic, and other backends.
Defines request/response structs, stream helpers,
and the canonical Provider trait shared across LLM provider implementations.
Re-exports§
pub use lifecycle::Lifecycle;pub use provider::LlmRequestResponse;pub use provider::LlmStream;pub use provider::Provider;pub use registry::Factory;pub use registry::Registry;pub use registry::default_registry;pub use types::CompletionRequest;pub use types::CompletionResponse;pub use types::ToolChoice;pub use types::ToolDefinition;
Modules§
- lifecycle
- Component lifecycle mixin for LLM providers (D12). Component lifecycle support for LLM providers.
- provider
- Provider trait with streaming, capabilities, and token counting. Provider trait — the canonical abstraction over LLM backends.
- registry
- Explicit LLM provider registry. Explicit LLM provider registry.
- stream_
events - Streaming event types emitted during completion. Streaming event types for LLM provider responses.
- types
- LLM request/response types and helper constructors.
Structs§
- Assistant
Message - An assistant message.
- Budget
- Budget vocabulary shared by agent/tool/LLM orchestration.
- Capabilities
- Model capability declaration.
- Cost
- Cost breakdown for an AI operation.
- Error
Event - Terminal stream error.
- Message
Start - Signals the start of a new message.
- Message
Stop - Message has stopped.
- Model
- Canonical model identity.
- Money
- Decimal money amount represented in millionths of the currency unit.
- Reasoning
Delta - Incremental reasoning delta.
- System
Message - A system instruction message.
- Text
Delta - Incremental text delta.
- Tool
Result Block - Tool-result block shape shared across LLM/tool/MCP boundaries.
- Tool
Result Message - A tool execution result message.
- Tool
UseBlock - Tool-use block shape shared across LLM/tool/MCP boundaries.
- Tool
UseDelta - Incremental tool-use input delta.
- Tool
UseStart - Tool-use block has started.
- Tool
UseStop - Tool-use block has stopped.
- Usage
- Token usage counters.
- Usage
Delta - Token usage delta/update.
- User
Message - A user message.
Enums§
- Budget
Exceeded Reason - Reason a budget was exceeded.
- Content
Part - A single content part in a multimodal message.
- Finish
Reason - Canonical finish reason for GenAI responses.
- GenAi
Error - Typed AI error sentinels.
- Message
- A chat message discriminated by role.
Traits§
- Stream
Event - Incremental event emitted during an AI stream.
Functions§
- assistant
- Create an assistant message with text content.
- system
- Create a system message.
- text_
content - Wrap text in a single text content block.
- text_of
- Extract concatenated text from content blocks.
- tool_
result_ msg - Create a tool-result message.
- user
- Create a user message with text content.
Type Aliases§
- Stream
Event Ref - Shared stream event reference used across async boundaries.