# Staples Inventry: Talk to a Database This is an end to end LLM project based on Google Palm and Langchain. We are building a system that can talk to MySQL database. User asks questions in a natural language and the system generates answers by converting those questions to an SQL query and then executing that query on MySQL database. Staples is an Inventory store where they maintain their inventory, sales and discounts data in MySQL database. A store manager will may ask questions such as, - How many Black colour gel do we have left in the stock? - How much sales our store will generate if we can sell all Blue gels after applying discounts? The system is intelligent enough to generate accurate queries for given question and execute them on MySQL database ![](atliq_tees.png) ## Project Highlights - Staples is a Inventory store that sells pens , books and office supplies. - Their inventory, sales and discounts data is stored in a MySQL database - We will build an LLM based question and answer system that will use following, - Google Palm LLM - Hugging face embeddings - Streamlit for UI - Langchain framework - Chromadb as a vector store - Few shot learning - In the UI, store manager will ask questions in a natural language and it will produce the answers ## Installation 1.Clone this repository to your local machine using: ```bash git clone https://github.com/codebasics/langchain.git ``` 2.Navigate to the project directory: ```bash cd 4_sqldb_tshirts ``` 3. Install the required dependencies using pip: ```bash pip install -r requirements.txt ``` 4.Acquire an api key through makersuite.google.com and put it in .env file ```bash GOOGLE_API_KEY="your_api_key_here" ``` ## Usage 1. Run the Streamlit app by executing: ```bash streamlit run main.py ``` 9 ## Project Structure - main.py: The main Streamlit application script. - langchain_helper.py: This has all the langchain code - requirements.txt: A list of required Python packages for the project. - few_shots.py: Contains few shot prompts - .env: Configuration file for storing your Google API key.