Skip to content

Commit 25f68a9

Browse files
committed
feat: implement decision-based routing with plugin architecture
Signed-off-by: bitliu <[email protected]>
1 parent d265d30 commit 25f68a9

File tree

6 files changed

+255
-254
lines changed

6 files changed

+255
-254
lines changed

deploy/kubernetes/crds/examples/intelligentroute-example.yaml

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -4,61 +4,61 @@ metadata:
44
name: default-route
55
namespace: default
66
spec:
7-
decisionStrategy: "priority" # or "confidence"
7+
# Signal extraction rules
8+
signals:
9+
# Keyword-based signals
10+
keywords:
11+
- name: "urgent_keyword"
12+
operator: "OR"
13+
keywords: ["urgent", "emergency", "asap", "critical"]
14+
caseSensitive: false
815

9-
# Keyword Rules
10-
keywordRules:
11-
- name: "urgent_keyword"
12-
operator: "OR"
13-
keywords: ["urgent", "emergency", "asap", "critical"]
14-
caseSensitive: false
16+
- name: "technical_keyword"
17+
operator: "AND"
18+
keywords: ["technical", "support"]
19+
caseSensitive: false
1520

16-
- name: "technical_keyword"
17-
operator: "AND"
18-
keywords: ["technical", "support"]
19-
caseSensitive: false
21+
# Embedding-based signals
22+
embeddings:
23+
- name: "tech_support_embedding"
24+
threshold: 0.72
25+
candidates:
26+
- "I need help with technical issues and troubleshooting"
27+
- "Can you help me debug this problem?"
28+
- "Technical support for system errors"
29+
aggregationMethod: "max"
2030

21-
# Embedding Rules
22-
embeddingRules:
23-
- name: "tech_support_embedding"
24-
threshold: 0.72
25-
candidates:
26-
- "I need help with technical issues and troubleshooting"
27-
- "Can you help me debug this problem?"
28-
- "Technical support for system errors"
29-
aggregationMethod: "max"
31+
- name: "sales_embedding"
32+
threshold: 0.75
33+
candidates:
34+
- "I want to know about pricing and purchase options"
35+
- "How can I buy this product?"
36+
- "Tell me about sales and discounts"
37+
aggregationMethod: "mean"
3038

31-
- name: "sales_embedding"
32-
threshold: 0.75
33-
candidates:
34-
- "I want to know about pricing and purchase options"
35-
- "How can I buy this product?"
36-
- "Tell me about sales and discounts"
37-
aggregationMethod: "mean"
39+
# Domain-based signals (MMLU domain categories)
40+
domains:
41+
- "business"
42+
- "law"
43+
- "psychology"
44+
- "biology"
45+
- "chemistry"
46+
- "history"
47+
- "other"
48+
- "health"
49+
- "economics"
50+
- "math"
51+
- "physics"
52+
- "computer_science"
53+
- "philosophy"
54+
- "engineering"
3855

39-
# Domain Rules (MMLU domain categories)
40-
domainRules:
41-
- "business"
42-
- "law"
43-
- "psychology"
44-
- "biology"
45-
- "chemistry"
46-
- "history"
47-
- "other"
48-
- "health"
49-
- "economics"
50-
- "math"
51-
- "physics"
52-
- "computer_science"
53-
- "philosophy"
54-
- "engineering"
55-
56-
# Decisions
56+
# Decisions (priority used when multiple decisions match)
5757
decisions:
5858
- name: "urgent_technical"
5959
priority: 100
6060
description: "Urgent technical requests requiring immediate attention"
61-
rules:
61+
signals:
6262
operator: "AND"
6363
conditions:
6464
- type: "keyword"
@@ -100,7 +100,7 @@ spec:
100100
- name: "math_problems"
101101
priority: 80
102102
description: "Mathematical and physics problems"
103-
rules:
103+
signals:
104104
operator: "OR"
105105
conditions:
106106
- type: "domain"
@@ -125,7 +125,7 @@ spec:
125125
- name: "general_queries"
126126
priority: 10
127127
description: "General purpose queries"
128-
rules:
128+
signals:
129129
operator: "OR"
130130
conditions:
131131
- type: "keyword"

