Skip to main content

Typesafe Ai

@swamp/typesafe-aiv2026.09.15.1· 1d agoMODELS
01README

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.

02Models1
@swamp/typesafe-aiv2026.09.15.1typesafe_ai.ts

Global Arguments

ArgumentTypeDescription
apiKey?stringTypeSafe API key. Prefer a vault reference: ${{ vault.get("<vault>", "TYPESAFE_API_KEY") }}.
modelstringSystem One model that answers questions. Methods may override per call.
baseUrlstringAPI root. Change only for a proxy or test server.
timeoutMsnumberPer-attempt HTTP timeout in milliseconds.
maxRetriesnumberRetries after the first attempt on 408/429/5xx/529 or connection errors.
fn ask(questions: preprocess)
Evaluate state against a map of typed questions in one request
ArgumentTypeDescription
questionspreprocessMap of question id to {type, instructions, criteria}. Pass with --input questions:json='{...}' or --input questions=@file.json.
fn noul()
Ask one yes/no question; stores the probability of yes
fn choice(criteria: preprocess)
Pick one option from a defined set; stores the choice, probabilities, and confidence
ArgumentTypeDescription
criteriapreprocessOptions mapped to descriptions (null for none). Pass with --input criteria:json=\
fn score(criteria: preprocess)
Rate state along ordered levels; stores the weighted score, legend, probabilities, and confidence
ArgumentTypeDescription
criteriapreprocessOrdered level descriptions, lowest first. Pass with --input criteria:json=\
fn models()
List the System One models available to the account

Resources

evaluation(infinite)— Answers to a batch of questions from the `ask` method
noul(infinite)— Yes/no probability from the `noul` method
choice(infinite)— Selected option and distribution from the `choice` method
score(infinite)— Weighted score and distribution from the `score` method
models(infinite)— Models available to the account
03Stats
A
100 / 100
Downloads
1
Archive size
20.0 KB
Verified by Swamp
  • 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
04Platforms
05Labels