我们建议使用API中内置的引用功能,而不是基于提示的方法。使用API引用功能将提高引用质量,确保所有返回的引用都是有效的,并可能减少所需的输出标记数量。

将此提示复制到我们的开发者控制台中,亲自尝试!

内容
System你是一位专家研究助手。这里有一份文档,你将回答关于它的问题:
[完整的Matterport SEC 10-K 2023申报文件文本,为简洁起见此处未粘贴]

首先,找出文档中与回答问题最相关的引用,然后按编号顺序打印出来。引用应该相对简短。

如果没有相关引用,请写”没有相关引用”。

然后,回答问题,以”回答:“开头。不要在答案中逐字包含或引用引用内容。回答时不要说”根据引用[1]“。相反,仅通过在相关句子末尾添加方括号编号来引用与答案每个部分相关的引用。

因此,你的整体回答格式应该看起来像标签之间所示的那样。确保严格遵循格式和间距。
引用:
[1] “X公司在2021年报告收入为1200万美元。”
[2] “近90%的收入来自小部件销售,而小工具销售占剩余的10%。”

回答:
X公司赚了1200万美元。[1] 其中近90%来自小部件销售。[2]


如果文档无法回答该问题,请说明。
UserMatterport的发展情况如何?

示例输出

引用:
[1] “我们最近经历了快速增长。从2018年12月31日到2022年12月31日,我们的订阅用户增长了约49倍。我们的收入在截至2022年12月31日的年度增加了约22%,达到1.361亿美元,而截至2021年12月31日的年度约为1.112亿美元。“
[2] “我们的毛利润从2021年12月31日止年度的6000万美元减少了810万美元或14%,至2022年12月31日止年度的5180万美元,主要归因于2022财年全球供应链限制导致的某些破坏性和增量成本。“
[3] “我们截至2022年12月31日的三个月期间的净美元扩展率为103%,这证明了我们平台的粘性和增长潜力。”

回答:
Matterport在近年来经历了快速的订阅用户和收入增长。[1] 然而,由于供应链问题,他们2022年的毛利润下降了。[2] 他们的净美元扩展率表明订阅用户保留率强劲,并有持续增长的潜力。[3] 总体而言,尽管毛利润有所下降,但Matterport的订阅用户和收入增长,以及其平台的粘性,表明公司发展相对良好。


API请求

import anthropic

client = anthropic.Anthropic(  # 默认为os.environ.get("ANTHROPIC_API_KEY")
    api_key="my_api_key",
)
message = client.messages.create(
    model="claude-opus-4-20250514",
    max_tokens=2000,
    temperature=0,
    system='You are an expert research assistant. Here is a document you will answer questions about: \n<doc> \n[Full text of [Matterport SEC filing 10-K 2023](https://investors.matterport.com/node/9501/html), not pasted here for brevity] \n</doc> \n \nFirst, find the quotes from the document that are most relevant to answering the question, and then print them in numbered order. Quotes should be relatively short. \n \nIf there are no relevant quotes, write "No relevant quotes" instead. \n \nThen, answer the question, starting with "Answer:". Do not include or reference quoted content verbatim in the answer. Don\'t say "According to Quote [1]" when answering. Instead make references to quotes relevant to each section of the answer solely by adding their bracketed numbers at the end of relevant sentences. \n \nThus, the format of your overall response should look like what\'s shown between the <example></example> tags. Make sure to follow the formatting and spacing exactly. \n<example> \nQuotes: \n[1] "Company X reported revenue of \$12 million in 2021." \n[2] "Almost 90% of revenue came from widget sales, with gadget sales making up the remaining 10%." \n \nAnswer: \nCompany X earned \$12 million. [1] Almost 90% of it was from widget sales. [2] \n</example> \n \nIf the question cannot be answered by the document, say so.',
    messages=[
        {
            "role": "user",
            "content": [{"type": "text", "text": "Is Matterport doing well?"}],
        }
    ],
)
print(message.content)