# shivammitra/gen-ai architecture

> Architecture diagram of the GitHub repository shivammitra/gen-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shivammitra/gen-ai
- Repository: https://github.com/shivammitra/gen-ai

## Overview

#### Purpose and Execution Model
This is an exploratory generative-AI repository centered on AWS SageMaker-hosted LLM inference and blog-content generation. It is notebook-first rather than a packaged service: users execute cells interactively with configured AWS credentials. A small Python application appears to provide a more direct blog-generation entry point.

Key entry points:
- `AWS sagemaker/falcon40B-instruct-notebook-full.ipynb`
- `AWS sagemaker/Untitled (2).ipynb`
- `Blog generation in aws/app.py`

#### SageMaker LLM Experimentation
The SageMaker notebooks are the primary environment for provisioning or invoking cloud model workflows, experimenting with prompts, and examining generated results. The Falcon 40B Instruct notebook is the most explicit model-oriented artifact and likely captures the end-to-end inference/deployment experiment.

Paths:
- `AWS sagemaker/falcon40B-instruct-notebook-full.ipynb`
- `AWS sagemaker/Untitled (2).ipynb`
- `AWS sagemaker/test.py`

#### Blog Generation Application
`app.py` is the repository’s application-oriented boundary for blog generation, separate from the exploratory notebooks. It should be treated as the likely executable integration point for converting user/topic input into LLM requests and returning generated blog text.

Paths:
- `Blog generation in aws/app.py`
- `Blog generation in aws/requirements.txt`

#### Primary Control and Data Flow
1. A user launches a Jupyter notebook or Python application.
2. The workflow accepts a prompt or blog-generation topic/configuration.
3. Python code authenticates to AWS through locally configured credentials or an AWS execution role.
4. The workflow invokes AWS SageMaker model training, deployment, or inference capabilities.
5. Generated LLM output is rendered in notebook cells or returned by the application.

The central boundary is local/interactive Python code versus managed AWS model execution. Prompt construction and output handling live client-side; model compute, endpoint hosting, and related permissions live in AWS.

#### Runtime and Infrastructure
Material runtimes are Python 3.8+ and Jupyter Notebook/Lab. AWS SageMaker is the core external platform; the README also identifies AWS S3 access as an expected permission/dependency for typical SageMaker workflows. Valid AWS credentials and IAM permissions are prerequisites for cloud execution.

Paths:
- `AWS sagemaker/falcon40B-instruct-notebook-full.ipynb`
- `Blog generation in aws/requirements.txt`

#### Architectural Character
There is no indicated shared library, API service, persistence layer, CI pipeline, or production deployment topology. The repository is best understood as a set of independently runnable experiments plus an application script. Changes should preserve the loose separation between:
- SageMaker/model experimentation under `AWS sagemaker/`
- Blog-generation application code under `Blog generation in aws/`

