Skip to main content
Zai provides methods for classifying, validating, and organizing data using an LLM.

Check a condition

zai.check() asks the LLM a yes/no question about some input and returns true or false:
Call .result() for the Boolean plus the LLM’s reasoning:

Label content

zai.label() applies multiple Boolean labels to content:

Filter an array

zai.filter() keeps items that match a condition:

Sort items

zai.sort() orders items using natural language criteria:

Rate items

zai.rate() scores items on a 1-5 scale. Pass a string for a single criterion:
Pass an object to score each item across multiple criteria. Each result includes a total:

Group items

zai.group() categorizes items into groups. With just instructions, it discovers groups on its own:
To force items into predefined categories, pass initialGroups:
Last modified on April 27, 2026