minds-cli-sdk


Nameminds-cli-sdk JSON
Version 1.0.3 PyPI version JSON
download
home_pagehttps://github.com/Better-Boy/minds-cli-sdk
SummaryA command-line tool for interacting with minds
upload_time2024-10-21 10:09:57
maintainerNone
docs_urlNone
authorAbhilash K R
requires_python>=3.7
licenseApache License, Version 2.0
keywords minds mindsdb ai
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Minds command line tool

[![PyPI](https://img.shields.io/pypi/v/minds-cli-sdk.svg)](https://pypi.org/project/minds-cli-sdk/)
[![Changelog](https://img.shields.io/github/v/release/Better-Boy/minds-cli-sdk?include_prereleases&label=changelog)](https://github.com/Better-Boy/minds-cli-sdk/releases)
[![Tests](https://github.com/Better-Boy/minds-cli-sdk/actions/workflows/test_on_push.yml/badge.svg)](https://github.com/Better-Boy/minds-cli-sdk/actions/workflows/test_on_push.yml)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/Better-Boy/minds-cli-sdk/blob/master/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`:
```bash
pip install minds-cli-sdk
```
## Usage

For help, run:
```bash
minds --help
```
You can also use:
```bash
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.

```bash
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.

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

## Datasources

All commands and options related to datasources are as follows:

```bash
minds datasources --help
```

Output:

```bash
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:

```bash
minds datasources create --help
```

Output:
```bash
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:

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

Output:
```bash
pssql successfully created.
```

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

```json
{
    "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:

```bash
minds datasources create --help
```

Output:
```bash
Usage: minds datasources get [OPTIONS] DATASOURCE_NAME

Get a datasource

Options:
--help  Show this message and exit.
```

Example:

```
minds datasources get pssql
```

Output:
```bash
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:

```bash
minds datasources list --help
```

Output:
```bash
Usage: minds datasources list [OPTIONS]

List the datasources

Options:
--help  Show this message and exit.
```

Example:

```
minds datasources list
```

Output:
```bash
[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:

```bash
minds datasources drop --help
```

Output:
```bash
Usage: minds datasources drop [OPTIONS] DATASOURCE_NAME

  Drop a datasource

Options:
  --help  Show this message and exit.
```

Example:

```bash
minds datasources drop pssql
```

Output:
```bash
pssql successfully deleted.
```


## Minds

All commands and options related to minds are as follows:

```bash
minds minds --help
```

Output:

```bash
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:

```bash
minds minds create --help
```

Output:
```bash
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:

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

Output:
```bash
newMind successfully created.
```

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

```json
{
    "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:

```bash
minds minds get --help
```

Output:
```bash
Usage: minds minds get [OPTIONS] MIND_NAME

  Get a mind

Options:
  --help  Show this message and exit.
```

Example:

```bash
minds minds get newMind
```

Output:
```bash
<Mind Object details>
```

### List all Minds

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

```bash
minds minds list --help
```

Output:
```bash
Usage: minds minds list [OPTIONS]

  List the minds

Options:
  --help  Show this message and exit.
```

Example:

```bash
minds minds list
```

Output:
```bash
[Mind Object1, Mind Object2, ....]
```

### Drop a Mind

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

```bash
minds minds drop --help
```

Output:
```bash
Usage: minds minds drop [OPTIONS] MIND_NAME

  Drop a mind

Options:
  --help  Show this message and exit.
```

Example:

```bash
minds minds drop newMind
```

Output:
```bash
newMind successfully deleted.
```

### Add a datasource to Mind

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

```bash
minds minds add_datasource --help
```

Output:
```bash
Usage: minds minds add_datasource [OPTIONS] MIND_NAME DATASOURCE_NAME

  Add a datasource to a mind

Options:
  --help  Show this message and exit.
```

Example:

```bash
minds minds add_datasource newMind newds
```

Output:
```bash
newds added to newMind
```

### Remove a datasource from Mind

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

```bash
minds minds drop_datasource --help
```

Output:
```bash
Usage: minds minds drop_datasource [OPTIONS] MIND_NAME DATASOURCE_NAME

  Drop a datasource from a mind

Options:
  --help  Show this message and exit.
```

Example:

```bash
minds minds drop_datasource newMind newds
```

Output:
```bash
newds dropped from newMind
```

### Chat with a mind

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

```bash
minds minds chat --help
```

Output:
```bash
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:

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

Enable chat streaming:

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

Output:
```bash
I'm good today
```


## Development

To contribute to this tool, first checkout the code. Then create a new virtual environment:
```bash
cd minds-cli-sdk
python -m venv venv
source venv/bin/activate
```
Now install the dependencies and test dependencies:
```bash
pip install -e '.[test]'
```
To run the tests:
```bash
python -m pytest
```

## TODO

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Better-Boy/minds-cli-sdk",
    "name": "minds-cli-sdk",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "minds mindsdb ai",
    "author": "Abhilash K R",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/50/55/3fe17b207ce47218d6048fc20077048cf12eebf24a76860c4bf0e85d43c7/minds_cli_sdk-1.0.3.tar.gz",
    "platform": null,
    "description": "# Minds command line tool\n\n[![PyPI](https://img.shields.io/pypi/v/minds-cli-sdk.svg)](https://pypi.org/project/minds-cli-sdk/)\n[![Changelog](https://img.shields.io/github/v/release/Better-Boy/minds-cli-sdk?include_prereleases&label=changelog)](https://github.com/Better-Boy/minds-cli-sdk/releases)\n[![Tests](https://github.com/Better-Boy/minds-cli-sdk/actions/workflows/test_on_push.yml/badge.svg)](https://github.com/Better-Boy/minds-cli-sdk/actions/workflows/test_on_push.yml)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/Better-Boy/minds-cli-sdk/blob/master/LICENSE)\n\nA command line tool for interacting with minds - https://mdb.ai/  \nDocumentation for minds - https://docs.mdb.ai/docs/data_sources\n\n## Installation\n\nInstall this tool using `pip`:\n```bash\npip install minds-cli-sdk\n```\n## Usage\n\nFor help, run:\n```bash\nminds --help\n```\nYou can also use:\n```bash\npython -m minds_cli --help\n```\n\n## Getting started\n\n### Setting the Minds API Key\n\nSet the environment variable `MINDS_API_KEY` to the api key from minds.\nTo create an API key - Login to minds (https://mdb.ai) and create an API key.\n\n```bash\nexport MINDS_API_KEY=<api-key>\n```\n\n### Setting the Minds API endpoint\n\nThis is optional. If the API endpoint is not provided, the cloud endpoint (https://mdb.ai) is taken by default.\n\nIf you have a self-hosted instance of minds, set the environment variable `MINDS_API_KEY` to the new endpoint.\n\n```bash\nexport MINDS_BASE_ENDPOINT=https://staging.mdb.ai\n```\n\n## Datasources\n\nAll commands and options related to datasources are as follows:\n\n```bash\nminds datasources --help\n```\n\nOutput:\n\n```bash\nUsage: minds datasources [OPTIONS] COMMAND [ARGS]...\n\nCommand group to deal with datasources\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  create  Create a datasource\n  drop    Drop a datasource\n  get     Get a datasource\n  list    List the datasources\n```\n\n### Creating a Data Source\n\nThe command and the different options to be passed is as follows:\n\n```bash\nminds datasources create --help\n```\n\nOutput:\n```bash\nUsage: minds datasources create [OPTIONS]\n\nCreate a datasource\n\nOptions:\n--name TEXT                  name of datatasource.  [required]\n--engine TEXT                type of database handler, for example\n                            'postgres', 'mysql', ...  [required]\n--description TEXT           description of the database. Used by mind to\n                            know what data can be got from it.  [required]\n--connection_data_file FILE  Credentials json file to connect to database.\n                            Refer https://docs.mdb.ai/docs/data_sources\n                            [required]\n--tables TEXT                Comma-separated list of allowed tables,\n                            optional. Ex. --tables table1,table2,table3\n--replace                    if true - to remove existing datasource,\n                            default is false\n--help                       Show this message and exit.\n```\n\nExample to create a postgres datasource:\n\n```bash\nminds datasources create --name pssql --engine postgres --description \"new pssql db\" --connection_data_file /Users/abhi/Downloads/ps_conn.json\n```\n\nOutput:\n```bash\npssql successfully created.\n```\n\nThe connection_data_file contains the connection json string which is as follows:\n\n```json\n{\n    \"user\": \"demo_user\",\n    \"password\": \"demo_password\",\n    \"host\": \"samples.mindsdb.com\",\n    \"port\": \"5432\",\n    \"database\": \"demo\",\n    \"schema\": \"demo_data\"\n}\n```\n\n### Get a Data Source\n\nThe command and the different options to be passed is as follows:\n\n```bash\nminds datasources create --help\n```\n\nOutput:\n```bash\nUsage: minds datasources get [OPTIONS] DATASOURCE_NAME\n\nGet a datasource\n\nOptions:\n--help  Show this message and exit.\n```\n\nExample:\n\n```\nminds datasources get pssql\n```\n\nOutput:\n```bash\nname='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=[]\n```\n\n### List all Data Sources\n\nThe command and the different options to be passed is as follows:\n\n```bash\nminds datasources list --help\n```\n\nOutput:\n```bash\nUsage: minds datasources list [OPTIONS]\n\nList the datasources\n\nOptions:\n--help  Show this message and exit.\n```\n\nExample:\n\n```\nminds datasources list\n```\n\nOutput:\n```bash\n[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=[])]\n```\n\n### Drop a Data Source\n\nThe command and the different options to be passed is as follows:\n\n```bash\nminds datasources drop --help\n```\n\nOutput:\n```bash\nUsage: minds datasources drop [OPTIONS] DATASOURCE_NAME\n\n  Drop a datasource\n\nOptions:\n  --help  Show this message and exit.\n```\n\nExample:\n\n```bash\nminds datasources drop pssql\n```\n\nOutput:\n```bash\npssql successfully deleted.\n```\n\n\n## Minds\n\nAll commands and options related to minds are as follows:\n\n```bash\nminds minds --help\n```\n\nOutput:\n\n```bash\nUsage: minds minds [OPTIONS] COMMAND [ARGS]...\n\n  Command group to deal with minds\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  add_datasource   Add a datasource to a mind\n  chat             Chat completion with minds\n  create           Create a mind\n  drop             Drop a mind\n  drop_datasource  Drop a datasource to a mind\n  get              Get a mind\n  list             List the minds\n  update           Update a mind\n```\n\n### Creating a Mind\n\nThe command and the different options to be passed is as follows:\n\n```bash\nminds minds create --help\n```\n\nOutput:\n```bash\nUsage: minds minds create [OPTIONS]\n\n  Create a mind\n\nOptions:\n  --name TEXT             name of the mind  [required]\n  --model_name TEXT       llm model name, optional\n  --provider TEXT         llm provider, optional. Ex. openai\n  --prompt_template TEXT  instructions to llm, optional\n  --datasources TEXT      Comma-separated list of datasources used by mind,\n                          optional. Ex. --datasources testds, testds1, testds2\n  --parameters TEXT       other parameters of the mind, optional. This is a\n                          json string.\n  --replace               if true - to remove existing mind, default is false\n  --help                  Show this message and exit.\n```\n\nExample to create a postgres datasource:\n\n```bash\nminds minds create --name newMind --model_name gpt-3.5 --datasources pssql1,testds --parameters \"{\\\"owner\\\":\\\"abhi\\\"}\" --replace\n```\n\nOutput:\n```bash\nnewMind successfully created.\n```\n\nThe connection_data_file contains the connection json string which is as follows:\n\n```json\n{\n    \"user\": \"demo_user\",\n    \"password\": \"demo_password\",\n    \"host\": \"samples.mindsdb.com\",\n    \"port\": \"5432\",\n    \"database\": \"demo\",\n    \"schema\": \"demo_data\"\n}\n```\n\n### Get a Mind\n\nThe command and the different options to be passed is as follows:\n\n```bash\nminds minds get --help\n```\n\nOutput:\n```bash\nUsage: minds minds get [OPTIONS] MIND_NAME\n\n  Get a mind\n\nOptions:\n  --help  Show this message and exit.\n```\n\nExample:\n\n```bash\nminds minds get newMind\n```\n\nOutput:\n```bash\n<Mind Object details>\n```\n\n### List all Minds\n\nThe command and the different options to be passed is as follows:\n\n```bash\nminds minds list --help\n```\n\nOutput:\n```bash\nUsage: minds minds list [OPTIONS]\n\n  List the minds\n\nOptions:\n  --help  Show this message and exit.\n```\n\nExample:\n\n```bash\nminds minds list\n```\n\nOutput:\n```bash\n[Mind Object1, Mind Object2, ....]\n```\n\n### Drop a Mind\n\nThe command and the different options to be passed is as follows:\n\n```bash\nminds minds drop --help\n```\n\nOutput:\n```bash\nUsage: minds minds drop [OPTIONS] MIND_NAME\n\n  Drop a mind\n\nOptions:\n  --help  Show this message and exit.\n```\n\nExample:\n\n```bash\nminds minds drop newMind\n```\n\nOutput:\n```bash\nnewMind successfully deleted.\n```\n\n### Add a datasource to Mind\n\nThe command and the different options to be passed is as follows:\n\n```bash\nminds minds add_datasource --help\n```\n\nOutput:\n```bash\nUsage: minds minds add_datasource [OPTIONS] MIND_NAME DATASOURCE_NAME\n\n  Add a datasource to a mind\n\nOptions:\n  --help  Show this message and exit.\n```\n\nExample:\n\n```bash\nminds minds add_datasource newMind newds\n```\n\nOutput:\n```bash\nnewds added to newMind\n```\n\n### Remove a datasource from Mind\n\nThe command and the different options to be passed is as follows:\n\n```bash\nminds minds drop_datasource --help\n```\n\nOutput:\n```bash\nUsage: minds minds drop_datasource [OPTIONS] MIND_NAME DATASOURCE_NAME\n\n  Drop a datasource from a mind\n\nOptions:\n  --help  Show this message and exit.\n```\n\nExample:\n\n```bash\nminds minds drop_datasource newMind newds\n```\n\nOutput:\n```bash\nnewds dropped from newMind\n```\n\n### Chat with a mind\n\nThe command and the different options to be passed is as follows:\n\n```bash\nminds minds chat --help\n```\n\nOutput:\n```bash\nUsage: cli.py minds chat [OPTIONS]\n\n  Chat completion with minds\n\nOptions:\n  --name TEXT     name of the mind  [required]\n  --message TEXT  Chat message [required]\n  --stream        if stream is enabled, default is false\n  --help          Show this message and exit.\n```\n\nExample:\n\n```bash\nminds chat --name test --message \"Hi, how are you?\"\n```\n\nEnable chat streaming:\n\n```bash\nminds chat --name test --message \"Hi, how are you?\" --stream\n```\n\nOutput:\n```bash\nI'm good today\n```\n\n\n## Development\n\nTo contribute to this tool, first checkout the code. Then create a new virtual environment:\n```bash\ncd minds-cli-sdk\npython -m venv venv\nsource venv/bin/activate\n```\nNow install the dependencies and test dependencies:\n```bash\npip install -e '.[test]'\n```\nTo run the tests:\n```bash\npython -m pytest\n```\n\n## TODO\n\n- Chat completion - Need a valid response from minds staging env\n",
    "bugtrack_url": null,
    "license": "Apache License, Version 2.0",
    "summary": "A command-line tool for interacting with minds",
    "version": "1.0.3",
    "project_urls": {
        "CI": "https://github.com/Better-Boy/minds-cli-sdk/actions",
        "Changelog": "https://github.com/Better-Boy/minds-cli-sdk/releases",
        "Download": "https://pypi.org/project/minds-cli-sdk/",
        "Homepage": "https://github.com/Better-Boy/minds-cli-sdk",
        "Issues": "https://github.com/Better-Boy/minds-cli-sdk/issues"
    },
    "split_keywords": [
        "minds",
        "mindsdb",
        "ai"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "50553fe17b207ce47218d6048fc20077048cf12eebf24a76860c4bf0e85d43c7",
                "md5": "acc6dc1131ba6e230c3696c844d33126",
                "sha256": "998dd721428abcb8fc87f8fae65aaa0548eac755159770a6687fa49df5c9ae08"
            },
            "downloads": -1,
            "filename": "minds_cli_sdk-1.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "acc6dc1131ba6e230c3696c844d33126",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 12621,
            "upload_time": "2024-10-21T10:09:57",
            "upload_time_iso_8601": "2024-10-21T10:09:57.967454Z",
            "url": "https://files.pythonhosted.org/packages/50/55/3fe17b207ce47218d6048fc20077048cf12eebf24a76860c4bf0e85d43c7/minds_cli_sdk-1.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-21 10:09:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Better-Boy",
    "github_project": "minds-cli-sdk",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "minds-cli-sdk"
}
        
Elapsed time: 0.36245s