MBG0903 commited on
Commit
8f8e94f
·
verified ·
1 Parent(s): e3d30ae

Update agents/brain.py

Browse files
Files changed (1) hide show
  1. agents/brain.py +33 -5
agents/brain.py CHANGED
@@ -1,7 +1,9 @@
1
  from agents.planner import detect_intent
2
  from agents.reasoner import (
3
  run_slotting_analysis,
4
- run_picking_optimization
 
 
5
  )
6
  import pandas as pd
7
 
@@ -20,7 +22,7 @@ class AutoWarehouseAgent:
20
 
21
  task = detect_intent(message.lower().strip())
22
 
23
- # Debug prints
24
  print(f"🧠 DETECTED TASK: {task}")
25
  print("📦 Slotting DF:", slotting_df)
26
  print("🚚 Picking DF:", picking_df)
@@ -50,7 +52,7 @@ class AutoWarehouseAgent:
50
  }
51
 
52
  # ------------------------------------------------------
53
- # 3️⃣ FULL REPORT (both slotting + picking)
54
  # ------------------------------------------------------
55
  if task == "report":
56
  exp1, slot_plan = run_slotting_analysis(message, slotting_df)
@@ -71,6 +73,30 @@ class AutoWarehouseAgent:
71
  "slotting_table": slot_plan
72
  }
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  # ------------------------------------------------------
75
  # ❌ FALLBACK
76
  # ------------------------------------------------------
@@ -79,9 +105,11 @@ class AutoWarehouseAgent:
79
  "### ❓ Unable to Understand Request\n"
80
  "I couldn't determine whether your request is about:\n"
81
  "- Slotting optimization\n"
82
- "- Picking route planning\n"
 
 
83
  "- Full warehouse report\n\n"
84
- "Try rewriting your query."
85
  ),
86
  "route_image": None,
87
  "slotting_table": pd.DataFrame()
 
1
  from agents.planner import detect_intent
2
  from agents.reasoner import (
3
  run_slotting_analysis,
4
+ run_picking_optimization,
5
+ run_demand_forecast,
6
+ run_replenishment_analysis
7
  )
8
  import pandas as pd
9
 
 
22
 
23
  task = detect_intent(message.lower().strip())
24
 
25
+ # Debug logs
26
  print(f"🧠 DETECTED TASK: {task}")
27
  print("📦 Slotting DF:", slotting_df)
28
  print("🚚 Picking DF:", picking_df)
 
52
  }
53
 
54
  # ------------------------------------------------------
55
+ # 3️⃣ FULL REPORT (slotting + picking)
56
  # ------------------------------------------------------
57
  if task == "report":
58
  exp1, slot_plan = run_slotting_analysis(message, slotting_df)
 
73
  "slotting_table": slot_plan
74
  }
75
 
76
+ # ------------------------------------------------------
77
+ # 4️⃣ DEMAND FORECASTING
78
+ # ------------------------------------------------------
79
+ if task == "forecast":
80
+ explanation, forecast_plot, forecast_table = run_demand_forecast(message, slotting_df)
81
+
82
+ return {
83
+ "report": explanation,
84
+ "route_image": forecast_plot,
85
+ "slotting_table": forecast_table
86
+ }
87
+
88
+ # ------------------------------------------------------
89
+ # 5️⃣ REPLENISHMENT ANALYSIS (NEW)
90
+ # ------------------------------------------------------
91
+ if task == "replenishment":
92
+ explanation, repl_table = run_replenishment_analysis(message, slotting_df)
93
+
94
+ return {
95
+ "report": explanation,
96
+ "route_image": None,
97
+ "slotting_table": repl_table
98
+ }
99
+
100
  # ------------------------------------------------------
101
  # ❌ FALLBACK
102
  # ------------------------------------------------------
 
105
  "### ❓ Unable to Understand Request\n"
106
  "I couldn't determine whether your request is about:\n"
107
  "- Slotting optimization\n"
108
+ "- Picking optimization\n"
109
+ "- Demand forecasting\n"
110
+ "- Replenishment needs\n"
111
  "- Full warehouse report\n\n"
112
+ "Try rephrasing your query."
113
  ),
114
  "route_image": None,
115
  "slotting_table": pd.DataFrame()