How jiabinfeng-commit/selfevolvingragagent works
This is a self-evolving RAG application: documents are parsed, chunked, embedded, and stored; users retrieve relevant passages and receive LLM answers, with optional reflection, tracing, and knowledge-gap healing. The React UI exposes knowledge-base management, chat, retrieval testing, health checks, and traces; the HTTP API connects those pages to the core. PostgreSQL stores source text and metadata, while Milvus stores vectors. The README documents evaluation and self-healing capabilities. Some internal paths are inferred only from the SOURCE INDEX; unverified links are omitted.
Main entry points: rag.py RAG orchestration · App.jsx Page routing · retrieval.py Hybrid retrieval · agent.py Self-healing agent
Components 27
User interface
- Page routing
frontend/src/App.jsx - Knowledge base
frontend/src/components/KnowledgeBase.jsx - Chat
frontend/src/components/Chat.jsx - Retrieval test
frontend/src/components/Retrieval.jsx - Health dashboard
frontend/src/components/Health.jsx - Trace viewer
frontend/src/components/Traces.jsx - API client
frontend/src/api.js
API and ingestion
- HTTP API
scripts/api.py - Document ingestion
core/ingest.py - Chunking
core/chunker.py
Retrieval and answering
- Embedding
core/embedder.py - RAG orchestration
core/rag.py - Hybrid retrieval
core/retrieval.py - BM25 search
core/bm25.py - Result reranking
core/reranker.py - Prompt construction
core/prompt.py - LLM client
core/llm.py - Answer reflection
core/reflexion.py
Knowledge operations
- Self-healing agent
core/agent.py - Knowledge health
core/health_check.py - RAG evaluator
core/evaluator.py
Storage and observability
- PostgreSQL
core/storage/pg_store.py - Milvus vector store
core/storage/vec_store.py - Trace recording
core/tracing.py
Other components
- User
- External documentation
- LLM provider
Connections 40
- User → Page routing: uses
frontend/src/App.jsx - Page routing → Knowledge base: routes to
frontend/src/App.jsx - Page routing → Chat: routes to
frontend/src/App.jsx - Page routing → Retrieval test: routes to
frontend/src/App.jsx - Page routing → Health dashboard: routes to
frontend/src/App.jsx - Page routing → Trace viewer: routes to
frontend/src/App.jsx - Knowledge base → API client: requests
frontend/src/components/KnowledgeBase.jsx - Chat → API client: requests
frontend/src/components/Chat.jsx - Retrieval test → API client: requests
frontend/src/components/Retrieval.jsx - Health dashboard → API client: requests
frontend/src/components/Health.jsx - Trace viewer → API client: requests
frontend/src/components/Traces.jsx - API client → HTTP API: calls
README.md - HTTP API → Document ingestion: calls
README.md - HTTP API → RAG orchestration: calls
scripts/api.py - HTTP API → Knowledge health: calls
scripts/api.py - HTTP API → Self-healing agent: calls
scripts/api.py - Document ingestion → Chunking: chunks
core/ingest.py - Document ingestion → Embedding: encodes
core/ingest.py - Document ingestion → PostgreSQL: writes
core/ingest.py - Document ingestion → Milvus vector store: writes
core/ingest.py - RAG orchestration → Hybrid retrieval: retrieves
core/rag.py - Hybrid retrieval → Embedding: encodes query
core/retrieval.py - Hybrid retrieval → Milvus vector store: searches
core/retrieval.py - Hybrid retrieval → PostgreSQL: loads passages
core/retrieval.py - Hybrid retrieval → Result reranking: reranks
core/retrieval.py - RAG orchestration → BM25 search: builds index
core/rag.py - RAG orchestration → Prompt construction: builds prompt
core/rag.py - RAG orchestration → LLM client: generates answer
core/rag.py - LLM client → LLM provider: sends request
core/llm.py - RAG orchestration → Answer reflection: reflects answer
core/rag.py - RAG orchestration → Self-healing agent: heals gaps
core/rag.py - Self-healing agent → External documentation: researches
README.md - Self-healing agent → PostgreSQL: stages knowledge
core/agent.py - Self-healing agent → Milvus vector store: stages vectors
core/agent.py - RAG orchestration → PostgreSQL: saves answers
core/rag.py - RAG orchestration → Trace recording: records trace
core/rag.py - Knowledge health → PostgreSQL: checks
core/health_check.py - Knowledge health → Milvus vector store: checks
core/health_check.py - RAG evaluator → Hybrid retrieval: evaluates
core/evaluator.py - RAG evaluator → Self-healing agent: evaluates healing
core/evaluator.py