What is a Mind
Minds work similarly to large language models (LLMs) but go beyond by answering any question from any data. This is accomplished by selecting the most relevant data for an answer using parametric search, understanding the meaning and providing responses within the correct context through semantic search, and finally, delivering precise answers by analyzing data and using machine learning (ML) models.
With Minds, any developer can seamlessly incorporate GenAI features with enterprise data knowledge into their applications in three simple steps:
- Create a Mind.
- Plug in data sources.
- Ask it questions from your Application or Agent using our OpenAI-compatible APIs.
The Mind responds as an expert would. It orchestrates across multiple knowledge sources and reasons about how best to answer complex questions.
Find out all supported data sources, and learn more about Minds here.
Create a Mind
Follow these steps to get started:
- Book a demo here.
- Or, if you have an existing account, log in at Minds Cloud and generate the Minds API key.
In this code, we’re connecting to our sample database, see full details here. Install the latest version of Minds SDK by running pip install minds_sdk
.
from minds.client import Client
from minds.datasources import DatabaseConfig
client = Client("MINDS_API_KEY")
postgres_config = DatabaseConfig(
name='my_data',
description='House sales data',
engine='postgres',
connection_data={
'user': 'demo_user',
'password': 'demo_password',
'host': 'samples.mindsdb.com',
'port': '5432',
'database': 'demo',
'schema': 'demo_data'
},
tables=['house_sales']
)
datasource = client.datasources.create(postgres_config, replace=True)
mind = client.minds.create(name='my_mind', datasources=[datasource], replace=True)
print(f"{mind.name} was created successfully. You can now use this Mind using the OpenAI-compatible API, see docs for next steps.")
Remember to replace MINDS_API_KEY
with your token generated here.
The following arguments are used to create a Data Source:
name
is the unique name of the data source.description
is the description of the data source that helps the Mind decide which data source to use for answering certain questions.engine
is the engine of the data source to be connected. See all supported data sources here.connection_data
stores the connection parameters that allow Minds to access the data source. See all supported data sources here.tables
is an optional parameter that lists specific table(s) to be accessed by the Mind. Note that if it is not provided, then the Mind accesses the entire database.
Note that Minds do not store or copy your data. Instead, Minds poll data from the connected data sources using the provided connection parameters whenever required, so all changes to your data are reflected in Minds upon querying the data.
The following arguments are used to create a Mind:
name
is the unique name of the Mind.datasources
is a list of configurations for data sources, such as databases, you can connect to your Mind. See all supported data sources here.
Now that you created the Mind, let's start the conversation with your data!
There are two options for accessing an AI-Data Mind:
- OpenAI Chat Completions API – suits for simple query-response interactions, yet is stateless.
- OpenAI Assistants API – for context persistence and advanced features like dynamic data retrieval or code execution.