nl2sql: Leveraging Open-Source AI Models for Natural Language to SQL Query Translation: An Implementation Using LLama
This project aims to leverage open-source AI models to translate natural language queries into SQL queries. The implementation utilizes the LLama model to achieve this translation effectively.
- Natural language to SQL query translation
- Utilizes the Ollama's Llama AI model
We welcome contributions! Please fork the repository and submit a pull request.
This project is licensed under the MIT License.
For any questions or feedback, please contact me at [email protected].
SQL Accuracy : The SQL generated by this tool may be inefficient, inaccurate or incomplete. Always review and test the generated code before using it. We also recommend setting up periodic audits of the generated results.
Data Sensitivity : Exercise caution when using this tool with sensitive or personal data. This framework can send information (sample rows, schema, comments etc.) from the database to LLMs, Vector Databases, etc. as part of the SQL generation pipeline. Ensure this does not violate your privacy policies and regulations. The framework may return improperly constructed SQL queries that can be exploited to gain unauthorized access or cause damage to your database. Always sanitize input parameters and validate generated SQL against known vulnerabilities.
Security Risks : Please follow the the principle of least privilege while using this framework. This framework does not handle auth and relies on you to correctly configure access control mechanisms for the environment the code will be running in, so please ensure sufficient access restrictions for the account used to run this framework to prevent unintended operations, bills etc. This framework may also auto-execute generated SQL queries for validation purposes, please ensure this is always used with read-only permissions to avoid accidental modifications to the database.