Skip to content
System One

Advocaat

Small type-safe client for asking questions about your data, powered by Jev. Returns probabilities, choices and scores in a single request, and ships an agent skill that teaches coding agents how to design the questions.

pithings/advocaat on GitHub

Stars
91
Forks
1
Language
TypeScript
License
MIT
Last push
18 Sep 2026

Read from GitHub on . Counts change daily.

Advocaat is a small, type-safe TypeScript client for asking Jev questions about your own data, built around one function, ask, that can mix several question types in a single request and return probabilities, choices and scores together. A yes/no question comes back as a probability with ask.chance, or a plain boolean with ask.if using a 0.5 threshold by default, adjustable per call. A choice question takes 2 to 255 named options and returns the selected label alongside a confidence value and the full probability distribution across every option. A score question takes 2 to 10 ordered levels and returns an expected, possibly fractional, position on that scale along with a 0-to-1 ratio version of the same result.

The package ships an agent skill, skills/advocaat/SKILL.md, that teaches coding agents how to design questions and build with ask. It talks to TypeSafe’s API directly with the jev-latest model by default, or routes through the Vercel AI Gateway, where the model id is typesafe-ai/jev.

How it uses Jev

const baseURL = (
  options.baseURL ??
  (gateway
    ? "https://ai-gateway.vercel.sh/v4/ai"
    : (env("TYPESAFE_BASE_URL") ?? "https://api.typesafe.ai"))
).replace(/\/+$/, "");
const model =
  options.model ??
  (gateway ? "typesafe-ai/jev" : (env("TYPESAFE_DEFAULT_MODEL") ?? "jev-latest"));
const fetch = options.fetch ?? globalThis.fetch;

View in src/api.ts

Open on GitHub

More like this

Use cases this is tagged with