How vadimsiminenco/pad works
This is a Unity documentation RAG application. Its user path is a question through language validation, semantic retrieval, evidence filtering/reranking, and cited answer generation; separate commands acquire documentation, preprocess and chunk it, then embed and index it. The tree and sampled files show these stages and several call relationships, but much of the command wiring and preprocessing/indexing implementation was not excerpted, so those links are omitted or marked unverified.
Main entry points: Program.cs RAG CLI · RagQueryService.cs RAG query service · IndexingRunner.cs Embedding indexer · SemanticSearchService.cs Semantic search
Components 24
Document ingestion
- RAG CLI
lab1/src/UnityDocsRag.Ingestion/Program.cs - API host
lab1/src/UnityDocsRag.Api/Program.cs - Documentation fetch
lab1/src/UnityDocsRag.Ingestion/IngestionRunner.cs - Document cache
lab1/src/UnityDocsRag.Infrastructure/Documentation
Processing and indexing
- HTML preprocessing
lab1/src/UnityDocsRag.Infrastructure/Preprocessing/UnityHtmlDocumentPreprocessor.cs - Heading-aware chunks
lab1/src/UnityDocsRag.Infrastructure/Preprocessing/HeadingAwareDocumentChunker.cs - Processing artifacts
lab1/src/UnityDocsRag.Infrastructure/Preprocessing/FileProcessingArtifactStore.cs - Artifact reader
lab1/src/UnityDocsRag.Infrastructure/Preprocessing/ProcessingArtifactReader.cs - Embedding indexer
lab1/src/UnityDocsRag.Ingestion/IndexingRunner.cs
Retrieval and answering
- Ask runner
lab1/src/UnityDocsRag.Ingestion/AskRunner.cs - RAG query service
lab1/src/UnityDocsRag.Infrastructure/Query/RagQueryService.cs - Language detector
lab1/src/UnityDocsRag.Infrastructure/Query/RussianEnglishLanguageDetector.cs - Semantic search
lab1/src/UnityDocsRag.Infrastructure/Retrieval/SemanticSearchService.cs - Vector retriever
lab1/src/UnityDocsRag.Infrastructure/Retrieval/PostgresVectorRetriever.cs - Ollama reranker
lab1/src/UnityDocsRag.Infrastructure/Reranking/OllamaReranker.cs - Answer generator
lab1/src/UnityDocsRag.Infrastructure/Generation/OllamaAnswerGenerator.cs - Answer prompt builder
lab1/src/UnityDocsRag.Infrastructure/Generation/RagPromptBuilder.cs - RAG evaluation
lab1/src/UnityDocsRag.Evaluation/EvaluationMetrics.cs
Infrastructure
- Ollama embeddings
lab1/src/UnityDocsRag.Infrastructure/Embeddings/OllamaEmbeddingProvider.cs - Vector store
lab1/src/UnityDocsRag.Infrastructure/Storage/PostgresVectorStore.cs
Other components
- Questioner
- Unity docs source
- Ollama
- PostgreSQL pgvector
Connections 26
- RAG CLI → Documentation fetch: runs ingestion
lab1/src/UnityDocsRag.Ingestion/Program.cs - Unity docs source → Documentation fetch: provides documents
- Documentation fetch → Document cache: saves changes
lab1/src/UnityDocsRag.Ingestion/IngestionRunner.cs - RAG CLI → HTML preprocessing: runs processing
lab1/src/UnityDocsRag.Ingestion/Program.cs - HTML preprocessing → Heading-aware chunks: prepares chunks
- RAG CLI → Processing artifacts: stores artifacts
lab1/src/UnityDocsRag.Ingestion/Program.cs - Artifact reader → Processing artifacts: reads artifacts
lab1/src/UnityDocsRag.Infrastructure/Preprocessing/ProcessingArtifactReader.cs - RAG CLI → Embedding indexer: runs indexing
lab1/src/UnityDocsRag.Ingestion/Program.cs - Embedding indexer → Ollama embeddings: creates embeddings
- Embedding indexer → Vector store: writes vectors
- Ollama embeddings → Ollama: requests vectors
lab1/src/UnityDocsRag.Infrastructure/Embeddings/OllamaEmbeddingProvider.cs - Vector store → PostgreSQL pgvector: persists vectors
lab1/src/UnityDocsRag.Infrastructure/Storage/PostgresVectorStore.cs - Questioner → RAG CLI: asks question
- RAG CLI → Ask runner: runs ask
lab1/src/UnityDocsRag.Ingestion/Program.cs - Ask runner → RAG query service: dispatches query
- RAG query service → Language detector: detects language
lab1/src/UnityDocsRag.Infrastructure/Query/RagQueryService.cs - RAG query service → Semantic search: searches evidence
lab1/src/UnityDocsRag.Infrastructure/Query/RagQueryService.cs - Semantic search → Ollama embeddings: embeds query
lab1/src/UnityDocsRag.Infrastructure/Retrieval/SemanticSearchService.cs - Semantic search → Vector retriever: retrieves chunks
lab1/src/UnityDocsRag.Infrastructure/Retrieval/SemanticSearchService.cs - Vector retriever → PostgreSQL pgvector: queries vectors
lab1/src/UnityDocsRag.Infrastructure/Retrieval/PostgresVectorRetriever.cs - RAG query service → Ollama reranker: reranks candidates
lab1/src/UnityDocsRag.Infrastructure/Query/RagQueryService.cs - RAG query service → Answer generator: generates answer
lab1/src/UnityDocsRag.Infrastructure/Query/RagQueryService.cs - Answer generator → Answer prompt builder: builds prompt
lab1/src/UnityDocsRag.Infrastructure/Generation/OllamaAnswerGenerator.cs - Answer generator → Ollama: requests completion
- Questioner → API host: submits request
- RAG evaluation → RAG query service: evaluates answers