Skip to content

Commit d265d30

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

File tree

13 files changed

+179
-915
lines changed

13 files changed

+179
-915
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,3 @@ spec:
3636
pricing:
3737
inputTokenPrice: 0.0000005
3838
outputTokenPrice: 0.000001
39-

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

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,50 +4,54 @@ metadata:
44
name: default-route
55
namespace: default
66
spec:
7-
strategy: "priority" # or "confidence"
8-
7+
decisionStrategy: "priority" # or "confidence"
8+
99
# Keyword Rules
1010
keywordRules:
1111
- name: "urgent_keyword"
12-
category: "urgent request"
1312
operator: "OR"
1413
keywords: ["urgent", "emergency", "asap", "critical"]
1514
caseSensitive: false
16-
15+
1716
- name: "technical_keyword"
18-
category: "technical support"
1917
operator: "AND"
2018
keywords: ["technical", "support"]
2119
caseSensitive: false
22-
20+
2321
# Embedding Rules
2422
embeddingRules:
2523
- name: "tech_support_embedding"
26-
category: "technical_support"
2724
threshold: 0.72
28-
keywords: ["technical support", "troubleshooting", "debugging"]
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"
2929
aggregationMethod: "max"
30-
model: "auto"
31-
dimension: 768
32-
30+
3331
- name: "sales_embedding"
34-
category: "sales_inquiry"
3532
threshold: 0.75
36-
keywords: ["pricing", "purchase", "buy", "sales"]
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"
3737
aggregationMethod: "mean"
38-
model: "auto"
39-
dimension: 768
40-
41-
# Domain Rules
38+
39+
# Domain Rules (MMLU domain categories)
4240
domainRules:
43-
- name: "math_domain"
44-
domains: ["math", "physics"]
45-
46-
- name: "science_domain"
47-
domains: ["biology", "chemistry", "physics"]
48-
49-
- name: "business_domain"
50-
domains: ["business", "economics"]
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"
5155

5256
# Decisions
5357
decisions:
@@ -100,7 +104,7 @@ spec:
100104
operator: "OR"
101105
conditions:
102106
- type: "domain"
103-
name: "math_domain"
107+
name: "math"
104108
modelRefs:
105109
- model: "base-model"
106110
loraName: "math-expert"
@@ -149,4 +153,3 @@ spec:
149153
configuration:
150154
enabled: true
151155
threshold: 0.5
152-

deploy/kubernetes/crds/intelligentpool-crd.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,3 @@ spec:
118118
- name: Age
119119
type: date
120120
jsonPath: .metadata.creationTimestamp
121-

deploy/kubernetes/crds/intelligentroute-crd.yaml

Lines changed: 23 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ spec:
2323
spec:
2424
type: object
2525
required:
26-
- strategy
26+
- decisionStrategy
2727
- decisions
2828
properties:
29-
strategy:
29+
decisionStrategy:
3030
type: string
3131
enum:
3232
- priority
@@ -38,16 +38,12 @@ spec:
3838
type: object
3939
required:
4040
- name
41-
- category
4241
- operator
4342
- keywords
4443
properties:
4544
name:
4645
type: string
47-
description: Unique name for this rule
48-
category:
49-
type: string
50-
description: Category name
46+
description: Unique name for this rule (also used as category name)
5147
operator:
5248
type: string
5349
enum:
@@ -67,67 +63,46 @@ spec:
6763
type: object
6864
required:
6965
- name
70-
- category
7166
- threshold
72-
- keywords
67+
- candidates
7368
properties:
7469
name:
7570
type: string
76-
description: Unique name for this rule
77-
category:
78-
type: string
79-
description: Category name
71+
description: Unique name for this rule (also used as category name)
8072
threshold:
8173
type: number
8274
format: float
8375
description: Similarity threshold
84-
keywords:
76+
candidates:
8577
type: array
8678
items:
8779
type: string
80+
description: Candidate phrases for semantic matching
8881
aggregationMethod:
8982
type: string
9083
enum:
9184
- max
9285
- mean
9386
default: max
94-
model:
95-
type: string
96-
default: auto
97-
dimension:
98-
type: integer
99-
format: int32
100-
default: 768
10187
domainRules:
10288
type: array
10389
items:
104-
type: object
105-
required:
106-
- name
107-
- domains
108-
properties:
109-
name:
110-
type: string
111-
description: Unique name for this rule
112-
domains:
113-
type: array
114-
items:
115-
type: string
116-
enum:
117-
- business
118-
- law
119-
- psychology
120-
- biology
121-
- chemistry
122-
- history
123-
- other
124-
- health
125-
- economics
126-
- math
127-
- physics
128-
- computer science
129-
- philosophy
130-
- engineering
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
131106
decisions:
132107
type: array
133108
items:
@@ -276,4 +251,3 @@ spec:
276251
- name: Age
277252
type: date
278253
jsonPath: .metadata.creationTimestamp
279-

0 commit comments

Comments
 (0)