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:

  1. Create a Mind.
  2. Plug in data sources.
  3. 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.

Data-Mind flow diagram

Create a Mind

Follow these steps to get started:

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='unique_data_source_name',
    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, update=True)

mind = client.minds.create(
                      name='unique_mind_name', 
                      datasources=[datasource], 
                      prompt_template='answer questions in a helpful way using the available data',
                      update=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.

Note that the update=True parameter of the create functions is used to update a data source or a Mind if it already exists.

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:

Was this page helpful?