# aashiq-04/ai-powered-reseach-assistant-tool architecture

> Architecture diagram of the GitHub repository aashiq-04/ai-powered-reseach-assistant-tool, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aashiq-04/ai-powered-reseach-assistant-tool
- Repository: https://github.com/aashiq-04/ai-powered-reseach-assistant-tool

## Overview

##### Main Components
- Backend Service: Built with FastAPI and located in the “backend” directory. It includes the main API (app.py) which exposes endpoints for uploading PDFs (/upload), embedding text from PDFs (/embed), and querying the embedded documents (/query). Additionally, the backend uses libraries such as LangChain, FAISS, and PyPDF2 to process the PDFs.
- Frontend Application: Found within the “pdf-query” directory. It is a ReactJS single-page application that offers a user interface for uploading documents, querying the data, and displaying responses.
- PDF Processing Module: Under “backend/ragPdf”, there are various scripts for PDF handling and related utilities. While some of these may be auxiliary tools (like PDF processing tools or test utilities), they show that PDF file manipulation is a core element.
- Data Storage / Vector Store: Although not explicitly a separate service or folder, the backend utilizes a vector store (built likely via FAISS) internally to keep track of embedded document representations.
- Integration Points: The communication between the frontend and backend (possibly enabled by CORS) and any configuration for external services like the Groq API (configured in the .env file) should also be represented.

##### Component Relationships
- The Frontend (ReactJS) issues HTTP requests to the FastAPI server.
- The FastAPI backend contains endpoints:
- The /upload endpoint handles file upload requests.
- The /embed endpoint processes the PDFs, splits the content, and embeds the text into a vector store.
- The /query endpoint accepts natural language queries and returns responses based on the vector search.
- The PDF Processing and Embedding consists of interaction between PDF parsing libraries (PyPDF2), text embedding (using LangChain), and vector indexing using FAISS.

##### Technologies and Frameworks to Highlight
- FastAPI for the backend service.
- ReactJS for building the UI in the frontend.
- LangChain for text embedding and managing language model workflows.
- FAISS for efficient vector similarity searches.
- PyPDF2 for processing PDF documents.
- Environment management via Python virtual environments and Node.js (npm) for React.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend Application (ReactJS)"
        FE1("Home Component"):::frontend
        FE2("UploadPDF Component"):::frontend
        FE3("QueryPDF Component"):::frontend
        FE4("API Service Layer"):::frontend
    end

    subgraph "Backend Service (FastAPI)"
        BE1("API Endpoint: POST /upload"):::backend
        BE2("API Endpoint: POST /embed"):::backend
        BE3("API Endpoint: POST /query"):::backend
        subgraph "PDF Processing Module"
            PP1("PDF Parsing (PyPDF2)"):::backend
            PP2("Text Embedding (LangChain)"):::backend
            PP3("PDF Splitting/Utilities"):::backend
        end
        VS("Vector Store (FAISS)"):::datastore
    end

    EC("External Configurations (.env, Groq_API)"):::external

    FE4 -->|"call_upload"| BE1
    FE4 -->|"call_embed"| BE2
    FE4 -->|"call_query"| BE3

    BE1 -->|"process_pdf"| PP1
    BE2 -->|"embed_text"| PP2
    BE3 -->|"vector_lookup"| VS

    PP1 -->|"prepare_text"| PP2
    PP2 -->|"utility_ops"| PP3

    EC --- BE1
    EC --- BE2
    EC --- BE3

    classDef frontend fill:#FFEDB8,stroke:#333,stroke-width:2px;
    classDef backend fill:#B8D1FF,stroke:#333,stroke-width:2px;
    classDef datastore fill:#C8E6C9,stroke:#333,stroke-width:2px;
    classDef external fill:#F9C0C0,stroke:#333,stroke-width:2px;

    click BE1 "https://github.com/aashiq-04/ai-powered-reseach-assistant-tool/blob/main/backend/app.py"
    click PP1 "https://github.com/aashiq-04/ai-powered-reseach-assistant-tool/tree/main/backend/ragPdf"
    click FE4 "https://github.com/aashiq-04/ai-powered-reseach-assistant-tool/tree/main/pdf-query/src/services"
    click FE2 "https://github.com/aashiq-04/ai-powered-reseach-assistant-tool/tree/main/pdf-query/src/components"
    click FE3 "https://github.com/aashiq-04/ai-powered-reseach-assistant-tool/tree/main/pdf-query/src/components"
```
