Update nexus wiki content

This commit is contained in:
2026-05-03 05:42:06 +08:00
parent 90f3811b83
commit 111bc65b7b
707 changed files with 32306 additions and 7289 deletions

View File

@@ -0,0 +1,49 @@
---
title: "Semantic Routing"
type: concept
tags: []
sources: [engineering-autonomous-optimization-architect]
last_updated: 2026-05-01
---
# Semantic Routing
## Definition
语义路由——基于任务语义和历史性能数据,动态选择最优 LLM 提供商进行路由,而非使用固定规则或纯价格优先策略。
## Routing Decision Factors
- **任务类型**:文本提取 vs. 代码生成 vs. 创意写作 vs. 复杂推理
- **历史准确率**:该模型在此类任务上的 LLM-as-a-Judge 评分
- **成本**:每百万 Token 成本
- **延迟**P95 响应时间
- **可用性**:当前熔断器状态
## Example
```typescript
// Gemini Flash 在特定提取任务上准确率达 98% 且成本仅为 Claude Opus 的 10%
// → 自动将此类任务路由到 Gemini Flash
const rankedProviders = rankByHistoricalPerformance(taskType, providers);
for (const provider of rankedProviders) {
if (!provider.circuitBreakerTripped) {
return await provider.execute(task);
}
}
```
## vs. Traditional Routing
| 维度 | 固定路由 | 语义路由 |
|------|----------|----------|
| 成本优化 | ❌ | ✅ |
| 任务适配 | ❌ | ✅ |
| 动态适应 | ❌ | ✅ |
| 新模型集成 | 需人工修改 | 自动发现 |
## Related
- [[Autonomous-Optimization-Architect]]:实施语义路由的核心 Agent
- [[AI-FinOps]]:语义路由是成本优化的主要手段
- [[Shadow-Traffic]]:语义路由的评分数据来源于影子测试