mindsql


Namemindsql JSON
Version 0.2.1 PyPI version JSON
download
home_pagehttps://www.mindinventory.com/text-to-sql-mindsql.php
SummaryText-2-SQL made easy in just a few lines of python.
upload_time2024-03-13 06:09:00
maintainer
docs_urlNone
authorMindinventory
requires_python>=3.10,<4.0
licenseGPL-3.0-or-later
keywords text2sql data text to sql text-to-sql rag llm nlp
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 🧠 MindSQL

MindSQL is a Python RAG (Retrieval-Augmented Generation) Library designed to streamline the interaction between users and their databases using just a few lines of code. With seamless integration for renowned databases such as PostgreSQL, MySQL, and SQLite, MindSQL also extends its capabilities to major databases like Snowflake and BigQuery by extending the `IDatabase` Interface. This library utilizes large language models (LLM) like GPT-4, Llama 2, Google Gemini, and supports knowledge bases like ChromaDB and Faiss.

![MindSQL Chart](https://github.com/Sammindinventory/MindSQL/assets/77489054/bc993117-8da9-4b4f-b217-8a33db65c342)


## 🚀 Installation

To install MindSQL, you can use pip:

```commandline
pip install mindsql
```

MindSQL requires Python 3.10 or higher.

## 💡 Usage
```python
# !pip install mindsql

from mindsql.core import MindSQLCore
from mindsql.databases import Sqlite
from mindsql.llms import GoogleGenAi
from mindsql.vectorstores import ChromaDB

# Add Your Configurations
config = {"api_key": "YOUR-API-KEY"}

# Choose the Vector Store. LLM and DB You Want to Work With And
# Create MindSQLCore Instance With Configured Llm, Vectorstore, And Database
minds = MindSQLCore(
    llm=GoogleGenAi(config=config),
    vectorstore=ChromaDB(),
    database=Sqlite()
)

# Create a Database Connection Using The Specified URL
connection = minds.database.create_connection(url="YOUR_DATABASE_CONNECTION_URL")

# Index All Data Definition Language (DDL) Statements in The Specified Database Into The Vectorstore
minds.index_all_ddls(connection=connection, db_name='NAME_OF_THE_DB')

# Index Question-Sql Pair in Bulk From the Specified Example Path
minds.index(bulk=True, path="your-qsn-sql-example.json")

# Ask a Question to The Database And Visualize The Result
response = minds.ask_db(
    question="YOUR_QUESTION",
    connection=connection,
    visualize=True
)

# Extract And Display The Chart From The Response
chart = response["chart"]
chart.show()

# Close The Connection to Your DB
connection.close()
```
## 📁 Code Structure 

- **_utils:** Utility modules containing constants and a logger.
- **_helper:** The helper module.
- **core:** The main core module, `minds_core.py`.
- **databases:** Database-related modules.
- **llms:** Modules related to Language Models.
- **testing:** Testing scripts.
- **vectorstores:** Modules related to vector stores.
- **poetry.lock** and **pyproject.toml:** Poetry dependencies and configuration files.
- **tests:** Testcases.

## 🤝 Contributing Guidelines 

Thank you for considering contributing to our project! Please follow these guidelines for smooth collaboration:

1. Fork the repository and create your branch from master.
2. Ensure your code adheres to our coding standards and conventions.
3. Test your changes thoroughly and add a test case in the `tests` folder.
4. Submit a pull request with a clear description of the problem and solution.

## 🐛 Bug Reports

If you encounter a bug while using MindSQL, help us resolve it by following these steps:

1. Check existing issues to see if the bug has been reported.
2. If not, open a new issue with a detailed description, including steps to reproduce and relevant screenshots or error messages.

##  🚀 Feature Requests

We welcome suggestions for new features or improvements to MindSQL. Here's how you can request a new feature:

1. Check existing feature requests to avoid duplication.
2. If your feature request is unique, open a new issue and describe the feature you would like to see.
3. Provide as much context and detail as possible to help us understand your request.

## 📣 Feedback

We value your feedback and strive to improve MindSQL. Here's how you can share your thoughts with us:

- Open an issue to provide general feedback, suggestions, or comments.
- Be constructive and specific in your feedback to help us understand your perspective better.

Thank you for your interest in contributing to our project! We appreciate your support and look forward to working with you. 🚀


## 🌟 Contributors

| GitHub Profile      | Link + Image                                                                                    | Name            |
|---------------------|-------------------------------------------------------------------------------------------------|-----------------|
| siddhant-mi         | [![](https://github.com/siddhant-mi.png?size=50)](https://github.com/siddhant-mi)               | Siddhant Pandey |
| ishika-mi           | [![](https://github.com/ishika-mi.png?size=50)](https://github.com/ishika-mi)                   | Ishika Shah     |
| Hasmukhsuthar05     | [![](https://github.com/Hasmukhsuthar05.png?size=50)](https://github.com/Hasmukhsuthar05)       | Hasmukh Suthar  |
| 	krishna-thakkar-mi | [![](https://github.com/krishna-thakkar-mi.png?size=50)](https://github.com/krishna-thakkar-mi) | Krishna Thakkar |
| UjjawalKRoy         | [![](https://github.com/UjjawalKRoy.png?size=50)](https://github.com/UjjawalKRoy)               | Ujjawal Roy     |

            

Raw data

            {
    "_id": null,
    "home_page": "https://www.mindinventory.com/text-to-sql-mindsql.php",
    "name": "mindsql",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "Text2SQL,data,text to sql,Text-to-SQL,RAG,LLM,NLP",
    "author": "Mindinventory",
    "author_email": "info@mindinventory.com",
    "download_url": "https://files.pythonhosted.org/packages/69/62/820502f99bc701bd6a5d3952db9aa06f0ce1bcb7b0c03fbfd57dca00131e/mindsql-0.2.1.tar.gz",
    "platform": null,
    "description": "# \ud83e\udde0 MindSQL\n\nMindSQL is a Python RAG (Retrieval-Augmented Generation) Library designed to streamline the interaction between users and their databases using just a few lines of code. With seamless integration for renowned databases such as PostgreSQL, MySQL, and SQLite, MindSQL also extends its capabilities to major databases like Snowflake and BigQuery by extending the `IDatabase` Interface. This library utilizes large language models (LLM) like GPT-4, Llama 2, Google Gemini, and supports knowledge bases like ChromaDB and Faiss.\n\n![MindSQL Chart](https://github.com/Sammindinventory/MindSQL/assets/77489054/bc993117-8da9-4b4f-b217-8a33db65c342)\n\n\n## \ud83d\ude80 Installation\n\nTo install MindSQL, you can use pip:\n\n```commandline\npip install mindsql\n```\n\nMindSQL requires Python 3.10 or higher.\n\n## \ud83d\udca1 Usage\n```python\n# !pip install mindsql\n\nfrom mindsql.core import MindSQLCore\nfrom mindsql.databases import Sqlite\nfrom mindsql.llms import GoogleGenAi\nfrom mindsql.vectorstores import ChromaDB\n\n# Add Your Configurations\nconfig = {\"api_key\": \"YOUR-API-KEY\"}\n\n# Choose the Vector Store. LLM and DB You Want to Work With And\n# Create MindSQLCore Instance With Configured Llm, Vectorstore, And Database\nminds = MindSQLCore(\n    llm=GoogleGenAi(config=config),\n    vectorstore=ChromaDB(),\n    database=Sqlite()\n)\n\n# Create a Database Connection Using The Specified URL\nconnection = minds.database.create_connection(url=\"YOUR_DATABASE_CONNECTION_URL\")\n\n# Index All Data Definition Language (DDL) Statements in The Specified Database Into The Vectorstore\nminds.index_all_ddls(connection=connection, db_name='NAME_OF_THE_DB')\n\n# Index Question-Sql Pair in Bulk From the Specified Example Path\nminds.index(bulk=True, path=\"your-qsn-sql-example.json\")\n\n# Ask a Question to The Database And Visualize The Result\nresponse = minds.ask_db(\n    question=\"YOUR_QUESTION\",\n    connection=connection,\n    visualize=True\n)\n\n# Extract And Display The Chart From The Response\nchart = response[\"chart\"]\nchart.show()\n\n# Close The Connection to Your DB\nconnection.close()\n```\n## \ud83d\udcc1 Code Structure \n\n- **_utils:** Utility modules containing constants and a logger.\n- **_helper:** The helper module.\n- **core:** The main core module, `minds_core.py`.\n- **databases:** Database-related modules.\n- **llms:** Modules related to Language Models.\n- **testing:** Testing scripts.\n- **vectorstores:** Modules related to vector stores.\n- **poetry.lock** and **pyproject.toml:** Poetry dependencies and configuration files.\n- **tests:** Testcases.\n\n## \ud83e\udd1d Contributing Guidelines \n\nThank you for considering contributing to our project! Please follow these guidelines for smooth collaboration:\n\n1. Fork the repository and create your branch from master.\n2. Ensure your code adheres to our coding standards and conventions.\n3. Test your changes thoroughly and add a test case in the `tests` folder.\n4. Submit a pull request with a clear description of the problem and solution.\n\n## \ud83d\udc1b Bug Reports\n\nIf you encounter a bug while using MindSQL, help us resolve it by following these steps:\n\n1. Check existing issues to see if the bug has been reported.\n2. If not, open a new issue with a detailed description, including steps to reproduce and relevant screenshots or error messages.\n\n##  \ud83d\ude80 Feature Requests\n\nWe welcome suggestions for new features or improvements to MindSQL. Here's how you can request a new feature:\n\n1. Check existing feature requests to avoid duplication.\n2. If your feature request is unique, open a new issue and describe the feature you would like to see.\n3. Provide as much context and detail as possible to help us understand your request.\n\n## \ud83d\udce3 Feedback\n\nWe value your feedback and strive to improve MindSQL. Here's how you can share your thoughts with us:\n\n- Open an issue to provide general feedback, suggestions, or comments.\n- Be constructive and specific in your feedback to help us understand your perspective better.\n\nThank you for your interest in contributing to our project! We appreciate your support and look forward to working with you. \ud83d\ude80\n\n\n## \ud83c\udf1f Contributors\n\n| GitHub Profile      | Link + Image                                                                                    | Name            |\n|---------------------|-------------------------------------------------------------------------------------------------|-----------------|\n| siddhant-mi         | [![](https://github.com/siddhant-mi.png?size=50)](https://github.com/siddhant-mi)               | Siddhant Pandey |\n| ishika-mi           | [![](https://github.com/ishika-mi.png?size=50)](https://github.com/ishika-mi)                   | Ishika Shah     |\n| Hasmukhsuthar05     | [![](https://github.com/Hasmukhsuthar05.png?size=50)](https://github.com/Hasmukhsuthar05)       | Hasmukh Suthar  |\n| \tkrishna-thakkar-mi | [![](https://github.com/krishna-thakkar-mi.png?size=50)](https://github.com/krishna-thakkar-mi) | Krishna Thakkar |\n| UjjawalKRoy         | [![](https://github.com/UjjawalKRoy.png?size=50)](https://github.com/UjjawalKRoy)               | Ujjawal Roy     |\n",
    "bugtrack_url": null,
    "license": "GPL-3.0-or-later",
    "summary": "Text-2-SQL made easy in just a few lines of python.",
    "version": "0.2.1",
    "project_urls": {
        "Homepage": "https://www.mindinventory.com/text-to-sql-mindsql.php",
        "Repository": "https://github.com/Mindinventory/MindSQL"
    },
    "split_keywords": [
        "text2sql",
        "data",
        "text to sql",
        "text-to-sql",
        "rag",
        "llm",
        "nlp"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3655d6f5a392fe6b10a4d7bfa25835f68aa8d03d11c8051d6d94fdc5c7edae61",
                "md5": "f149f774bcd2249407c0f5afe66bd2f6",
                "sha256": "37c253af0d94fb436b2671b88756c26f89802024eb90920379b5995d5d5a6319"
            },
            "downloads": -1,
            "filename": "mindsql-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f149f774bcd2249407c0f5afe66bd2f6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 41169,
            "upload_time": "2024-03-13T06:08:58",
            "upload_time_iso_8601": "2024-03-13T06:08:58.281920Z",
            "url": "https://files.pythonhosted.org/packages/36/55/d6f5a392fe6b10a4d7bfa25835f68aa8d03d11c8051d6d94fdc5c7edae61/mindsql-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6962820502f99bc701bd6a5d3952db9aa06f0ce1bcb7b0c03fbfd57dca00131e",
                "md5": "c3c612924fc1da40d75154eef9ff42ce",
                "sha256": "82cfe60d96f977523595f61fd4eb19a4df3cc2d63f0d754d0ca835ca1ee5716c"
            },
            "downloads": -1,
            "filename": "mindsql-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "c3c612924fc1da40d75154eef9ff42ce",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 33982,
            "upload_time": "2024-03-13T06:09:00",
            "upload_time_iso_8601": "2024-03-13T06:09:00.561265Z",
            "url": "https://files.pythonhosted.org/packages/69/62/820502f99bc701bd6a5d3952db9aa06f0ce1bcb7b0c03fbfd57dca00131e/mindsql-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-13 06:09:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Mindinventory",
    "github_project": "MindSQL",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "mindsql"
}
        
Elapsed time: 0.19679s