Skip to main content

Crate ailoop_core

Crate ailoop_core 

Source
Expand description

Foundation crate for the ailoop workspace: shared vocabulary used by the ailoop façade and by every adapter / middleware crate.

Most application code does not depend on ailoop-core directly — it depends on ailoop, which re-exports the types you need to build a Conversation and write a ChatMiddleware. Reach for ailoop-core when:

  • implementing a new CompletionModel / CompletionClient adapter for a provider HTTP API;
  • writing a generic middleware that should be reusable across façades, examples, or test harnesses;
  • building reliability or observability infrastructure on top of the shared event vocabulary.

§Layout

Re-exports§

pub use config::RunConfig;
pub use ids::RunId;
pub use ids::StepId;
pub use message::AssistantBlock;
pub use message::CacheControl;
pub use message::Message;
pub use message::Source;
pub use message::SystemBlock;
pub use message::SystemPrompt;
pub use message::ToolResultBlock;
pub use message::ToolResultContent;
pub use message::UserBlock;
pub use middleware::ChatMiddleware;
pub use middleware::HookAction;
pub use middleware::ToolDecision;
pub use request::ChatRequest;
pub use request::ToolChoice;
pub use request::ToolDefinition;
pub use request::ToolTag;
pub use retry::RetryClassification;
pub use retry::RetryConfig;
pub use retry::Retryable;
pub use retry::RetryingModel;
pub use stream::FinishReason;
pub use stream::StreamChunk;
pub use stream::Usage;

Modules§

config
Per-run configuration: see RunConfig.
ids
Run and step identifiers used by the engine to correlate crate::StreamChunks and crate::ChatMiddleware hooks.
message
Conversation message model: Message, its block enums, and the SystemPrompt / CacheControl support types.
middleware
ChatMiddleware extension point and its decision enums (HookAction, ToolDecision).
request
Per-turn request shape: ChatRequest plus ToolChoice, ToolDefinition, and ToolTag.
retry
Reliability decorator: RetryingModel wraps any CompletionModel and retries setup-time failures with exponential backoff that honours Retry-After hints surfaced by the adapter.
stream
Engine event vocabulary: StreamChunk, FinishReason, and Usage.

Structs§

CancellationToken
A token which can be used to signal a cancellation request to one or more tasks.
CharTokenizer
Fallback Tokenizer that approximates tokens as text.len() / 4.

Traits§

CompletionClient
Factory for CompletionModel handles bound to a provider account / endpoint.
CompletionModel
Provider-agnostic streaming completion contract.
Tokenizer
Counts tokens in text and full messages.