What is a Database Mind

A Database Mind is like an LLM that answers questions and engages in conversations using data from your database. Creating a Mind is simple: you just configure how it accesses the database, and then you can interact with it through OpenAI's standard Completions or Assistants API. Minds are designed to assist AI agents in completing tasks that require data, making it as straightforward as interacting with a typical LLM. This simplifies the complexity of data retrieval and reasoning, allowing you to focus on building your AI applications without worrying about maintaining intricate execution and reasoning loops. Additionally, Minds can be customized for complex use cases, streamlining your development process.

Currently available data sources include ClickHouse, MariaDB, MySQL, PostgreSQL, Amazon Redshift, Snowflake, and Google BigQuery.

Support for files is coming soon!

Database-Mind flow diagram

Create a Mind

Follow these steps to get started:

Install the latest version of MindsDB SDK by running pip install mindsdb_sdk.

from mindsdb_sdk.utils.mind import create_mind, DatabaseConfig

your_minds_api_key = <YOUR API KEY>
minds_name = <NAME YOU GAVE TO YOUR MIND>

# Connection details for House Sales Data in our postgres demo DB
pg_config = DatabaseConfig(
    description='House Sales Data',
    type='postgres',
    connection_args={
        'user': 'demo_user',
        'password': 'demo_password',
        'host': 'samples.mindsdb.com',
        'port': '5432',
        'database': 'demo',
        'schema': 'demo_data'
    },
    tables=['house_sales']
)

# Create a Mind and connect your data source to it
mind = create_mind(
    name=minds_name,

    # API connection details
    base_url='https://llm.mdb.ai/', 
    api_key=your_minds_api_key,

    # Connect one or more data sources to your Mind listing them in the data_source_configs parameter
    data_source_configs=[pg_config]
)

print(f"{mind.name} was created successfully. You can now use this Mind using the OpenAI-compatible API, see docs for next steps.")

The following arguments are required to create a Mind:

  • base_url is the URL where requests are sent.
  • api_key is the Minds API key generated at Minds Cloud.
  • name is the unique name of the Mind.
  • data_source_configs 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 a Database Mind:

Was this page helpful?