Main entry points: [`Blog generation in aws/app.py`](https://github.com/shivammitra/gen-ai/blob/main/Blog%20generation%20in%20aws/app.py) (Blog App Entry), [`AWS sagemaker/falcon40B-instruct-notebook-full.ipynb`](https://github.com/shivammitra/gen-ai/blob/main/AWS%20sagemaker/falcon40B-instruct-notebook-full.ipynb) (Falcon 40B Notebook), [`AWS sagemaker/Untitled (2).ipynb`](https://github.com/shivammitra/gen-ai/blob/main/AWS%20sagemaker/Untitled%20(2).ipynb) (Exploratory Notebook), [`AWS sagemaker/test.py`](https://github.com/shivammitra/gen-ai/blob/main/AWS%20sagemaker/test.py) (Experiment Script)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experiments["SageMaker Experiments"]
  node_falcon_notebook["Falcon 40B Notebook<br/>Jupyter notebook"]
  node_scratch_notebook["Exploratory Notebook<br/>Jupyter notebook<br/>[Untitled &#40;2&#41;.ipynb]"]
  node_experiment_script["Experiment Script<br/>Python script<br/>[test.py]"]
end

subgraph group_blog_app["Blog Generator"]
  node_blog_app_entry["Blog App Entry<br/>Python application<br/>[app.py]"]
  node_blog_dependencies["App Dependencies<br/>Python requirements<br/>[requirements.txt]"]
end

subgraph group_aws["AWS Managed Services"]
  node_aws_credentials{{"AWS Credentials / IAM<br/>access control"}}
  node_sagemaker["AWS SageMaker<br/>managed ML platform"]
  node_llm_endpoint{{"Hosted LLM Inference<br/>model endpoint"}}
  node_s3[("Amazon S3<br/>object storage")]
end

node_user(("User<br/>actor"))
node_prompt_handling["Prompt &amp; Output Handling<br/>client-side workflow"]
node_generated_content["Generated Blog Content<br/>LLM output"]

node_user -->|"runs interactively"| node_falcon_notebook
node_user -->|"runs interactively"| node_scratch_notebook
node_user -->|"provides topic"| node_blog_app_entry
node_falcon_notebook -->|"constructs prompts"| node_prompt_handling
node_scratch_notebook -->|"experiments with prompts"| node_prompt_handling
node_experiment_script -->|"invokes workflows"| node_sagemaker
node_blog_app_entry -.->|"uses"| node_blog_dependencies
node_blog_app_entry -->|"builds request"| node_prompt_handling
node_prompt_handling -->|"submits model request"| node_sagemaker
node_aws_credentials -->|"authorizes"| node_sagemaker
node_sagemaker -->|"deploys or invokes"| node_llm_endpoint
node_sagemaker -.->|"accesses workflow data"| node_s3
node_llm_endpoint -->|"returns text"| node_generated_content
node_generated_content -->|"renders in cells"| node_falcon_notebook
node_generated_content -->|"returns response"| node_blog_app_entry

click node_falcon_notebook "https://github.com/shivammitra/gen-ai/blob/main/AWS%20sagemaker/falcon40B-instruct-notebook-full.ipynb"
click node_scratch_notebook "https://github.com/shivammitra/gen-ai/blob/main/AWS%20sagemaker/Untitled%20(2).ipynb"
click node_experiment_script "https://github.com/shivammitra/gen-ai/blob/main/AWS%20sagemaker/test.py"
click node_blog_app_entry "https://github.com/shivammitra/gen-ai/blob/main/Blog%20generation%20in%20aws/app.py"
click node_blog_dependencies "https://github.com/shivammitra/gen-ai/blob/main/Blog%20generation%20in%20aws/requirements.txt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_falcon_notebook,node_scratch_notebook,node_experiment_script toneBlue
class node_blog_app_entry,node_blog_dependencies toneAmber
class node_aws_credentials,node_sagemaker,node_llm_endpoint,node_s3 toneMint
class node_user,node_prompt_handling,node_generated_content toneNeutral
```

## Components

### SageMaker Experiments

Independently runnable notebook and script workflows.

- [Falcon 40B Notebook](https://github.com/shivammitra/gen-ai/blob/main/AWS%20sagemaker/falcon40B-instruct-notebook-full.ipynb): Jupyter notebook · Primary end-to-end model inference or deployment experiment. · `AWS sagemaker/falcon40B-instruct-notebook-full.ipynb`
- [Exploratory Notebook](https://github.com/shivammitra/gen-ai/blob/main/AWS%20sagemaker/Untitled%20(2).ipynb): Jupyter notebook · `AWS sagemaker/Untitled (2).ipynb`
- [Experiment Script](https://github.com/shivammitra/gen-ai/blob/main/AWS%20sagemaker/test.py): Python script · `AWS sagemaker/test.py`

### Blog Generator

Application-oriented blog generation entry point.

- [Blog App Entry](https://github.com/shivammitra/gen-ai/blob/main/Blog%20generation%20in%20aws/app.py): Python application · Accepts blog topics and returns generated text. · `Blog generation in aws/app.py`
- [App Dependencies](https://github.com/shivammitra/gen-ai/blob/main/Blog%20generation%20in%20aws/requirements.txt): Python requirements · `Blog generation in aws/requirements.txt`

### AWS Managed Services

Cloud execution boundary requiring valid IAM access.

- **AWS Credentials / IAM**: access control · Local credentials or execution roles authorize cloud operations.
- **AWS SageMaker**: managed ML platform · Runs model training, deployment, and inference workflows.
- **Hosted LLM Inference**: model endpoint · Managed Falcon-style model compute and response generation.
- **Amazon S3**: object storage · Expected SageMaker workflow storage dependency.

### Other components

- **User**: actor
- **Prompt & Output Handling**: client-side workflow · Builds prompts and presents generated output locally.
- **Generated Blog Content**: LLM output

## Connections

- User → Falcon 40B Notebook: runs interactively
- User → Exploratory Notebook: runs interactively
- User → Blog App Entry: provides topic
- Falcon 40B Notebook → Prompt & Output Handling: constructs prompts
- Exploratory Notebook → Prompt & Output Handling: experiments with prompts
- Experiment Script → AWS SageMaker: invokes workflows
- Blog App Entry → App Dependencies: uses
- Blog App Entry → Prompt & Output Handling: builds request
- Prompt & Output Handling → AWS SageMaker: submits model request
- AWS Credentials / IAM → AWS SageMaker: authorizes
- AWS SageMaker → Hosted LLM Inference: deploys or invokes
- AWS SageMaker → Amazon S3: accesses workflow data
- Hosted LLM Inference → Generated Blog Content: returns text
- Generated Blog Content → Falcon 40B Notebook: renders in cells
- Generated Blog Content → Blog App Entry: returns response
