Spaces:
Sleeping
Sleeping
Commit Β·
c928e70
1
Parent(s): c5fe829
update readme
Browse files
README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# TechFlow Customer Support Agent π€
|
| 2 |
+
|
| 3 |
+
A robust, RAG-based AI agent designed to assist users by answering questions from local PDF documentation and seamlessly creating GitHub support tickets when answers are unavailable.
|
| 4 |
+
|
| 5 |
+
## hugging face link
|
| 6 |
+
[niddijoris/RAG_Customer_Support](https://huggingface.co/spaces/niddijoris/RAG_Customer_Support)
|
| 7 |
+
## π Features
|
| 8 |
+
|
| 9 |
+
* **RAG (Retrieval-Augmented Generation)**: Answers user queries using a local knowledge base created from PDF documents.
|
| 10 |
+
* **Smart Search & Synthesis**:
|
| 11 |
+
* **Typo Tolerance**: Handles misspellings (e.g., "solutiun") and infers user intent.
|
| 12 |
+
* **Relevance Filtering**: Automatically discards search results with a similarity score below **0.7** to prevent hallucinated answers from irrelevant text.
|
| 13 |
+
* **Comprehensive Summarization**: Synthesizes answers from multiple document chunks.
|
| 14 |
+
* **Strict Citations**: Every answer includes mandatory source citations with filenames and page numbers (e.g., `**Source:** manual.pdf (Page 12)`).
|
| 15 |
+
* **Automated Ticket System**:
|
| 16 |
+
* **Condition-Based**: Offers to create a ticket only when the agent explicitly "could not find the answer".
|
| 17 |
+
* **GitHub Integration**: Directly creates issues in a specified GitHub repository.
|
| 18 |
+
* **Project Organization**: Automatically applies labels and prefixes titles based on the configured `PROJECT_FOLDER`.
|
| 19 |
+
* **Auto-Ingestion**: Automatically checks and updates the vector database from the `data/` directory when the application starts.
|
| 20 |
+
|
| 21 |
+
## π οΈ Prerequisites
|
| 22 |
+
|
| 23 |
+
* Python 3.9+
|
| 24 |
+
* OpenAI API Key
|
| 25 |
+
* GitHub Personal Access Token (with `repo` scope)
|
| 26 |
+
|
| 27 |
+
## π Installation & Setup
|
| 28 |
+
|
| 29 |
+
1. **Clone the Repository**
|
| 30 |
+
```bash
|
| 31 |
+
git clone <your-repo-url>
|
| 32 |
+
cd <project-directory>
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
2. **Install Dependencies**
|
| 36 |
+
```bash
|
| 37 |
+
pip install -r requirements.txt
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
3. **Configure Environment**
|
| 41 |
+
Create a `.env` file in the root directory (copy from `.env.example`):
|
| 42 |
+
```bash
|
| 43 |
+
cp .env.example .env
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
Update `.env` with your credentials:
|
| 47 |
+
```env
|
| 48 |
+
OPENAI_API_KEY=sk-...
|
| 49 |
+
GITHUB_TOKEN=ghp_...
|
| 50 |
+
REPO_NAME=your_username/your_repo_name
|
| 51 |
+
PROJECT_FOLDER=if_ur_project_has_folder_name_put_it_here # Used for ticket labels/titles
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
4. **Add Knowledge Base**
|
| 55 |
+
Place your PDF documents into the `data/` folder.
|
| 56 |
+
* The system will automatically ingest them when you run the app.
|
| 57 |
+
|
| 58 |
+
## π» Usage
|
| 59 |
+
|
| 60 |
+
Start the Streamlit application:
|
| 61 |
+
|
| 62 |
+
```bash
|
| 63 |
+
streamlit run app.py
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
### How it works:
|
| 67 |
+
1. **Ask a Question**: Type your query in the chat.
|
| 68 |
+
2. **Get an Answer**: The agent searches the PDFs.
|
| 69 |
+
* If a high-confidence answer is found (Score > 0.7), it answers with citations.
|
| 70 |
+
* If relevant info is NOT found, it replies "I could not find the answer".
|
| 71 |
+
3. **Raise a Ticket**: If the answer was not found, a form appears allowing you to create a GitHub issue immediately.
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
* `app.py`: Main Streamlit application entry point.
|
| 75 |
+
* `agent.py`: Core logic for the AI agent, RAG search, and TicketSystem.
|
| 76 |
+
* `ingest.py`: Script handles loading PDFs, chunking, and FAISS vector storage.
|
| 77 |
+
* `data/`: Directory for source PDF files.
|
| 78 |
+
* `vector_db/`: Directory where the FAISS index is saved locally.
|
| 79 |
+
<img width="1157" height="818" alt="Image" src="https://github.com/user-attachments/assets/7b69e60d-33f6-4640-b82f-2b6e37978b8e" />
|
| 80 |
+
|
| 81 |
+
<img width="1189" height="798" alt="Image" src="https://github.com/user-attachments/assets/e6466d6b-cd67-41c4-98e9-1afe7e33f6e4" />
|
| 82 |
+
<img width="1189" height="798" alt="Image" src="https://github.com/user-attachments/assets/8ceb9ce8-731d-448c-9dc2-93cf5a6922af" />
|
| 83 |
+
|
| 84 |
+
<img width="1338" height="90" alt="Image" src="https://github.com/user-attachments/assets/6d9b3139-c28f-436f-8196-6f5dcc119496" />
|