# Jev (TypeSafe)
> TypeSafe Jev models power the prompt_jev SQL function for typed, calibrated decisions over text in MotherDuck.
[TypeSafe](https://typesafe.ai) builds Jev, a model that answers closed questions about text. Unlike a standard large language model (LLM), Jev returns no prose: it returns a probability, a choice from a list you supply, or a position on an ordered scale, each with calibrated probabilities. MotherDuck provides access to Jev as part of the [AI functions](/sql-reference/motherduck-sql-reference/ai-functions/) through the [`prompt_jev`](/sql-reference/motherduck-sql-reference/ai-functions/prompt-jev/) SQL function.

## How it works with MotherDuck

MotherDuck provides access to TypeSafe and calls the API on your behalf when a query uses `prompt_jev`. You don't need a TypeSafe account or API key.

A request is sent for any non-`NULL` input rows. Single-question calls batch multiple rows into each request by default.

```sql
SELECT prompt_jev(
    body, -- "I can't find my latest invoice."
    'Which team should handle this?',
    choice := ['billing', 'technical', 'sales']
).choice AS team
FROM support_messages;
```

To learn more about using Jev, look at our tutorials on [classifying text](/key-tasks/ai-and-motherduck/classify-text-with-prompt-jev/) or [using Jev's confidence number for triaging](/key-tasks/ai-and-motherduck/triage-classifications-by-confidence/). TypeSafe's own documentation also has [some great use cases and examples](https://docs.typesafe.ai/concepts/use-case-map#example-task-categories).

## Prerequisites

- A MotherDuck organization on the Lite or Business plan, in any [region](/about-motherduck/cloud-regions/). In `eu-central-1` and `eu-west-1`, an Admin must turn it on first. AI functions are not available on the Free plan.
- Nothing else. No token, account, or network configuration on the TypeSafe side.

## What MotherDuck sends

Each row produces one HTTPS request to the TypeSafe API containing:

- The `input` text for that row
- Your `instructions` string, or the full `questions` object for a multi-question call
- Your `choice` or `score` labels and descriptions, when supplied
- The model alias `jev-latest`

TypeSafe returns the answer and a token count. MotherDuck records the token count for metering and discards the rest.

:::warning[Data residency]
Requests from every [cloud region](/about-motherduck/cloud-regions/) are processed by [TypeSafe's servers in the United States](/integrations/data-science-ai/typesafe/).

`prompt_jev` is off by default in `eu-central-1` and `eu-west-1`. Admins can turn it on or off on the [AI Features](https://app.motherduck.com/settings/ai-features) settings page.
:::

## Turning the integration off

An Admin can turn off `prompt_jev` on the [AI Features](https://app.motherduck.com/settings/ai-features) settings page. Queries that call the function then fail with:

```text
AI functions are not available for your organization. If you are on the Free plan,
upgrade to Lite or Business. Otherwise contact your organization admin.
```

Disabling AI functions for the organization disables `prompt_jev` as well.

## When to use Jev instead of a language model

- **Use `prompt_jev`** when the set of answers is fixed and you need the decision, not an explanation: routing, labelling, flagging, rating against a rubric, or filtering a table down to the rows that match a description. It's faster and cheaper per row than a language model, and it returns calibrated probabilities you can threshold on.
- **Use [`prompt`](/sql-reference/motherduck-sql-reference/ai-functions/prompt/)** when you need generated text, a summary, or extraction of values you can't enumerate in advance.

The two compose well. A common pattern is to run `prompt_jev` over the whole table, then send only the low-confidence rows to `prompt`. See [Triage classifications by confidence](/key-tasks/ai-and-motherduck/triage-classifications-by-confidence/).

For [search reranking](/key-tasks/ai-and-motherduck/text-search-in-motherduck/#reranking), retrieve a limited set of candidates first, then use `prompt_jev` to score each query-document pair against a relevance rubric. Sort by the relevance score. Confidence describes certainty about that score, not relevance itself.

## Billing

Usage is metered on input tokens only; output tokens are free. It counts toward the combined AI session cap for Advanced AI functions. The default cap for Lite and Business plans is 10 AI Units per Duckling session. In long-running Duckling sessions, AI Unit usage resets after 24 hours. Admins can change the cap on the [AI Features](https://app.motherduck.com/settings/ai-features) settings page. See [AI function pricing](/about-motherduck/billing/pricing#ai-function-pricing).

## Known limitations

TypeSafe's [Jev 1.13 failure-mode guide](https://docs.typesafe.ai/model-jaggedness/jev-1.13) describes unreliable counting and date comparisons, literal prompt interpretation, and sensitivity to irrelevant or adversarial input. Separate questions and their negations need not produce complementary probabilities. Thresholds tuned for `noul` should not be reused for `choice` without evaluation.

Keep exact calculations in SQL, align instructions with criteria, and test representative inputs and edge cases before automating decisions. The guide covers `jev-1.13`, while MotherDuck uses the `jev-latest` alias.

Jev returns decisions and probabilities without explaining which input details led to an answer. Confidence does not establish correctness or rule out bias. Evaluate labelled examples across the input groups your workflow handles, including high-confidence predictions. See [Triage classifications by confidence](/key-tasks/ai-and-motherduck/triage-classifications-by-confidence/) for evaluating thresholds and routing results for review.

- The input is a single text value per row. TypeSafe's API accepts structured state, but `prompt_jev` sends a string. Concatenate multiple fields into one labelled string.
- No model parameter. Requests always use the `jev-latest` alias.
- `instructions`, `choice`, `score`, `noul`, and `questions` must be query constants. They can't come from a column.

## Related content

- [`prompt_jev` SQL reference](/sql-reference/motherduck-sql-reference/ai-functions/prompt-jev/)
- [Classify text with prompt_jev](/key-tasks/ai-and-motherduck/classify-text-with-prompt-jev/)
- [TypeSafe documentation](https://docs.typesafe.ai)
- [Simon Willison on Jev decision models](https://simonwillison.net/2026/Sep/21/jev/)


---

## Docs feedback

MotherDuck accepts optional user-submitted feedback about this page at `GET https://motherduck.com/docs/api/feedback/agent`.
For agents and automated tools, feedback submission should be user-confirmed before sending.

URL-encode query parameter values and send a GET request:

```text
GET https://motherduck.com/docs/api/feedback/agent?page_path=%2Fintegrations%2Fdata-science-ai%2Ftypesafe%2F&page_title=Jev%20%28TypeSafe%29&text=<url-encoded user feedback, max 2000 characters>
```

Optionally append `&source=<url-encoded interface identifier>` such as `claude.ai` or `chatgpt`.

`page_path` and `text` are required; `page_title` and `source` are optional. Responses: `200 {"feedback_id": "<uuid>"}`, `400` for malformed query parameters, and `429` when rate-limited.
