Spaces:
Running
Running
Update README.md
Browse files
README.md
CHANGED
|
@@ -10,64 +10,206 @@ pinned: false
|
|
| 10 |
license: mit
|
| 11 |
short_description: Agentic retrieval & smart routing for customer support
|
| 12 |
tags:
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
---
|
| 25 |
|
| 26 |
# ๐ฌ Smart Customer Support Triage Agent
|
| 27 |
|
| 28 |
-
An
|
| 29 |
|
| 30 |
-
|
|
|
|
| 31 |
|
| 32 |
-
|
| 33 |
|
| 34 |
-
|
| 35 |
|
| 36 |
-
|
| 37 |
|
| 38 |
-
|
| 39 |
-
- **Frontend UI**: Gradio - Interactive web interface for user interactions
|
| 40 |
-
- **Agent Framework**: LlamaIndex - Intelligent document routing and retrieval system
|
| 41 |
-
- **LLM**: Anthropic Claude Sonnet 4 - Response generation and reasoning
|
| 42 |
|
| 43 |
-
|
| 44 |
-
- **Document Processing**: LlamaCloud - Managed parsing, indexing and vector storage
|
| 45 |
-
- **Embeddings**: Cohere embed-english-v3.0 - Semantic representation of documents
|
| 46 |
|
| 47 |
-
|
| 48 |
-
- **Observability**: LlamaTrace (Arize Phoenix) - Performance monitoring and tracing
|
| 49 |
-
- **Coding Assistant**: Gemini 2.5 Flash - AI pair programming support
|
| 50 |
-
- **Synthetic Data**: Grok Chat + Slidesgo - Test content generation
|
| 51 |
|
| 52 |
-
|
| 53 |
-
-
|
| 54 |
-
-
|
| 55 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
-
##
|
| 58 |
|
| 59 |
```
|
| 60 |
cs-agent/
|
| 61 |
-
โโโ data/ # Sample knowledge base
|
| 62 |
-
โ โโโ ProductManuals/ # Technical documentation
|
| 63 |
-
โ โโโ FAQGeneralInfo/ # FAQs and general policies
|
| 64 |
-
โ โโโ BillingPolicy/ # Pricing and subscription details
|
| 65 |
-
โ โโโ CompanyIntroductionSlides/ # Company overview materials
|
| 66 |
โโโ app.py # Main application logic
|
| 67 |
โโโ requirements.txt # Python dependencies
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
```
|
| 70 |
|
| 71 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
This project is licensed under the MIT License.
|
|
|
|
| 10 |
license: mit
|
| 11 |
short_description: Agentic retrieval & smart routing for customer support
|
| 12 |
tags:
|
| 13 |
+
- agent-demo-track
|
| 14 |
+
- llamaindex
|
| 15 |
+
- llamacloud
|
| 16 |
+
- rag
|
| 17 |
+
- agentic-retrieval
|
| 18 |
+
- smart-routing
|
| 19 |
+
- customer-service
|
| 20 |
+
- chatbot
|
| 21 |
+
- claude
|
| 22 |
+
- anthropic
|
| 23 |
+
- cohere-embed
|
| 24 |
---
|
| 25 |
|
| 26 |
# ๐ฌ Smart Customer Support Triage Agent
|
| 27 |
|
| 28 |
+
An intelligent customer support system powered by LlamaIndex, Anthropic Claude and Gradio, featuring agentic routing and smart document retrieval across multiple knowledge bases.
|
| 29 |
|
| 30 |
+
> [!IMPORTANT]
|
| 31 |
+
> This project earned [Agent Track Honorable Mention](https://www.gradio.app/hackathon-winners) in โGradio Agents & MCP Hackathon 2025โ. Thank you so much! ๐ฅน๐โค๏ธ
|
| 32 |
|
| 33 |
+
## ๐ฎ Live Demo
|
| 34 |
|
| 35 |
+
Try the chatbot: **[https://huggingface.co/spaces/karenwky/cs-agent](https://huggingface.co/spaces/karenwky/cs-agent)**
|
| 36 |
|
| 37 |
+
_\* Llama-3.1-405B-Instruct supported by Nebius AI Studio is used as the LLM in live demo._
|
| 38 |
|
| 39 |
+
## ๐น Preview
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
+
<video controls autoplay src="https://cdn-uploads.huggingface.co/production/uploads/67d2db58176fdb283211e929/VZv-vBdGfYTsyD-3LuJYC.mp4"></video>
|
|
|
|
|
|
|
| 42 |
|
| 43 |
+
## ๐ Technologies Used
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
+
- **LLM**: Anthropic Claude Sonnet 4.0 for natural language understanding and generation
|
| 46 |
+
- **RAG Framework**: LlamaIndex for agent framework and intelligent query routing
|
| 47 |
+
- **Cloud Platform**: LlamaCloud for document parsing & indexng, managed vector database
|
| 48 |
+
- **UI Framework**: Gradio for interactive web interface
|
| 49 |
+
- **Observability**: LlamaTrace (Arize Phoenix) for LLM tracing and monitoring
|
| 50 |
+
- **Language**: Python 3.12
|
| 51 |
+
- **Document Types**: PDF, PPTX, CSV support
|
| 52 |
+
- **Coding Assistance**: Gemini 2.5 Flash
|
| 53 |
+
- **Synthetic Data**: Grok Chat, Slidesgo for sample knowledge base generation
|
| 54 |
|
| 55 |
+
## ๐ Project Structure
|
| 56 |
|
| 57 |
```
|
| 58 |
cs-agent/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
โโโ app.py # Main application logic
|
| 60 |
โโโ requirements.txt # Python dependencies
|
| 61 |
+
โโโ logo.png # Chatbot avatar image
|
| 62 |
+
โโโ data/ # Sample knowledge base
|
| 63 |
+
โโโ ProductManuals/ # Product documentation
|
| 64 |
+
โโโ FAQGeneralInfo/ # FAQ and general information
|
| 65 |
+
โโโ BillingPolicy/ # Billing and payment policies
|
| 66 |
+
โโโ CompanyIntroductionSlides/ # Company overview
|
| 67 |
```
|
| 68 |
|
| 69 |
+
## ๐ Architecture & Workflow
|
| 70 |
+
|
| 71 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/67d2db58176fdb283211e929/U3hKTIcnfrSE3ErjuFE8U.png"
|
| 72 |
+
alt="Architecture & Workflow Diagram" width="1000" />
|
| 73 |
+
|
| 74 |
+
## โจ Key Features
|
| 75 |
+
|
| 76 |
+
### ๐ฏ **Agentic Routing**
|
| 77 |
+
- Intelligent query classification and routing to appropriate knowledge bases
|
| 78 |
+
- Composite retrieval with automatic reranking
|
| 79 |
+
- Context-aware document selection based on query intent
|
| 80 |
+
|
| 81 |
+
### ๐ง **Metadata Awareness**
|
| 82 |
+
- Extracts and utilizes document metadata (e.g., author, creation date, modification date)
|
| 83 |
+
- File-specific information retrieval from document properties
|
| 84 |
+
- Enhanced context understanding through metadata integration
|
| 85 |
+
|
| 86 |
+
### ๐ **Automatic Version Control**
|
| 87 |
+
- Tracks document versions automatically (e.g., `late_payment_policy_v2.pdf`)
|
| 88 |
+
- Maintains historical document access
|
| 89 |
+
- Version-aware responses for policy and procedure queries
|
| 90 |
+
|
| 91 |
+
### ๐พ **Memory Management**
|
| 92 |
+
- Persistent chat memory with token limit
|
| 93 |
+
- Context preservation across conversation turns
|
| 94 |
+
- Condensed question generation for better retrieval
|
| 95 |
+
|
| 96 |
+
### ๐ **Observability**
|
| 97 |
+
- Real-time LLM tracing with Arize Phoenix
|
| 98 |
+
- Retrieval performance monitoring
|
| 99 |
+
- Source attribution and scoring visibility
|
| 100 |
+
|
| 101 |
+
## ๐ Quick Start
|
| 102 |
+
|
| 103 |
+
### Prerequisites
|
| 104 |
+
- Python 3.8+
|
| 105 |
+
- LlamaCloud API key
|
| 106 |
+
- Anthropic API key
|
| 107 |
+
- (Optional) Arize Phoenix API key
|
| 108 |
+
|
| 109 |
+
### Installation
|
| 110 |
+
|
| 111 |
+
1. **Clone the repository**
|
| 112 |
+
```bash
|
| 113 |
+
git clone https://github.com/karenwky/cs-agent
|
| 114 |
+
cd cs-agent
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
2. **Install dependencies**
|
| 118 |
+
```bash
|
| 119 |
+
pip install -r requirements.txt
|
| 120 |
+
```
|
| 121 |
+
|
| 122 |
+
3. **Set environment variables**
|
| 123 |
+
```bash
|
| 124 |
+
export ANTHROPIC_API_KEY="your-anthropic-api-key"
|
| 125 |
+
export LLAMA_CLOUD_API_KEY="your-llamacloud-api-key"
|
| 126 |
+
|
| 127 |
+
# Optional: For Phoenix tracing
|
| 128 |
+
export PHOENIX_PROJECT_NAME="your-phoenix-project"
|
| 129 |
+
export PHOENIX_API_KEY="your-phoenix-api-key"
|
| 130 |
+
```
|
| 131 |
+
|
| 132 |
+
4. **Set up LlamaCloud indices**
|
| 133 |
+
- Create a project named `CustomerSupportProject` in LlamaCloud
|
| 134 |
+
- Upload documents to create these indices:
|
| 135 |
+
- `ProductManuals`
|
| 136 |
+
- `FAQGeneralInfo`
|
| 137 |
+
- `BillingPolicy`
|
| 138 |
+
- `CompanyIntroductionSlides`
|
| 139 |
+
|
| 140 |
+
5. **Launch the application**
|
| 141 |
+
```bash
|
| 142 |
+
python app.py
|
| 143 |
+
```
|
| 144 |
+
|
| 145 |
+
## ๐ฃ๏ธ Sample Questions
|
| 146 |
+
|
| 147 |
+
### ๐ **Product Manual Queries**
|
| 148 |
+
- "Help! No response from the app, I can't do anything. What should I do?"
|
| 149 |
+
- "What are the procedures to set up task automation?"
|
| 150 |
+
- "How can your software help team collaboration?"
|
| 151 |
+
- "Who is the author of the product manual and when is the last modified date?"
|
| 152 |
+
|
| 153 |
+
### โ **General FAQ & Company Info**
|
| 154 |
+
- "Who are the founders of this company? What are their backgrounds?"
|
| 155 |
+
- "Is your company environmentally friendly?"
|
| 156 |
+
- "What kind of technical detail can I expect for sustainability questions?"
|
| 157 |
+
|
| 158 |
+
### ๐ฐ **Billing & Policy Questions**
|
| 159 |
+
- "I got a $200 invoice outstanding for 45 days. How much is the late charge?"
|
| 160 |
+
- "What is your latest late payment policy?"
|
| 161 |
+
- "If I enable auto-pay but my payment method expires, will I get notified?"
|
| 162 |
+
- "Does the 14-day refund policy refer to calendar days or business days?"
|
| 163 |
+
|
| 164 |
+
### ๐ง **Complex Multi-Domain Queries**
|
| 165 |
+
- "If I sign up for annual 'Pro' subscription with 10% discount but cancel after 20 days, what exact refund amount considering the 14-day policy?"
|
| 166 |
+
- "For multi-user discounts, if I add a 5th user mid-cycle, when does the 10% discount apply and how is prorating calculated?"
|
| 167 |
+
|
| 168 |
+
## ๐ฎ Potential Enhancements
|
| 169 |
+
|
| 170 |
+
### ๐ฏ **Advanced AI Capabilities**
|
| 171 |
+
- **Multi-modal Support**: Add image and video processing for visual troubleshooting guides
|
| 172 |
+
- **Voice Integration**: Implement speech-to-text and text-to-speech for accessibility
|
| 173 |
+
- **Sentiment Analysis**: Detect customer frustration levels and escalate appropriately
|
| 174 |
+
- **Predictive Analytics**: Anticipate customer needs based on interaction patterns
|
| 175 |
+
|
| 176 |
+
### ๐ง **Technical Improvements**
|
| 177 |
+
- **Streaming Responses**: Implement real-time response streaming for better UX
|
| 178 |
+
- **Caching Layer**: Add Redis/Memcached for frequently accessed information
|
| 179 |
+
- **API Gateway**: Create RESTful APIs for integration with existing support systems
|
| 180 |
+
- **Containerization**: Docker support for easy deployment and scaling
|
| 181 |
+
|
| 182 |
+
### ๐ **Analytics & Monitoring**
|
| 183 |
+
- **Custom Dashboards**: Build comprehensive analytics for support metrics
|
| 184 |
+
- **A/B Testing**: Framework for testing different response strategies
|
| 185 |
+
- **Performance Metrics**: Track response accuracy, user satisfaction, and resolution rates
|
| 186 |
+
- **Automated Quality Assurance**: Implement response quality scoring and feedback loops
|
| 187 |
+
|
| 188 |
+
### ๐ **Security & Compliance**
|
| 189 |
+
- **Authentication System**: User management and role-based access control
|
| 190 |
+
- **Data Encryption**: End-to-end encryption for sensitive customer data
|
| 191 |
+
- **Audit Logging**: Comprehensive logging for compliance and security monitoring
|
| 192 |
+
- **GDPR Compliance**: Data privacy controls and user data management
|
| 193 |
+
|
| 194 |
+
### ๐ **Integration & Scalability**
|
| 195 |
+
- **CRM Integration**: Connect with Salesforce, HubSpot, or other CRM systems
|
| 196 |
+
- **Ticketing System**: Integration with Zendesk, Jira Service Management
|
| 197 |
+
- **Multi-language Support**: Internationalization for global customer base
|
| 198 |
+
- **Load Balancing**: Horizontal scaling for high-traffic scenarios
|
| 199 |
+
|
| 200 |
+
### ๐ค **Advanced Agent Capabilities**
|
| 201 |
+
- **Tool Integration**: Connect with external APIs and services
|
| 202 |
+
- **Workflow Automation**: Automated ticket creation and routing
|
| 203 |
+
- **Escalation Logic**: Smart human handoff based on complexity scoring
|
| 204 |
+
- **Learning System**: Continuous improvement from customer interactions
|
| 205 |
+
|
| 206 |
+
## ๐ Acknowledgments
|
| 207 |
+
|
| 208 |
+
- [RAG is dead, long live agentic retrieval โ LlamaIndex](https://www.llamaindex.ai/blog/rag-is-dead-long-live-agentic-retrieval)
|
| 209 |
+
- [LlamaCloudIndex + LlamaCloudRetriever - LlamaIndex](https://docs.llamaindex.ai/en/stable/module_guides/indexing/llama_cloud_index/)
|
| 210 |
+
- [Condense plus context - LlamaIndex](https://docs.llamaindex.ai/en/stable/api_reference/chat_engines/condense_plus_context/)
|
| 211 |
+
- [LlamaIndex | Phoenix](https://arize.com/docs/phoenix/tracing/integrations-tracing/llamaindex#setup)
|
| 212 |
+
|
| 213 |
+
## ๐ License
|
| 214 |
|
| 215 |
This project is licensed under the MIT License.
|