Spaces:
Runtime error
Runtime error
Update workflows/sales_analysis.py
Browse files- 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
|
| 96 |
-
|
| 97 |
-
"
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
)
|
| 101 |
-
workflow.
|
| 102 |
-
|
| 103 |
-
|
| 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
|