# willdupree90/findingedoc architecture

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

- Interactive diagram: https://gitdiagram.com/willdupree90/findingedoc
- Repository: https://github.com/willdupree90/findingedoc

## Overview

##### Project Type and Purpose
- Project Type: This is a full-stack application with a containerized multi-service architecture.
- Purpose: Building a chatbot that helps developers explore codebases. It leverages generative AI (via OpenAI’s API), constructs knowledge graphs (stored in Neo4j), and uses Retrieval-Augmented Generation (RAG) to answer code-related queries.

##### File Structure
- Top-level Files & Directories: Notice the presence of Dockerfiles (for Neo4j and Python) and a docker-compose.yaml file which indicate containerized services.
- Directories:
- “src/edoc”: Contains application code including the chatbot entry point.
- “src/edoc/chatbot_components” and “src/edoc/gpt_helpers”: Responsible for handling conversation logic and managing interactions with GPT.
- “src/edoc/kg_construction”: Handles the building and processing of the knowledge graph (KG); includes components for bulk loading and file system processing.
- “src/edoc/rag_components”: Deals with retrieval and response generation through both structured and unstructured retrievers.
- “notebooks”: Contains experimental Jupyter notebooks which serve as prototypes and testing scripts, offering insights into prototyping of KG creation and RAG responses.
- Configuration/Environment: The presence of a Docker setup (docker-compose.yaml, Dockerfiles) and environment variables indicate a strong separation of concerns between the runtime environment (containers), development/testing (notebooks), and production code (in src/edoc).

##### Synthesize Information from the README
- The README explains two primary methods of interacting with the system:
- Running the system via Docker (with both a Neo4j service and a Python Gradio App).
- Running the application locally by activating a Python virtual environment.
- Key functionalities include setting up API keys, uploading codebase archives to build a knowledge graph, asking questions via a Gradio interface, and optionally clearing existing graph data.
- It explicitly mentions the use of generative AI and RAG for processing developer queries.

##### Main Components
a. Frontend/Interface:
- Gradio Chatbot Interface: Provides user interaction, enabling file uploads, API key input, querying, etc.
b. Backend/Application Logic:
- Chatbot Entry Point (src/edoc/chatbot.py): Routes incoming requests, handles logic, and coordinates with underlying modules.
- Chatbot Components: Handles conversation flow and potentially preprocessing or postprocessing of data.
- GPT Helpers: Manages connections to the OpenAI APIs and handles generative AI calls.
- KG Construction: Handles the ingestion of code project data, processes file systems, builds/updates the knowledge graph via utilities and bulk loading.
- RAG Components: Incorporates both structured and unstructured retrievers, and a responder component that synthesizes the final output for queries.
c. Database/External Service:
- Neo4j Database: Serves as the persistent store for the knowledge graph, connected via Docker.
d. Infrastructure/Containers:
- Docker Environment: Manages separate containers for Neo4j (as specified in Dockerfile.neo4j) and the Python application (Dockerfile.python).
- docker-compose: Orchestrates the different services and ensures they communicate appropriately.

## Diagram (Mermaid)

```mermaid
flowchart TD
    DO["Docker Environment"]:::container

    subgraph "Containerized Services"
        subgraph "Python Container"
            CS["Chatbot Service"]:::frontend
            CC["Chatbot Components"]:::module
            GH["GPT Helpers"]:::external
            KG["Knowledge Graph Construction"]:::module
            RAG["RAG Modules"]:::module
        end
        subgraph "Neo4j Container"
            NDB["Neo4j Database"]:::database
        end
    end

    OAI["OpenAI API"]:::external
    EXP["Experimental Notebooks"]:::prototype

    %% Deployment connections
    DO -->|"deploys"| CS
    DO -->|"deploys"| NDB

    %% Internal interactions within the Python container
    CS -->|"triggers"| CC
    CS -->|"invokes"| GH
    GH -->|"calls"| OAI
    OAI -->|"responds"| GH
    CS -->|"initiates"| KG
    KG -->|"updates"| NDB
    KG -->|"feeds"| RAG
    RAG -->|"responds"| CS

    %% Experimental insights for KG construction
    EXP -->|"prototypingInsights"| KG

    %% Styles
    classDef frontend fill:#f9c,stroke:#333,stroke-width:2px;
    classDef module fill:#ccf,stroke:#333,stroke-width:2px;
    classDef external fill:#cfc,stroke:#333,stroke-width:2px;
    classDef database fill:#cff,stroke:#333,stroke-width:2px;
    classDef container fill:#fc9,stroke:#333,stroke-width:2px;
    classDef prototype fill:#ffd,stroke:#333,stroke-width:2px;

    %% Click Events
    click CS "https://github.com/willdupree90/findingedoc/blob/main/src/edoc/chatbot.py"
    click CC "https://github.com/willdupree90/findingedoc/tree/main/src/edoc/chatbot_components/"
    click GH "https://github.com/willdupree90/findingedoc/tree/main/src/edoc/gpt_helpers/"
    click KG "https://github.com/willdupree90/findingedoc/tree/main/src/edoc/kg_construction/"
    click RAG "https://github.com/willdupree90/findingedoc/tree/main/src/edoc/rag_components/"
    click NDB "https://github.com/willdupree90/findingedoc/blob/main/Dockerfile.neo4j"
    click DO "https://github.com/willdupree90/findingedoc/blob/main/docker-compose.yaml"
    click EXP "https://github.com/willdupree90/findingedoc/tree/main/notebooks/experimental/"
```
