Skip to main content

Module typesafe

Module typesafe 

Source
Expand description

Client for TypeSafe’s System One decision API (model family “Jev”).

A System One request sends one state (text, JSON, or images) plus named, typed questions; every question is evaluated in parallel and answered with a typed, calibrated result:

QuestionAnswer
Question::Choiceselected option, a probability per option, confidence
Question::Scoreexpected score over ordered levels, probabilities, confidence
Question::Noulprobability that the yes/no statement is true
Question::Boxbox edges (fractions of the image) and optional confidence

Requests go to POST {base_url}/v1/systemone with Authorization: Bearer <key>. The key is static (SystemOneConfig::api_key) or fetched per request from a CredentialSource; a 401/403 invalidates the credential and retries once.

The client validates the documented request rules before sending (at least one question, 1–255 choice options, 1–10 score levels, nesting depth, referenced assets, body size) and sets the TypeSafe-Danger-Zone-Images header whenever a request carries images or a box question.

Structs§

BoxCoordinates
Box edges as fractions of the image (top/bottom from the top, left/right from the left).
ImageAsset
An image asset, referenced by its key wherever it appears in a request string.
NoulCriteria
Criteria of a yes/no question: what counts as yes and as no.
SystemOneClient
System One API client. Register it in graphrt_core::Services as Arc<SystemOneClient>.
SystemOneConfig
Client configuration.
SystemOneRequest
A System One request.
SystemOneResponse
A System One response.
SystemOneUsage
Token usage of a request.

Enums§

Answer
A typed answer.
Question
A typed question.

Constants§

DEFAULT_BASE_URL
Default API endpoint.
DEFAULT_MODEL
Default model alias: the newest stable Jev release.
MAX_BODY_BYTES
Documented maximum request body (32 MiB).
MAX_CHOICE_OPTIONS
Documented maximum options of a choice question.
MAX_NESTING
Documented maximum nesting of state, instructions and criteria.
MAX_REFERENCES_BYTES
Documented maximum total length of all asset references, in bytes.
MAX_REFERENCE_BYTES
Documented maximum length of one asset reference, in bytes.
MAX_SCORE_LEVELS
Documented maximum levels of a score question.
PROVIDER
Registry / service name used by nodes (model.provider: typesafe).

Functions§

error_for_status
Map a documented HTTP status to an error.
normalize_format
Map a format name or media type to png / jpg.