# AI

[SmartBots AI](https://docs.mysmartbots.com/s/ai/) is a conversation-based AI system designed to work with Playground scripts, enabling bots to conduct contextual, conversational interactions.

## SmartBots AI for Developers

The most convenient way to use SmartBots AI is through **conversations**.

While you can send raw requests to the AI, conversations allow you to maintain context across messages and responses.

* Create a conversation using [`Bot.AI.getConversationByName(residentName)`](/doc/botaigetconversationbyname-38hb08RmfO).
* The resulting conversation object can be reused for subsequent messages.
* SmartBots AI keeps track of context within a conversation.
* Conversation options can be configured individually for each conversation.
* Conversations are **system-wide**, tied to a **script + bot + specific resident**.

## Main Concepts

### Instructions

Rules for the bot: how it should react, how to role-play, and what knowledge it should have. (See examples in **Instructions** section.)

### Token

Each request to SmartBots AI consumes tokens. Read more about token usage.

## AI Commands Reference

| **Commands** |
|----------|
| [`Bot.AI.chat`](/doc/botaichat-pDY9tV5iVf) | Sends a chat message request to the bot AI. |
| [`Bot.AI.configure`](/doc/botaiconfigure-kSc6na53RQ) | Configures AI options to be used in all further communications within the current script. |
| [`Bot.AI.getConversationByName`](/doc/botaigetconversationbyname-38hb08RmfO) | Gets or creates a conversation with a specific resident. If it doesn’t exist, it will be created. |
| [`Bot.AI.forgetConversation`](/doc/botaiforgetconversation-q1JisGOaph) | Forgets (cancels) a conversation between the bot and a specific resident. |
| **Conversation Commands** |
| [`Conversation.chat`](/doc/conversationchat-rHnqjyYuT8) | Sends a chat message request to the bot AI within a conversation with a specific resident. |
| [`Conversation.configure`](/doc/conversationconfigure-PV2HrOsrOM) | Sets configuration values for future usage. |

---

**Documents**

- [Bot.AI.chat](https://sb-docs-dev.getoutline.com/s/dev/doc/botaichat-pDY9tV5iVf)
- [Bot.AI.configure](https://sb-docs-dev.getoutline.com/s/dev/doc/botaiconfigure-kSc6na53RQ)
- [Bot.AI.forgetConversation](https://sb-docs-dev.getoutline.com/s/dev/doc/botaiforgetconversation-q1JisGOaph)
- [Bot.AI.getConversationByName](https://sb-docs-dev.getoutline.com/s/dev/doc/botaigetconversationbyname-38hb08RmfO)
- [Conversation.chat](https://sb-docs-dev.getoutline.com/s/dev/doc/conversationchat-rHnqjyYuT8)
- [Conversation.configure](https://sb-docs-dev.getoutline.com/s/dev/doc/conversationconfigure-PV2HrOsrOM)
- [Tokens](https://sb-docs-dev.getoutline.com/s/dev/doc/tokens-qtbJCNMti1)