clarify

clarify = 当用户需求不明确时,让模型或 Agent 向用户提问以获取更多信息

用户输入
   ↓
Agent / LLM 尝试生成 schema
   ↓
发现缺信息
   ↓
生成 clarify prompt → 问用户
   ↓
用户回答
   ↓
继续生成 schema
特性repairclarify
作用对象 模型输出 用户输入
目的 修复错误 / 保持 schema 合法 弥补信息缺失 / 确定需求
输出形式 JSON / schema 问题 / 提示用户回答
角色使用 system + assistant + user system + user
// 1. 尝试生成 schema
const schema = generateSchema(userInput)

// 2. 验证是否缺信息
if (isMissingInfo(schema)) {
  // 触发 clarify
  const clarifyPrompt = buildClarifyPrompt(schema)
  const questions = await callLLM(clarifyPrompt)
  // 问用户
  const userAnswers = await getUserInput(questions)
  // 再生成 schema
  const finalSchema = generateSchema(userInput + userAnswers)
}

 

posted on 2026-01-23 10:16  sss大辉  阅读(2)  评论(0)    收藏  举报

导航