Skip to main content
jev is a Bloom scalar function that evaluates a state against a typed question using TypeSafe’s Jev model. Use it to classify text, assess a yes/no statement, or rate text against a rubric.
Bloom’s jev integration is in beta. Its syntax and behavior may change as the integration evolves.

Setup

  1. Open Settings → Config → Environment.
  2. Under General, click + Add variable.
  3. Set the name to TYPESAFE_API_KEY and the value to your TypeSafe API key, then save it.
Bloom automatically recognizes this environment variable. The key belongs in Environment settings; it is not an argument to jev. Run the queries below on Bloom. jev is available in local and distributed Bloom execution and currently uses TypeSafe’s jev-latest model.

Syntax

Pass one question object as the second argument. Do not wrap it in the TypeSafe HTTP API’s questions map or include the full API request body. Use single quotes around SQL string literals and double quotes inside JSON. Escape an apostrophe inside a SQL string by doubling it: 'What''s new?'.

Return value

For all three question types, jev returns a JSON object encoded as a SQL string (Utf8). On success, Bloom extracts the answer at answers.result from TypeSafe’s response and serializes that object as the result column. For example, a successful Noul result contains JSON text with this shape (illustrative value):
Parse the JSON string in your consuming application and check for an error object before reading answer fields. A SQL NULL state returns SQL NULL without making an API request. Empty strings are evaluated; the Choice example below filters them out before calling jev.

Question types

Choice: classify social media posts

This example evaluates up to 100 nonempty posts. Replace oleander.bluesky.bluesky_posts with your own table and text with the column you want to classify.
The first argument, text, supplies the state from each row. The second argument supplies the same question for those rows. The other option covers posts that do not fit the named categories.

Noul: assess a yes/no question

This example uses a string literal as the state, so no table is needed.
The criteria object is optional for noul; you can use just type and instructions. TypeSafe expresses a Noul judgment as a probability from 0 to 1 that the answer is yes. See Noul for its interpretation.

Score: rate against a rubric

Score levels are numbered by their position in criteria, starting at 0. This three-level rubric spans 0 to 2, and TypeSafe’s score can fall between levels. Use descriptive levels and measure one dimension at a time. See Score for details.

Errors

A missing or empty TYPESAFE_API_KEY, an unusable authorization header, or an invalid question fails query planning. Check the environment variable and ensure the question is a non-null JSON string literal with a supported type and valid criteria. Failures during evaluation are returned as JSON strings in the affected rows. Other rows can still succeed. For example:
Bloom retries HTTP 429 and 529 responses up to twice within a 15-second per-row request budget. Provider error bodies are not included in the result.

Writing questions

Keep each question focused on one decision and give enough context in the state to answer it. Start with a small sample, review the results, and refine the question before applying it to a larger table. See TypeSafe’s question guide for more on choosing and composing question types.