Spaces:
Runtime error
Runtime error
Update workflows/sales_analysis.py
Browse files- 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 |
-
|
| 123 |
-
|
| 124 |
-
"handle_error"
|
| 125 |
-
|
| 126 |
-
)
|
| 127 |
-
workflow.
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 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
|