MindsDB provides a custom syntax to build AI agents that comprises an AI model augmented with users’ data access. AI agents can be connected to a chat interface, like Slack or MS Teams, to create chatbots.See details following this link for Agents and this link for Chatbots.
This tutorial demonstrates how to build AI agents with MindsDB using MindsDB SQL editor. This can be also accomplished with APIs and Python SDK.Let’s list all the steps required to build an AI agent.
Create one or more skills to be assigned to an agent.
Note that skills store data to be passed to an agent, so it is required to connect users’ data to MindsDB before creating skills.
3
Create an AI agent
Create an AI agent providing the conversational model and the set of skills.
4
Create a chatbot
Optionally, connect an agent to a chat interface to create a chatbot.
The following sections walk you through the process of building an AI agent.
A skill is essentially users’ data fed to the model, so the model can answer questions over users’ data.First, connect your database to MindsDB. Here the sample database is used.
CREATE SKILL text2sql_skillUSING type = 'text2sql', database = 'datasource', -- connect your database with CREATE DATABASE and pass its name here tables = ['car_sales'], -- list table(s) to be made accessible by an agent description = 'this is car sales data';
Note that there are two types of skills: text-to-SQL and knowledge bases. Learn more about skills here.Verify that the skill has been created successully using this command:
Optionally, you can create a chatbot by connecitng an AI agent to a chat interface.First connect a chat interface to MindsDB. Here the Slack connection is made.
Follow the instructions on how to connect Slack to MindsDB for this use case.Now create a chatbot providing the AI agent and the Slack connection.
Copy
Ask AI
CREATE CHATBOT ai_chatbotUSING database = 'mindsdb_slack', -- connect a chat interface with CREATE DATABASE agent = 'ai_agent'; -- create an agent with with CREATE AGENT
Verify that the chatbot is running using this command:
Copy
Ask AI
SHOW CHATBOTS;
Now you can go ahead and chat with the AI agent via Slack.