逐日AI微信小程序
5 天提示词工程零基础
第 1 周 · D3🔒 锁定约 4 小时

结构化输出:JSON schema、模板与变量、多语言输出

让模型的回答能被程序直接消费:用 schema 约束输出形状、用模板与变量把提示词变成可复用的函数、让同一份提示词稳定输出多种语言。

今日目标 0/3

登录后可以勾选并保存进度。

让模型的回答能被程序直接消费:用 schema 约束输出形状、用模板与变量把提示词变成可复用的函数、让同一份提示词稳定输出多种语言。

登录并关联后阅读全文

请先登录网页,并在账户页关联微信小程序账号。关联后每天可免费阅读 1 篇;额外文章需在小程序看广告解锁。

小程序码

微信扫码打开「逐日AI」,进入相同课程和章节,选择看广告解锁,完成后刷新本页。

面试题库

  • 结构化输出为什么要用 schema 约束,而不是在提示词里写「请输出 JSON」?schema 通过之后还需要校验吗?Why should structured output be enforced with a schema instead of a 'please respond in JSON' instruction, and do you still need validation once the schema passes?
    国内高频海外高频基础#structured-output#json-schema

    🔒 解锁本章后查看答题要点。

  • 提示词模板里哪些内容该做成变量,哪些该写死?变量多了会有什么问题?In a prompt template, what should become a variable and what should stay constant, and what goes wrong when you have too many variables?
    国内高频海外高频进阶#prompt-template#structured-output

    🔒 解锁本章后查看答题要点。

  • 模型返回的 JSON 解析或校验失败时,你会怎么设计兜底?重试几次、怎么重试、失败之后怎么办?When the model's JSON fails to parse or validate, how do you design the fallback — how many retries, how do you retry, and what happens after the last failure?
    国内高频海外高频进阶#structured-output#error-handling

    🔒 解锁本章后查看答题要点。

评论