Skip to main content

Crate cortexkit_model_batch

Crate cortexkit_model_batch 

Source
Expand description

The batch rules every CortexKit model-batch role shares.

A model-batch role (classifier/v1, extractor/v1) takes a batch of items, calls one hosted model per item, and returns the provider’s answers untouched. The roles differ in what they ask the model; they share how a batch is admitted, identified, priced, failed and replayed. RULES.md, next to this crate’s Cargo.toml, states each shared rule once, and each role contract points to it. The code here is those rules:

  • errors: the one error vocabulary, its classes, and the item error and admission refusal shapes;
  • status: provider status mapping, with the Cloudflare Workers AI code table;
  • identity: batch identity, hashed as canonical JSON with images in canonical form;
  • image: the item image shape, its decoding validation and its canonical form;
  • admission: the batch_id grammar, bounds, request size, the catalog row, and the spend ceiling;
  • estimate: the conservative cost estimate and nanodollar arithmetic;
  • absent: absent is not zero, for usage and cost;
  • number: provider number text kept as written;
  • vectors (with the test-vectors feature): this crate’s vector files.

Modules§

absent
Absent is not zero (RULES.md §10): a count or price the provider or catalog did not state stays absent, in each item and in every sum.
admission
Admission rules every model-batch role shares (RULES.md §1, §5, §8, §9): the batch_id grammar, count bounds, the request size, the catalog row, and the max_cost_usd ceiling.
errors
The error vocabulary every model-batch role shares: codes, their classes, and the two error shapes of a batch call.
estimate
The conservative cost estimate a runner checks against a batch’s max_cost_usd before each provider call, and the money arithmetic it needs (RULES.md §5).
identity
Batch identity: what decides whether a re-sent batch_id is a replay or batch_id_reuse (RULES.md §2).
image
The item image shape every model-batch role shares, its validation, and its canonical form.
number
Number text (RULES.md §12): a provider’s number reaches the reply with the provider’s own spelling.
status
Mapping a provider’s error to a per-item code, once the runner’s own retries are spent.

Constants§

RULES_VERSION
The major of the shared rules this crate states; each role’s v1 uses these rules.