Skip to content

ruby_llm-providers-typesafe

RubyLLM provider gem for TypeSafe Jev: block-style typed evaluations with noul, choice and score, plus RubyLLM.rerank support.

Projectbeta

Overview

ruby_llm-providers-typesafe adds TypeSafe's System One models, starting with Jev, to RubyLLM. After configuring an API key, RubyLLM::Typesafe.evaluate takes a state (a string, hash or array) and a block of questions: q.noul, q.choice with described options, and q.score with ordered levels. All questions run in parallel against the same state, and questions can reference parts of the state with backticked paths. Answers expose probability and yes? for nouls, option, probabilities and confidence for choices, and a fractional score and level for scores, along with the model version and cost.

yes? compares to 0.5 by default, and the README recommends choosing thresholds from your own data, using confidence to send uncertain cases to a person, and pinning a model version once thresholds are tuned. Jev also plugs into RubyLLM.rerank: every document gets a relevance question in a single request and its score is the probability it helps answer the query; the query and documents share Jev's 32k-token state budget, so it suits reranking a shortlist. Tests use recorded VCR cassettes.

What the decision model decides

TypeQuestionAnswers
Yes / noDoes this convey urgency?—
ChoiceWhich team should handle this?billing · technical · sales
ScoreHow frustrated is the customer?Calm · Frustrated · Very angry
Yes / noDoes this document help answer the query? (rerank)(inferred)—

How it works

  1. Configure typesafe_api_key in RubyLLM
  2. Call RubyLLM::Typesafe.evaluate with a state and question block
  3. Read typed answers, confidence and cost
  4. Apply your own thresholds, or rerank a shortlist with RubyLLM.rerank

Strengths

  • Idiomatic Ruby DSL for typed questions
  • Reranking within RubyLLM's existing API
  • Cost and model version on each evaluation

Caveats

  • Rerank limited by the 32k-token state budget
  • Default 0.5 threshold should be tuned

Getting started

gem 'ruby_llm-providers-typesafe', set config.typesafe_api_key, then RubyLLM::Typesafe.evaluate(state) { |q| q.noul :urgent, "..." }.

At a glance

Type
Project
Status
beta
Language
Ruby
Runtime
RubyLLM provider gem
Has code
yes
Has tests
yes

Use cases and integrations

How curated lists describe it

  • TypeSafe System One models (Jev) for RubyLLM: typed judgments, evaluations and reranking.

    hellogumbo/awesome-jev

Frequently asked questions

What can I ask Jev with this gem?

Yes/no, choice and score questions about any state, plus relevance for reranking.

How should I set thresholds?

The README advises choosing them from your own data and pinning the model version afterwards.

Can it rerank a whole corpus?

No; the query and documents share a 32k-token budget, so rerank a shortlist.

Related projects

  • 248 small installable TypeScript recipes that each make one typed Jev decision: route, rerank, gate, grade, compare or label.

    LibraryproductionTypeScript
  • Java SDK for TypeSafe's System One API plus Spring AI integrations using Jev as judge, guardrail, RAG filter/reranker and tool index.

    LibrarybetaJava
  • Ax, a DSPy-style multi-language LLM framework, listed with a native TypeSafe provider for Boolean, Choice, Score and raw Jev questions.

    PluginproductionTypeScript
  • Effect TypeScript library whose @effect/ai-typesafe package maps classify, probability and rating operations to Jev questions.

    ProjectproductionTypeScript
  • PHP monorepo whose Polyglot module adds a TypeSafe driver for typed Noul, Choice and Score decisions alongside LLM inference.

    ProjectproductionPHP
  • Elixir library for unified LLM calls across providers, with an evaluate interface that calls Jev via TypeSafe or OpenRouter.

    ProjectproductionElixir