This project is designed to create a Retrieval-Augmented Generation (RAG) system using a Large Language Model (LLM). The system integrates with an API to scrape content from the internet and uses an API to serve the LLM-generated answers. A simple front-end interface is provided to interact with the system. Note: ONLY use the packages provided in the requirements.txt file (similar/alternative packages are ok only if they perform similar task/function).
-
User Input via Streamlit Interface:
- The user interacts with a Streamlit-based front-end where they can input their query.
-
Query Sent to Flask Backend:
- The query entered by the user is sent from the Streamlit interface to a Flask backend via an API call.
-
Internet Search and Article Scraping:
- The Flask backend searches the internet for the query using a designated API. It retrieves the top relevant articles and scrapes their content, extracting only the useful text (headings and paragraphs).
-
Content Processing:
- The scraped content is processed to create a coherent input, which is then passed to the LLM for generating a response.
-
LLM Response Generation:
- The processed content and the user's query are used to generate a contextual answer using the LLM. The LLM is accessed via an API, and the generated response is returned to the Flask backend.
-
Response Sent Back to Streamlit Interface:
- The Flask backend sends the generated answer back to the Streamlit interface, where it is displayed to the user.
git clone https://github.com/RaghuRam2005/llm_based_search.git
cd project_name
Or download it
You can use venv
or conda
to create an isolated environment for this project.
python -m venv env
source env/bin/activate # On Windows, use `env\Scripts\activate`
conda create --name project_env python=3.8
conda activate project_env
pip install -r requirements.txt
Create a .env
file in the root directory and add your API keys in a way it can be accessed in the app.
Navigate to the flask_app
directory and start the Flask server:
cd flask_app
python app.py
In a new terminal, run the Streamlit app:
cd streamlit_app
streamlit run app.py
Open your web browser and go to http://localhost:8501
. You can now interact with the system by entering your query.
- flask_app/: Contains the backend Flask API and utility functions.
- streamlit_app/: Contains the Streamlit front-end code.
- .env: Stores API keys (make sure this file is not included in version control).
- requirements.txt: Lists the project dependencies.