Install and configure
npm install jevlishexport TYPESAFE_API_KEY=...Node 20+. ESM only. The package ships its own type declarations.
The API key
Section titled “The API key”given, from, and grade share one Sense: the three verbs bound to one runtime. On first use, that runtime reads TYPESAFE_API_KEY and creates a Jev client. Nothing is sent until an expression runs, so importing the package and building expressions costs nothing.
Jevlish uses the TypeSafe/Jev SDK. The environment variable is therefore named TYPESAFE_API_KEY, and the default transport is TypeSafeClient.
If the key is missing when the first request goes out, the expression rejects with a SenseError that says so.
Defaults for the shared runtime
Section titled “Defaults for the shared runtime”The module-level verbs create their shared Sense lazily. Call configure before their first use only when you need to replace its defaults.
import { configure } from "jevlish";
configure({ model: "jev-1.13", // default: jev-latest policy: { noul: { yesAbove: 0.9, noBelow: 0.1 } }, // default: 0.8 / 0.2});Every field is optional:
apiKeyinstead of the environment variable. Ignored whenclientis given.model, defaulting to the SDK’sjev-latest.policy: the thresholds that turn probabilities into decisions. The defaults are Noul yes at P(yes) ≥ 0.8 and no at ≤ 0.2, Choice and Score at confidence ≥ 0.5. See Uncertainty and acceptance policy.client: your own transport, or a fake in tests. See Testing.cache,concurrency,questionsPerRequest: see Runtime.
More than one runtime
Section titled “More than one runtime”createSense(config) builds a second, independent runtime and returns given, from, and grade bound to it. Use it when two parts of an application need different models, policies, or transports, or when a test should not touch the shared state.
import { createSense } from "jevlish";
const strict = createSense({ policy: { noul: { yesAbove: 0.95, noBelow: 0.05 } } });const judgment = await strict.given(ticket).when(blocked);