Spaces:
Sleeping
Sleeping
File size: 4,082 Bytes
143b2d2 be454f3 143b2d2 be454f3 143b2d2 be454f3 143b2d2 be454f3 143b2d2 be454f3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | ---
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:
1. **Create a New Space**: Go to [Hugging Face Spaces](https://huggingface.co/spaces/new) and create a new Space. Choose `Streamlit` as the SDK.
2. **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.
3. **Entry Point**: Ensure your main application file is named `app.py`. If you have a `main.py` like in this project, you will need to rename it to `app.py` or create an `app.py` that imports and runs your Streamlit app.
* In this project, `app.py` has been created to serve as the entry point, which calls `StreamlitApp` from `ui/streamlit_app.py`.
4. **Dependencies**: The `requirements.txt` file specifies all necessary Python dependencies. Hugging Face Spaces will automatically install these when building your Space.
5. **Environment Variables**: Set the `GOOGLE_API_KEY` environment variable in your Space settings.
* Go to your Space settings (usually `Settings` tab in your Space).
* Scroll down to "Repository secrets" or "Environment variables".
* Add a new secret/variable named `GOOGLE_API_KEY` with your actual Google API Key.
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:
1. **Clone the repository**:
```bash
git clone <repository_url>
cd Z
```
2. **Create a virtual environment** (recommended):
```bash
python -m venv virtual_container
source virtual_container/bin/activate
```
3. **Install dependencies**:
```bash
pip install -r requirements.txt
```
4. **Set Environment Variable**: Set your `GOOGLE_API_KEY`:
```bash
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"
```
5. **Run the Streamlit application**:
```bash
streamlit run app.py
```
The application will typically open in your web browser at `http://localhost:8501`.
## Usage
1. **Upload Documents**: Use the sidebar to upload PDF, PPTX, CSV, DOCX, TXT, or MD files.
2. **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)
```
|