Spaces:
Sleeping
Sleeping
Commit ·
b9f4a46
1
Parent(s): 7cd9df8
feat: expand keyword routing vocabulary for better agent selection
Browse filesAdd missing keywords: gear, bearing, flange, heatsink, bolt, shaft,
surface finish, drill, tap, endmill, bracket, housing, etc.
Includes 7 new routing tests verifying the improvements.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- agents/prompts.py +8 -2
- tests/test_prompts.py +35 -0
agents/prompts.py
CHANGED
|
@@ -162,18 +162,24 @@ def parse_mentions(message: str) -> tuple[str, list[str]]:
|
|
| 162 |
_ROUTING_KEYWORDS: dict[str, list[str]] = {
|
| 163 |
"design": [
|
| 164 |
"design", "look", "shape", "style", "form", "aesthetic", "appearance",
|
| 165 |
-
"layout", "concept", "idea", "propose", "suggest",
|
|
|
|
| 166 |
],
|
| 167 |
"engineering": [
|
| 168 |
"dimension", "tolerance", "material", "strength", "load", "stress",
|
| 169 |
"thickness", "wall", "fillet", "radius", "clearance",
|
| 170 |
"m2", "m3", "m4", "m5", "m6", "m8", "m10", "m12",
|
| 171 |
"aluminum", "steel", "brass", "titanium", "nylon",
|
|
|
|
|
|
|
|
|
|
| 172 |
],
|
| 173 |
"cnc": [
|
| 174 |
"machine", "mill", "cnc", "manufacture", "machinable", "axis",
|
| 175 |
"tool", "fixture", "setup", "pocket", "undercut", "access",
|
| 176 |
-
"3-axis", "5-axis", "cost",
|
|
|
|
|
|
|
| 177 |
],
|
| 178 |
"cad": CAD_TRIGGER_KEYWORDS,
|
| 179 |
}
|
|
|
|
| 162 |
_ROUTING_KEYWORDS: dict[str, list[str]] = {
|
| 163 |
"design": [
|
| 164 |
"design", "look", "shape", "style", "form", "aesthetic", "appearance",
|
| 165 |
+
"layout", "concept", "idea", "propose", "suggest", "bracket", "mount",
|
| 166 |
+
"enclosure", "housing", "ergonomic", "profile", "contour",
|
| 167 |
],
|
| 168 |
"engineering": [
|
| 169 |
"dimension", "tolerance", "material", "strength", "load", "stress",
|
| 170 |
"thickness", "wall", "fillet", "radius", "clearance",
|
| 171 |
"m2", "m3", "m4", "m5", "m6", "m8", "m10", "m12",
|
| 172 |
"aluminum", "steel", "brass", "titanium", "nylon",
|
| 173 |
+
"gear", "bearing", "flange", "heatsink", "fin", "rib",
|
| 174 |
+
"bolt", "screw", "thread", "torque", "deflection",
|
| 175 |
+
"hole", "bore", "shaft", "keyway", "spline",
|
| 176 |
],
|
| 177 |
"cnc": [
|
| 178 |
"machine", "mill", "cnc", "manufacture", "machinable", "axis",
|
| 179 |
"tool", "fixture", "setup", "pocket", "undercut", "access",
|
| 180 |
+
"3-axis", "5-axis", "cost", "surface finish", "roughness",
|
| 181 |
+
"endmill", "drill", "tap", "chamfer tool", "deburr",
|
| 182 |
+
"setup count", "cycle time", "tolerance class",
|
| 183 |
],
|
| 184 |
"cad": CAD_TRIGGER_KEYWORDS,
|
| 185 |
}
|
tests/test_prompts.py
CHANGED
|
@@ -179,3 +179,38 @@ class TestBuildChatMessages:
|
|
| 179 |
user_content = msgs[1]["content"]
|
| 180 |
assert "msg 49" in user_content
|
| 181 |
assert "msg 0" not in user_content
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
user_content = msgs[1]["content"]
|
| 180 |
assert "msg 49" in user_content
|
| 181 |
assert "msg 0" not in user_content
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
# ── Improved routing coverage ───────────────────────���─────────────────────
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
class TestRouteByKeywordsImproved:
|
| 188 |
+
"""Tests for expanded keyword routing vocabulary."""
|
| 189 |
+
|
| 190 |
+
def test_gear_routes_to_engineering(self):
|
| 191 |
+
agents = route_by_keywords("I need a spur gear with 20 teeth")
|
| 192 |
+
assert "engineering" in agents
|
| 193 |
+
|
| 194 |
+
def test_bearing_routes_to_engineering(self):
|
| 195 |
+
agents = route_by_keywords("Design a bearing housing")
|
| 196 |
+
assert "engineering" in agents
|
| 197 |
+
|
| 198 |
+
def test_heatsink_routes_to_engineering(self):
|
| 199 |
+
agents = route_by_keywords("Create a heatsink with fins")
|
| 200 |
+
assert "engineering" in agents
|
| 201 |
+
|
| 202 |
+
def test_flange_routes_to_engineering(self):
|
| 203 |
+
agents = route_by_keywords("A pipe flange with bolt holes")
|
| 204 |
+
assert "engineering" in agents
|
| 205 |
+
|
| 206 |
+
def test_servo_bracket_routes_to_design(self):
|
| 207 |
+
agents = route_by_keywords("Design a servo bracket for a camera gimbal")
|
| 208 |
+
assert "design" in agents
|
| 209 |
+
|
| 210 |
+
def test_cost_routes_to_cnc(self):
|
| 211 |
+
agents = route_by_keywords("How much would this cost to machine?")
|
| 212 |
+
assert "cnc" in agents
|
| 213 |
+
|
| 214 |
+
def test_surface_finish_routes_to_cnc(self):
|
| 215 |
+
agents = route_by_keywords("What surface finish can we achieve?")
|
| 216 |
+
assert "cnc" in agents
|