MBG0903 commited on
Commit
1e1431e
·
verified ·
1 Parent(s): e610f00

Update agents/planner.py

Browse files
Files changed (1) hide show
  1. agents/planner.py +47 -30
agents/planner.py CHANGED
@@ -1,41 +1,58 @@
1
  # ---------------------------------------------------------
2
- # INTENT DETECTOR FOR AUTO-GPT WAREHOUSE AGENT
3
  # ---------------------------------------------------------
4
 
5
  def detect_intent(message: str) -> str:
6
  """
7
- Classifies user intent for warehouse tasks.
 
 
 
 
8
  """
 
9
 
10
- if not message:
11
- return "unknown"
12
 
13
- msg = message.lower()
 
14
 
15
- # Slotting-related
16
- slotting_keywords = [
17
- "slot", "slotting", "sku placement", "velocity",
18
- "fast mover", "medium mover", "slow mover",
19
- "optimize slotting", "re-slot"
20
- ]
21
- if any(k in msg for k in slotting_keywords):
22
- return "slotting_analysis"
23
-
24
- # Picking path related
25
- picking_keywords = [
26
- "pick", "picking", "pick path", "route",
27
- "picking route", "walking path", "optimize picking"
28
- ]
29
- if any(k in msg for k in picking_keywords):
30
- return "picking_route"
31
-
32
- # Full assessment
33
- overall_keywords = [
34
- "full report", "warehouse report", "assessment",
35
- "complete analysis", "operations report",
36
- "full warehouse", "360"
37
- ]
38
- if any(k in msg for k in overall_keywords):
39
- return "full_warehouse_assessment"
40
 
41
  return "unknown"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # ---------------------------------------------------------
2
+ # PLANNER: CLASSIFIES USER INTENT AND SUB-SCENARIOS
3
  # ---------------------------------------------------------
4
 
5
  def detect_intent(message: str) -> str:
6
  """
7
+ Classifies the high-level warehouse task:
8
+ - slotting
9
+ - picking
10
+ - full_report
11
+ - unknown
12
  """
13
+ msg = message.lower()
14
 
15
+ if any(k in msg for k in ["slot", "re-slot", "sku", "velocity", "fast mover", "slow mover"]):
16
+ return "slotting"
17
 
18
+ if any(k in msg for k in ["pick", "picking", "pick path", "walking route", "picker route"]):
19
+ return "picking"
20
 
21
+ if any(k in msg for k in ["report", "summary", "analysis", "warehouse report"]):
22
+ return "report"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  return "unknown"
25
+
26
+
27
+ def detect_slotting_scenario(message: str) -> str:
28
+ """ Detects which slotting scenario the agent should optimize for. """
29
+ msg = message.lower()
30
+
31
+ if "congestion" in msg or "traffic" in msg:
32
+ return "reduce_congestion"
33
+ if "fast mover" in msg or "priority" in msg:
34
+ return "prioritize_fast"
35
+ if "slow mover" in msg or "free space" in msg or "prime space" in msg:
36
+ return "move_slow_out"
37
+ if "balance" in msg or "even" in msg:
38
+ return "balance_zones"
39
+ if "efficiency" in msg or "walking" in msg:
40
+ return "improve_efficiency"
41
+
42
+ return "generic_slotting"
43
+
44
+
45
+ def detect_picking_scenario(message: str) -> str:
46
+ """ Detects specialized picking scenarios for adaptive behavior. """
47
+ msg = message.lower()
48
+
49
+ if "inefficient" in msg or "better path" in msg:
50
+ return "fix_inefficiency"
51
+ if "dispatch" in msg or "start from" in msg:
52
+ return "new_dispatch_location"
53
+ if "avoid" in msg or "block" in msg:
54
+ return "avoid_aisles"
55
+ if "batch" in msg or "multi-order" in msg:
56
+ return "batch_picking"
57
+
58
+ return "generic_picking"