How raju1998060745/docsynapse works
Main Components
• Ingestion Handler (Service-1): Even if its implementation isn’t in the file tree, the README explains that there is a component that monitors document storage (e.g., AWS S3) to detect new/updated files and initiates the embedding process.
• Processing & Storage (Service-2): The directory “service_2” has subdirectories for API endpoints (e.g., “api/user_routes.py”), configuration (with logging config), and core business logic (e.g., splitting text, embedding, exception handling, models, and retrieval logic). This service handles processing uploaded documents (splitting, embedding, adding metadata) and storing/updating them in the vector store.
• Query & Answer Engine (Service-3): The “service_3” folder appears to host the frontend application that handles user interactions. It contains an “app.py” alongside static assets (CSS, JavaScript) and HTML templates (chat, home, login, register). This service is responsible for user authentication and managing the query process—receiving user queries, retrieving relevant document chunks, and then forwarding requests to the LLM(s) using GROQ.
Relationships & Data Flows
• Users interact with the Presentation/UI layer in Service-3 (login, document upload, chat interface).
• Service-3 then communicates with the backend (likely via API calls) to perform queries.
• When a document is uploaded via the ingestion process (Service-1, even if not directly visible in the file tree), it is processed by Service-2:
• Service-2 takes care of splitting the document, generating embeddings via core processing (see “process.py” and “retrieve.py”), and storing metadata in the vector store.
• When a query is issued from Service-3, it retrieves the relevant document chunks that Service-2 stored and then calls an LLM (or multiple, via GROQ integration) to generate a contextual answer.
• External dependencies include:
• Cloud storage (e.g., AWS S3) for document files.
• A vector store (such as FAISS, Pinecone, or Weaviate) for embeddings.
• LLM providers and an underlying database (for user authentication and metadata).
Architectural Patterns & Design Principles
• Modular Service Architecture: The division into Service-1, Service-2, and Service-3 indicates separation of concerns, where file ingestion, processing, and query handling are performed as distinct modules.
• API Layer: Service-2 exposes APIs (as noted by the “service_2/api” folder) which can be used by the frontend (Service-3) or possibly by the ingestion handler.
• Core Logic Encapsulation: The “core” directory within Service-2 encapsulates the text processing and embedding logic alongside exception handling.
• Presentation Layer: Service-3 uses a combination of templates and static assets, suggesting a server-rendered frontend (which might be backed by a framework like Flask or FastAPI even though the README mentions React / Next.js).
Technologies & Frameworks
• Backend: FastAPI for API endpoints and service integration (as per the README).
• Frontend: While the README names React/Next.js, the file tree’s “service_3” structure (templates, static files) suggests a server-side rendered approach.
• External Services: AWS S3 for storage; vector stores (FAISS/Pinecone/Weaviate) for document embeddings; various LLMs integrated via a GROQ orchestrator.
• Supporting Libraries: Use of configuration and logging (see “logger_config.py”), along with core modules for processing and exception handling.