Skip to content

Commit

Permalink
Improve diagram layout and styling
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacck committed Dec 15, 2024
1 parent d6402d8 commit cd0f198
Showing 1 changed file with 41 additions and 18 deletions.
59 changes: 41 additions & 18 deletions architecture_generator.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,39 @@
from diagrams import Diagram, Cluster
from diagrams import Diagram, Cluster, Edge
from diagrams.programming.language import Python
from diagrams.programming.framework import FastAPI
from diagrams.onprem.database import PostgreSQL
from diagrams.generic.storage import Storage

def generate_architecture():
"""Generate architecture diagram for AdalFlow project."""

with Diagram("AdalFlow Architecture", show=False, direction="TB"):
with Cluster("Core Components"):
graph_attr = {
"fontsize": "30",
"bgcolor": "white",
"splines": "ortho",
"pad": "0.5"
}

node_attr = {
"fontsize": "14"
}

with Diagram(
"AdalFlow Architecture",
show=False,
direction="TB",
graph_attr=graph_attr,
node_attr=node_attr,
filename="architecture",
outformat="png"
):
with Cluster("Core"):
core = Python("Core Engine")

with Cluster("Data Processing"):
datasets = Python("Datasets")
optim = Python("Optimization")
eval_comp = Python("Evaluation")

with Cluster("Infrastructure"):
database = PostgreSQL("Database")
tracing = Storage("Tracing")
Expand All @@ -22,20 +42,23 @@ def generate_architecture():
components = Python("Components")
utils = Python("Utils")

# Connect components
core >> datasets
core >> optim
core >> eval_comp
core >> components
core >> database
core >> tracing
core >> utils
# Core connections
core >> Edge(color="darkgreen") >> datasets
core >> Edge(color="darkgreen") >> optim
core >> Edge(color="darkgreen") >> eval_comp
core >> Edge(color="darkblue") >> components

# Infrastructure connections
components >> Edge(color="red") >> database
datasets >> Edge(color="red") >> database

# Tracing connections
optim >> Edge(color="orange") >> tracing
eval_comp >> Edge(color="orange") >> tracing

# Component interactions
components >> database
optim >> tracing
eval_comp >> tracing
datasets >> database
# Utils connections
utils >> Edge(style="dotted") >> components
utils >> Edge(style="dotted") >> core

if __name__ == "__main__":
generate_architecture()

0 comments on commit cd0f198

Please sign in to comment.