Agent
With MindsDB, you can create and deploy AI agents that comprise AI models and customizable skills such as knowledge bases and text-to-SQL.
AI agents use a conversational model (like OpenAI) from LangChain utilizing tools as skills to respond to user input. Users can customize AI agents with their own prompts to fit their use cases.
A chatbot can be thought of as an agent connected to some messaging interface.
How to work with AI agents
Create skills
Start by setting up the skills. Here is how you can create and manage skills using SQL API.
-
Creating, inserting into, updating, and deleting a knowledge base:
-
Creating, updating, and deleting a
knowledge_base
skill: -
Creating, updating, and deleting a
text2sql
skill:
You can query all skills using this command:
Create an agent
An agent can be created, deleted, queried, and updated. Here is how you can do that using SQL API.
-
Creating an AI agent:
Alternatively, you can create an agent and define the model to be used by an agent at the agent creation time based on the model providers defined here.
-
Updating an AI agent:
-
Querying an AI agent:
-
Deleting an AI agent:
You can query all agents using this command:
Example
Agents with Text-to-SQL Skills
Start by creating a conversational large language model to be used by an agent.
Agents access models via the LangChain integration with MindsDB. Check out the link to find out available models.
Then, connect a data source to be used for creating a skill.
Create a skill using one or more tables from a connected data source.
Now that we have a model and a skill, let’s create an agent.
Query the agent as below:
The next step would be to connect a chat app, like Slack, to MindsDB and create a chatbot utilizing this agent.
Learn about chatbots here.
Agents with Knowledge Bases as Skills
In this example, let’s create an embedding model (using OpenAI or LangChain as an engine) for the knowledge base. Note that this step is optional, as knowledge bases provide default embedding model.
Now let’s create a knowledge base that uses this embedding model and the default storage vector database (that is, ChromaDB).
This is how you can insert data into the knowledge base and select it.
Use this knowledge base to create a skill for an agent:
Now you can assign this skill to the agent ( that was created in the example above) and query it again:
Was this page helpful?