Skip to main content

Minds command line tool

PyPI Changelog Tests License

A command line tool for interacting with minds - https://mdb.ai/
Documentation for minds - https://docs.mdb.ai/docs/data_sources

Installation

Install this tool using pip:

pip install minds-cli-sdk

Usage

For help, run:

minds --help

You can also use:

python -m minds_cli --help

Getting started

Setting the Minds API Key

Set the environment variable MINDS_API_KEY to the api key from minds. To create an API key - Login to minds (https://mdb.ai) and create an API key.

export MINDS_API_KEY=<api-key>

Setting the Minds API endpoint

This is optional. If the API endpoint is not provided, the cloud endpoint (https://mdb.ai) is taken by default.

If you have a self-hosted instance of minds, set the environment variable MINDS_API_KEY to the new endpoint.

export MINDS_BASE_ENDPOINT=https://staging.mdb.ai

Datasources

All commands and options related to datasources are as follows:

minds datasources --help

Output:

Usage: minds datasources [OPTIONS] COMMAND [ARGS]...

Command group to deal with datasources

Options:
  --help  Show this message and exit.

Commands:
  create  Create a datasource
  drop    Drop a datasource
  get     Get a datasource
  list    List the datasources

Creating a Data Source

The command and the different options to be passed is as follows:

minds datasources create --help

Output:

Usage: minds datasources create [OPTIONS]

Create a datasource

Options:
--name TEXT                  name of datatasource.  [required]
--engine TEXT                type of database handler, for example
                            'postgres', 'mysql', ...  [required]
--description TEXT           description of the database. Used by mind to
                            know what data can be got from it.  [required]
--connection_data_file FILE  Credentials json file to connect to database.
                            Refer https://docs.mdb.ai/docs/data_sources
                            [required]
--tables TEXT                Comma-separated list of allowed tables,
                            optional. Ex. --tables table1,table2,table3
--replace                    if true - to remove existing datasource,
                            default is false
--help                       Show this message and exit.

Example to create a postgres datasource:

minds datasources create --name pssql --engine postgres --description "new pssql db" --connection_data_file /Users/abhi/Downloads/ps_conn.json

Output:

pssql successfully created.

The connection_data_file contains the connection json string which is as follows:

{
    "user": "demo_user",
    "password": "demo_password",
    "host": "samples.mindsdb.com",
    "port": "5432",
    "database": "demo",
    "schema": "demo_data"
}

Get a Data Source

The command and the different options to be passed is as follows:

minds datasources create --help

Output:

Usage: minds datasources get [OPTIONS] DATASOURCE_NAME

Get a datasource

Options:
--help  Show this message and exit.

Example:

minds datasources get pssql

Output:

name='pssql' engine='postgres' description='new pssql db' connection_data={'database': 'demo', 'host': 'samples.mindsdb.com', 'password': 'demo_password', 'port': '5432', 'schema': 'demo_data', 'user': 'demo_user'} tables=[]

List all Data Sources

The command and the different options to be passed is as follows:

minds datasources list --help

Output:

Usage: minds datasources list [OPTIONS]

List the datasources

Options:
--help  Show this message and exit.

Example:

minds datasources list

Output:

[Datasource(name='pssql1', engine='postgres', description='new pssql db', connection_data={'database': 'demo', 'host': 'samples.mindsdb.com', 'password': 'demo_password', 'port': '5432', 'schema': 'demo_data', 'user': 'demo_user'}, tables=[])]

Drop a Data Source

The command and the different options to be passed is as follows:

minds datasources drop --help

Output:

Usage: minds datasources drop [OPTIONS] DATASOURCE_NAME

  Drop a datasource

Options:
  --help  Show this message and exit.

Example:

minds datasources drop pssql

Output:

pssql successfully deleted.

Minds

All commands and options related to minds are as follows:

minds minds --help

Output:

Usage: minds minds [OPTIONS] COMMAND [ARGS]...

  Command group to deal with minds

Options:
  --help  Show this message and exit.

Commands:
  add_datasource   Add a datasource to a mind
  chat             Chat completion with minds
  create           Create a mind
  drop             Drop a mind
  drop_datasource  Drop a datasource to a mind
  get              Get a mind
  list             List the minds
  update           Update a mind

Creating a Mind

The command and the different options to be passed is as follows:

minds minds create --help

Output:

Usage: minds minds create [OPTIONS]

  Create a mind

Options:
  --name TEXT             name of the mind  [required]
  --model_name TEXT       llm model name, optional
  --provider TEXT         llm provider, optional. Ex. openai
  --prompt_template TEXT  instructions to llm, optional
  --datasources TEXT      Comma-separated list of datasources used by mind,
                          optional. Ex. --datasources testds, testds1, testds2
  --parameters TEXT       other parameters of the mind, optional. This is a
                          json string.
  --replace               if true - to remove existing mind, default is false
  --help                  Show this message and exit.

Example to create a postgres datasource:

minds minds create --name newMind --model_name gpt-3.5 --datasources pssql1,testds --parameters "{\"owner\":\"abhi\"}" --replace

Output:

newMind successfully created.

The connection_data_file contains the connection json string which is as follows:

{
    "user": "demo_user",
    "password": "demo_password",
    "host": "samples.mindsdb.com",
    "port": "5432",
    "database": "demo",
    "schema": "demo_data"
}

Get a Mind

The command and the different options to be passed is as follows:

minds minds get --help

Output:

Usage: minds minds get [OPTIONS] MIND_NAME

  Get a mind

Options:
  --help  Show this message and exit.

Example:

minds minds get newMind

Output:

<Mind Object details>

List all Minds

The command and the different options to be passed is as follows:

minds minds list --help

Output:

Usage: minds minds list [OPTIONS]

  List the minds

Options:
  --help  Show this message and exit.

Example:

minds minds list

Output:

[Mind Object1, Mind Object2, ....]

Drop a Mind

The command and the different options to be passed is as follows:

minds minds drop --help

Output:

Usage: minds minds drop [OPTIONS] MIND_NAME

  Drop a mind

Options:
  --help  Show this message and exit.

Example:

minds minds drop newMind

Output:

newMind successfully deleted.

Add a datasource to Mind

The command and the different options to be passed is as follows:

minds minds add_datasource --help

Output:

Usage: minds minds add_datasource [OPTIONS] MIND_NAME DATASOURCE_NAME

  Add a datasource to a mind

Options:
  --help  Show this message and exit.

Example:

minds minds add_datasource newMind newds

Output:

newds added to newMind

Remove a datasource from Mind

The command and the different options to be passed is as follows:

minds minds drop_datasource --help

Output:

Usage: minds minds drop_datasource [OPTIONS] MIND_NAME DATASOURCE_NAME

  Drop a datasource from a mind

Options:
  --help  Show this message and exit.

Example:

minds minds drop_datasource newMind newds

Output:

newds dropped from newMind

Chat with a mind

The command and the different options to be passed is as follows:

minds minds chat --help

Output:

Usage: cli.py minds chat [OPTIONS]

  Chat completion with minds

Options:
  --name TEXT     name of the mind  [required]
  --message TEXT  Chat message [required]
  --stream        if stream is enabled, default is false
  --help          Show this message and exit.

Example:

minds chat --name test --message "Hi, how are you?"

Enable chat streaming:

minds chat --name test --message "Hi, how are you?" --stream

Output:

I'm good today

Development

To contribute to this tool, first checkout the code. Then create a new virtual environment:

cd minds-cli-sdk
python -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

python -m pytest

TODO

  • Chat completion - Need a valid response from minds staging env

Metadata

Release files for minds-cli-sdk 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for minds-cli-sdk 1.0.3
File Size Uploaded Provenance Actions
minds_cli_sdk-1.0.3.tar.gz 12.6 kB Without provenance Details for minds_cli_sdk-1.0.3.tar.gz

Release files / minds_cli_sdk-1.0.3.tar.gz

Download URL minds_cli_sdk-1.0.3.tar.gz
Size 12.6 kB
Tags Source
SHA-256 checksum
How to use checksums
998dd721428abcb8fc87f8fae65aaa0548eac755159770a6687fa49df5c9ae08
BLAKE2b-256 checksum
How to use checksums
50553fe17b207ce47218d6048fc20077048cf12eebf24a76860c4bf0e85d43c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Security for minds-cli-sdk 1.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.3 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page