Within MindsDB, chatbots are agents connected to a chat interface.

Creating a chatbot requires either an AI agent or an LLM, and a connection to a chat app, like Slack or MS Teams.

CREATE CHATBOT Syntax

Here is how to create a chatbot that integrates an AI Agent and can be connected to a chat interface.

CREATE CHATBOT my_chatbot
USING
    database = 'my_slack',   -- created with CREATE DATABASE my_slack
    agent = 'my_agent',   -- created with CREATE AGENT my_agent
    is_running = true;   -- default is true

It creates a chatbot that users can interact with via the configured chat interface.

View all chatbots with this command.

SHOW CHATBOTS;

database

In MindsDB, the CREATE DATABASE command is used to connect data integrations including databases and applications such as chat interfaces.

The database parameter stores the name of the chat interface connected to MindsDB with the CREATE DATABASE command, such as Slack or MS Teams.

agent

The agent parameter stores the name of the agent created in MindsDB with the CREATE AGENT command.

Alternatively, user can use the model parameter, instead of agent, to connect an LLM created in MindsDB with the CREATE MODEL command.

is_running

The is_running parameter defines whether the chatbot is going to be available right after its creation (true) or not (false).

If it is set to false, users can enable it with this command.

UPDATE CHATBOT my_chatbot
SET
  is_running = true;

Here are some tips for using the Slack integration:

  1. If you want to use Slack in the CREATE CHATBOT syntax, use this method of connecting Slack to MindsDB.

  2. If you want to connect the chatbot to multiple Slack channels, open your Slack application and add the App/Bot to one or more channels:

  • Go to the channel where you want to use the bot.
  • Right-click on the channel and select View Channel Details.
  • Select Integrations.
  • Click on Add an App.

DROP CHATBOT Syntax

Here is how to delete a chatbot:

DROP CHATBOT my_chatbot;

Example

Following the example from here, let’s create a chatbot utilizing the already created agent.

Start by connecting a chat app to MindsDB:

Next, create a chatbot.

CREATE CHATBOT text_to_sql_chatbot
USING
    database = 'my_slack',        -- this must be created with CREATE DATABASE
    agent = 'text_to_sql_agent',  -- this must be created with CREATE AGENT
    is_running = true;

Follow this tutorial to build your own chatbot.