# Decide with AI

> Have AI sort text into options you name, such as spam, toxic or fine.

Source: https://docs.buildcord.dev/nodes/integrations/decide-with-ai/

`integration.decide` reads some text, asks a question about it, and takes the way out of the option that fits best. Use it to moderate messages, route support questions or sort replies.

## Settings

| Setting | What it does |
| --- | --- |
| What to judge | The text to read, such as `{message.content}`. Up to 8,000 characters are read. |
| Question | What to decide, such as “Which best describes this message?” |
| Options | One per line, as `Name: what it means`. Each gets its own way out. Saying what an option means helps it pick well. |
| Model | **Fast** suits most checks. **Careful** is a larger model that reads more closely. |

## Ways out

One for each option, named as you wrote it. Turn on **If it fails** for a red way out, taken when AI can't be reached or the bot has asked too many times this minute.

## Produces

| Token | Value |
| --- | --- |
| `{ai.choice}` | The option picked, as you named it |
| `{ai.confidence}` | How sure it was, from 0 to 1 |
| `{ai.NAME}` | Each option's chance, from 0 to 1, with its name written in lowercase with dashes |

## Notes

- A bot can ask up to 60 times a minute. Past that, the step fails until the minute is up.
- A test run doesn't ask AI. It goes down the way you choose, or the first option.
- Reading a message's text in an event flow needs the Message Content intent.

## Example

When a message is sent, decide between `Fine`, `Spam` and `Toxic`. From **Spam**, delete the message. From **Toxic**, delete it and time the member out for 10 minutes. Check `{ai.confidence}` with a condition first if you only want to act when it's sure.

## Related

- [Event](https://docs.buildcord.dev/nodes/triggers/event)
- [Comparison](https://docs.buildcord.dev/nodes/conditions/comparison)
- [Switch](https://docs.buildcord.dev/nodes/conditions/switch)
