minds-sdk


Nameminds-sdk JSON
Version 1.0.9 PyPI version JSON
download
home_pagehttps://github.com/mindsdb/minds_python_sdk
SummaryAn AI-Data Mind is an LLM with the built-in power to answer data questions for Agents
upload_time2024-11-12 09:37:31
maintainerNone
docs_urlNone
authorMindsDB Inc
requires_python>=3.8
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Minds SDK

### Installation

To install the SDK, use pip:

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

```python
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)
```

2. 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.

```python

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>']
)
```

3. Creating a Mind

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

```python

# 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:

```python

# 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.

```python

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.

```python

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

#### List Minds

You can list all the minds you’ve created.

```python

print(client.minds.list())
```

#### Get a Mind by Name

You can fetch details of a mind by its name.

```python

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

#### Remove a Mind

To delete a mind, use the following command:

```python

client.minds.drop('mind_name')
```

### Managing Data Sources

To view all data sources:

```python

print(client.datasources.list())
```

#### Get a Data Source by Name

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

```python

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

#### Remove a Data Source

To delete a data source, use the following command:

```python

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](https://github.com/Better-Boy/minds-cli-sdk)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mindsdb/minds_python_sdk",
    "name": "minds-sdk",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "MindsDB Inc",
    "author_email": "hello@mindsdb.com",
    "download_url": "https://files.pythonhosted.org/packages/57/5f/38a7c195b0fef9eb4ebd33da9d6da75aab079efb7be119ba021d3d1342b7/minds_sdk-1.0.9.tar.gz",
    "platform": null,
    "description": "# Minds SDK\n\n### Installation\n\nTo install the SDK, use pip:\n\n```bash\npip install minds-sdk\n```\n\n### Getting Started\n\n1. Initialize the Client\n\nTo 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.\n\n```python\nfrom minds.client import Client\n\n# Default connection to Minds Cloud that uses 'https://mdb.ai' as the base URL\nclient = Client(\"YOUR_API_KEY\")\n\n# If you have self-hosted Minds Cloud instance, use your custom base URL\nbase_url = 'https://<custom_cloud>.mdb.ai/'\nclient = Client(\"YOUR_API_KEY\", base_url)\n```\n\n2. Creating a Data Source\n\nYou 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.\n\n```python\n\nfrom minds.datasources import DatabaseConfig\n\npostgres_config = DatabaseConfig(\n    name='my_datasource',\n    description='<DESCRIPTION-OF-YOUR-DATA>',\n    engine='postgres',\n    connection_data={\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    tables=['<TABLE-1>', '<TABLE-2>']\n)\n```\n\n3. Creating a Mind\n\nYou can create a `mind` and associate it with a data source.\n\n```python\n\n# Create a mind with a data source\nmind = client.minds.create(name='mind_name', datasources=[postgres_config])\n\n# Alternatively, create a data source separately and add it to a mind later\ndatasource = client.datasources.create(postgres_config)\nmind2 = client.minds.create(name='mind_name', datasources=[datasource])\n```\n\nYou can also add a data source to an existing mind:\n\n```python\n\n# Create a mind without a data source\nmind3 = client.minds.create(name='mind_name')\n\n# Add a data source to the mind\nmind3.add_datasource(postgres_config)  # Using the config\nmind3.add_datasource(datasource)       # Using the data source object\n```\n\n### Managing Minds\n\nYou can create a mind or replace an existing one with the same name.\n\n```python\n\nmind = client.minds.create(name='mind_name', replace=True, datasources=[postgres_config])\n```\n\nTo update a mind, specify the new name and data sources. The provided data sources will replace the existing ones.\n\n```python\n\nmind.update(\n    name='mind_name',\n    datasources=[postgres_config]\n)\n```\n\n#### List Minds\n\nYou can list all the minds you\u2019ve created.\n\n```python\n\nprint(client.minds.list())\n```\n\n#### Get a Mind by Name\n\nYou can fetch details of a mind by its name.\n\n```python\n\nmind = client.minds.get('mind_name')\n```\n\n#### Remove a Mind\n\nTo delete a mind, use the following command:\n\n```python\n\nclient.minds.drop('mind_name')\n```\n\n### Managing Data Sources\n\nTo view all data sources:\n\n```python\n\nprint(client.datasources.list())\n```\n\n#### Get a Data Source by Name\n\nYou can fetch details of a specific data source by its name.\n\n```python\n\ndatasource = client.datasources.get('my_datasource')\n```\n\n#### Remove a Data Source\n\nTo delete a data source, use the following command:\n\n```python\n\nclient.datasources.drop('my_datasource')\n```\n>Note: The SDK currently does not support automatically removing a data source if it is no longer connected to any mind.\n\n### Other SDKs\n#### [Command-Line](https://github.com/Better-Boy/minds-cli-sdk)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "An AI-Data Mind is an LLM with the built-in power to answer data questions for Agents",
    "version": "1.0.9",
    "project_urls": {
        "Download": "https://pypi.org/project/mindsdb/",
        "Homepage": "https://github.com/mindsdb/minds_python_sdk"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "575f38a7c195b0fef9eb4ebd33da9d6da75aab079efb7be119ba021d3d1342b7",
                "md5": "eed360b05cfa54e16896c00db1854430",
                "sha256": "b81490904210ee9d8a6e00d89bac72071ba7d9f2d328c4d4867f2ebfd67b46f6"
            },
            "downloads": -1,
            "filename": "minds_sdk-1.0.9.tar.gz",
            "has_sig": false,
            "md5_digest": "eed360b05cfa54e16896c00db1854430",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 8867,
            "upload_time": "2024-11-12T09:37:31",
            "upload_time_iso_8601": "2024-11-12T09:37:31.573175Z",
            "url": "https://files.pythonhosted.org/packages/57/5f/38a7c195b0fef9eb4ebd33da9d6da75aab079efb7be119ba021d3d1342b7/minds_sdk-1.0.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-12 09:37:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mindsdb",
    "github_project": "minds_python_sdk",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "minds-sdk"
}
        
Elapsed time: 0.99300s