Spaces:
Sleeping
Sleeping
A newer version of the Streamlit SDK is available: 1.62.0
metadata
app_file: ui/streamlit_app.py
sdk: streamlit
Agentic RAG Chatbot
Project Description
This project implements an Agentic RAG (Retrieval Augmented Generation) Chatbot designed to answer questions based on uploaded documents. It leverages various agents for ingestion, retrieval, and LLM response generation, providing a conversational interface through a Streamlit application.
Features
- Document Upload: Supports PDF, PPTX, CSV, DOCX, TXT, and MD file formats.
- Intelligent Retrieval: Retrieves relevant information from uploaded documents to answer user queries.
- Conversational Interface: Interact with the chatbot through a user-friendly Streamlit UI.
- Modular Agentic Architecture: Built with distinct agents for better maintainability and scalability.
Hugging Face Spaces Deployment
To deploy this application on Hugging Face Spaces, follow these steps:
- Create a New Space: Go to Hugging Face Spaces and create a new Space. Choose
Streamlitas the SDK. - Upload Files: Upload all project files and directories (
agents/,config/,core/,ui/,main.py,requirements.txt,ad.txt,PHILIP_SIMON_DEROCK.pdf) to your Hugging Face Space repository. - Entry Point: Ensure your main application file is named
app.py. If you have amain.pylike in this project, you will need to rename it toapp.pyor create anapp.pythat imports and runs your Streamlit app.- In this project,
app.pyhas been created to serve as the entry point, which callsStreamlitAppfromui/streamlit_app.py.
- In this project,
- Dependencies: The
requirements.txtfile specifies all necessary Python dependencies. Hugging Face Spaces will automatically install these when building your Space. - Environment Variables: Set the
GOOGLE_API_KEYenvironment variable in your Space settings.- Go to your Space settings (usually
Settingstab in your Space). - Scroll down to "Repository secrets" or "Environment variables".
- Add a new secret/variable named
GOOGLE_API_KEYwith your actual Google API Key.
- Go to your Space settings (usually
Your Space should now be ready to deploy and run the Agentic RAG Chatbot.
Local Setup (Optional)
To run this project locally, follow these steps:
- Clone the repository:
git clone <repository_url> cd Z - Create a virtual environment (recommended):
python -m venv virtual_container source virtual_container/bin/activate - Install dependencies:
pip install -r requirements.txt - Set Environment Variable: Set your
GOOGLE_API_KEY:export GOOGLE_API_KEY="your_google_api_key" # For Windows (Command Prompt): # set GOOGLE_API_KEY="your_google_api_key" # For Windows (PowerShell): # $env:GOOGLE_API_KEY="your_google_api_key" - Run the Streamlit application:
The application will typically open in your web browser atstreamlit run app.pyhttp://localhost:8501.
Usage
- Upload Documents: Use the sidebar to upload PDF, PPTX, CSV, DOCX, TXT, or MD files.
- Ask Questions: Once documents are uploaded, type your questions in the chat input field to get answers based on the document content.
Project Structure
Z/
βββ agents/ # Contains different agents (base, ingestion, llm_response, retrieval)
βββ config/ # Configuration settings
βββ core/ # Core functionalities like document parsing and vector store
βββ ui/ # Streamlit UI components
βββ app.py # Main entry point for the Streamlit application (for Hugging Face Spaces)
βββ main_local.py # Original main entry point (can be removed or kept for local dev)
βββ requirements.txt # Python dependencies
βββ README.md # Project README and deployment instructions
βββ ... other files (ad.txt, PHILIP_SIMON_DEROCK.pdf)