questions
TypeScript library for typed semantic decisions via Zod schemas or native batches, defaulting to Jev, with confidence-gated policies.
Overview
Questions (@nitoba/questions) lets TypeScript code ask typed questions about data and decide what happens next with ordinary async/await or Web Streams. You define decisions with Zod 4 schemas or native typed question batches; for example questions.about(ticket).is("Is production work blocked?") returns a validated boolean. Providers include TypeSafe directly (default model jev-latest), the Vercel AI Gateway evaluation route for Jev, and an optional AI SDK generative adapter for Gemini, Claude, GPT and Gateway models without rewriting questions.
Policies declare questions once and apply ordered rules to the evidence, selecting static values rather than running business handlers; thresholds refer to probability mass (for example accept 0.8, reject 0.2), and uncertainty stops selection instead of counting as false. It adds readable deadlines, explicit retries, replay and observability. The README is careful to say decisions are finite classifications, not factual guarantees or authorisation for business actions, and that generative adapters report estimated rather than calibrated confidence.
What the decision model decides
| Type | Question | Answers |
|---|---|---|
| Yes / no | Is production work blocked? | — |
| Choice | Classify the public API impact of this release | — |
How it works
- Create a Questions client with a TypeSafe, Vercel or generative provider
- Ask is/choice/score questions about an object, or declare a Policy
- Apply ordered rules with accept/reject probability thresholds
- Act on the selected value; uncertain evidence stops selection
Strengths
- Answers inferred and validated as TypeScript types
- Same questions work across Jev and generative LLM providers
- Policies separate evidence from decision rules
- Stable 0.1.0 release on npm
Caveats
- Generative adapters return estimated, not calibrated, confidence
- Requires the Zod 4 peer even for native batches
Getting started
npm install @nitoba/questions zod, set TYPESAFE_API_KEY, then Questions.create({ model: TypeSafe.create({ apiKey }) }).At a glance
- Type
- Library
- Status
- beta
- Language
- TypeScript
- Runtime
- Node / Bun / Web Streams
- Has code
- yes
- License
- MIT
Use cases and integrations
How curated lists describe it
A TypeScript decision library that asks typed questions via Zod or native batches, defaulting to TypeSafe Jev, with optional Vercel or generative adapters.
logicrw/awesome-jev-projects
Frequently asked questions
Which models can answer the questions?
Jev via TypeSafe or the Vercel AI Gateway, or generative models like Gemini, Claude and GPT through the AI SDK adapter.
How are thresholds handled?
Policies use probability-mass thresholds such as accept 0.8 and reject 0.2; uncertainty stops selection rather than counting as false.
Can a decision trigger a business action?
The README says decisions are finite classifications, not authorisation; your code decides what to do.
Related projects
Rust CLI and library that asks Jev typed questions via OpenRouter and combines the probabilities with fuzzy-logic rules into decisions.
CLIbetaRustSimon Willison's LLM plugin that adds Jev as a model for yes/no, choice and score questions from the command line.
PluginproductionPythonGo integration bringing TypeSafe Choice, Score and Noul to Google's adk-go agents, with a typed client, routing agent and callbacks.
ProjectbetaGoRuby gem for probabilistic conditionals like Feelings(msg).like?("urgent"), answered by Jev or other decision models.
ProjectbetaRubyElixir DSL (Gut.feel) that picks an Elixir value for a subject and question, with a Jev evaluation adapter among LLM options.
ProjectbetaElixirUnofficial standard-library Go client for Jev with generic typed Choice values and local confidence thresholds.
ProjectbetaGo