How dodarshancode/rag_now works
Project type and purpose
• This is a production-ready, full-stack offline RAG (Retrieval-Augmented Generation) system.
• Purpose: take NL descriptions, retrieve relevant docs/examples, run ML inference on local GPU cluster, validate output DSL via py-osc2, and serve via a modern Web UI with metrics.
File structure
• Top level
• app.py – Flask API entry point
• config/openscenario_config.yaml – system settings (paths, GPU count, models)
• requirements.txt, setup.sh – install/runtime scripts
• src/core/ – modular pipeline components (config_manager, cache_manager, document_processor, retrieval_engine, vector_store, model_inference, osc_validator)
• src/openscenario_rag_system.py – orchestrator tying all core modules
• templates/index.html – single-page UI
• Implicit directories (created at runtime)
• data/{models,docs,examples,processed,embeddings,cache} – persistent storage
• logs/ – logs
• Optional services: Redis (production caching), Prometheus (metrics)
README for additional insights
• Offline-only: all models, docs, embeddings are on local disk
• Multi-GPU, high-performance: FAISS on GPU, mixed precision, model sharding
• Hybrid retrieval: dense (FAISS) + sparse (BM25)
• Multi-model inference engine with automatic switching
• Validation pipeline with py-osc2, retry logic
• Web UI + Flask API + Prometheus health/stats endpoints
Details without overthinking
• Break the monolith into its 8–10 logical components
• Both control flow (HTTP, function calls) and data flow (documents, embeddings, model weights)
• Don’t omit the caching and validation loops—they’re core to performance and correctness
• Configuration driving paths (config_manager reads YAML → sets model paths/GPU count)