fischer-agentkit/docs/plans/2026-06-16-005-reasoning-ve...

1.8 KiB
Raw Permalink Blame History

推理验证纠偏记录

created: 2026-06-16

验证场景

场景 1: "查下ip"

  • SimpleRouter: 无 @skill 前缀,非问候 → REACT + 全量工具
  • ReActEngine: system prompt 注入工具描述 + <tool_use> 格式
  • LLM 看到工具描述,理解需要 shell → 输出 <tool_use> → 解析执行
  • 结论: 正确 ✓

场景 2: "你好"

  • SimpleRouter: 匹配 _GREETING_RE → DIRECT_CHAT
  • 直接 LLM 调用,无工具
  • 结论: 正确 ✓

场景 3: "翻译hello为中文"

  • SimpleRouter: 无前缀,非问候 → REACT + 全量工具
  • LLM 看到工具但判断不需要 → 直接翻译
  • 代价: 多约 2000 tokens工具描述但保证正确性
  • 结论: 正确 ✓token 成本可接受)

场景 4: "@skill:shell_agent 查看当前ip"

  • SimpleRouter: @skill 前缀 → SKILL_REACT + shell_agent 工具
  • 结论: 正确 ✓

发现的问题

P3: tool_schemas 和 prompt-based 工具描述同时存在

  • 分析: API tools 参数 + system prompt 工具描述同时传入
  • 影响: 支持 function calling 的模型走原生路径,不支持的走 prompt-based
  • 当前代码已兼容: has_tool_calls → 原生路径else → 文本解析路径
  • 代价: 工具描述冗余约 2000 tokens
  • 结论: 可接受,不需要修改

P4: ChatMessage timestamp 类型不匹配(已修复)

  • 问题: add_message 中用了 .isoformat(),但字段类型是 datetime
  • 修复: 移除 .isoformat(),使用默认的 datetime.now(timezone.utc)

未修改的已知问题

  1. tasks.py 仍使用 IntentRouter — 不在 Portal 路径,暂不影响
  2. 工具描述冗余 — 后续可优化(检测模型是否支持 function calling
  3. chat.py 中 user_msg 未使用变量 — 预先存在的 lint 警告