How srivenkateshmani/local-rag-system works
This is a local hybrid RAG application: users upload a PDF and ask questions; the app extracts and chunks the document, embeds and indexes its content, then combines semantic and BM25 search results before generating an answer with a local model. The graph emphasizes the Streamlit workflow and its separate pipeline stages. The README documents the OpenSearch and Ollama services and model; source excerpts show the app’s calls and the retrieval and generation implementations. The sample-script entry point and logging helper are omitted as secondary to the user workflow.
Main entry points: app.py Streamlit App · ingestion.py Document Indexing · opensearch_client.py OpenSearch Client · retrieval.py Semantic Search
Components 16
User Interface
- Streamlit App
app.py - PDF Upload
app.py - Answer Display
app.py
Document Ingestion
- Text Extraction
src/document_loader.py - Word Chunking
src/document_loader.py - Text Embeddings
src/embeddings.py - Document Indexing
src/ingestion.py - OpenSearch Client
src/opensearch_client.py
Hybrid Retrieval
- OpenSearch
- Semantic Search
src/retrieval.py - BM25 Search
src/retrieval.py - Rank Fusion
src/retrieval.py
Answer Generation
- Prompt Generation
src/generation.py - Ollama
- Llama 3.2
Other components
- User
Connections 19
- User → Streamlit App: uploads and asks
app.py - Streamlit App → PDF Upload: accepts PDF
app.py - Streamlit App → Text Extraction: loads PDF
app.py - Streamlit App → Word Chunking: chunks text
app.py - Streamlit App → Text Embeddings: embeds chunks and query
app.py - Streamlit App → OpenSearch Client: creates client and index
app.py - Streamlit App → Document Indexing: indexes documents
app.py - Document Indexing → OpenSearch: writes documents
src/ingestion.py - OpenSearch Client → OpenSearch: connects and creates index
src/opensearch_client.py - Streamlit App → Semantic Search: requests vector search
app.py - Streamlit App → BM25 Search: requests keyword search
app.py - Semantic Search → OpenSearch: searches vectors
src/retrieval.py - BM25 Search → OpenSearch: searches text
src/retrieval.py - Streamlit App → Rank Fusion: fuses search results
app.py - Streamlit App → Prompt Generation: generates answer
app.py - Prompt Generation → Ollama: sends prompt
src/generation.py - Ollama → Llama 3.2: runs model
README.md - Streamlit App → Answer Display: displays answer
app.py - Answer Display → User: returns answer
app.py