deploy/kubernetes/crds/intelligentroute-crd.yaml

Lines changed: 76 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -23,94 +23,91 @@ spec:
2323
spec:
2424
type: object
2525
required:
26-
- decisionStrategy
2726
- decisions
2827
properties:
29-
decisionStrategy:
30-
type: string
31-
enum:
32-
- priority
33-
- confidence
34-
description: Strategy for selecting among multiple matching decisions
35-
keywordRules:
36-
type: array
37-
items:
38-
type: object
39-
required:
40-
- name
41-
- operator
42-
- keywords
43-
properties:
44-
name:
45-
type: string
46-
description: Unique name for this rule (also used as category name)
47-
operator:
48-
type: string
49-
enum:
50-
- AND
51-
- OR
52-
description: Logical operator for keywords
53-
keywords:
54-
type: array
55-
items:
56-
type: string
57-
caseSensitive:
58-
type: boolean
59-
default: false
60-
embeddingRules:
61-
type: array
62-
items:
63-
type: object
64-
required:
65-
- name
66-
- threshold
67-
- candidates
68-
properties:
69-
name:
70-
type: string
71-
description: Unique name for this rule (also used as category name)
72-
threshold:
73-
type: number
74-
format: float
75-
description: Similarity threshold
76-
candidates:
77-
type: array
78-
items:
79-
type: string
80-
description: Candidate phrases for semantic matching
81-
aggregationMethod:
28+
signals:
29+
type: object
30+
description: Signal extraction rules for routing decisions
31+
properties:
32+
keywords:
33+
type: array
34+
items:
35+
type: object
36+
required:
37+
- name
38+
- operator
39+
- keywords
40+
properties:
41+
name:
42+
type: string
43+
description: Unique name for this keyword signal
44+
operator:
45+
type: string
46+
enum:
47+
- AND
48+
- OR
49+
description: Logical operator for keywords
50+
keywords:
51+
type: array
52+
items:
53+
type: string
54+
caseSensitive:
55+
type: boolean
56+
default: false
57+
embeddings:
58+
type: array
59+
items:
60+
type: object
61+
required:
62+
- name
63+
- threshold
64+
- candidates
65+
properties:
66+
name:
67+
type: string
68+
description: Unique name for this embedding signal
69+
threshold:
70+
type: number
71+
format: float
72+
description: Similarity threshold
73+
candidates:
74+
type: array
75+
items:
76+
type: string
77+
description: Candidate phrases for semantic matching
78+
aggregationMethod:
79+
type: string
80+
enum:
81+
- max
82+
- mean
83+
default: max
84+
domains:
85+
type: array
86+
items:
8287
type: string
8388
enum:
84-
- max
85-
- mean
86-
default: max
87-
domainRules:
88-
type: array
89-
items:
90-
type: string
91-
enum:
92-
- business
93-
- law
94-
- psychology
95-
- biology
96-
- chemistry
97-
- history
98-
- other
99-
- health
100-
- economics
101-
- math
102-
- physics
103-
- computer_science
104-
- philosophy
105-
- engineering
89+
- business
90+
- law
91+
- psychology
92+
- biology
93+
- chemistry
94+
- history
95+
- other
96+
- health
97+
- economics
98+
- math
99+
- physics
100+
- computer_science
101+
- philosophy
102+
- engineering
106103
decisions:
107104
type: array
108105
items:
109106
type: object
110107
required:
111108
- name
112109
- priority
113-
- rules
110+
- signals
114111
- modelRefs
115112
properties:
116113
name:
@@ -119,10 +116,10 @@ spec:
119116
priority:
120117
type: integer
121118
format: int32
122-
description: Priority for this decision (higher = more important)
119+
description: Priority for this decision (higher = more important, used when multiple decisions match)
123120
description:
124121
type: string
125-
rules:
122+
signals:
126123
type: object
127124
required:
128125
- operator
@@ -239,9 +236,6 @@ spec:
239236
subresources:
240237
status: {}
241238
additionalPrinterColumns:
242-
- name: Strategy
243-
type: string
244-
jsonPath: .spec.strategy
245239
- name: Decisions
246240
type: integer
247241
jsonPath: .status.decisionCount

0 commit comments

Comments
 (0)