Skip to main content

Module identity

Module identity 

Source
Expand description

The batch body identity: what decides whether a re-sent batch_id is a replay or batch_id_reuse.

The identity is the model, the questions, and each item, the questions and every item hashed as RFC 8785 (JCS) canonical JSON. Canonicalizing first means the key order of an object state, whitespace, and number spellings JSON treats as equal (1.0 and 1, 1e30 and 1E+30) can’t turn a retry into a reuse. max_cost_usd is not part of it: a re-send may carry another ceiling (see effective_ceiling).

Structs§

BatchIdentity
A batch’s body identity, as a runner records it at first admission.
IdentityError
Why an identity could not be computed: the request holds a value JCS cannot encode.

Functions§

canonical_json
The RFC 8785 (JCS) canonical JSON bytes of value.
digest
SHA-256 of the canonical JSON of value, as 64 lowercase hex characters.