{"id":25562711,"url":"https://github.com/amine-akrout/customer-support-agentic-rag","last_synced_at":"2026-04-15T05:31:48.174Z","repository":{"id":277688365,"uuid":"921785355","full_name":"amine-akrout/customer-support-agentic-rag","owner":"amine-akrout","description":"An intelligent customer support system powered by LangGraph and LangChain that uses Retrieval-Augmented Generation (RAG) to provide accurate, context-aware responses to customer queries. Built with FastAPI, FAISS, and multi-stage validation for production-ready deployment.","archived":false,"fork":false,"pushed_at":"2025-02-18T10:25:08.000Z","size":638,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-11T20:13:29.519Z","etag":null,"topics":["docker","faiss","fastapi","langchain","langgraph","llm","ollama","python","rag"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amine-akrout.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-24T16:02:25.000Z","updated_at":"2025-05-15T10:12:18.000Z","dependencies_parsed_at":"2025-02-15T13:24:01.019Z","dependency_job_id":"6c2346b4-6b44-4597-a736-39bd565f2259","html_url":"https://github.com/amine-akrout/customer-support-agentic-rag","commit_stats":null,"previous_names":["amine-akrout/customer-support-agentic-rag"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/amine-akrout/customer-support-agentic-rag","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amine-akrout%2Fcustomer-support-agentic-rag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amine-akrout%2Fcustomer-support-agentic-rag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amine-akrout%2Fcustomer-support-agentic-rag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amine-akrout%2Fcustomer-support-agentic-rag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amine-akrout","download_url":"https://codeload.github.com/amine-akrout/customer-support-agentic-rag/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amine-akrout%2Fcustomer-support-agentic-rag/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31828530,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T18:05:02.291Z","status":"online","status_checked_at":"2026-04-15T02:00:06.175Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","faiss","fastapi","langchain","langgraph","llm","ollama","python","rag"],"created_at":"2025-02-20T19:48:53.212Z","updated_at":"2026-04-15T05:31:48.156Z","avatar_url":"https://github.com/amine-akrout.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🤖 Customer Support Agentic RAG\r\n\r\n**An intelligent customer support system leveraging LangGraph and LangChain for Retrieval-Augmented Generation (RAG) with agent-like behavior to deliver accurate, context-aware responses.**\r\n\r\n---\r\n\r\n## 🚀 Project Overview\r\n\r\nThis project implements a **intelligent RAG-based customer support system** that combines the power of **LangGraph for workflow orchestration** and **LangChain for LLM interactions**. The system provides intelligent, context-aware responses to customer queries through a multi-stage validation and retrieval pipeline.\r\n\r\nBuilt with **FastAPI, FAISS, LangGraph, and Ollama**, this system efficiently processes customer support queries while maintaining high accuracy and safety standards through comprehensive validation checks.\r\n\r\n---\r\n\r\n## ✨ Key Features\r\n\r\n✅ **Intelligent Workflow Orchestration** – LangGraph-powered pipeline for sophisticated query processing  \r\n✅ **Advanced Document Retrieval** – FAISS vector store for efficient semantic search  \r\n✅ **Multi-Stage Validation** – Comprehensive quality checks at each step  \r\n✅ **Local LLM Support** – Integration with Ollama for on-premise deployment  \r\n✅ **Content Safety** – LLM Guard implementation for safe responses  \r\n✅ **Efficient Data Processing** – Polars-based data preprocessing  \r\n✅ **API-First Design** – FastAPI backend for scalable deployment  \r\n\r\n---\r\n\r\n## 🏗️ Tech Stack\r\n\r\n| Category | Tools Used |\r\n|----------|------------|\r\n| **Programming** | `Python 3.9+` |\r\n| **LLM Integration** | `LangChain`, `Ollama`, `OpenAI API (optional)` |\r\n| **Vector Search** | `FAISS` |\r\n| **Workflow Orchestration** | `LangGraph` |\r\n| **Backend Framework** | `FastAPI` |\r\n| **Data Processing** | `Polars` |\r\n| **Safety \u0026 Validation** | `LLM Guard` |\r\n| **Deployment** | `Docker`, `Docker Compose` |\r\n\r\n---\r\n\r\n## 🔧 System Architecture\r\n\r\nThe system follows a sophisticated agentic workflow with six main components:\r\n\r\n1. **Question Validation**\r\n   - Input safety checks\r\n   - Token limit verification\r\n   - Toxicity detection\r\n\r\n2. **Topic Classification**\r\n   - Customer support relevance verification\r\n   - Query categorization\r\n\r\n3. **Document Retrieval**\r\n   - FAISS-powered semantic search\r\n   - Context gathering\r\n\r\n4. **Document Grading**\r\n   - Relevance scoring\r\n   - Context validation\r\n\r\n5. **Answer Generation**\r\n   - Context-aware response generation\r\n   - Local or cloud LLM integration\r\n\r\n6. **Answer Validation**\r\n   - Output quality assessment\r\n   - Safety verification\r\n\r\n---\r\n\r\n## 📁 Project Structure\r\n\r\n```\r\n├── data/\r\n│   ├── indexes/          # FAISS index storage\r\n│   └── customer_care_emails.csv\r\n├── src/\r\n│   ├── api/             # FastAPI application\r\n│   ├── graph/           # LangGraph workflow components\r\n│   │   ├── answer_check_node.py\r\n│   │   ├── answer_node.py\r\n│   │   ├── docs_grader_node.py\r\n│   │   ├── graph.py\r\n│   │   ├── question_check_node.py\r\n│   │   ├── retriever_node.py\r\n│   │   ├── state.py\r\n│   │   ├── topic_check_node.py\r\n│   │   └── utils.py\r\n│   ├── static/          # Frontend assets\r\n│   └── indexing/        # Data preprocessing and indexing\r\n├── tests/               # Test cases\r\n├── Dockerfile           # Docker file\r\n└── docker-compose.yml   # Docker configuration\r\n```\r\n\r\n---\r\n\r\n## ⚙️ Setup \u0026 Installation\r\n\r\n### 1️⃣ Prerequisites\r\n\r\nBefore you begin, ensure you have:\r\n- Python 3.9 or higher\r\n- Docker (optional)\r\n- [Ollama](https://ollama.ai/) installed (for local LLM support)\r\n- OpenAI API key (optional, for cloud LLM)\r\n\r\n### 2️⃣ Clone the Repository\r\n\r\n```bash\r\ngit clone https://github.com/amine-akrout/customer-support-agentic-rag.git\r\ncd customer-support-agentic-rag\r\n```\r\n\r\n### 3️⃣ Environment Setup\r\n\r\nCreate and activate a virtual environment:\r\n```bash\r\npython -m venv venv\r\nsource venv/bin/activate  # On Windows: .\\venv\\Scripts\\activate\r\n```\r\n\r\nInstall dependencies:\r\n```bash\r\npip install -r requirements.txt\r\n```\r\n\r\n### 4️⃣ Configuration\r\n\r\nCreate a `.env` file with your settings:\r\n```env\r\nOPENAI_API_KEY=your_api_key_here  # Optional\r\nLANGCHAIN_API_KEY=your_api_key_here # Optional\r\nLANGCHAIN_TRACING_V2= true # Optional\r\nLANGCHAIN_PROJECT=your_project_id_here # Optional\r\n\r\n```\r\n\r\n---\r\n\r\n## 🚀 Usage\r\n\r\n### Local Development\r\n\r\n1. **Preprocess and Index Data**\r\n```bash\r\npython -m src.indexing.preprocess\r\n```\r\n\r\n2. **Start the API Server**\r\n```bash\r\nuvicorn src.main:app --reload\r\n```\r\n\r\n3. Access the API at `http://localhost:8000`\r\n\r\n### Docker Deployment\r\n\r\n1. **Build and Start Containers**\r\n```bash\r\ndocker-compose up --build\r\n```\r\n\r\n2. Access the API at `http://localhost:8000`\r\n\r\n---\r\n\r\n## 📡 API Endpoints\r\n\r\n| Method | Endpoint | Description |\r\n|--------|----------|-------------|\r\n| `POST` | `/answer` | Submit question and get response |\r\n| `GET` | `/health` | Check API health status |\r\n\r\nExample request:\r\n```json\r\n{\r\n  \"question\": \"How do I return a damaged product?\"\r\n}\r\n```\r\n\r\n---\r\n\r\n## 🔄 Workflow Process\r\n\r\nThe system follows this process for each query:\r\n\r\n1. **Input Processing**\r\n   - Question validation\r\n   - Safety checks\r\n   - Topic classification\r\n\r\n2. **Context Retrieval**\r\n   - Document search\r\n   - Relevance scoring\r\n   - Context selection\r\n\r\n3. **Response Generation**\r\n   - Answer formulation\r\n   - Quality validation\r\n   - Safety verification\r\n\r\n\r\n\r\n\u003cp align=\"center\"\u003e\r\n   \u003cimg src=\"assets\\flow.png\" width=\"150\"/\u003e\r\n\u003c/p\u003e\r\n\r\n---\r\n\r\n## 🤝 Contributing\r\n\r\nWe welcome contributions! Here's how you can help:\r\n\r\n1. Fork the repository\r\n2. Create a feature branch (`git checkout -b feature/improvement`)\r\n3. Make your changes\r\n4. Commit (`git commit -am 'Add new feature'`)\r\n5. Push (`git push origin feature/improvement`)\r\n6. Create a Pull Request\r\n\r\n---\r\n\r\n## 📄 License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\n---\r\n\r\n## 🙏 Acknowledgments\r\n\r\n- [LangChain](https://github.com/hwchase17/langchain) - LLM framework\r\n- [LangGraph](https://github.com/hwchase17/langgraph) - Workflow orchestration\r\n- [FastAPI](https://fastapi.tiangolo.com/) - API framework\r\n- [FAISS](https://github.com/facebookresearch/faiss) - Vector similarity search\r\n- [Ollama](https://ollama.ai/) - Local LLM support\r\n\r\n---\r\n\r\n## ⭐ Star This Repo!\r\n\r\nIf you find this project useful, please consider giving it a star! 🌟\r\n\r\n---\r\n\r\n## 📩 Contact\r\n\r\nFor questions or feedback, please open an issue in the repository.\r\n\r\n---\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famine-akrout%2Fcustomer-support-agentic-rag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famine-akrout%2Fcustomer-support-agentic-rag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famine-akrout%2Fcustomer-support-agentic-rag/lists"}