Skip to main content

🧠 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

🚀 Installation

To install MindSQL, you can use pip:

pip install mindsql

MindSQL requires Python 3.10 or higher.

💡 Usage

# !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 Siddhant Pandey
ishika-mi Ishika Shah
Hasmukhsuthar05 Hasmukh Suthar
krishna-thakkar-mi Krishna Thakkar
UjjawalKRoy Ujjawal Roy

Release files for mindsql 0.2.1

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

Source distribution (sdist)

Source distribution for mindsql 0.2.1
File Size Uploaded
mindsql-0.2.1.tar.gz 34.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mindsql 0.2.1
File Interpreter ABI Platform
mindsql-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 75.2 kB

Release files / mindsql-0.2.1.tar.gz

Download URL mindsql-0.2.1.tar.gz
Size 34.0 kB
Tags Source
SHA-256 checksum
How to use checksums
82cfe60d96f977523595f61fd4eb19a4df3cc2d63f0d754d0ca835ca1ee5716c
BLAKE2b-256 checksum
How to use checksums
6962820502f99bc701bd6a5d3952db9aa06f0ce1bcb7b0c03fbfd57dca00131e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.12 Linux/5.15.0-91-generic

Release files / mindsql-0.2.1-py3-none-any.whl

Download URL mindsql-0.2.1-py3-none-any.whl
Size 41.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
37c253af0d94fb436b2671b88756c26f89802024eb90920379b5995d5d5a6319
BLAKE2b-256 checksum
How to use checksums
3655d6f5a392fe6b10a4d7bfa25835f68aa8d03d11c8051d6d94fdc5c7edae61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.12 Linux/5.15.0-91-generic

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

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