-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflow.py
33 lines (28 loc) · 1.05 KB
/
flow.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from pocketflow import Flow
# Import all node classes from nodes.py
from nodes import (
FetchRepo,
IdentifyAbstractions,
AnalyzeRelationships,
OrderChapters,
WriteChapters,
CombineTutorial
)
def create_tutorial_flow():
"""Creates and returns the codebase tutorial generation flow."""
# Instantiate nodes
fetch_repo = FetchRepo()
identify_abstractions = IdentifyAbstractions(max_retries=3, wait=10)
analyze_relationships = AnalyzeRelationships(max_retries=3, wait=10)
order_chapters = OrderChapters(max_retries=3, wait=10)
write_chapters = WriteChapters(max_retries=3, wait=10) # This is a BatchNode
combine_tutorial = CombineTutorial()
# Connect nodes in sequence based on the design
fetch_repo >> identify_abstractions
identify_abstractions >> analyze_relationships
analyze_relationships >> order_chapters
order_chapters >> write_chapters
write_chapters >> combine_tutorial
# Create the flow starting with FetchRepo
tutorial_flow = Flow(start=fetch_repo)
return tutorial_flow