cryogenic22 commited on
Commit
c87abe1
·
verified ·
1 Parent(s): 1d2394d

Update workflows/sales_analysis.py

Browse files
Files changed (1) hide show
  1. workflows/sales_analysis.py +9 -39
workflows/sales_analysis.py CHANGED
@@ -118,45 +118,15 @@ class SalesAnalysisWorkflow:
118
  # Add error handling
119
  workflow.add_node("handle_error", self.handle_error_node)
120
 
121
- # Add conditional edges for error handling using LangGraph's newer API
122
- def route_planning(state):
123
- if state["status"] == "error":
124
- return "handle_error"
125
- return "data_collection"
126
-
127
- def route_data_collection(state):
128
- if state["status"] == "error":
129
- return "handle_error"
130
- return "analysis"
131
-
132
- def route_analysis(state):
133
- if state["status"] == "error":
134
- return "handle_error"
135
- return "validation"
136
-
137
- def route_validation(state):
138
- if state["status"] == "error":
139
- return "handle_error"
140
- return "insights"
141
-
142
- def route_insights(state):
143
- if state["status"] == "error":
144
- return "handle_error"
145
- return END
146
-
147
- # Replace linear edges with conditional ones
148
- workflow.remove_edge("planning", "data_collection")
149
- workflow.remove_edge("data_collection", "analysis")
150
- workflow.remove_edge("analysis", "validation")
151
- workflow.remove_edge("validation", "insights")
152
- workflow.remove_edge("insights", END)
153
-
154
- # Add the conditional routing
155
- workflow.add_conditional_edges("planning", route_planning)
156
- workflow.add_conditional_edges("data_collection", route_data_collection)
157
- workflow.add_conditional_edges("analysis", route_analysis)
158
- workflow.add_conditional_edges("validation", route_validation)
159
- workflow.add_conditional_edges("insights", route_insights)
160
  workflow.add_edge("handle_error", END)
161
 
162
  # Set the entry point
 
118
  # Add error handling
119
  workflow.add_node("handle_error", self.handle_error_node)
120
 
121
+ # Define a simple linear workflow without error handling for now
122
+ # This should work with any version of LangGraph
123
+ workflow.add_edge("planning", "data_collection")
124
+ workflow.add_edge("data_collection", "analysis")
125
+ workflow.add_edge("analysis", "validation")
126
+ workflow.add_edge("validation", "insights")
127
+ workflow.add_edge("insights", END)
128
+
129
+ # We'll handle errors within each node function instead of using graph branching
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  workflow.add_edge("handle_error", END)
131
 
132
  # Set the entry point