## 新功能 - Langfuse 自建部署 (192.168.0.110:3100) - langfuse_client.py - LLM 呼叫追蹤包裝 - OpenClaw 整合 Langfuse trace ## 模型升級 (統帥批准) - 生產預設: llama3.2:3b → qwen2.5:7b-instruct - 摘要任務: llama3.2:3b (速度優先) ## 配置更新 - requirements.txt: +langfuse>=2.0.0 - config.py: +LANGFUSE_* 設定 - models.json: 更新 Ollama 模型配置 - K8s: Secret + ConfigMap 更新 ## 審查通過 - 模組化檢查 ✅ - 核心測試 31/31 ✅ Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
150 lines
3.6 KiB
JSON
150 lines
3.6 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"name": "OpenClaw AI Router Configuration",
|
|
"version": "1.0.0",
|
|
"description": "AI 模型路由與備援設定 (ADR-006)",
|
|
"updated_at": "2026-03-26",
|
|
|
|
"default_provider": "ollama",
|
|
"fallback_order": ["ollama", "gemini", "claude"],
|
|
|
|
"providers": {
|
|
"ollama": {
|
|
"name": "Ollama (Local)",
|
|
"enabled": true,
|
|
"priority": 1,
|
|
"endpoint": "http://192.168.0.188:11434",
|
|
"api_path": "/api/generate",
|
|
"models": {
|
|
"default": "qwen2.5:7b-instruct",
|
|
"rca": "qwen2.5:7b-instruct",
|
|
"summary": "llama3.2:3b"
|
|
},
|
|
"options": {
|
|
"temperature": 0.1,
|
|
"top_p": 0.9,
|
|
"num_predict": 1024,
|
|
"format": "json"
|
|
},
|
|
"timeout_seconds": 90,
|
|
"cost": {
|
|
"per_1k_tokens": 0,
|
|
"currency": "USD"
|
|
},
|
|
"health_check": {
|
|
"endpoint": "/api/tags",
|
|
"interval_seconds": 60
|
|
}
|
|
},
|
|
|
|
"gemini": {
|
|
"name": "Google Gemini",
|
|
"enabled": true,
|
|
"priority": 2,
|
|
"endpoint": "https://generativelanguage.googleapis.com/v1beta",
|
|
"api_path": "/models/{model}:generateContent",
|
|
"models": {
|
|
"default": "gemini-1.5-flash",
|
|
"rca": "gemini-1.5-flash",
|
|
"summary": "gemini-1.5-flash"
|
|
},
|
|
"options": {
|
|
"temperature": 0.1,
|
|
"maxOutputTokens": 2048,
|
|
"responseMimeType": "application/json"
|
|
},
|
|
"timeout_seconds": 30,
|
|
"cost": {
|
|
"per_1k_tokens": 0.001,
|
|
"currency": "USD"
|
|
},
|
|
"auth": {
|
|
"type": "api_key",
|
|
"env_var": "GEMINI_API_KEY",
|
|
"query_param": "key"
|
|
},
|
|
"rate_limits": {
|
|
"daily_tokens": 70000,
|
|
"requests_per_minute": 60
|
|
}
|
|
},
|
|
|
|
"claude": {
|
|
"name": "Anthropic Claude",
|
|
"enabled": true,
|
|
"priority": 3,
|
|
"endpoint": "https://api.anthropic.com/v1",
|
|
"api_path": "/messages",
|
|
"models": {
|
|
"default": "claude-3-haiku-20240307",
|
|
"rca": "claude-3-haiku-20240307",
|
|
"summary": "claude-3-haiku-20240307"
|
|
},
|
|
"options": {
|
|
"max_tokens": 2048
|
|
},
|
|
"timeout_seconds": 30,
|
|
"cost": {
|
|
"per_1k_tokens": 0.008,
|
|
"currency": "USD"
|
|
},
|
|
"auth": {
|
|
"type": "header",
|
|
"env_var": "CLAUDE_API_KEY",
|
|
"header_name": "x-api-key"
|
|
},
|
|
"rate_limits": {
|
|
"daily_tokens": 35000,
|
|
"requests_per_minute": 50
|
|
},
|
|
"features": {
|
|
"tool_use": true,
|
|
"structured_output": true
|
|
}
|
|
}
|
|
},
|
|
|
|
"use_cases": {
|
|
"rca_analysis": {
|
|
"description": "Root Cause Analysis for alerts",
|
|
"preferred_provider": "ollama",
|
|
"fallback_enabled": true,
|
|
"required_features": ["json_output"]
|
|
},
|
|
"log_summary": {
|
|
"description": "Summarize K8s logs for context gathering",
|
|
"preferred_provider": "ollama",
|
|
"fallback_enabled": true,
|
|
"max_input_tokens": 4096
|
|
},
|
|
"telegram_compose": {
|
|
"description": "Compose compressed Telegram messages",
|
|
"preferred_provider": "ollama",
|
|
"fallback_enabled": false,
|
|
"max_output_tokens": 500
|
|
}
|
|
},
|
|
|
|
"monitoring": {
|
|
"enabled": true,
|
|
"metrics": {
|
|
"track_latency": true,
|
|
"track_tokens": true,
|
|
"track_cost": true,
|
|
"track_fallbacks": true
|
|
},
|
|
"alerts": {
|
|
"daily_cost_threshold_usd": 5,
|
|
"monthly_cost_threshold_usd": 10,
|
|
"fallback_rate_threshold_percent": 20
|
|
}
|
|
},
|
|
|
|
"circuit_breaker": {
|
|
"enabled": true,
|
|
"failure_threshold": 5,
|
|
"recovery_timeout_seconds": 60,
|
|
"half_open_requests": 3
|
|
}
|
|
}
|