cryogenic22 commited on
Commit
a67d4f1
·
verified ·
1 Parent(s): c85c7c1

Update workflows/sales_analysis.py

Browse files
Files changed (1) hide show
  1. workflows/sales_analysis.py +9 -25
workflows/sales_analysis.py CHANGED
@@ -119,31 +119,15 @@ class SalesAnalysisWorkflow:
119
  workflow.add_node("handle_error", self.handle_error_node)
120
 
121
  # Add conditional edges for error handling
122
- workflow.add_edge_condition(
123
- "planning",
124
- "handle_error",
125
- lambda x: x["status"] == "error"
126
- )
127
- workflow.add_edge_condition(
128
- "data_collection",
129
- "handle_error",
130
- lambda x: x["status"] == "error"
131
- )
132
- workflow.add_edge_condition(
133
- "analysis",
134
- "handle_error",
135
- lambda x: x["status"] == "error"
136
- )
137
- workflow.add_edge_condition(
138
- "validation",
139
- "handle_error",
140
- lambda x: x["status"] == "error"
141
- )
142
- workflow.add_edge_condition(
143
- "insights",
144
- "handle_error",
145
- lambda x: x["status"] == "error"
146
- )
147
  workflow.add_edge("handle_error", END)
148
 
149
  # Set the entry point
 
119
  workflow.add_node("handle_error", self.handle_error_node)
120
 
121
  # Add conditional edges for error handling
122
+ # Using add_conditional_edges API instead of add_edge_condition
123
+ def route_on_error(state):
124
+ return "handle_error" if state["status"] == "error" else None
125
+
126
+ workflow.add_conditional_edges("planning", route_on_error)
127
+ workflow.add_conditional_edges("data_collection", route_on_error)
128
+ workflow.add_conditional_edges("analysis", route_on_error)
129
+ workflow.add_conditional_edges("validation", route_on_error)
130
+ workflow.add_conditional_edges("insights", route_on_error)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  workflow.add_edge("handle_error", END)
132
 
133
  # Set the entry point