Spaces:
Sleeping
Sleeping
metadata
license: afl-3.0
title: RAG
sdk: docker
emoji: π
colorFrom: green
colorTo: yellow
TechFlow Customer Support Agent π€
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.
π Live Demo
π Features
- RAG (Retrieval-Augmented Generation): Answers user queries using a local knowledge base created from PDF documents.
- Smart Search & Synthesis:
- Typo Tolerance: Handles misspellings (e.g., "solutiun") and infers user intent.
- Relevance Filtering: Automatically discards search results with a similarity score below 0.7 to prevent hallucinated answers from irrelevant text.
- Comprehensive Summarization: Synthesizes answers from multiple document chunks.
- Strict Citations: Every answer includes mandatory source citations with filenames and page numbers (e.g.,
**Source:** manual.pdf (Page 12)). - Automated Ticket System:
- Condition-Based: Offers to create a ticket only when the agent explicitly "could not find the answer".
- GitHub Integration: Directly creates issues in a specified GitHub repository.
- Project Organization: Automatically applies labels and prefixes titles based on the configured
PROJECT_FOLDER.
- Auto-Ingestion: Automatically checks and updates the vector database from the
data/directory when the application starts.
π οΈ Prerequisites
- Python 3.9+
- OpenAI API Key
- GitHub Personal Access Token (with
reposcope)
π Installation & Setup
Clone the Repository
git clone <your-repo-url> cd <project-directory>Install Dependencies
pip install -r requirements.txtConfigure Environment Create a
.envfile in the root directory (copy from.env.example):cp .env.example .envUpdate
.envwith your credentials:OPENAI_API_KEY=sk-... GITHUB_TOKEN=ghp_... REPO_NAME=your_username/your_repo_name PROJECT_FOLDER=if_ur_project_has_folder_name_put_it_here # Used for ticket labels/titlesAdd Knowledge Base Place your PDF documents into the
data/folder.- The system will automatically ingest them when you run the app.
π» Usage
Start the Streamlit application:
streamlit run app.py
How it works:
- Ask a Question: Type your query in the chat.
- Get an Answer: The agent searches the PDFs.
- If a high-confidence answer is found (Score > 0.7), it answers with citations.
- If relevant info is NOT found, it replies "I could not find the answer".
- Raise a Ticket: If the answer was not found, a form appears allowing you to create a GitHub issue immediately.
app.py: Main Streamlit application entry point.agent.py: Core logic for the AI agent, RAG search, and TicketSystem.ingest.py: Script handles loading PDFs, chunking, and FAISS vector storage.data/: Directory for source PDF files.vector_db/: Directory where the FAISS index is saved locally.