How mahmoudosama20/support-assistant works
This is a Nile Wallet support assistant combining an intent-classifier experiment with an async request service. Its principal workflow accepts a chat query, preprocesses and routes it, then returns a grounded RAG answer, read-only SQL result, clarification, or refusal; responses are validated and traced. The graph preserves the separate routing and intent models and the RAG and SQL stages. Relationships use README documentation and the shown service, agent, builder, and retrieval code; unsampled internals are represented only where documented.
Main entry points: core.py Support Agent · retriever.py Hybrid Retriever · build.py RAG Tool Adapter · app.py FastAPI Service
Components 22
Service API
- FastAPI Service
src/service/app.py - Request Tracing
src/service/trace_log.py
Agent Routing
- Support Agent
src/agent/core.py - Query Preprocessing
src/agent/preprocess.py - Deterministic Policy
src/agent/policy.py - RAG Tool Adapter
src/agent/build.py
Knowledge Retrieval
- KB Chunking
src/rag/chunking.py - Hybrid Retriever
src/rag/retriever.py - BM25 Search
src/rag/bm25.py - Dense Search
src/rag/dense.py - Cross-Encoder Reranker
src/rag/rerank.py - Evidence Gate
src/rag/context.py - Grounded Answer
src/rag/answer.py
SQL Tool
- SQL Generation
src/sqltool/generate.py - SQL Validation
src/sqltool/validate.py - Read-Only Execution
src/sqltool/execute.py - Support Database
src/supportdb/seed.py
Models and LLM
- Route Classifier
src/agent/models.py - Intent Classifier
src/agent/models.py - LLM Client
src/llm/client.py
Other components
- Chat Client
- LLM Provider
Connections 24
- Chat Client → FastAPI Service: sends chat
README.md - FastAPI Service → Support Agent: handles query
src/service/app.py - FastAPI Service → Request Tracing: writes trace
src/service/app.py - Support Agent → Query Preprocessing: preprocesses
README.md - Support Agent → Route Classifier: infers route
src/agent/core.py - Support Agent → Intent Classifier: infers intent
src/agent/core.py - Support Agent → Deterministic Policy: selects action
README.md - Support Agent → RAG Tool Adapter: dispatches RAG
src/agent/core.py - Support Agent → SQL Generation: dispatches SQL
README.md - RAG Tool Adapter → Hybrid Retriever: retrieves passages
src/agent/build.py - RAG Tool Adapter → Evidence Gate: gates evidence
src/agent/build.py - RAG Tool Adapter → Grounded Answer: requests answer
src/agent/build.py - KB Chunking → BM25 Search: provides chunks
src/rag/bm25.py - Hybrid Retriever → BM25 Search: searches lexically
src/rag/retriever.py - Hybrid Retriever → Dense Search: searches semantically
src/rag/retriever.py - Hybrid Retriever → Cross-Encoder Reranker: reranks fusion
src/rag/retriever.py - Hybrid Retriever → Evidence Gate: returns ranked hits
src/agent/build.py - Evidence Gate → Grounded Answer: supplies context
src/rag/answer.py - Grounded Answer → LLM Client: generates claims
src/rag/answer.py - SQL Generation → SQL Validation: validates query
src/sqltool/generate.py - SQL Generation → LLM Client: requests SQL
README.md - SQL Validation → Read-Only Execution: authorizes query
README.md - Read-Only Execution → Support Database: reads rows
README.md - LLM Client → LLM Provider: calls completion API
src/llm/client.py