# iamarunbrahma/vision-parse architecture

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

- Interactive diagram: https://gitdiagram.com/iamarunbrahma/vision-parse
- Repository: https://github.com/iamarunbrahma/vision-parse

## Overview

##### Main Components

a) Core Components:
- PDF Input Handler
- Vision Language Model Interface Layer
- Markdown Generation Engine
- Concurrent Processing Manager
- Configuration Manager

b) Model Integration Components:
- OpenAI/Azure OpenAI Connector
- Google Gemini Connector
- Ollama Local Model Connector
- DeepSeek Connector

**[Input Layer]**
- ↓
**[Processing Layer]**
- ↓
**[Model Interface Layer]**
- ↓
**[Output Layer]**

##### Specific Component Details

Input Layer:
- An image processing component (supports URL and base64 modes)

Processing Layer:
- A "Configuration Manager" for handling various model settings
- A "Concurrent Processing Manager" for parallel page processing

Model Interface Layer:
- OpenAI/Azure OpenAI
- Google Gemini
- Ollama Local Models
- DeepSeek

Output Layer:
- A Markdown Formatting Engine
- A Results Aggregator for multi-page documents

##### Additional Elements

- Configuration options (temperature, top_p, etc.)
- Template files (*.j2 files in src/vision_parse/)
- Utility functions (utils.py)

##### Notes for Implementation

- The modular nature of the model integrations
- The flexibility in configuration
- The parallel processing capabilities
- The template-based approach for prompts

##### Technical Details

- Supported Python versions (>=3.9)
- Model-specific configuration blocks
- Image processing modes (URL, base64)
- Performance optimization options

This system design should help developers understand both the high-level architecture and the specific implementation details of Vision Parse, making it easier to contribute to or extend the project.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Input
        PDF[PDF Document]
        IMG[Image Processing]:::core
    end

    subgraph Processing
        PARSER[Parser Core]:::core
        CONFIG[Configuration Manager]:::util
        CONPROC[Concurrent Processing Manager]:::core
    end

    subgraph "Model Interface"
        MODELFACTORY[Model Factory]:::core
        OPENAI[OpenAI/Azure OpenAI]:::model
        GEMINI[Google Gemini]:::model
        OLLAMA[Ollama Local Models]:::model
        DEEPSEEK[DeepSeek]:::model
    end

    subgraph Output
        MARKDOWN[Markdown Formatting Engine]:::core
        RESULTS[Results Aggregator]:::core
    end

    %% Connections
    PDF --> IMG
    IMG --> PARSER
    PARSER --> CONPROC
    CONFIG --> PARSER
    CONPROC --> MODELFACTORY
    MODELFACTORY --> OPENAI & GEMINI & OLLAMA & DEEPSEEK
    OPENAI & GEMINI & OLLAMA & DEEPSEEK --> MARKDOWN
    MARKDOWN --> RESULTS

    %% Click Events
    click IMG "https://github.com/iamarunbrahma/vision-parse/blob/main/src/vision_parse/image_analysis.j2"
    click PARSER "https://github.com/iamarunbrahma/vision-parse/blob/main/src/vision_parse/parser.py"
    click CONFIG "https://github.com/iamarunbrahma/vision-parse/blob/main/src/vision_parse/constants.py"
    click MODELFACTORY "https://github.com/iamarunbrahma/vision-parse/blob/main/src/vision_parse/llm.py"
    click MARKDOWN "https://github.com/iamarunbrahma/vision-parse/blob/main/src/vision_parse/markdown_prompt.j2"
    click OPENAI "https://github.com/iamarunbrahma/vision-parse/blob/main/docs/examples/openai_demo.ipynb"
    click GEMINI "https://github.com/iamarunbrahma/vision-parse/blob/main/docs/examples/gemini_demo.ipynb"
    click OLLAMA "https://github.com/iamarunbrahma/vision-parse/blob/main/docs/examples/ollama_demo.ipynb"
    click DEEPSEEK "https://github.com/iamarunbrahma/vision-parse/blob/main/docs/examples/deepseek_demo.ipynb"

    %% Styles
    classDef core fill:#2374ab
    classDef model fill:#57a773
    classDef util fill:#ffc857
    classDef default fill:#ddd

    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[Model Integrations]:::model
        L3[Utility Components]:::util
        L4[Basic Components]:::default
    end
```
