This project utilizes OpenAI's/HF's language models, Langchain, and Faiss for semantic search to create a custom summarization app. The app is designed to answer questions from any PDF document through a combination of semantic search and retrieval augmented generation (RAG).
Ensure you have the necessary dependencies installed by running:
pip install -r requirements.txt
The key dependencies include:
- OpenAI: Python wrapper for OpenAI API
- PyPDF2: Library for reading PDF files
- Langchain: A library for natural language processing tasks
- Streamlit: A web app framework for creating interactive data applications
- Clone the repository:
git clone https://github.com/mishragauravgm/qna-faiss-rag
cd qna-faiss-rag
- Set up your environment variables by creating a
.env
file with your OpenAI API key:
OPENAI_API_KEY=your-api-key
HF_KEY=your-hf-key
- Run the application:
streamlit run app.py
- Enter a user prompt and the path to a PDF file in the provided input fields.
- Click the "Generate Answer" button to obtain the answer to your question.
The main components of the project include:
- app.py: The Streamlit web application.
- langchain: A library for natural language processing tasks.
- requirements.txt: List of Python dependencies for the project.
- RAG (Retrieval Augmented Generation): Utilizes Faiss for semantic search and the Hugging Face model repository for language models.
- Faiss: A library for efficient similarity search and clustering of dense vectors.