Giter VIP home page Giter VIP logo

llm-on-sql's Introduction

Semantic Search Engine

This is an end-to-end search engine that is designed to interact with a MySQL database. This engine allows users to ask questions in natural language. It then translates these questions into SQL queries and executes them on the MySQL database to retrieve answers. We're implementing this technology at AtliQ Tees, a T-shirt store that manages its inventory, sales, and discount data using a MySQL database.

Index

  1. Background
  2. Preview
  3. Installation
  4. Run Locally
  5. Sample Queries
  6. Repository Structure
  7. About the Author

Background

AtliQ Tees is a hypothetical T-shirt store that sells T-shirts from 4 brands: Adidas, Nike, Levi’s and Van Heusen. The data related to the store’s inventory, sales and discounts is stored in a MySQL database. Here we are building an LLM-based query system that uses the below-given technologies to answer questions based on the database. In the UI, the store manager can type questions in natural language, and the system will generate the answers:

  • LangChain as our framework
  • Google PaLM
  • Few-shot learning
  • Hugging Face for embedding generation
  • ChromaDB as vector store
  • Streamlit for UI

Preview

Preview

Installation

  1. Create a local copy of this repository on your machine:
git clone https://github.com/ayucd/llm-on-sql.git
  1. Go to the project directory:
cd llm-on-sql
  1. Install the required dependencies using pip:
pip install -r requirements.txt
  1. Acquire an API key through makersuite.google.com and put it in the secret_key.py file:
GOOGLE_API_KEY="your_api_key_here"
  1. Run database/db_creation_atliq_t_shirts.sql in your MySQL workbench to set up the database.

NOTE: You may also need to replace the db_password in the llm_helper.py file with the password of your MySQL database.

Run Locally

  1. Run the Stramlit UI for the engine by using:
streamlit run main.py
  1. The web app will then open in your browser where you can query the SQL database to get numerical answers!

Sample Queries

Here are a few sample queries and the corresponding answers by the search engine:

Sample Query 1

Sample Query 1

Sample Query 2

Sample Query 2

Sample Query 3

Sample Query 3

Repository Structure

  • main.py: This is the main Streamlit application script.
  • llm_helper.py: This has all the LangChain code.
  • requirements.txt: The list of required Python packages for the project.
  • few_shots.py: Contains the few-shot prompts.
  • secret_key.py: File for storing the Google API key.

About the Author

This search engine was built by me, Ayushi Chaudhary. Feel free to reach out to me at [email protected] for any queries on the project!

llm-on-sql's People

Contributors

ayucd avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.