# ivanfioravanti/prompt-eng-ollama-interactive-tutorial architecture

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

- Interactive diagram: https://gitdiagram.com/ivanfioravanti/prompt-eng-ollama-interactive-tutorial
- Repository: https://github.com/ivanfioravanti/prompt-eng-ollama-interactive-tutorial

## Overview

##### Project type and purpose
- This repository is an interactive, educational tutorial for prompt engineering using Ollama’s Qwen models.
- It is not a traditional web or microservice application but a self‑contained set of Jupyter notebooks (the “course modules”) plus a small helper library (hints.py) that demonstrate best practices in prompt writing and allow you to experiment live with the Ollama model.

##### File structure
- Top‑level files:
- README.md – course overview and structure
- LICENSE, .gitignore – repo meta
- hints.py – Python helper utilities shared by notebooks
- Jupyter notebooks (00_… through 10.2_…):
- 00_Tutorial_How‑To.ipynb – orientation to the environment
- 01_… to 09_… – nine sequential “chapters,” each with lessons and playground exercises
- 10.1_Appendix_… and 10.2_Appendix_… – chaining prompts and tool‑use extensions

##### README for additional insights
- The README outlines a linear, chapter‑based progression from beginner to advanced techniques, with each notebook containing an “Example Playground” for live experimentation.
- It specifies the external dependency on the Ollama Qwen 2.5:14B (or 7B) model.

a. Main components
1. Developer/User Environment
– Jupyter Notebook interface (local or remote)
– Python runtime
2. Course Modules
– Notebook files (00_… → 10.2_…) containing lesson content + code cells
– Playground cells that invoke prompt runs
3. Support Library
– hints.py (common utility functions, e.g., formatting prompts or parsing responses)
4. Ollama Model Service
– Local/remote Qwen 2.5 model invoked via CLI or Python binding
b. Relationships and interactions
– Notebooks import hints.py for shared functions
– Code cells call the Ollama client (e.g., `ollama run qwen2.5:14b …`)
– Ollama service returns model outputs, which are rendered in the notebook
– User reads prompts, edits them, re‑runs cells to observe changes
c. Architectural patterns and design principles
– Separation of content (markdown explanations) vs. executable code
– Single source of truth for helper logic in hints.py (DRY principle)
– Linear progression of modules, with appendices for advanced topics
d. Key technologies, frameworks, and libraries
– Jupyter Notebook
– Python 3.x
– Ollama CLI or Python binding for Qwen 2.5
– Git for version control

