Expand description
classify.run requests and their validators.
A runner validates a request completely before it records anything or
calls a provider: parse_request decodes the request text naming the
first malformed field, check_request_bytes checks its size,
check_catalog_row the model’s catalog row, and check_request
every limit the model’s role.describe entry states. Each refusal
carries its code and detail.field.
Structs§
- Classify
Request - The
classify.runrequest. - Item
- One item:
{state, images?}.
Constants§
- BATCH_
ID_ MAX_ LEN - Longest
batch_id, in bytes. - CLASSIFIER_
KIND - The catalog
kindof a classifier model.
Functions§
- check_
catalog_ row - Check the model’s catalog row:
Nonewhen the model is not in the catalog (model_unknown), else itskind, which must beCLASSIFIER_KIND(model_not_classifier). The model is never substituted. - check_
request - Check every limit of
requestagainst the model’srole.describeentry: the batch id, question count and each question, item count, each item’s state and images, andmax_cost_usd. Returns the first refusal. - check_
request_ bytes - Check the request body’s size against the module’s limit. The refusal
names
paramsand the limit: the size belongs to the request as a whole, so no narrower path applies. - effective_
ceiling - The ceiling a call works under, and the batch’s recorded ceiling from
then on: the lower of the ceiling recorded so far and the one this call
carries.
Nonewhen neither names one. - is_
batch_ id - Whether
batch_idis 1 toBATCH_ID_MAX_LENprintable ASCII characters (space through tilde). - is_
state - Whether
stateis a kind the role forwards: a string, an object or an array. - parse_
request - Decode a
classify.runrequest from its JSON text, refusing a malformed oneinvalid_paramsnaming the first malformed field. Decoding from the text keeps the order of the questions and of each choice’s options.