引导式测验 · 简单 等级

提示测验中的 XML 标签和分隔符

检查您对为什么分隔符将指令与内容分开、标签如何使输出可解析以及为什么标签不安全的理解程度。

问题 1 的 8

分隔符使提示更可靠的主要原因是什么?

预览每个问题8 问题

当您参加测验时,就会出现答案和解释。

  1. 分隔符使提示更可靠的主要原因是什么?
    • They make the prompt shorter
    • The model can tell where each part of the prompt starts and ends
    • They switch the model into a special mode
    • They reduce the price per token
  2. 您是否必须使用特定的官方标签名称,例如 <document>?
    • Yes, only names from the provider's official list work
    • Yes, and tags must be valid strict XML
    • No, there is no official list, but you should use names consistently and refer to them
    • No, and tag names should change on every request
  3. XML 标签是针对提示注入的可靠安全边界吗?
    • No, text inside tags can still contain injection attempts that may succeed
    • Yes, models ignore everything inside tags
    • Yes, but only if tags are nested
    • Only with the <secure> tag
  4. 为什么要求模型将其最终结果放在 <answer> 标签内?
    • It makes the answer more accurate by default
    • It lowers the cost of output tokens
    • It hides the answer from the user
    • It gives your code a reliable place to extract the result
  5. 对于长文档的提示,Anthropic 建议将问题放在哪里?
    • Before the documents
    • At the end, after the documents
    • Only in the system prompt
    • Split across several messages
  6. What should you do if user-supplied text contains your own closing tag, such as </document>?
    • Leave it, since models ignore it
    • Delete the entire user input
    • Escape or remove it so the input cannot break out of its section
    • Add more opening tags
  7. Which delimiters does OpenAI's prompting guidance suggest, according to the guide?
    • Triple quotes, Markdown headings or XML
    • Only emoji markers
    • Only JSON
    • Line numbers
  8. How do tags express hierarchy, such as several documents that each have a source?
    • By using capital letters
    • By numbering each line
    • By writing everything on one line
    • By nesting, for example <document> elements inside <documents>