cortexkit_model_batch/lib.rs
1//! The batch rules every CortexKit model-batch role shares.
2//!
3//! A model-batch role (`classifier/v1`, `extractor/v1`) takes a batch of
4//! items, calls one hosted model per item, and returns the provider's
5//! answers untouched. The roles differ in what they ask the model; they
6//! share how a batch is admitted, identified, priced, failed and replayed.
7//! `RULES.md`, next to this crate's `Cargo.toml`, states each shared rule
8//! once, and each role contract points to it. The code here is those rules:
9//!
10//! - [`errors`]: the one error vocabulary, its classes, and the item error
11//! and admission refusal shapes;
12//! - [`status`]: provider status mapping, with the Cloudflare Workers AI
13//! code table;
14//! - [`identity`]: batch identity, hashed as canonical JSON with images in
15//! canonical form;
16//! - [`image`]: the item image shape, its decoding validation and its
17//! canonical form;
18//! - [`admission`]: the `batch_id` grammar, bounds, request size, the
19//! catalog row, and the spend ceiling;
20//! - [`estimate`]: the conservative cost estimate and nanodollar arithmetic;
21//! - [`absent`]: absent is not zero, for usage and cost;
22//! - [`number`]: provider number text kept as written;
23//! - `vectors` (with the `test-vectors` feature): this crate's vector files.
24
25#![forbid(unsafe_code)]
26
27pub mod absent;
28pub mod admission;
29pub mod errors;
30pub mod estimate;
31pub mod identity;
32pub mod image;
33pub mod number;
34pub mod status;
35#[cfg(any(test, feature = "test-vectors"))]
36pub mod vectors;
37
38/// The major of the shared rules this crate states; each role's `v1` uses
39/// these rules.
40pub const RULES_VERSION: &str = "v1";