MBG0903 commited on
Commit
560c288
·
verified ·
1 Parent(s): defccd4

Update agents/planner.py

Browse files
Files changed (1) hide show
  1. agents/planner.py +79 -34
agents/planner.py CHANGED
@@ -1,40 +1,26 @@
1
  def detect_intent(message: str):
2
  """
3
- A robust, rule-based classifier for warehouse tasks.
4
  Returns one of:
5
  - "slotting"
6
  - "picking"
7
- - "report"
8
  - "forecast"
 
 
 
 
 
9
  """
10
 
11
  msg = message.lower().strip()
12
 
13
  # -----------------------------
14
- # SLOTING KEYWORDS
15
- # -----------------------------
16
- slot_keywords = [
17
- "slot", "slotting", "putaway", "storage location",
18
- "rearrange items", "reorganize racks", "optimize space",
19
- "velocity", "sku placement", "bin allocation"
20
- ]
21
-
22
- # -----------------------------
23
- # PICKING KEYWORDS
24
- # -----------------------------
25
- pick_keywords = [
26
- "pick", "picking", "route", "path", "walk sequence",
27
- "shortest path", "aisle", "rack", "order fulfillment",
28
- "picklist"
29
- ]
30
-
31
- # -----------------------------
32
- # FULL REPORT KEYWORDS
33
  # -----------------------------
34
  report_keywords = [
35
  "full report", "overall performance", "warehouse report",
36
  "summary", "end to end", "combined", "complete report",
37
- "all optimizations"
38
  ]
39
 
40
  # -----------------------------
@@ -42,25 +28,75 @@ def detect_intent(message: str):
42
  # -----------------------------
43
  forecast_keywords = [
44
  "forecast", "predict", "demand", "future usage",
45
- "consumption trend", "usage trend", "project demand",
46
- "estimate usage"
47
  ]
48
 
49
  # -----------------------------
50
  # REPLENISHMENT KEYWORDS
51
  # -----------------------------
52
  replenish_keywords = [
53
- "replenish", "refill", "stock level", "stockout", "stock-out",
54
- "low stock", "replenishment", "min max", "restock", "safety stock"
 
 
 
 
 
 
 
 
 
 
55
  ]
56
 
57
- # ---------------------------------------------------------
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  # PRIORITY ORDER:
59
  # 1. Full report
60
- # 2. Forecasting
61
- # 3. Slotting
62
- # 4. Picking
63
- # ---------------------------------------------------------
 
 
 
 
64
 
65
  if any(k in msg for k in report_keywords):
66
  return "report"
@@ -68,15 +104,24 @@ def detect_intent(message: str):
68
  if any(k in msg for k in forecast_keywords):
69
  return "forecast"
70
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  if any(k in msg for k in slot_keywords):
72
  return "slotting"
73
 
74
  if any(k in msg for k in pick_keywords):
75
  return "picking"
76
 
77
- if any(k in msg for k in replenish_keywords):
78
- return "replenishment"
79
-
80
  # -----------------------------
81
  # UNKNOWN → DEFAULT TO REPORT
82
  # -----------------------------
 
1
  def detect_intent(message: str):
2
  """
3
+ A robust, rule-based classifier for warehouse AI tasks.
4
  Returns one of:
5
  - "slotting"
6
  - "picking"
 
7
  - "forecast"
8
+ - "replenishment"
9
+ - "rebalancing"
10
+ - "workforce"
11
+ - "dock"
12
+ - "report"
13
  """
14
 
15
  msg = message.lower().strip()
16
 
17
  # -----------------------------
18
+ # FULL REPORT KEYWORDS (Highest Priority)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  # -----------------------------
20
  report_keywords = [
21
  "full report", "overall performance", "warehouse report",
22
  "summary", "end to end", "combined", "complete report",
23
+ "all optimizations", "generate full report"
24
  ]
25
 
26
  # -----------------------------
 
28
  # -----------------------------
29
  forecast_keywords = [
30
  "forecast", "predict", "demand", "future usage",
31
+ "consumption trend", "estimate usage", "project demand",
32
+ "usage forecast"
33
  ]
34
 
35
  # -----------------------------
36
  # REPLENISHMENT KEYWORDS
37
  # -----------------------------
38
  replenish_keywords = [
39
+ "replenish", "refill", "stock level", "stock levels",
40
+ "stockout", "stock-out", "low stock", "running low",
41
+ "replenishment", "min max", "restock", "safety stock"
42
+ ]
43
+
44
+ # -----------------------------
45
+ # INVENTORY REBALANCING KEYWORDS
46
+ # -----------------------------
47
+ rebalancing_keywords = [
48
+ "rebalance", "redistribute", "inventory balancing",
49
+ "zone balancing", "congestion", "reduce aisle load",
50
+ "balance inventory", "redistribution"
51
  ]
52
 
53
+ # -----------------------------
54
+ # WORKFORCE OPTIMIZATION KEYWORDS
55
+ # -----------------------------
56
+ workforce_keywords = [
57
+ "workforce", "staff", "labour", "labor", "manpower",
58
+ "how many workers", "allocate workers", "workload",
59
+ "staffing requirement", "optimize workforce"
60
+ ]
61
+
62
+ # -----------------------------
63
+ # DOCK SCHEDULING KEYWORDS
64
+ # -----------------------------
65
+ dock_keywords = [
66
+ "dock", "dock scheduling", "loading bay", "unloading",
67
+ "assign dock", "dock allocation", "door scheduling",
68
+ "truck scheduling"
69
+ ]
70
+
71
+ # -----------------------------
72
+ # SLOTING KEYWORDS
73
+ # -----------------------------
74
+ slot_keywords = [
75
+ "slot", "slotting", "putaway", "storage location",
76
+ "rearrange items", "reorganize racks", "optimize space",
77
+ "velocity", "sku placement", "bin allocation"
78
+ ]
79
+
80
+ # -----------------------------
81
+ # PICKING KEYWORDS
82
+ # -----------------------------
83
+ pick_keywords = [
84
+ "pick", "picking", "route", "path", "walk sequence",
85
+ "shortest path", "aisle", "rack", "order fulfillment",
86
+ "picklist"
87
+ ]
88
+
89
+ # -----------------------------
90
  # PRIORITY ORDER:
91
  # 1. Full report
92
+ # 2. Forecast
93
+ # 3. Replenishment
94
+ # 4. Rebalancing
95
+ # 5. Workforce
96
+ # 6. Dock Scheduling
97
+ # 7. Slotting
98
+ # 8. Picking
99
+ # -----------------------------
100
 
101
  if any(k in msg for k in report_keywords):
102
  return "report"
 
104
  if any(k in msg for k in forecast_keywords):
105
  return "forecast"
106
 
107
+ if any(k in msg for k in replenish_keywords):
108
+ return "replenishment"
109
+
110
+ if any(k in msg for k in rebalancing_keywords):
111
+ return "rebalancing"
112
+
113
+ if any(k in msg for k in workforce_keywords):
114
+ return "workforce"
115
+
116
+ if any(k in msg for k in dock_keywords):
117
+ return "dock"
118
+
119
  if any(k in msg for k in slot_keywords):
120
  return "slotting"
121
 
122
  if any(k in msg for k in pick_keywords):
123
  return "picking"
124
 
 
 
 
125
  # -----------------------------
126
  # UNKNOWN → DEFAULT TO REPORT
127
  # -----------------------------