Build an AI Agent with MindsDB
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.
Step-by-Step Tutorial
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 a conversational model
Create a conversational model using the LangChain integration.
Create skills
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.
Create an AI agent
Create an AI agent providing the conversational model and the set of skills.
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.
Step 1. Create a conversational model
Use the CREATE MODEL
statement below to create a conversational model. If required, adjust the parameters and prompts to fit your use case.
Ensure that the model status reads complete
using this command:
Learn more about models created with LangChain.
Step 2. Create skills
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 a skill using the connected 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:
Step 3. Create an AI agent
Now that both the conversational model and the skill are ready, let’s create an AI agent.
Verify that the agent has been created successully using this command:
At this point, you can query an agent to ask questions over the data.
Step 4. Create a chatbot
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.
Verify that the chatbot is running using this command:
Now you can go ahead and chat with the AI agent via Slack.