- Overview
- Features
- Installation
- Usage
- Project Structure
- Configuration
- Dependencies
- Contributing
- License
The Document Q&A Application is a Streamlit-based web application that allows users to upload documents, process them, and ask questions about their content. This application leverages advanced natural language processing techniques to understand and respond to user queries based on the uploaded document.
- Support for multiple document types (PDF, DOCX, TXT, MD)
- Document summarization
- Interactive Q&A based on document content
- Utilizes state-of-the-art language models for accurate responses
- Vector store for efficient document chunk retrieval
- Customizable LLM configuration
-
Clone the repository:
git clone https://github.com/rampal-punia/rag-app.git cd rag-app
-
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install the required dependencies:
pip install -r requirements.txt
-
Set up environment variables: Create a
.env
file in the root directory and add the following:HUGGINGFACEHUB_API_TOKEN=your_huggingface_api_token REDIS_URL=your_redis_url # Optional, defaults to localhost
-
Run the Streamlit app:
streamlit run app.py
-
Open your web browser and navigate to the URL provided by Streamlit (usually
http://localhost:8501
). -
Use the application:
- Upload a document (PDF, DOCX, TXT, or MD)
- View the document summary
- Ask questions about the document content
rag-app/
├── app.py # Main Streamlit application
├── configure_llm.py # LLM configuration and chain building
├── loader.py # Document processing and vector store management
├── settings.py # Application settings and configurations
├── requirements.txt # Project dependencies
├── .env # Environment variables (create this file)
├── logs/ # Log files directory
└── README.md # This file
The application can be configured by modifying the settings.py
file. Key configurations include:
CHUNK_SIZE
: Size of document chunks for processing (default: 350)CHUNK_OVERLAP
: Overlap between document chunks (default: 80)REDIS_URL
: URL for Redis connection (optional)
LLM configurations can be adjusted in the configure_llm.py
file, including model selection and parameters.
Main dependencies include:
- streamlit
- langchain
- huggingface_hub
- chromadb
- pypdf
- docx2txt
- python-decouple
For a complete list of dependencies, refer to the requirements.txt
file.
Contributions to the Document Q&A Application are welcome! Please follow these steps:
- Fork the repository
- Create a new branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
This project is intended as a learning exercise and demonstration of integrating these technologies:
- Sreamlit
- LangChain
- chromadb
- Hugging Face Endpoint APIs
Please note that this application is not designed or tested for production use. It serves as an educational resource and a showcase of technology integration rather than a production-ready web application.
Contributors and users are welcome to explore, learn from, and build upon this project for educational purposes.
For any questions or issues, please open an issue on the GitHub repository.