update readme examples

This commit is contained in:
zachary62
2025-04-04 15:06:41 -04:00
parent b63a1c14b0
commit dc4d445676
7 changed files with 1053 additions and 55 deletions
+31 -12
View File
@@ -1,14 +1,33 @@
from pocketflow import Flow
from nodes import GetQuestionNode, AnswerNode
# Import all node classes from nodes.py
from nodes import (
FetchRepo,
IdentifyAbstractions,
AnalyzeRelationships,
OrderChapters,
WriteChapters,
CombineTutorial
)
def create_qa_flow():
"""Create and return a question-answering flow."""
# Create nodes
get_question_node = GetQuestionNode()
answer_node = AnswerNode()
# Connect nodes in sequence
get_question_node >> answer_node
# Create flow starting with input node
return Flow(start=get_question_node)
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