Skip to content

Primitives

The raw API as three tools. Everything else in the package is a specialisation of the first.

jev_ask

Ask Jev any mix of typed questions about one piece of state, in one request.

This is the raw System One call. Use it when no specialised tool fits: write the questions yourself. Three question types (docs.typesafe.ai/primitives): noul is a yes/no question that returns the probability of yes; choice picks one option from a set you define (up to 255) and returns the option, its confidence and every option's probability; score rates the state on an ordered scale of 2 to 10 levels you describe and returns a probability-weighted position with index 0 the first level. All questions are answered against the same state in parallel and cannot see each other, so ask everything at once, including speculative questions whose premise may not hold. Jev reads literally: it does not count, do arithmetic, compare dates or follow indirection, and it cannot generate text.

parameter type default description
state str | dict | list required What Jev reads. Text, or a JSON object whose field names carry meaning ({"ticket": ..., "policy": ...}). Questions can point into it with backticked paths such as ticket.messages[0].text.
questions dict | list | str required A map of your own keys to question specs. A spec is {"type": "noul", "instructions": "...", "criteria": {"true": ..., "false": ...}} (criteria optional), {"type": "choice", "instructions": "...", "criteria": {"option": "when it applies", ...}} or {"type": "score", "instructions": "...", "criteria": ["level 0", "level 1", ...]}. Instructions and criteria may be structured objects instead of strings. A plain string is a noul. A list is named q1..qN. A JSON string of either shape is accepted. Keys are not shown to the model.
context str None Optional text folded in next to the state, such as the user's request.

Returns JSON with answers (per key: noul, or choice + confidence + probabilities, or score + confidence + legend + probabilities), model (the versioned id that answered), latency_ms and input_tokens; plus a one-line summary.

Ports primitives

Measured 2026-09-29, jev-1.13.0: Jev 7/8, baseline 5/8, 8 calls, 3,519 input tokens, $0.000148, mean 179 ms. Details.

jev_models

List the model ids the Jev endpoint serves, with their aliases.

Ports GET /v1/models (docs.typesafe.ai/models). jev-latest is an alias that follows new releases; pin a versioned id such as jev-1.13.0 when thresholds were tuned against it.

Returns JSON with models (the raw rows from the endpoint) and a one-line summary.

Ports models

jev_usage

Report what the Jev calls in this process have cost so far.

The API reports input and output tokens; cost is computed at $0.042 per million input tokens (docs.typesafe.ai/models, 2026-09-29), output tokens being free.

parameter type default description
reset bool False Zero the counters after reading them.

Returns JSON with calls, questions, input_tokens, output_tokens, cost_usd, latency_ms_mean, latency_ms_total and last_model; plus a one-line summary.

Ports models

Edit page