How ajay9345/skcet-rag works
Purpose and Entry Points
SKCET Knowledge Assistant is a document-grounded RAG assistant for answering questions about Sri Krishna College of Engineering and Technology. The interactive runtime starts at app.py; ingestion is run through ingest.py; retrieval/answering is available through query.py.
Runtime Composition
The application is a Python/Streamlit system with a persistent local Chroma vector database. It uses an embedding model to represent document chunks and Groq-hosted LLM generation for final responses. Dependencies are declared in requirements.txt; persisted Chroma state is under chroma_db/chroma.sqlite3 and chroma_db/f99740fd-0a99-487f-b78c-9ebe45745b99/.
Configuration and Provider Boundary
Central configuration should define model choices, credentials, collection/storage settings, and retrieval parameters in src/config.py. External-provider calls are isolated by responsibility: embedding generation in src/embeddings.py, LLM/Groq interaction in src/llm.py, and Chroma persistence/query operations in src/vector_store.py.
Offline Ingestion Pipeline
ingest.py coordinates the knowledge-base build process:
1. Source documents are acquired and normalized by src/loader.py.
2. Text is divided into retrieval-sized, likely overlapping chunks by src/chunker.py.
3. Each chunk is embedded through src/embeddings.py.
4. Vectors plus chunk metadata are written through src/vector_store.py into the local chroma_db/ store.
This is the key boundary between source content preparation and the query-serving path; it must be rerun to refresh indexed knowledge.
Retrieval and Generation Flow
At query time, query.py and the Streamlit interface invoke the RAG orchestration in src/rag.py. A user question is embedded, passed to src/retriever.py for nearest-neighbor lookup against Chroma, then paired with retrieved chunks as LLM context. src/llm.py sends the grounded prompt to Groq and returns the generated answer.
State and Memory
Persistent semantic knowledge resides in chroma_db/, including SQLite metadata and binary vector-index files. Conversational or request-scoped state is separated into src/memory.py, allowing the UI/RAG layer to retain dialogue context without conflating it with the document index.
Primary Control Boundaries
The UI (app.py) should remain a presentation/controller layer over the RAG service. src/rag.py is the application-level coordinator; retriever, vector-store, embedding, and LLM modules are replaceable infrastructure adapters. Document loading/chunking is intentionally isolated from serving, while Chroma and Groq are the material external storage and inference dependencies.
Main entry points: rag.py RAG coordinator · vector_store.py Chroma adapter · config.py Central configuration · embeddings.py Embedding adapter
Components 14
Entry Points
- Streamlit UI
app.py - Query entry point
query.py
Offline Ingestion
- Ingestion coordinator · Rebuilds the document index when source content changes.
ingest.py - Document loader
src/loader.py - Text chunker
src/chunker.py
RAG Serving
- RAG coordinator · Coordinates retrieval, context assembly, and answer generation.
src/rag.py - Conversation memory · Keeps dialogue context separate from the document index.
src/memory.py - Retriever
src/retriever.py
Infrastructure Adapters
- Central configuration · Defines models, credentials, storage, collection, and retrieval settings.
src/config.py - Embedding adapter
src/embeddings.py - Chroma adapter
src/vector_store.py - Groq LLM adapter
src/llm.py - Persistent Chroma store · Stores chunk metadata, SQLite state, and vector-index files.
chroma_db/chroma.sqlite3 - Groq
Connections 18
- Streamlit UI → RAG coordinator: asks questions
- Query entry point → RAG coordinator: asks questions
- Ingestion coordinator → Document loader: loads sources
- Document loader → Text chunker: normalized text
- Text chunker → Embedding adapter: chunks
- Embedding adapter → Chroma adapter: vectors and metadata
- Chroma adapter → Persistent Chroma store: writes index
- RAG coordinator → Conversation memory: reads and updates context
- RAG coordinator → Embedding adapter: embeds question
- RAG coordinator → Retriever: retrieves context
- Retriever → Chroma adapter: searches vectors
- Chroma adapter → Persistent Chroma store: queries index
- RAG coordinator → Groq LLM adapter: grounded prompt
- Groq LLM adapter → Groq: generation request
- Central configuration → Embedding adapter: model settings
- Central configuration → Chroma adapter: storage settings
- Central configuration → Retriever: retrieval settings
- Central configuration → Groq LLM adapter: credentials and model