How sumitnemade/ragify works
Purpose and Entry Points
Ragify is a Python framework for assembling LLM context from documents, APIs, databases, and real-time feeds. Its public integration point is ContextOrchestrator, exported from src/ragify/__init__.py and implemented in src/ragify/core.py. Applications register source adapters, then asynchronously request ranked, conflict-resolved context.
The primary runnable product integration is the Streamlit/OpenAI RAG example at examples/rag_chat_assistant/rag_chat_assistant.py.
Orchestration Layer
ContextOrchestrator coordinates the request lifecycle: source registration, concurrent retrieval, downstream scoring/fusion, and returned context assembly.
• src/ragify/core.py
• src/ragify/models.py
• src/ragify/exceptions.py
This is the boundary between an LLM application and Ragify internals; callers provide a query and retrieval limits rather than invoking engines directly.
Source Adapter Boundary
A shared source abstraction separates orchestration from source-specific ingestion/retrieval. Implementations cover local documents, HTTP APIs, databases, and streaming/live systems.
• src/ragify/sources/base.py
• src/ragify/sources/document.py
• src/ragify/sources/api.py
• src/ragify/sources/database.py
• src/ragify/sources/realtime.py
Sources are intended to be processed concurrently. External-system connectivity and format handling remain inside these adapters.
Context Evaluation and Fusion
The scoring engine evaluates candidate relevance, while the fusion engine combines source results and detects/resolves contradictions using signals such as authority and freshness.
• src/ragify/engines/scoring.py
• src/ragify/engines/fusion.py
• src/ragify/models.py
The key control flow is: retrieved source chunks → relevance ranking → conflict resolution/fusion → coherent context with source-aware information for the consuming LLM workflow.
Storage, Search, and Cache
Persistent context handling is isolated behind storage components. Vector search is a pluggable infrastructure boundary supporting vector database backends; caching reduces repeated retrieval work.
• src/ragify/engines/storage.py
• src/ragify/storage/vector_db.py
• src/ragify/storage/cache.py
The README identifies ChromaDB, Pinecone, Weaviate, and FAISS as supported vector-store targets, with Redis and Memcached as cache options. The chat example specifically uses FAISS.
Live Updates
Update processing is a separate engine, enabling refreshed context rather than treating ingestion as a one-time batch operation.
• src/ragify/engines/updates.py
• src/ragify/sources/realtime.py
Real-time adapters form the boundary for WebSocket, MQTT, and Kafka-style inputs; update handling should feed changed material back into storage/indexing and subsequent retrieval.
Security, Privacy, and Compliance
Security concerns are implemented as storage-adjacent controls rather than delegated to callers: encryption/key handling and access control, privacy classification/anonymization, and regulatory compliance workflows.
• src/ragify/storage/security.py
• src/ragify/storage/privacy.py
• src/ragify/storage/compliance.py
These controls are material for deployments handling sensitive context and should sit on data persistence and retrieval paths.
Runtime and Packaging
The project is a Python package using the src/ layout, with package metadata/install behavior in pyproject.toml and setup.py. Model artifacts for a random-forest-based capability are bundled under models/, indicating optional ML-backed scoring or ensemble behavior.
• pyproject.toml
• setup.py
• models/ml_model_random_forest.joblib
Main entry points: core.py ContextOrchestrator · base.py Source abstraction · storage.py Storage engine · scoring.py Scoring engine
Components 19
Public Integration
- RAG chat example · Runnable application integration.
examples/rag_chat_assistant/rag_chat_assistant.py - Package API · Exports the public orchestrator.
src/ragify/__init__.py - ContextOrchestrator · Registers sources and assembles requested context.
src/ragify/core.py - Error contracts
src/ragify/exceptions.py
Source Adapters
- Source abstraction · Isolates orchestration from external retrieval systems.
src/ragify/sources/base.py - Document source
src/ragify/sources/document.py - API source
src/ragify/sources/api.py - Database source
src/ragify/sources/database.py - Real-time source · Handles WebSocket, MQTT, and Kafka-style inputs.
src/ragify/sources/realtime.py
Context Processing
- Context models · Shared request, candidate, and context structures.
src/ragify/models.py - Scoring engine · Ranks retrieved candidate chunks.
src/ragify/engines/scoring.py - Fusion engine · Combines ranked results using authority and freshness.
src/ragify/engines/fusion.py - Update engine · Feeds changed live material back into persistence.
src/ragify/engines/updates.py - Random forest model · Optional ML-backed scoring capability.
models/ml_model_random_forest.joblib
Storage & Controls
- Storage engine · Coordinates persistent context handling.
src/ragify/engines/storage.py - Vector search · Supports FAISS and external vector database backends.
src/ragify/storage/vector_db.py - Retrieval cache · Avoids repeated retrieval work.
src/ragify/storage/cache.py - Data protection · Encryption, access control, privacy, and compliance controls.
src/ragify/storage/security.py
Other components
- Package metadata
pyproject.toml
Connections 21
- RAG chat example → Package API: uses
- Package API → ContextOrchestrator: exports
- ContextOrchestrator → Source abstraction: registers and queries
- Source abstraction → Document source: implemented by
- Source abstraction → API source: implemented by
- Source abstraction → Database source: implemented by
- Source abstraction → Real-time source: implemented by
- ContextOrchestrator → Retrieval cache: checks
- ContextOrchestrator → Scoring engine: ranks candidates
- Scoring engine → Fusion engine: ranked chunks
- Fusion engine → Context models: returns context
- ContextOrchestrator → Context models: accepts query and limits
- Scoring engine → Random forest model: optional model
- Storage engine → Vector search: indexes and searches
- Storage engine → Retrieval cache: manages cache
- Data protection → Storage engine: protects persistence
- ContextOrchestrator → Storage engine: retrieves context
- Real-time source → Update engine: live changes
- Update engine → Storage engine: refreshes index
- Package metadata → Package API: installs
- ContextOrchestrator → Error contracts: raises