Skip to main content
Zai is a utility library for structured LLM operations. Instead of writing raw prompts, you call typed methods like extract(), check(), summarize(), and text() that handle prompting, parsing, and validation for you. In the ADK, Zai is available via adk.zai. It automatically uses your agent’s configured zai model from defaultModels in agent.config.ts.
import { adk } from "@botpress/runtime"

const zai = adk.zai

What you can do

MethodWhat it doesPage
extract()Pull structured data from unstructured textExtract structured data
check()Verify a Boolean conditionClassify, validate and filter
label()Categorize content with multiple labelsClassify, validate and filter
filter()Filter an array by a conditionClassify, validate and filter
sort()Sort items using natural language criteriaClassify, validate and filter
rate()Rate items on a 1-5 scaleClassify, validate and filter
group()Group items into categoriesClassify, validate and filter
text()Generate text from a promptGenerate text and summaries
rewrite()Transform text based on instructionsGenerate text and summaries
summarize()Summarize long contentGenerate text and summaries
answer()Answer questions with citationsGenerate text and summaries
patch()Make surgical edits to filesGenerate text and summaries

Quick example

import { adk, z } from "@botpress/runtime"

const zai = adk.zai

const product = await zai.extract(
  "Blueberries are $3.99 and are in stock.",
  z.object({
    name: z.string(),
    price: z.number(),
    inStock: z.boolean(),
  })
)
// { name: "blueberries", price: 3.99, inStock: true }

Model configuration

Zai uses the zai model from defaultModels in agent.config.ts:
defaultModels: {
  autonomous: "cerebras:gpt-oss-120b",
  zai: "cerebras:gpt-oss-120b",
},
You can also change the model from the dev console under Settings > LLM Config.

Method categories

Extract structured data

Pull typed data from unstructured text.

Generate text and summaries

Generate, rewrite, summarize, and answer with citations.

Classify, validate and filter

Check conditions, label content, filter, sort, rate, and group.
Last modified on April 24, 2026