Skip to main content

Crate rskit_llm

Crate rskit_llm 

Source
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§

AssistantMessage
An assistant message.
Budget
Budget vocabulary shared by agent/tool/LLM orchestration.
Capabilities
Model capability declaration.
Cost
Cost breakdown for an AI operation.
ErrorEvent
Terminal stream error.
MessageStart
Signals the start of a new message.
MessageStop
Message has stopped.
Model
Canonical model identity.
Money
Decimal money amount represented in millionths of the currency unit.
ReasoningDelta
Incremental reasoning delta.
SystemMessage
A system instruction message.
TextDelta
Incremental text delta.
ToolResultBlock
Tool-result block shape shared across LLM/tool/MCP boundaries.
ToolResultMessage
A tool execution result message.
ToolUseBlock
Tool-use block shape shared across LLM/tool/MCP boundaries.
ToolUseDelta
Incremental tool-use input delta.
ToolUseStart
Tool-use block has started.
ToolUseStop
Tool-use block has stopped.
Usage
Token usage counters.
UsageDelta
Token usage delta/update.
UserMessage
A user message.

Enums§

BudgetExceededReason
Reason a budget was exceeded.
ContentPart
A single content part in a multimodal message.
FinishReason
Canonical finish reason for GenAI responses.
GenAiError
Typed AI error sentinels.
Message
A chat message discriminated by role.

Traits§

StreamEvent
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§

StreamEventRef
Shared stream event reference used across async boundaries.