> ## Documentation Index
> Fetch the complete documentation index at: https://help.wotnot.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Set AI

Uses an LLM-based AI model to generate a response based on the prompt given.

![Image](https://mintcdn.com/wotnot/ez0GlzggSLvSJ5j6/images/image-474.png?fit=max\&auto=format\&n=ez0GlzggSLvSJ5j6\&q=85\&s=a74b4241d62d4fba2de44e136deb0037)

> [!NOTE]
>
> **Available on all channels**

> [!NOTE]
>
> Set AI consumes AI credits each time it generates a response. The number of credits used can vary depending on the selected AI model. See [AI credits](https://help.wotnot.io/account/billing.md) for credit usage and pricing details.

The **Set AI** action block uses an AI model to generate a value based on your prompt and stores the result in a variable.

Unlike blocks that send a response directly to the user, Set AI works in the background. Nothing is displayed to the user unless you use the generated variable in a later block.

You can use Set AI to:

* Classify a user's message or intent
* Extract information from a conversation
* Summarize text or a conversation
* Rewrite or transform text
* Generate a value before sending it to an API or another block

Set AI is available on all channels because its output is stored in a variable and is not directly rendered to the user.

## Using the Set AI block

Drag the **Set AI** block onto the canvas and connect it to the previous block.

1. Add the **Set AI** block to your flow.
2. Enter a prompt that describes what the AI should generate.
3. Select the input variables or conversation context the AI should use.
4. Select the variable where the generated output should be stored.
5. Define the required output format.
6. Configure the model settings if required.
7. Connect the Set AI block to the next block.

The generated value is stored in the selected variable and can be used by subsequent blocks.

## Configuration

### Prompt

A prompt is nothing but an instruction that helps the LLM know what to remember and follow while generating an answer.

The more clear, concise and brief your instruction, the more accurate your answers will be from the AI.

Things to write in your prompt:

* **Objective** - What is its objective
* **Output format** - Typically would be HTML/markdown.
* **Writing style** - How should the answers be written.
* **Don'ts** - Clear instructions of what to avoid.
* **Examples** - Examples of question and answer.

For example:

```text theme={null}
Classify the user's message into exactly one of these categories:
- Sales
- Support
- Other

Return only the category name.
```

See [Prompts](https://help.wotnot.io/build/prompts.md) for more information.

### Input

**Input** defines the information passed to the AI when generating the output.

You can provide information such as:

* User messages
* Conversation context
* Variables
* Other available input data

Select the information the AI needs to complete the task defined in the prompt.

### Save to variable

**Save to variable** determines where the generated output is stored.

For example, if you select the `intent` variable, Set AI stores the generated category in `intent`.

You can then use the variable in later blocks, such as a **Condition** block, API call, or message block.

![Image](https://mintcdn.com/wotnot/ez0GlzggSLvSJ5j6/images/image-478.png?fit=max\&auto=format\&n=ez0GlzggSLvSJ5j6\&q=85\&s=a1224052577c5324e67abae5cbf948e2)

[Learn more about variables](https://help.wotnot.io/data/variables.md)

### Output format

Use **Output format** to define the structure of the generated value.

For example, you can ask Set AI to return:

* A single word
* A classification label
* A number
* A short sentence
* A JSON object

When the output is used by another block or API, define the format precisely so the generated value is predictable and easy to process.

# Advances Settings

![Image](https://mintcdn.com/wotnot/ez0GlzggSLvSJ5j6/images/image-454.png?fit=max\&auto=format\&n=ez0GlzggSLvSJ5j6\&q=85\&s=c6829f670d839d75d69a06ba3d1ed60d)

### Model settings

Use **Model settings** to select the AI model and configure available parameters such as temperature.

For tasks such as classification and data extraction, use settings that produce consistent results.

#### Max Tokens

A **token** is a small unit of text that an AI model processes when reading your question, knowledge base content, or generating a response.

**Example:**

If a user asks:

> “What is your refund policy?”

The AI breaks the text into smaller pieces called **tokens** before processing it.

* **1 token ≈ 4 characters** but actual token usage may vary depending on the language, words, and AI model.
* Shorter responses use fewer credits, and longer or more complex responses use more. You only pay for what you actually use.

> [!TIP]
>
> **Value should be between 1 - 2000**

#### Temperature

**Temperature** controls how consistent or varied the AI-generated output is.

* A value closer to **0** produces more consistent responses.
* A value closer to **1** produces more varied responses.

The default temperature is **0.5**.

For tasks such as classification or data extraction, a lower temperature can help produce more consistent results.

#### Chunks

When the AI is asked a question, it first fetches relevant content from the knowledge base, which is then sent to the LLM model to generate an answer.

The more relevant content the AI can fetch, the more chances of accurate responses are.

The number indicates the number of relevant responses which will be fetched from the knowledge base.

Select the number of knowledge base **chunks** Answer AI should use when generating a response.

> [card] Choose a value between 1 and 10 from the dropdown.
>
> * A lower number uses fewer chunks and can produce a more focused response.
> * A higher number gives Answer AI more relevant knowledge base content to consider when answering the question.

#### Include Chat History

Enable **Include Chat History** to provide the conversation history as context when generating the output.

This can be useful when the current user message depends on information from earlier messages in the conversation.

For example, if the user first asks about a product and then asks, "What is its price?", including chat history allows the AI to understand what "its" refers to.

## Example: Classify a user message

A common use of Set AI is to classify an incoming message and then route the conversation based on the result.

For example, you can classify messages into three categories:

* `Sales`
* `Support`
* `Other`

### Step 1: Configure Set AI

Set the prompt to:

```text theme={null}
Classify the user's message into exactly one of these categories:

Sales
Support
Other

Return only the category name.
```

Pass the user's message as the input and save the result to the `intent` variable.

For example, if the user says:

```text theme={null}
I want to know more about your pricing.
```

Set AI can generate:

```text theme={null}
Sales
```

The value `Sales` is then stored in the `intent` variable.

### Step 2: Add a Condition block

After Set AI, add a **Condition** block and check the value stored in `intent`.

For example:

* If `intent` = `Sales` → Continue to the sales flow
* If `intent` = `Support` → Continue to the support flow
* If `intent` = `Other` → Continue to the general flow

This allows Set AI to perform the AI processing while the **Condition** block controls what happens next.

## Output path

Set AI has a single output path that continues to the next block after the AI finishes processing.

The generated value is stored in the selected variable before the flow continues.

If the AI does not generate the expected value, validate the variable in a later block before using it for actions that depend on a specific format or value.

## Variables set

Set AI writes the generated value to the variable selected in **Save to variable**.

For example:

| **Configuration** | **Value** |
| :- | :- |
| Save to variable | `intent` |
| Generated output | `Sales` |

The `intent` variable can then be used in subsequent blocks, such as a **Condition** block, API call, or message block.

The Set AI block does not display the generated value to the user by itself. Use the stored variable in a later block when you want to display or process the output.


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