Spaces:
Sleeping
Sleeping
| title: Telecom | |
| emoji: π | |
| colorFrom: pink | |
| colorTo: red | |
| sdk: gradio | |
| sdk_version: 6.10.0 | |
| app_file: app.py | |
| pinned: false | |
| license: mit | |
| # Autonomous Telecom Support Agent (Self-Improving RAG) | |
| A production-grade Tier-1 Telecommunications Support Engineer powered by **Gemini 1.5 Flash-Lite** and **FAISS**. This agent features a "closed-loop" learning system that automatically expands its knowledge base by capturing and validating high-confidence resolutions. | |
| ## π Key Features | |
| * **Self-Improving Knowledge Base:** Automatically collects and deduplicates high-scoring answers (Score β₯ 9) to improve future retrieval. | |
| * **Hierarchical Retrieval (RAG):** Combines vector search (FAISS) with session-based memory for context-aware troubleshooting. | |
| * **Autonomous Evaluation:** Includes an "AI Judge" that scores responses based on groundedness, hallucination risk, and evidence usage. | |
| * **HNSW Vector Indexing:** Uses Hierarchical Navigable Small Worlds for efficient, incremental updates to the knowledge base without full re-indexing. | |
| * **Memory Summarization:** Intelligently summarizes long conversations to stay within LLM context windows while preserving key facts. | |
| ## ποΈ Architecture | |
| [attachment_0](attachment) | |
| 1. **Retrieval:** Pulls data from the Nigerian Telecom Customer Support dataset and short-term session memory. | |
| 2. **Generation:** Gemini generates a structured JSON response grounded strictly in retrieved evidence. | |
| 3. **Validation:** A secondary "Judge" prompt evaluates the output for logical consistency. | |
| 4. **Learning:** If the answer is exceptional, it is embedded and injected into the permanent FAISS index for future use. | |
| ## π οΈ Tech Stack | |
| * **LLM:** Google Gemini (via `google-genai`) | |
| * **Vector Database:** FAISS (Facebook AI Similarity Search) | |
| * **Embeddings:** `all-MiniLM-L6-v2` (Sentence-Transformers) | |
| * **Data Source:** HuggingFace Datasets (Nigerian Telecom Support Records) | |
| * **Language:** Python | |
| ## π Prerequisites | |
| ```bash | |
| pip install google-genai sentence-transformers faiss-cpu datasets scikit-learn | |
| ``` | |
| βοΈ Configuration | |
| Set your environment variables: | |
| GEMINI_API_KEY: Your Google AI Studio key. | |
| HF_TOKEN: HuggingFace token for dataset access. | |
| π Usage | |
| from your_script import telecom_agent | |
| # Initialize and query the agent | |
| answer, evaluation, stats = telecom_agent("My MTN sim is not showing 4G signal in Lagos.") | |
| print(f"Diagnosis: {answer['diagnosis']}") | |
| print(f"Confidence: {answer['confidence_score']}") | |
| π Self-Learning Logic | |
| The system uses Semantic Deduplication. New samples are only added to the training set if their cosine similarity to existing data is < 0.9, ensuring the knowledge base grows in quality, not just volume. | |
| Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference |