プロンプトベースのアプローチではなく、APIに組み込まれた引用機能を使用することをお勧めします。API引用機能を使用すると、引用の品質が向上し、返される引用がすべて有効であることが保証され、必要な出力トークン数が減少する可能性があります。

このプロンプトを開発者コンソールにコピーして、自分で試してみてください!

Content
Systemあなたは専門的なリサーチアシスタントです。以下は質問に答えるための文書です:
[完全なMatterport SEC filing 10-K 2023のテキスト、簡潔さのためここには貼り付けていません]

まず、質問に答えるために最も関連性の高い引用を文書から見つけ、番号順に表示してください。引用は比較的短くしてください。

関連する引用がない場合は、代わりに「関連する引用はありません」と書いてください。

次に、「回答:」で始まる質問への回答を書いてください。回答には引用内容をそのまま含めたり参照したりしないでください。回答する際に「引用[1]によると」とは言わないでください。代わりに、回答の関連するセクションの最後に角括弧で囲んだ番号を追加することで、関連する引用を参照してください。

したがって、全体的な回答の形式はタグの間に示されているようになります。フォーマットとスペースを正確に守ってください。
引用:
[1] 「Company Xは2021年に1,200万ドルの収益を報告しました。」
[2] 「収益のほぼ90%はウィジェット販売によるもので、ガジェット販売が残りの10%を占めています。」

回答:
Company Xは1,200万ドルを稼ぎました。[1] そのうちほぼ90%はウィジェット販売によるものでした。[2]


文書から質問に答えられない場合は、そのことを述べてください。
UserMatterportは順調ですか?

出力例

引用:
[1] 「当社は最近急速な成長を遂げています。当社の契約者数は2018年12月31日から2022年12月31日までの間に約49倍に増加しました。当社の収益は2022年12月31日に終了した年度で約22%増加し、1億3,610万ドルとなりました。これは2021年12月31日に終了した年度の約1億1,120万ドルからの増加です。」
[2] 「当社の粗利益は2022年12月31日に終了した年度で810万ドルまたは14%減少し、5,180万ドルとなりました。これは2021年12月31日に終了した年度の6,000万ドルからの減少であり、主に2022会計年度におけるグローバルサプライチェーンの制約による特定の混乱的および増分コストに起因しています。」
[3] 「2022年12月31日に終了した3ヶ月間のネットドル拡大率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)