Skip to content

Migrating to 0.17

No rewrites needed. 0.17 is additive: one new capability tag in @effect-uai/core and one new package, @effect-uai/typesafe-ai. Bump your dependencies, run typecheck, done.

No effect bump this release; the peer range stays >=4.0.0-rc.111 <5.0.0.

If you hit a compile error that looks like a rename, you are crossing an earlier breaking release. Apply the 0.16 page and the ones before it first.

What’s new (additive, no migration needed)

Decision models

DecisionModel answers typed questions about one input with a probability distribution per question, all in one call, instead of generating text. You declare the questions once, hand over the input, and the routing rule stays in your code.

import { Schema } from "effect"
import * as Decision from "@effect-uai/core/Decision"
import { decide } from "@effect-uai/core/DecisionModel"
const triage = Decision.make({
inputSchema: Schema.Struct({ message: Schema.String }),
decisions: {
department: Decision.classify({
instructions: "Which team should handle this?",
criteria: { billing: "Payments, refunds", technical: "Bugs, outages" },
}),
severity: Decision.rate({
instructions: "How severe is the issue?",
criteria: ["Cosmetic", "Degraded", "Blocking"],
}),
refund: Decision.probability({ instructions: "Is a refund being asked for?" }),
},
})
const program = Effect.gen(function* () {
const { answers } = yield* decide(triage, { model: "jev-latest", input })
answers.department.labels.billing // number; `labels.shipping` does not compile
answers.severity.legend[Decision.topLevel(answers.severity)] // "Degraded"
answers.refund.probability // number
})
  • Three kinds. classify picks one of a set of named labels, rate places the input on an ordered rubric, probability asks how likely one statement is to hold.
  • Typed answers. Label names and rubric length come from the definition, so a typo is a compile error rather than a runtime undefined.
  • One call, one bill. Every decision in a definition is answered against one encoded input. Ask the speculative question up front; it costs tokens, not a round trip.
  • Reading helpers on Decision: winner, ranked, margin, confidence, topLevel, expectedLevel. Gate on the top probability and margin. confidence is normalised entropy and shrinks with label count, so a threshold tuned on two labels quietly escalates most four-way questions.
  • The schema is a filter. inputSchema encodes the input on the way out; a field it omits never reaches the model.

The capability is marked @experimental. This class of model is new and the shape may change in a later minor.

One provider:

Terminal window
pnpm add @effect-uai/typesafe-ai # Jev, TypeSafe AI's System One model

@effect-uai/typesafe-ai/Jev registers the typed Jev tag and the generic DecisionModel tag from one layer. The typed tag adds Jev’s own confidence per answer.

See Decision models, the provider page for TypeSafe AI, and the ticket triage recipe.