aidale-core
Core abstractions and runtime for Aidale - Rust AI SDK.
Overview
aidale-core provides the foundational traits and runtime for the Aidale ecosystem:
- Provider Trait: Abstract interface for AI service providers
- Layer Trait: Composable middleware system (AOP pattern)
- Plugin Trait: Runtime extension hooks for business logic
- Strategy Trait: Provider-specific adaptation patterns
- RuntimeExecutor: High-level orchestration and execution engine
Core Concepts
Provider
Pure HTTP client abstraction for AI services:
Layer
Composable middleware with zero-cost abstraction:
Layers are composed at compile-time using type-level recursion for static dispatch.
Plugin
Runtime extension points for business logic:
RuntimeExecutor
High-level API combining strategies, layers, and plugins:
let executor = builder
.layer
.plugin
.finish;
let result = executor.generate_text.await?;
Usage
This crate is typically used indirectly through the main aidale crate:
[]
= "0.1"
For direct usage:
[]
= "0.1"
Features
- Zero-cost abstractions: Static dispatch via compile-time composition
- Type safety: Leverage Rust's type system for correctness
- Async-first: Built on
tokioandasync-trait - Extensible: Clear extension points via traits
Architecture
┌─────────────────────────────────────┐
│ RuntimeExecutor │ High-level API
│ - generate_text() │ + Plugin orchestration
│ - generate_object() │ + Strategy selection
└─────────────┬───────────────────────┘
│
▼
┌─────────────────────────────────────┐
│ Layers (AOP) │ Middleware stack
│ Logging → Retry → Cache │ (Static dispatch)
└─────────────┬───────────────────────┘
│
▼
┌─────────────────────────────────────┐
│ Provider │ HTTP client
│ - chat_completion() │ (No business logic)
└─────────────────────────────────────┘
Related Crates
aidale- Main meta-crateaidale-provider- Provider implementationsaidale-layer- Built-in layersaidale-plugin- Built-in plugins
License
MIT OR Apache-2.0