cryogenic22 commited on
Commit
d042067
·
verified ·
1 Parent(s): b0ea79d

Update workflows/sales_analysis.py

Browse files
Files changed (1) hide show
  1. workflows/sales_analysis.py +9 -26
workflows/sales_analysis.py CHANGED
@@ -92,32 +92,15 @@ class SalesAnalysisWorkflow:
92
  workflow.add_node("handle_error", self.handle_error_node)
93
 
94
  # Add conditional edges for error handling
95
- # Using add_edge_condition instead of add_edge with condition parameter
96
- workflow.add_edge_condition(
97
- "planning",
98
- "handle_error",
99
- lambda x: x["status"] == "error"
100
- )
101
- workflow.add_edge_condition(
102
- "data_collection",
103
- "handle_error",
104
- lambda x: x["status"] == "error"
105
- )
106
- workflow.add_edge_condition(
107
- "analysis",
108
- "handle_error",
109
- lambda x: x["status"] == "error"
110
- )
111
- workflow.add_edge_condition(
112
- "validation",
113
- "handle_error",
114
- lambda x: x["status"] == "error"
115
- )
116
- workflow.add_edge_condition(
117
- "insights",
118
- "handle_error",
119
- lambda x: x["status"] == "error"
120
- )
121
  workflow.add_edge("handle_error", END)
122
 
123
  # Set the entry point
 
92
  workflow.add_node("handle_error", self.handle_error_node)
93
 
94
  # Add conditional edges for error handling
95
+ # Using the newer add_conditional_edges method
96
+ def route_on_error(state):
97
+ return "handle_error" if state["status"] == "error" else None
98
+
99
+ workflow.add_conditional_edges("planning", route_on_error)
100
+ workflow.add_conditional_edges("data_collection", route_on_error)
101
+ workflow.add_conditional_edges("analysis", route_on_error)
102
+ workflow.add_conditional_edges("validation", route_on_error)
103
+ workflow.add_conditional_edges("insights", route_on_error)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  workflow.add_edge("handle_error", END)
105
 
106
  # Set the entry point