jevalyn
A Rails-native decision layer: typed answers inside control flow.
Raymond Hughes’s gem wraps the TypeSafe API the way a Rails app expects. A calibrated decision becomes an ordinary branch in the code.
**Fast, cheap, structured decisions baked into your Rails app's control flow.**
[](https://rubygems.org/gems/jevalyn)
[](https://rubygems.org/gems/jevalyn)
[](https://github.com/Ray-Hughes/jevalyn/actions/workflows/ci.yml)
[](https://www.ruby-lang.org)
[](https://rubyonrails.org)
[](https://docs.typesafe.ai)
[](LICENSE.txt)
[Install](#install) · [Decisions](#decisions) · [Guardrails](#guardrails) · [Router](#router) · [Testing](#testing)
</div>
---
```ruby
class SupportTriage < Jevalyn::Decision
question :department, type: :choice,
instructions: "Which team should handle this?",
criteria: {
billing: "Payments, invoicing, refunds",
technical: "Bugs, outages, integrations",
sales: "Pricing, upgrades, new accounts"
}
confidence_threshold 0.75
end
result = SupportTriage.evaluate(ticket.body)
result.department # => :technical
result.certain? # => true
```
**Jevalyn is the decision layer for your Rails app**, built on
[Jev](https://docs.typesafe.ai). That is a routing decision made by a model, inside a
Rails request, in about as long as a database query. Not a prompt, not a parsed JSON
blob, not a retry loop around something that might return prose this time.
## What this is, and what it is not
Jevalyn wraps [TypeSafe's Jev](https://docs.typesafe.ai), a **System One** model. You
give it a `state` and a set of typed questions; it gives back typed, calibrated
answers. There are exactly three kinds of question:
| Type | Ask it | Get back |
| --- | --- | --- |
| `noul` | a yes/no question | the probability the answer is yes, `0.0`–`1.0` |
| `choice` | pick one of up to 255 options you define | the winner, the full distribution, a confidence |
| `score` | rate against 2–10 ordered levels you define | a weighted score, the d