# takuyakubo/slide-generator-langchain architecture

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

- Interactive diagram: https://gitdiagram.com/takuyakubo/slide-generator-langchain
- Repository: https://github.com/takuyakubo/slide-generator-langchain

## Overview

##### Project Overview and Main Components
- Project Type: This is a tooling application that generates slide presentations (in HTML) from images. It leverages LangChain for document processing and LangGraph for workflow management. It is essentially a full-stack-like backend pipeline with representation in generated HTML along with interactive JavaScript controls.
- Core Functionality: The tool performs multi-stage image analysis and content extraction followed by slide generation and HTML conversion.

##### Identifying the Components
a. Image Processing Module:
- Represents the initial "ProcessImages" stage.
- Responsible for analyzing input images and extracting content.
- Dependencies: PIL for image processing; external API keys for LLM access like Google Gemini or OpenAI.
b. Structure Extraction Module:
- Handles the extraction of key structures and content from analyzed images.
- Identified in the README as part of the "ExtractContentStructure" stage.
c. Slide Outline Generator:
- Generates a high-level outline for the slides.
- Represents the "GenerateSlideOutline" functionality.
d. Detailed Slide Generation:
- Constructs detailed slide content based on the previously determined outline.
- Represents the "GenerateDetailedSlides" component.
e. HTML Conversion Module:
- Transforms generated content into a structured HTML presentation using customizable templates.
- Loaded templates (default.html, modern.html in the src/templates directory) should be included in this component.
f. Workflow Manager:
- This component ties the steps together. It is backed by LangGraph’s workflow management and LangChain for document handling.
- The main workflow orchestration is defined in files like workflow.py, workflow_base.py, workflow_nodes.py, and workflow_states.py.
g. External Dependencies:
- External APIs and the LLM providers (Google Gemini API key or OpenAI API key) should be identified.
- The project’s reliance on libraries such as langchain, langgraph, langchain-google-genai, pydantic, and PIL.

##### Illustrating Relationships and Data Flow
- “Structure Extraction” to “Slide Outline Generator”, then to “Detailed Slide Generation”, and finally point to “HTML Conversion Module.”
- External calls to the LLM services during the stages where language models generate outlines or detailed content.
- If desired, illustrate the environment configuration (via .env file loading) as an initialization step that configures API keys.

##### Architectural Patterns and Design Principles
- The project uses a pipeline architecture to process inputs step-by-step. Represent this sequential flow distinctly.
- Separation between “processing” (backend logic) and “presentation” (final HTML output with interactive JavaScript features).
- Modularity: each stage (processing, extraction, generation, conversion) is well encapsulated, facilitating potential future enhancements like adding document processing functionality.

## Diagram (Mermaid)

```mermaid
graph TD
    imageFiles["Image Files"]:::input
    imageProcessing["ProcessImages (Image Processing Module)"]:::pipeline
    structureExtraction["ExtractContentStructure (Structure Extraction Module)"]:::pipeline
    slideOutline["GenerateSlideOutline (Slide Outline Generator)"]:::pipeline
    detailedSlides["GenerateDetailedSlides (Detailed Slide Generation)"]:::pipeline
    defaultTemplate["Default Template"]:::template
    modernTemplate["Modern Template"]:::template
    finalHTML["Final HTML Presentation"]:::pipeline
    workflowManager["Workflow Manager"]:::orchestration
    llmServices["LLM Services"]:::external
    configDeps["Deployment & Config"]:::external

    %% Main Processing Pipeline
    imageFiles --> imageProcessing
    imageProcessing --> structureExtraction
    structureExtraction --> slideOutline
    slideOutline --> detailedSlides
    detailedSlides --> defaultTemplate
    detailedSlides --> modernTemplate
    defaultTemplate --> finalHTML
    modernTemplate --> finalHTML

    %% Workflow Manager orchestrates the pipeline
    workflowManager --> imageProcessing
    workflowManager --> structureExtraction
    workflowManager --> slideOutline
    workflowManager --> detailedSlides
    workflowManager --> finalHTML

    %% External integrations and configuration
    configDeps --> workflowManager
    llmServices --> slideOutline
    llmServices --> detailedSlides

    %% Click Events
    click imageProcessing "https://github.com/takuyakubo/slide-generator-langchain/blob/main/src/utils.py"
    click structureExtraction "https://github.com/takuyakubo/slide-generator-langchain/blob/main/src/workflow_nodes.py"
    click slideOutline "https://github.com/takuyakubo/slide-generator-langchain/blob/main/src/workflow_nodes.py"
    click detailedSlides "https://github.com/takuyakubo/slide-generator-langchain/blob/main/src/workflow_nodes.py"
    click defaultTemplate "https://github.com/takuyakubo/slide-generator-langchain/blob/main/src/templates/default.html"
    click modernTemplate "https://github.com/takuyakubo/slide-generator-langchain/blob/main/src/templates/modern.html"
    click workflowManager "https://github.com/takuyakubo/slide-generator-langchain/blob/main/src/workflow.py"
    click workflowManager "https://github.com/takuyakubo/slide-generator-langchain/blob/main/src/workflow_base.py"
    click workflowManager "https://github.com/takuyakubo/slide-generator-langchain/blob/main/src/workflow_nodes.py"
    click workflowManager "https://github.com/takuyakubo/slide-generator-langchain/blob/main/src/workflow_states.py"
    click configDeps "https://github.com/takuyakubo/slide-generator-langchain/blob/main/.env.example"
    click configDeps "https://github.com/takuyakubo/slide-generator-langchain/blob/main/requirements.txt"

    %% Styles
    classDef input fill:#d1c4e9,stroke:#512da8,stroke-width:2px;
    classDef pipeline fill:#c7e9c0,stroke:#2f6627,stroke-width:2px;
    classDef orchestration fill:#fef3bd,stroke:#a18700,stroke-width:2px;
    classDef external fill:#fde2e4,stroke:#a70019,stroke-width:2px;
    classDef template fill:#e0f7fa,stroke:#006064,stroke-width:2px;
```
