Update agents/planner.py
Browse files- agents/planner.py +44 -25
agents/planner.py
CHANGED
|
@@ -1,36 +1,55 @@
|
|
| 1 |
-
def detect_intent(message: str)
|
| 2 |
"""
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
|
|
|
| 7 |
"""
|
| 8 |
-
if not message:
|
| 9 |
-
return "unknown"
|
| 10 |
|
| 11 |
msg = message.lower().strip()
|
| 12 |
|
| 13 |
-
#
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
"
|
|
|
|
|
|
|
| 18 |
]
|
| 19 |
-
if any(k in msg for k in picking_kw):
|
| 20 |
-
return "picking"
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
]
|
| 28 |
-
if any(k in msg for k in slotting_kw):
|
| 29 |
-
return "slotting"
|
| 30 |
|
| 31 |
-
#
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
| 34 |
return "report"
|
| 35 |
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
"""
|
|
|
|
|
|
|
| 9 |
|
| 10 |
msg = message.lower().strip()
|
| 11 |
|
| 12 |
+
# -----------------------------
|
| 13 |
+
# SLOTING KEYWORDS
|
| 14 |
+
# -----------------------------
|
| 15 |
+
slot_keywords = [
|
| 16 |
+
"slot", "slotting", "putaway", "storage location",
|
| 17 |
+
"rearrange items", "reorganize racks", "optimize space",
|
| 18 |
+
"velocity", "sku placement", "bin allocation"
|
| 19 |
]
|
|
|
|
|
|
|
| 20 |
|
| 21 |
+
# -----------------------------
|
| 22 |
+
# PICKING KEYWORDS
|
| 23 |
+
# -----------------------------
|
| 24 |
+
pick_keywords = [
|
| 25 |
+
"pick", "picking", "route", "path", "walk sequence",
|
| 26 |
+
"shortest path", "aisle", "rack", "order fulfillment",
|
| 27 |
+
"picklist"
|
| 28 |
+
]
|
| 29 |
+
|
| 30 |
+
# -----------------------------
|
| 31 |
+
# FULL REPORT KEYWORDS
|
| 32 |
+
# -----------------------------
|
| 33 |
+
report_keywords = [
|
| 34 |
+
"full report", "overall performance", "warehouse report",
|
| 35 |
+
"summary", "end to end", "combined", "complete report",
|
| 36 |
+
"all optimizations"
|
| 37 |
]
|
|
|
|
|
|
|
| 38 |
|
| 39 |
+
# -----------------------------
|
| 40 |
+
# PRIORITY: Full Report → Slotting → Picking
|
| 41 |
+
# (Prevents overlap confusion)
|
| 42 |
+
# -----------------------------
|
| 43 |
+
if any(k in msg for k in report_keywords):
|
| 44 |
return "report"
|
| 45 |
|
| 46 |
+
if any(k in msg for k in slot_keywords):
|
| 47 |
+
return "slotting"
|
| 48 |
+
|
| 49 |
+
if any(k in msg for k in pick_keywords):
|
| 50 |
+
return "picking"
|
| 51 |
+
|
| 52 |
+
# -----------------------------
|
| 53 |
+
# UNKNOWN → DEFAULT TO REPORT
|
| 54 |
+
# -----------------------------
|
| 55 |
+
return "report"
|