Expand description
AI inference module, containing model registry, provider trait, and backends. Backend-agnostic AI inference types: registry, provider trait, cache, call log, adapters, and backends. Inference runs on a Ring 1 worker, never Ring 0.
Re-exports§
pub use adapter::parse_response;pub use adapter::AdapterError;pub use cache::content_hash;pub use cache::params_version;pub use cache::AiCacheKey;pub use cache::AiResultCache;pub use cache::AiResultCacheConfig;pub use cache::CachedOutput;pub use call_log::AiCallLog;pub use call_log::AiCallRecord;pub use call_log::CallOutcome;pub use provider::InferenceOutputs;pub use provider::InferenceParams;pub use provider::InferenceProvider;pub use provider::InferenceRequest;pub use provider::InferenceResponse;pub use provider::ProviderError;pub use provider::Usage;pub use registry::BackendKind;pub use registry::ModelBackend;pub use registry::ModelEntry;pub use registry::ModelRegistry;pub use registry::RegistryError;pub use registry::Task;pub use runtime::AiRuntime;pub use runtime::AiRuntimeError;pub use runtime::ResolvedModel;
Modules§
- adapter
- Adapt a raw provider response to a task’s per-row output. Stays Arrow-free;
the operator builds the column from the returned
InferenceOutputs. - backends
- Concrete inference backends, feature-gated so the default build has no HTTP or ML weight. Transport only: task framing lives in the adapter, not here.
- cache
- Per-row inference result cache, keyed
(content_hash, model_id, params_version). - call_
log - Bounded in-memory log of inference calls, surfaced as
laminar.ai_calls. One record per batch; written from Ring 1, never Ring 0. Oldest record is dropped when full; a monotonic counter tracks lifetime call count. - provider
InferenceProvidertrait and request/response types.- registry
- Model registry: maps SQL-referenced model names to backends and tasks. Built once at startup; AI functions resolve against it at plan time.
- runtime
- Assembled AI subsystem: registry, provider clients, result cache, and call log.
Built once at startup;
AiRuntime::resolvereturns everything the inference operator needs to run a named model.