##### Elements
- **Clear labels**:
- “User / Developer Environment”
- “Jupyter Notebook Server”
- “Lesson Notebooks (01…09)”
- “Appendix Notebooks (10.1, 10.2)”
- “hints.py Utility Module”
- “Ollama Qwen Model Service”
- Notebooks → hints.py (dependency)
- Notebooks → Ollama service (prompt execution)
- Ollama → Notebooks (response rendering)
- Utility code (hints.py) in another

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Developer Environment and Repo Metadata
    subgraph "Developer/User Environment"
        direction TB
        DEV["Developer/User Environment"]:::env
        README["README.md"]:::metadata
        LICENSE["LICENSE"]:::metadata
        GITIGNORE[".gitignore"]:::metadata
    end

    DEV -->|clones repo| README
    DEV -->|clones repo| LICENSE
    DEV -->|clones repo| GITIGNORE

    %% Jupyter Server
    JNB["Jupyter Notebook Server"]:::infra
    DEV -->|launches| JNB

    %% Course Modules
    subgraph "Course Modules"
        direction TB
        N00["00_Tutorial_How-To.ipynb"]:::course
        N01["01_Basic_Prompt_Structure.ipynb"]:::course
        N02["02_Being_Clear_and_Direct.ipynb"]:::course
        N03["03_Assigning_Roles_Role_Prompting.ipynb"]:::course
        N04["04_Separating_Data_and_Instructions.ipynb"]:::course
        N05["05_Formatting_Output_and_Speaking_for_Claude.ipynb"]:::course
        N06["06_Precognition_Thinking_Step_by_Step.ipynb"]:::course
        N07["07_Using_Examples_Few-Shot_Prompting.ipynb"]:::course
        N08["08_Avoiding_Hallucinations.ipynb"]:::course
        N09["09_Complex_Prompts_from_Scratch.ipynb"]:::course
        N10A["10.1_Appendix_Chaining Prompts.ipynb"]:::course
        N10B["10.2_Appendix_Tool Use.ipynb"]:::course
    end

    JNB --> N00
    N00 --> N01 --> N02 --> N03 --> N04 --> N05 --> N06 --> N07 --> N08 --> N09 --> N10A --> N10B

    %% Utility Module
    subgraph "Support Library"
        direction TB
        HINTS["hints.py"]:::utility
    end

    N00 -->|imports| HINTS
    N01 -->|imports| HINTS
    N02 -->|imports| HINTS
    N03 -->|imports| HINTS
    N04 -->|imports| HINTS
    N05 -->|imports| HINTS
    N06 -->|imports| HINTS
    N07 -->|imports| HINTS
    N08 -->|imports| HINTS
    N09 -->|imports| HINTS
    N10A -->|imports| HINTS
    N10B -->|imports| HINTS

    %% External Service
    subgraph "External Service"
        direction TB
        OLLAMA["Ollama Qwen Model Service"]:::external
    end

    N00 -->|invoke prompt| OLLAMA
    N01 -->|invoke prompt| OLLAMA
    N02 -->|invoke prompt| OLLAMA
    N03 -->|invoke prompt| OLLAMA
    N04 -->|invoke prompt| OLLAMA
    N05 -->|invoke prompt| OLLAMA
    N06 -->|invoke prompt| OLLAMA
    N07 -->|invoke prompt| OLLAMA
    N08 -->|invoke prompt| OLLAMA
    N09 -->|invoke prompt| OLLAMA
    N10A -->|invoke prompt| OLLAMA
    N10B -->|invoke prompt| OLLAMA

    OLLAMA -->|model output| N00
    OLLAMA -->|model output| N01
    OLLAMA -->|model output| N02
    OLLAMA -->|model output| N03
    OLLAMA -->|model output| N04
    OLLAMA -->|model output| N05
    OLLAMA -->|model output| N06
    OLLAMA -->|model output| N07
    OLLAMA -->|model output| N08
    OLLAMA -->|model output| N09
    OLLAMA -->|model output| N10A
    OLLAMA -->|model output| N10B

    %% Click Events
    click README "https://github.com/ivanfioravanti/prompt-eng-ollama-interactive-tutorial/blob/main/README.md"
    click LICENSE "https://github.com/ivanfioravanti/prompt-eng-ollama-interactive-tutorial/tree/main/LICENSE"
    click GITIGNORE "https://github.com/ivanfioravanti/prompt-eng-ollama-interactive-tutorial/blob/main/.gitignore"
    click N00 "https://github.com/ivanfioravanti/prompt-eng-ollama-interactive-tutorial/blob/main/00_Tutorial_How-To.ipynb"
    click N01 "https://github.com/ivanfioravanti/prompt-eng-ollama-interactive-tutorial/blob/main/01_Basic_Prompt_Structure.ipynb"
    click N02 "https://github.com/ivanfioravanti/prompt-eng-ollama-interactive-tutorial/blob/main/02_Being_Clear_and_Direct.ipynb"
    click N03 "https://github.com/ivanfioravanti/prompt-eng-ollama-interactive-tutorial/blob/main/03_Assigning_Roles_Role_Prompting.ipynb"
    click N04 "https://github.com/ivanfioravanti/prompt-eng-ollama-interactive-tutorial/blob/main/04_Separating_Data_and_Instructions.ipynb"
    click N05 "https://github.com/ivanfioravanti/prompt-eng-ollama-interactive-tutorial/blob/main/05_Formatting_Output_and_Speaking_for_Claude.ipynb"
    click N06 "https://github.com/ivanfioravanti/prompt-eng-ollama-interactive-tutorial/blob/main/06_Precognition_Thinking_Step_by_Step.ipynb"
    click N07 "https://github.com/ivanfioravanti/prompt-eng-ollama-interactive-tutorial/blob/main/07_Using_Examples_Few-Shot_Prompting.ipynb"
    click N08 "https://github.com/ivanfioravanti/prompt-eng-ollama-interactive-tutorial/blob/main/08_Avoiding_Hallucinations.ipynb"
    click N09 "https://github.com/ivanfioravanti/prompt-eng-ollama-interactive-tutorial/blob/main/09_Complex_Prompts_from_Scratch.ipynb"
    click N10A "https://github.com/ivanfioravanti/prompt-eng-ollama-interactive-tutorial/blob/main/10.1_Appendix_Chaining Prompts.ipynb"
    click N10B "https://github.com/ivanfioravanti/prompt-eng-ollama-interactive-tutorial/blob/main/10.2_Appendix_Tool Use.ipynb"
    click HINTS "https://github.com/ivanfioravanti/prompt-eng-ollama-interactive-tutorial/blob/main/hints.py"

    %% Styles
    classDef env fill:#D6EAF8,stroke:#2980B9,color:#1B4F72;
    classDef metadata fill:#FDEDEC,stroke:#C0392B,color:#641E16;
    classDef infra fill:#D5F5E3,stroke:#27AE60,color:#145A32;
    classDef course fill:#FCF3CF,stroke:#F1C40F,color:#7D6608;
    classDef utility fill:#E8DAEF,stroke:#8E44AD,color:#4A235A;
    classDef external fill:#E8F8F5,stroke:#17A589,color:#0E6251;
```
