Typesafe Ai
Ask TypeSafe's System One models (Jev) typed questions from swamp and branch workflows on the calibrated answers. Jev does not generate text: it takes application state plus typed questions and returns a probability for a yes/no question (Noul), a selected option with a full distribution (Choice), or a weighted position along an ordered rubric (Score).
Every method calls POST /v1/systemone directly with fetch (no SDK),
retries transient failures with exponential backoff that honours
Retry-After, and writes one resource per evaluation so later workflow
steps can read the answer with CEL.
Methods
| Method | What it does |
|---|---|
noul |
Ask one yes/no question; stores the probability of yes as noul. |
choice |
Pick one option from a defined set; stores choice, probabilities, confidence. |
score |
Rate state along ordered levels; stores score, legend, probabilities, confidence. |
ask |
Evaluate a map of typed questions in a single request; stores answers.<id>.*. |
models |
List the System One models available to the account. |
Each evaluation lands as <spec>-<name> (default name latest) so several
evaluations can live side by side, and every resource records model,
state, usage, and evaluatedAt.
Credentials
Supply the API key with the apiKey global argument, ideally as a vault
reference: ${{ vault.get("typesafe", "TYPESAFE_API_KEY") }}. When omitted
the model falls back to the TYPESAFE_API_KEY environment variable. The
api-key-configured pre-flight check (label policy) fails early when no
key is available.
Usage
swamp extension pull @swamp/typesafe-ai
swamp model create @swamp/typesafe-ai jev \
--global-arg 'apiKey=${{ vault.get("typesafe", "TYPESAFE_API_KEY") }}'
swamp model method run jev noul \
--input state="Help! My payouts have been failing for 3 days." \
--input instructions="Does this convey urgency?" \
--input name=urgency
# In a workflow guard:
# ${{ data.latest("jev", "noul-urgency").attributes.noul > 0.8 }}See the bundled README for the full argument reference and worked examples.
Global Arguments
| Argument | Type | Description |
|---|---|---|
| apiKey? | string | TypeSafe API key. Prefer a vault reference: ${{ vault.get("<vault>", "TYPESAFE_API_KEY") }}. |
| model | string | System One model that answers questions. Methods may override per call. |
| baseUrl | string | API root. Change only for a proxy or test server. |
| timeoutMs | number | Per-attempt HTTP timeout in milliseconds. |
| maxRetries | number | Retries after the first attempt on 408/429/5xx/529 or connection errors. |
| Argument | Type | Description |
|---|---|---|
| questions | preprocess | Map of question id to {type, instructions, criteria}. Pass with --input questions:json='{...}' or --input questions=@file.json. |
| Argument | Type | Description |
|---|---|---|
| criteria | preprocess | Options mapped to descriptions (null for none). Pass with --input criteria:json=\ |
| Argument | Type | Description |
|---|---|---|
| criteria | preprocess | Ordered level descriptions, lowest first. Pass with --input criteria:json=\ |
Resources
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types (deprecated)1/1earned
- Dependencies pass trust audit2/2earned
- Has description1/1earned
- Platform support declared (or universal)2/2earned
- License declared1/1earned
- Verified public repository2/2earned