https://github.com/xmen3em/ask-pdf
AskPdf is a Streamlit-based application for question-answering over PDF documents using Retrieval-Augmented Generation (RAG) with conversational history. Upload your PDFs and interactively ask questions to get concise, contextually relevant answers, leveraging LangChain, Chroma for vector storage, and HuggingFace embeddings.
https://github.com/xmen3em/ask-pdf
chatbot gemma-2b generative-ai groq-api langchain nlp python
Last synced: 7 months ago
JSON representation
AskPdf is a Streamlit-based application for question-answering over PDF documents using Retrieval-Augmented Generation (RAG) with conversational history. Upload your PDFs and interactively ask questions to get concise, contextually relevant answers, leveraging LangChain, Chroma for vector storage, and HuggingFace embeddings.
- Host: GitHub
- URL: https://github.com/xmen3em/ask-pdf
- Owner: Xmen3em
- Created: 2024-10-31T12:23:00.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-11-23T16:28:17.000Z (11 months ago)
- Last Synced: 2025-01-19T19:56:03.141Z (9 months ago)
- Topics: chatbot, gemma-2b, generative-ai, groq-api, langchain, nlp, python
- Language: Python
- Homepage: https://ask-pdf-ae4sfuns8j2chbxyotovsc.streamlit.app/
- Size: 22.9 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Ask-Pdf 🤖



You can use the power of a Large Language Model (LLM) along with a vector database to ask questions about your own documents with an interactive GUI based on Streamlit. Currently, it works with the Groq API. You can use only PDF files.
Built with Langchain, HuggingFace, Streamlit, FAISS vector database, and Sentence Transformers. Please see the below demo-
[](https://vimeo.com/1032648830?share=copy)
Getting Started 🚶
To get your environment ready for running the code provided here, start by installing all the required dependencies (we recommend using a virtual environment):
```bash
pip install -r requirements.txt
```### Setting Up .env
I have set up a few environment variables for ease of use. Therefore, you need to configure the necessary environment variables before proceeding to use the GUI.
add your groq API key if you want to use the same api to use the gemma2-9b-It model as your llm and also add HuggingFace api for use pretrained model for embeddings.### Running the application through GUI
This project uses Streamlit for frontend GUI, you can run the ```app_1.py``` script to launch the application.
```
python3 app_1.py
```
When you execute this script, the application will launch on a local server, and you can monitor the local server's output in your terminal.How Does it Work? 🤔
This work is based on the principle of Retrieval Augmentation Generation (RAG) which is an approach in the field of Natural Language Processing (NLP) that combines three key components: retrieval, augmentation, and generation. This approach is designed to improve the performance and capabilities of language models.

1. Documents and File Types: At the top, it shows a variety of document types (DOC, XLS, PPT, PDF) being ingested into the system, which matches your project since you're working with PDF documents as input for a retrieval system.
2. Splitting and Vectorization: The documents are split and then stored in a Vector Database. This is relevant because in your project, you use FAISS (a vector database) to store embeddings of document chunks for efficient retrieval. Splitting documents into chunks is crucial for managing large text inputs and allowing efficient querying.
3. Retrieval and Query Embedding: A Retriever component is present, which takes user queries, embeds them, and uses these embeddings to retrieve relevant document chunks. This process is similar to how your project uses embeddings and LangChain to retrieve answers based on the query.
4. LLM Response Generation: The LLM (Large Language Model) receives the retrieved document chunks and generates an answer. This is in line with your project as well, where the conversational RAG (retrieval-augmented generation) process uses the retrieved content to produce a response for the user query.
5. User Interaction: The flow starts with a User query, goes through retrieval and LLM response generation, and ends with an Answer sent back to the user. This accurately represents the conversational loop in your AskPdf project.
## Contact
Feel free to reach out for collaborations or inquiries:- **Email**: [abdelmoneimmohamedrehab@gmail.com](mailto:rehababdelmoneim755@gmail.com)
- **Linkedin** : [www.linkedin.com/in/abdelmoneim77](www.linkedin.com/in/abdelmoneim77)