# bharathvarma008/prompt_runner architecture

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

- Interactive diagram: https://gitdiagram.com/bharathvarma008/prompt_runner
- Repository: https://github.com/bharathvarma008/prompt_runner

## Overview

##### Project Type and Purpose
- This project is a lightweight, command-line Python tool built to interact with OpenAI’s API. Its purpose is to perform various text analysis tasks such as resume skill extraction, skill gap analysis, sentiment analysis, summarization, and idea generation.
- The README explains that it is modelled around customizable prompts and emphasizes features related to text analysis tasks. It also mentions using logs and adjustable prompt configurations through the prompt manager.

##### Analyzing the File Structure
- At the top level, you have configuration and dependency files (.gitignore, README.md, requirements.txt) and the src folder containing the source code.
- Inside the src directory, the main architectural components are:
- config.py: Manages configuration settings and loads environment variables.
- logger.py: Handles logging (and as noted in the README, logs are stored in a “logs” directory even if not visible in the tree).
- main.py: The entry point which ties all the components together and executes the workflows.
- openai_client.py: Communicates with OpenAI’s API and wraps the API calls.
- prompt_manager.py: Contains and manages the customizable prompt templates used for different analysis tasks.
- The structure implies a modular design, where each module has a specific responsibility, ensuring separation of concerns.

##### Elements
- Clear labels for each module and component:
- Main Entry Point (main.py)
- Configuration Component (config.py)
- Logging Component (logger.py)
- Prompt Management (prompt_manager.py)
- OpenAI API Client (openai_client.py)
- External OpenAI API Service
- Logs Directory (as output storage)
- From main.py to config.py (showing configuration initialization)
- From main.py to logger.py (logging events)
- From main.py to prompt_manager.py (retrieval of prompt templates)
- From main.py to openai_client.py (making the external API call)
- From openai_client.py to the external OpenAI API (indicating request and response flow)
- From modules to logger.py to log events and responses
- Internal modules (contained in the src folder)
- External dependencies (OpenAI API, logs storage)

##### Final Advice
- Capturing the flow from user initiation (via main.py) to external API communication and back, showing how customization and logging are woven into the process.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Internal Modules"
        MAIN["CLI (main.py)"]:::internal
        CONFIG["Configuration (config.py)"]:::internal
        LOGGER["Logging (logger.py)"]:::internal
        PROMPT["Prompt Manager (prompt_manager.py)"]:::internal
        CLIENT["OpenAI Client (openai_client.py)"]:::internal
    end

    subgraph "External Dependencies"
        API["External OpenAI API"]:::external
        LOGS["Logs Storage"]:::external
    end

    MAIN -->|"initializes_configuration"| CONFIG
    MAIN -->|"initializes_logging"| LOGGER
    MAIN -->|"retrieves_prompt"| PROMPT
    MAIN -->|"sends_prompt"| CLIENT
    CLIENT -->|"api_request_response"| API
    CLIENT -->|"logs_api_call"| LOGGER
    MAIN -->|"records_activity"| LOGGER
    LOGGER -->|"stores_logs"| LOGS

    click MAIN "https://github.com/bharathvarma008/prompt_runner/blob/main/src/main.py"
    click CONFIG "https://github.com/bharathvarma008/prompt_runner/blob/main/src/config.py"
    click LOGGER "https://github.com/bharathvarma008/prompt_runner/blob/main/src/logger.py"
    click CLIENT "https://github.com/bharathvarma008/prompt_runner/blob/main/src/openai_client.py"
    click PROMPT "https://github.com/bharathvarma008/prompt_runner/blob/main/src/prompt_manager.py"

    classDef internal fill:#BBE1FA,stroke:#1D3557,stroke-width:2px;
    classDef external fill:#F4A261,stroke:#E76F51,stroke-width:2px;
```
