Agents enable conversation with data, including structured and unstructured data connected to MindsDB.
Connect your data to MindsDB by connecting databases or applications or uploading files. Users can opt for using knowledge bases to store and retrieve data efficiently.
Create an agent, passing the connected data and defining the underlying model.
CREATE AGENT my_agent
USING
model = {
"provider": "openai",
"model_name" : "gpt-4o",
"api_key": "sk-abc123"
},
data = {
"knowledge_bases": ["mindsdb.sales_kb", "mindsdb.orders_kb"],
"tables": ["postgres_conn.customers", "mysql_conn.products"]
},
prompt_template='
mindsdb.sales_kb stores sales analytics data
mindsdb.orders_kb stores order data
postgres_conn.customers stores customers data
mysql_conn.products stores products data
';
Query an agent and ask question over the connected data.
SELECT answer
FROM my_agent
WHERE question = 'What is the average number of orders per customers?';
Responses are generated using AI and may contain mistakes.