-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.yaml
More file actions
109 lines (91 loc) · 3.37 KB
/
config.yaml
File metadata and controls
109 lines (91 loc) · 3.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# SmartRouter 配置文件
# 所有模型名称、路由规则、分类器配置均在此处定义
# 修改后重启服务即可生效
# ===== 上游 API =====
upstream:
url: "${NEW_API_URL}"
key: "${NEW_API_KEY}"
# ===== 分类器配置 (Layer 2) =====
classifier:
# 用哪个模型做任务分类(建议用免费/便宜的)
model: "MiniMax-M2.5"
# LRU 缓存条目数
cache_size: 500
# 缓存过期时间(秒),0 = 不过期
cache_ttl: 3600
# 分类超时(秒),超时则 fallback 到 general
timeout: 10
# 分类 prompt 模板,{user_message} 会被替换为用户消息前 500 字符
prompt: |
你是一个请求分类器。根据用户消息判断任务类型,只回复类型名称,不要解释。
可选类型:
- simple: 简单问候、闲聊、打招呼
- code: 代码生成、调试、编程、技术实现、算法
- reasoning: 数学推理、逻辑证明、复杂分析、多步推导
- creative: 创意写作、文案、翻译、诗歌、小说
- general: 通用知识问答、信息查询、日常对话
用户消息:
{user_message}
任务类型:
# ===== Tier 模型映射 =====
# 每个 tier 的 models 列表,第一个为首选
tiers:
simple:
models: ["MiniMax-M2.5"]
description: "简单问答、闲聊"
code:
models: ["GLM-5", "SSY-DeepSeek-V3.2", "MiniMax-M2.5"]
description: "代码生成、调试、技术实现"
reasoning:
models: ["SSY-DeepSeek-V3.2", "DeepSeek-V3.2", "GLM-5"]
description: "数学推理、逻辑证明、复杂分析"
creative:
models: ["SSY-GPT-5.2", "SSY-Kimi-K2.5", "MiniMax-M2.5"]
description: "创意写作、文案、翻译"
general:
models: ["MiniMax-M2.5", "GLM-5"]
description: "通用对话、知识问答"
premium:
models: ["claude-opus-4-6", "claude-opus-4-6-thinking"]
description: "手动指定的高端模型"
# ===== 快速规则 (Layer 1) =====
# 按顺序匹配,命中即停止,不经过 LLM 分类器
fast_rules:
# 带 tools 参数 → 必须用支持 function calling 的模型
- name: "has_tools"
condition: "has_tools"
tier: "code"
reason: "请求包含 tools 参数,需要支持 function calling"
# 消息包含代码块
- name: "has_code_block"
condition: "has_code_block"
tier: "code"
reason: "消息包含代码块"
# system prompt 含代码相关指令
- name: "system_code_hint"
condition: "system_contains"
keywords: ["代码", "编程", "code", "programming", "developer", "engineer", "coder", "debug"]
tier: "code"
reason: "system prompt 指示代码任务"
# system prompt 含推理相关指令
- name: "system_reasoning_hint"
condition: "system_contains"
keywords: ["数学", "推理", "math", "reasoning", "logic", "prove", "theorem"]
tier: "reasoning"
reason: "system prompt 指示推理任务"
# 短消息问候 (< 10 字符,无特殊内容)
- name: "short_greeting"
condition: "short_message"
max_length: 10
tier: "simple"
reason: "简短消息"
# ===== 特殊模型名映射 =====
special_models:
# 这些模型名触发特殊行为
auto: "smart-auto" # auto 等同于 smart-auto
smart-auto: "smart-auto" # 自动路由
smart-premium: "premium" # 路由到 premium tier
# ===== 服务配置 =====
server:
port: 30081
log_routes: true # 是否打印路由决策日志