How swethaguru-snsihub/agenticai_workshop works
Project type and purpose
• This “Conversational AI” folder is a Python-based Retrieval-Augmented Generation (RAG) chat system.
• It ingests domain data (JSON files), indexes them in a FAISS vector store, and uses an LLM (wrapped in gemini_model.py) to answer user queries with retrieved context.
File structure
• Top-level script:
• main.py – orchestrates the end-to-end flow (load data, build or load index, handle queries).
• Data sources:
• datas/koramangala_stores.json and datas/stores_data.json – JSON knowledge bases.
• Vector index:
• faiss_index/index.faiss + index.pkl – serialized FAISS index & metadata.
• Models:
• models/gemini_model.py – wraps the LLM (e.g., OpenAI, Vertex AI) with predict/generation logic.
• Services (business logic):
• services/vector_store_service.py – create embeddings, persist/load the FAISS index.
• services/rag_utils.py – assemble prompt with retrieved docs.
• services/langgraph_agent.py – manage agent loop, tool invocation patterns.
• services/stores.py – data-loader for JSON store files.
• Config/dependencies:
• requirements.txt – Python packages (e.g., faiss-cpu, langchain, openai).
Key architectural insights from README (assumed)
• The system uses RAG: retrieval from vector store plus LLM generation.
• Modular services separate concerns: data loading, indexing, retrieval, prompting, LLM inference.
a. Main components:
1. User Interface (CLI or API endpoint in main.py)
2. Data Layer
– JSON Knowledge Bases (datas/…)
– FAISS Vector Store (faiss_index/…)
3. Service Layer
– Data Loader Service (stores.py)
– Vector Store Service (vector_store_service.py)
– RAG Utilities (rag_utils.py)
– Agent Controller (langgraph_agent.py)
4. Model Layer
– LLM Wrapper (gemini_model.py)
5. (Optional) Logging/Monitoring or Config (not present but can be shown)
b. Relationships & interactions:
• The UI calls the Agent Controller.
• The Agent invokes Vector Store Service to retrieve top-k docs.
• RAG Utilities combine docs + user query into prompt.
• LLM Wrapper is invoked with prompt → generates answer.
• Answer returned to UI.
• On first run or data-update, Data Loader Service parses JSON → Vector Store Service builds or refreshes FAISS index.
c. Architectural patterns & principles:
– Layered architecture: Interface → Services → Models → Data
– Single responsibility per module (data loading vs. indexing vs. prompting vs. inference)
– Separation of concerns: index persistence decoupled from model inference
d. Key technologies & libraries:
– FAISS for vector-based retrieval
– An LLM API (via gemini_model.py)
– JSON as the knowledge-base format
– Python packaging (requirements.txt)