Spaces:
Sleeping
Sleeping
refactor: simplify graph structure by removing subgraph and directly adding nodes to main graph
Browse files- planning_ai/graph.py +5 -24
planning_ai/graph.py
CHANGED
@@ -17,32 +17,13 @@ from planning_ai.states import DocumentState, OverallState
|
|
17 |
|
18 |
|
19 |
def create_graph():
|
20 |
-
subgraph = StateGraph(DocumentState)
|
21 |
-
subgraph.add_node("generate_summary", generate_summary)
|
22 |
-
# subgraph.add_node("check_hallucination", check_hallucination)
|
23 |
-
# subgraph.add_node("fix_hallucination", fix_hallucination)
|
24 |
-
|
25 |
-
subgraph.add_conditional_edges(START, map_summaries, ["generate_summary"])
|
26 |
-
# subgraph.add_conditional_edges(
|
27 |
-
# "generate_summary", map_hallucinations, ["check_hallucination"]
|
28 |
-
# )
|
29 |
-
# subgraph.add_conditional_edges(
|
30 |
-
# "check_hallucination", map_fix_hallucinations, ["fix_hallucination"]
|
31 |
-
# )
|
32 |
-
# subgraph.add_conditional_edges(
|
33 |
-
# "fix_hallucination", map_hallucinations, ["check_hallucination"]
|
34 |
-
# )
|
35 |
-
subgraph = subgraph.compile()
|
36 |
-
|
37 |
graph = StateGraph(OverallState)
|
38 |
-
graph.add_node("
|
39 |
-
|
40 |
|
41 |
-
graph.
|
42 |
-
|
43 |
-
|
44 |
-
# )
|
45 |
-
# graph.add_edge("generate_final_summary", END)
|
46 |
|
47 |
return graph.compile()
|
48 |
|
|
|
17 |
|
18 |
|
19 |
def create_graph():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
graph = StateGraph(OverallState)
|
21 |
+
graph.add_node("generate_summary", generate_summary)
|
22 |
+
graph.add_node("generate_final_summary", generate_final_summary)
|
23 |
|
24 |
+
graph.add_conditional_edges(START, map_summaries, ["generate_summary"])
|
25 |
+
graph.add_edge("generate_summary", "generate_final_summary")
|
26 |
+
graph.add_edge("generate_final_summary", END)
|
|
|
|
|
27 |
|
28 |
return graph.compile()
|
29 |
|