An advanced AI-powered system for automatic analysis, classification, and routing of customer feedback using Natural Language Processing and Retrieval-Augmented Generation (RAG).
This project implements an intelligent feedback management system that automates the entire lifecycle of customer feedback processing. The system combines Google's Gemini AI with a RAG architecture to provide context-aware responses based on internal documentation while automatically routing feedback to appropriate teams.
The solution addresses a common challenge in customer support: efficiently processing large volumes of feedback while maintaining quality and consistency. By leveraging LangChain and LangGraph, the system creates a workflow that can classify feedback, determine priority levels, search through knowledge bases, and generate appropriate responses or actions.
Key innovations include automatic sentiment analysis, intelligent routing based on feedback type, semantic search through PDF documentation, and a fallback mechanism that ensures every feedback receives appropriate attention. The system can handle feature suggestions, bug reports, complaints, and testimonials, routing each to Product, Support, or Marketing teams respectively.
graph TD
A[Customer Submits Feedback] --> B[AI Initial Analysis]
B --> C[Gemini Classification Engine]
C --> D{Feedback Type Detection}
D -->|Feature Request| E[Route to Product Team]
D -->|Bug Report| F[Route to Support Team]
D -->|Testimonial/Praise| G[Route to Marketing Team]
D -->|Insufficient Info| H[Request More Details]
D -->|Special Case| I[Create Support Ticket]
E --> J[Priority Analysis]
F --> J
G --> J
J --> K{Priority Level}
K -->|HIGH| L[Critical Bug/Urgent]
K -->|MEDIUM| M[Feature Request/Moderate Bug]
K -->|LOW| N[Testimonial/Minor Issue]
L --> O[RAG System Activation]
M --> O
N --> O
O --> P[Load PDF Documents]
P --> Q[Generate Embeddings]
Q --> R[FAISS Vector Search]
R --> S[Retrieve Relevant Context]
S --> T{Found Relevant Info?}
T -->|Yes| U[Generate Contextualized Response]
U --> V[Add Source Citations]
V --> W[Format Final Response]
T -->|No + Special Keywords| I
T -->|No + Generic| H
H --> X[Request Additional Details]
I --> Y[Create Ticket with Metadata]
W --> Z[Send Response to Customer]
X --> Z
Y --> Z
Z --> AA[Log Interaction]
AA --> AB[Update Analytics]
AB --> AC[End Process]
style A fill:#2c3e50,color:#fff
style C fill:#e74c3c,color:#fff
style O fill:#3498db,color:#fff
style R fill:#9b59b6,color:#fff
style U fill:#27ae60,color:#fff
style Z fill:#f39c12,color:#fff
- Automatic Classification: Analyzes and categorizes feedback automatically
- Smart Routing: Directs feedback to correct teams (Product, Support, Marketing)
- Priority Analysis: Assigns priority levels (HIGH, MEDIUM, LOW)
- Context Detection: Identifies when additional information is needed
- Knowledge Base: Processes PDF documents (manuals, policies, roadmaps)
- Contextualized Responses: Provides answers based on official documentation
- Automatic Citations: Includes references to source documents
- Semantic Search: Uses embeddings to find relevant information
- Conditional Flow: Implemented with LangGraph for complex decisions
- Intelligent Fallback: Recovery system when AI cannot find answers
- Ticket Creation: Automatic ticket generation for specific cases
Feedback Router Module
- Initial feedback analysis
- Classification into predefined categories
- Determination of appropriate action
RAG System
- PDF document loading and processing
- Embedding creation with Google Gemini
- Relevant information retrieval
Orchestrator Agent
- Coordination between different modules
- Rule-based decision making
- Workflow management
- Feature Request: New functionalities or improvements
- Bug Report: Errors, failures, or unexpected behavior
- Critical Bug: Prevents use of main features
- Moderate Bug: Affects experience but doesn't prevent use
- Testimonial/Praise: Positive feedback for marketing
- UX Complaint: Usability and design issues
- SEND_TO_PRODUCT: Suggestions and UX improvements
- SEND_TO_SUPPORT: Bugs and technical issues
- SEND_TO_MARKETING: Testimonials and praise
- REQUEST_INFO: Vague or incomplete messages
- CREATE_TICKET: Special requests and exceptions
- Google Gemini 2.5 Flash: Primary language model
- LangChain: Framework for LLM applications
- LangGraph: Complex workflow orchestration
- Pydantic: Data validation and structuring
- PyMuPDF: PDF text extraction
- FAISS: Vector database for semantic search
- Google Embeddings: Text embedding generation
- RecursiveCharacterTextSplitter: Intelligent document splitting
- Python 3.8+
- Google Gemini API Key
- Jupyter Notebook or Google Colab
pip install langchain langchain-google-genai google-generativeai
pip install langchain_community faiss-cpu langchain-text-splitters pymupdf
pip install langgraph pydantic# Google Colab
from google.colab import userdata
GOOGLE_API_KEY = userdata.get('GEMINI_API_KEY')
# Local environment
import os
GOOGLE_API_KEY = os.getenv('GEMINI_API_KEY')Place PDF files in the /content/ folder (Colab) or adjust the path in code:
- User manual
- Internal policies
- Product roadmap
- Other relevant documents
Input: "I can't log into the system"
Output: {
"suggested_action": "SEND_TO_SUPPORT",
"priority_level": "HIGH",
"additional_data": ["Bug Report"]
}Input: "It would be nice if the app had a dark theme"
Output: {
"suggested_action": "SEND_TO_PRODUCT",
"priority_level": "MEDIUM",
"additional_data": ["Feature Request"]
}Input: "The new app design looks amazing"
Output: {
"suggested_action": "SEND_TO_MARKETING",
"priority_level": "LOW",
"additional_data": ["Testimonial"]
}Sistema-Feedbacks/
├── AgentesInteligentesUpdate.ipynb # Main notebook
├── README.md # This file
├── LICENSE # Project license
└── docs/ # Additional documentation
├── manual_usuario_feedback_app_v1.2.pdf
├── politica_interna_de_feedback_v2.pdf
└── roadmap_produto_q4_2025.pdf
Luiz Augusto Oliveira de Farias