Text to SQL using Gemini pro

Subhranil Paul

Subhranil Paul

Kolkata, West Bengal

1 0
  • 0 Collaborators

This project streamlines SQL query generation using a prompt processed by a Language Model (LLM) and potential optimization with Gemini Pro. The system, adaptable to various SQL databases like SQLite, proposes a user-friendly interface through Streamlit for effortless query input and execution. ...learn more

Project status: Concept

Artificial Intelligence

Groups
Student Developers for oneAPI

Intel Technologies
Intel Python

Code Samples [1]

Overview / Usage

The project is a comprehensive system designed to facilitate the generation and execution of SQL queries through a streamlined process. The workflow begins with a user-inputted prompt, serving as a natural language query or intent. This prompt is then processed by a Language Model (LLM), which interprets and converts the natural language input into a structured SQL query. The utilization of advanced language models like GPT-3 ensures accurate and context-aware query generation.

One notable component in this project is Gemini Pro, which plays a crucial role in enhancing the overall query generation or processing. While the specific functionalities of Gemini Pro were not explicitly outlined, it can be assumed that it contributes to the optimization or analysis of the generated SQL queries. This integration could potentially lead to more efficient and performant SQL queries, improving the overall system's effectiveness.

The generated SQL query is then executed on a SQL database, specifically mentioning SQLite as one of the implementation options. The choice of SQLite highlights the flexibility of the system, as it can be adapted to interact with different database systems based on user requirements.

To make the system more accessible and user-friendly, the inclusion of Streamlit is proposed. Streamlit is a Python library for creating web applications with minimal code, allowing for the development of an intuitive user interface. Users can input their queries through the Streamlit interface, which then triggers the entire process of query generation, optimization (potentially involving Gemini Pro), and execution on the chosen SQL database.

In summary, this project combines natural language processing, advanced language models, database interaction (specifically with SQLite), potential optimization with Gemini Pro, and a user-friendly interface through Streamlit to create a comprehensive system for SQL query generation and execution. The modular design allows for flexibility and scalability, making it adaptable to various scenarios and user preferences in the domain of database querying.

Methodology / Approach

  1. User Input: "Retrieve all products and their prices."
  2. Gemini Pro Query: Generates SQL query to fetch product names and prices from the database.
  3. SQLite Execution: Executes the query against the SQLite database.
  4. Streamlit Display: Presents the retrieved data in a tabular format through the Streamlit interface.

Technologies Used

Python

Gemini Pro (Language Model)

SQLite (Database)

Streamlit (Web Application Framework)

Repository

https://github.com/GeneralSubhra/TextToSQLGenai

Comments (0)