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.

Chatbot with an AI agent

AI Agents are customized AI models that can answer questions over your data. You can connect your data to agents in the form of skills.

Here is how to create a chatbot that integrates an AI Agent and can be connected to a chat interface to have a conversation with your data.

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

The parameters include the following:

  • database stores connection to a chat app (like Slack or MS Teams) that should be created with the CREATE DATABASE statement.
  • agent is an AI agent created with the CREATE AGENT command. It consists of an AI model and a set of skills, that is, defined data sets provided at inference time via RAG-based techniques.
  • is_running indicates whether or not to start the chatbot upon creation.

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.

Chatbot with an LLM

ALternatively, you can create a chatbot that is equivalent to embedding an LLM of your choice into a chat app, like Slack or MS Teams.

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

CREATE CHATBOT my_chatbot
USING
    database = 'my_slack',   -- created with CREATE DATABASE my_slack
    model = 'my_model',   -- created with CREATE MODEL my_model
    is_running = true;   -- default is true

The parameters include the following:

  • database stores connection to a chat app (like Slack or MS Teams) that should be created with the CREATE DATABASE statement.
  • model is a conversational model created with the CREATE MODEL command using the LangChain engine.
  • is_running indicates whether or not to start the chatbot upon creation.

Here is how to delete a chatbot:

DROP CHATBOT my_chatbot;

And here is how to query all chatbots:

SHOW CHATBOTS;

SELECT * FROM chatbots;

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.