AI Agents' Skills

With MindsDB, you can create and deploy AI agents that comprise AI models and customizable skills such as knowledge bases and text-to-SQL.

Learn more about AI Agents here.

There are two types of skills available in MindsDB:

  1. Text2SQL skill translates users’ questions into SQL queries and fetches relevant information from data sources assigned to this skill.

  2. Knowledge Bases store data from databases, files, or webpages, and use different retrieval methods to fetch relevant information and present it as answers.

Syntax and Examples


/**
 * Create a skill
 * 
 * @param name   Name of the skill
 * @param type   Type of the skill
 * @param params Parameters of the skill
 * @return Skill
 */
public Skill createSkill(String name, String type, Map<String, Object> params)

Skill textToSqlSkill = server.createSkill("text_to_sql", "sql", Map.of(
    "tables", List.of("my_table"),
    "database", "my_database"
));

Note that it is required to assign a database and a set of tables to be used by this skill.

Here is how to list all available skills:

List<Skill> skills = server.listSkills();

// Or 

List<Skill> skills = server.skills.list();

Here is how to get an existing skill by name:

Skill mySkill = server.getSkill("my_skill");

// Or

Skill mySkill = server.skills.get("my_skill");

Here is how to update a skill with new datasets:

Skill textToSqlSkill = server.getSkill("my_sql_skill");

textToSqlSkill.setParams(Map.of(
    "tables", List.of("car_sales"),
    "database", "example_db"
));

Skill updatedSkill = server.skills.update("my_sql_skill", textToSqlSkill);

Here is how to delete a skill:

Server server = MindsDB.connect();
server.skills.drop("my_skill");

// Or 

server.dropSkill("my_skill")

Here is how to create an agent and assign it a skill:

Agent myAgent = server.agents.create("my_agent", "model_name", null, List.of("skill_name"), null); 
Updated on