Skip to content

Conversation

@WainWong
Copy link

Summary

  • 添加模糊问题澄清策略,当用户问题存在歧义或信息缺失时,系统会主动询问澄清而非猜测生成可能错误的SQL
  • 在 SQL 生成流程中增加强制检查步骤:在生成 SQL 前先判断问题是否存在歧义
  • 增加多种触发场景:字段歧义、缺少聚合维度、缺少筛选条件、问题过于宽泛、指标不明确

Changes

  • 更新 backend/templates/template.yaml 中的 prompt 模板,添加澄清策略规则和示例

- Add clarification check as step 2 in SQL generation process
- Add clarification-policy rule with must-clarify and should-clarify triggers
- Add few-shot examples for clarification scenarios:
  - Ambiguous field names
  - Missing aggregation dimensions
  - Unclear filter conditions
  - Overly broad questions
  - User questions about SQL meaning
- Enforce JSON response format for all scenarios including clarifications
- Use complex 3-table schema in examples (sales_order, product, customer)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant