ruby_llm-providers-typesafe
RubyLLM provider gem for TypeSafe Jev: block-style typed evaluations with noul, choice and score, plus RubyLLM.rerank support.
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
| Type | Question | Answers |
|---|---|---|
| Yes / no | Does this convey urgency? | — |
| Choice | Which team should handle this? | billing · technical · sales |
| Score | How frustrated is the customer? | Calm · Frustrated · Very angry |
| Yes / no | Does this document help answer the query? (rerank)(inferred) | — |
How it works
- Configure typesafe_api_key in RubyLLM
- Call RubyLLM::Typesafe.evaluate with a state and question block
- Read typed answers, confidence and cost
- 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.
LibraryproductionTypeScriptJava SDK for TypeSafe's System One API plus Spring AI integrations using Jev as judge, guardrail, RAG filter/reranker and tool index.
LibrarybetaJavaAx, a DSPy-style multi-language LLM framework, listed with a native TypeSafe provider for Boolean, Choice, Score and raw Jev questions.
PluginproductionTypeScriptEffect TypeScript library whose @effect/ai-typesafe package maps classify, probability and rating operations to Jev questions.
ProjectproductionTypeScriptPHP monorepo whose Polyglot module adds a TypeSafe driver for typed Noul, Choice and Score decisions alongside LLM inference.
ProjectproductionPHPElixir library for unified LLM calls across providers, with an evaluate interface that calls Jev via TypeSafe or OpenRouter.
ProjectproductionElixir