Skip to main content

An AI-Data Mind is an LLM with the built-in power to answer data questions for Agents

Project description

Minds SDK

Installation

To install the SDK, use pip:

pip install minds-sdk

Getting Started

  1. Initialize the Client

To get started, you'll need to initialize the Client with your API key. If you're using a different server, you can also specify a custom base URL.

from minds.client import Client

# Default connection to Minds Cloud that uses 'https://mdb.ai' as the base URL
client = Client("YOUR_API_KEY")

# If you have self-hosted Minds Cloud instance, use your custom base URL
base_url = 'https://<custom_cloud>.mdb.ai/'
client = Client("YOUR_API_KEY", base_url)
  1. Creating a Data Source

You can connect to various databases, such as PostgreSQL, by configuring your data source. Use the DatabaseConfig to define the connection details for your data source.

from minds.datasources import DatabaseConfig

postgres_config = DatabaseConfig(
    name='my_datasource',
    description='<DESCRIPTION-OF-YOUR-DATA>',
    engine='postgres',
    connection_data={
        'user': 'demo_user',
        'password': 'demo_password',
        'host': 'samples.mindsdb.com',
        'port': 5432,
        'database': 'demo',
        'schema': 'demo_data'
    },
    tables=['<TABLE-1>', '<TABLE-2>']
)
  1. Creating a Mind

You can create a mind and associate it with a data source.

# Create a mind with a data source
mind = client.minds.create(name='mind_name', datasources=[postgres_config])

# Alternatively, create a data source separately and add it to a mind later
datasource = client.datasources.create(postgres_config)
mind2 = client.minds.create(name='mind_name', datasources=[datasource])

You can also add a data source to an existing mind:

# Create a mind without a data source
mind3 = client.minds.create(name='mind_name')

# Add a data source to the mind
mind3.add_datasource(postgres_config)  # Using the config
mind3.add_datasource(datasource)       # Using the data source object

Managing Minds

You can create a mind or replace an existing one with the same name.

mind = client.minds.create(name='mind_name', replace=True, datasources=[postgres_config])

To update a mind, specify the new name and data sources. The provided data sources will replace the existing ones.

mind.update(
    name='mind_name',
    datasources=[postgres_config]
)

List Minds

You can list all the minds you’ve created.

print(client.minds.list())

Get a Mind by Name

You can fetch details of a mind by its name.

mind = client.minds.get('mind_name')

Remove a Mind

To delete a mind, use the following command:

client.minds.drop('mind_name')

Managing Data Sources

To view all data sources:

print(client.datasources.list())

Get a Data Source by Name

You can fetch details of a specific data source by its name.

datasource = client.datasources.get('my_datasource')

Remove a Data Source

To delete a data source, use the following command:

client.datasources.drop('my_datasource')

Note: The SDK currently does not support automatically removing a data source if it is no longer connected to any mind.

Other SDKs

Command Line Tools

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

minds_sdk-1.2.0.tar.gz (11.4 kB view details)

Uploaded Source

File details

Details for the file minds_sdk-1.2.0.tar.gz.

File metadata

  • Download URL: minds_sdk-1.2.0.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.15

File hashes

Hashes for minds_sdk-1.2.0.tar.gz
Algorithm Hash digest
SHA256 512b9ce81e378e6f272400a69a15cacc9a24800992f90f65b691443191495c11
MD5 922f348205a590b8eff0515d031548ff
BLAKE2b-256 acdbca740f7770e5012e22dc5798d8ffda3676bbf4e3e56a59bbbfbdbb948589

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page