Expand description
Wire contract of the classifier/v1 role.
A classifier module takes a batch of items and a set of questions, calls
one hosted classifier model for each item, and returns the provider’s
answers untouched. It claims the role by listing PROVIDES in its
manifest’s capabilities.provides and answers every op in
REQUIRED_OPS.
CONTRACT.md, next to this crate’s Cargo.toml, is the role document:
it marks every rule pinned, and says where each provider shape comes
from. The types here are the wire shapes it describes:
describe: therole.describeanswer;question: the providers’ shared question shape, used both in aclassify.runrequest and in the provider request it is forwarded in;request: theclassify.runrequest and its validators;reply: theclassify.runreply and the provider’s answer objects;provider: the provider-side request and response;identity: the batch body identity that decides replay versusbatch_id_reuse;errors: admission refusal codes, per-item error codes and classes;vectors(with thetest-vectorsfeature): the role’s vector files, compiled in, so a module’s tests can use the same bytes.
Maps whose key order is part of what a provider documents (questions,
choice options, probabilities) are IndexMaps, so a decoded and
re-encoded object keeps its order. Every enumeration a consumer decodes
(question type, error class) decodes open: an unknown value is kept as a
string rather than refused. Decoding is not validating: the request
validators still refuse an unknown question type, which a runner can
neither check nor map.
Modules§
- describe
role.describe: the module’s limits and every model it serves.- errors
- Error codes, their classes, and the two error shapes of
classify.run. - identity
- The batch body identity: what decides whether a re-sent
batch_idis a replay orbatch_id_reuse. - ops
- Names of the ops a classifier module serves.
- provider
- The provider side: what a runner sends each provider for one item, and
what the provider answers. Both starting providers share one shape
(Cloudflare calls clef “fully Jev-API compatible”);
CONTRACT.mdcites the documentation each shape comes from. - question
- The providers’ shared question shape, and the images an item may carry.
- reply
classify.runreplies and the provider’s answer objects.- request
classify.runrequests and their validators.
Structs§
- Index
Map - A hash table where the iteration order of the key-value pairs is independent of the hash values of the keys.
Constants§
- PROVIDES
- The capability identifier a classifier module lists in its manifest’s
capabilities.provides, and therolemember of itsrole.describeanswer. - REQUIRED_
OPS - Ops every
classifier/v1module serves. - ROLE
- The role name.
- VERSION
- The only major this crate defines.