{"id":14468456,"url":"https://github.com/mindinventory/mindsql","last_synced_at":"2025-07-09T21:31:13.865Z","repository":{"id":225959491,"uuid":"765636168","full_name":"Mindinventory/MindSQL","owner":"Mindinventory","description":"MindSQL: A Python Text-to-SQL RAG Library simplifying database interactions. Seamlessly integrates with PostgreSQL, MySQL, SQLite, Snowflake, and BigQuery. Powered by GPT-4 and Llama 2, it enables natural language queries. Supports ChromaDB and Faiss for context-aware responses.","archived":false,"fork":false,"pushed_at":"2025-03-18T07:00:23.000Z","size":88,"stargazers_count":380,"open_issues_count":10,"forks_count":37,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-05-24T08:41:35.446Z","etag":null,"topics":["chatbot","gemini","langchain","rag","retrival-augmented","text-to-sql"],"latest_commit_sha":null,"homepage":"https://www.mindinventory.com/text-to-sql-mindsql.php?utm_source=sampromotiion\u0026utm_medium=Button\u0026utm_campaign=sampromotion\u0026utm_id=sampromotion\u0026utm_term=sampromotiion\u0026utm_content=sampromotiion","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mindinventory.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-01T10:13:07.000Z","updated_at":"2025-05-23T21:02:10.000Z","dependencies_parsed_at":"2024-06-27T12:43:36.788Z","dependency_job_id":null,"html_url":"https://github.com/Mindinventory/MindSQL","commit_stats":null,"previous_names":["sammindinventory/mindsql"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/Mindinventory/MindSQL","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mindinventory%2FMindSQL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mindinventory%2FMindSQL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mindinventory%2FMindSQL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mindinventory%2FMindSQL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mindinventory","download_url":"https://codeload.github.com/Mindinventory/MindSQL/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mindinventory%2FMindSQL/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264503949,"owners_count":23618762,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatbot","gemini","langchain","rag","retrival-augmented","text-to-sql"],"created_at":"2024-09-02T03:01:36.928Z","updated_at":"2025-07-09T21:31:13.622Z","avatar_url":"https://github.com/Mindinventory.png","language":"Python","funding_links":[],"categories":["Chatbots"],"sub_categories":[],"readme":"# 🧠 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## 🚀 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## 💡 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## 📁 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## 🤝 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   [Learn more](CONTRIBUTING.md)\n\n## 🐛 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     [Learn more](.github/ISSUE_TEMPLATE/bug-report.md)\n\n##  🚀 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    [Learn more](.github/ISSUE_TEMPLATE/feature-request.md)\n\n## 📣 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. 🚀\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmindinventory%2Fmindsql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmindinventory%2Fmindsql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmindinventory%2Fmindsql/lists"}