Check a condition
zai.check() asks the LLM a yes/no question about some input and returns true or false:
.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:
total:
Group items
zai.group() categorizes items into groups. With just instructions, it discovers groups on its own:
initialGroups:
| Option | Type | Description |
|---|---|---|
instructions | string | How to group the items |
initialGroups | Array<{id, label}> | Predefined categories to use instead of discovering them |
maxGroups | number | Upper limit on groups. Smaller groups merge at the end until within the limit |
minElements | number | Minimum items per group. Groups below the threshold have their elements redistributed |
tokensPerElement | number | Max tokens per item |
chunkLength | number | Max tokens per chunk for large inputs |