> ## Documentation Index
> Fetch the complete documentation index at: https://botpress-docs-pr-583.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction to Zai

> Type-safe LLM utilities for common AI operations.

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`.

```typescript theme={null}
import { adk } from "@botpress/runtime"

const zai = adk.zai
```

## What you can do

| Method | What it does | Page |
| - | - | - |
| `extract()` | Pull structured data from unstructured text | [Extract structured data](/adk/zai/extract) |
| `check()` | Verify a Boolean condition | [Classify, validate and filter](/adk/zai/classify) |
| `label()` | Categorize content with multiple labels | [Classify, validate and filter](/adk/zai/classify) |
| `filter()` | Filter an array by a condition | [Classify, validate and filter](/adk/zai/classify) |
| `sort()` | Sort items using natural language criteria | [Classify, validate and filter](/adk/zai/classify) |
| `rate()` | Rate items on a 1-5 scale | [Classify, validate and filter](/adk/zai/classify) |
| `group()` | Group items into categories | [Classify, validate and filter](/adk/zai/classify) |
| `text()` | Generate text from a prompt | [Generate text and summaries](/adk/zai/generate) |
| `rewrite()` | Transform text based on instructions | [Generate text and summaries](/adk/zai/generate) |
| `summarize()` | Summarize long content | [Generate text and summaries](/adk/zai/generate) |
| `answer()` | Answer questions with citations | [Generate text and summaries](/adk/zai/generate) |
| `patch()` | Make surgical edits to files | [Generate text and summaries](/adk/zai/generate) |

## Quick example

```typescript theme={null}
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`:

```typescript theme={null}
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

<CardGroup cols={3}>
  <Card title="Extract structured data" icon="braces" href="/adk/zai/extract">
    Pull typed data from unstructured text.
  </Card>

  <Card title="Generate text and summaries" icon="sparkles" href="/adk/zai/generate">
    Generate, rewrite, summarize, and answer with citations.
  </Card>

  <Card title="Classify, validate and filter" icon="tags" href="/adk/zai/classify">
    Check conditions, label content, filter, sort, rate, and group.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.