このプロンプトを開発者Consoleにコピーして、自分で試してみましょう!

Content
Systemあなたの任務は、提供された非構造化テキストを取り、JSONを使用して整理されたテーブル形式に変換することです。テキストで言及されている主要なエンティティ、属性、またはカテゴリを識別し、それらをJSONオブジェクトのキーとして使用します。次に、テキストから関連情報を抽出し、JSONオブジェクト内の対応する値を入力します。データがJSON構造内で正確に表現され、適切にフォーマットされていることを確認してください。結果のJSONテーブルは、元のテキストで提示された情報の明確で構造化された概要を提供する必要があります。
Userシルバーミスト・ホロウは魅力的な村で、並外れた個性を持つ人々の集まりの故郷でした。その中には、地域の医療センターで手術技術に革命をもたらした45歳のイェール大学出身の神経外科医、リアム・パテル博士がいました。28歳のオリビア・チェンは、UCバークレー出身の革新的な建築家で、持続可能で息をのむようなデザインで村の景観を変えました。地元の劇場では、72歳のジュリアード音楽院出身の音楽家であり作曲家であるイーサン・コバックスの魅惑的な交響曲が演奏されていました。地元の食材に情熱を持つ独学のシェフ、イザベラ・トーレスは、ファーム・トゥ・テーブルのレストランで料理の感覚を生み出し、それは食通にとって必見の目的地となりました。これらの素晴らしい個人は、それぞれ独自の才能を持ち、シルバーミスト・ホロウの生活の活気あるタペストリーに貢献しました。

Example output

[
  {
    "name": "Dr. Liam Patel",
    "age": 45,
    "profession": "Neurosurgeon",
    "education": "Yale",
    "accomplishments": "Revolutionized surgical techniques at the regional medical center"
  },
  {
    "name": "Olivia Chen",
    "age": 28,
    "profession": "Architect",
    "education": "UC Berkeley",
    "accomplishments": "Transformed the village's landscape with sustainable and breathtaking designs"
  },
  {
    "name": "Ethan Kovacs",
    "age": 72,
    "profession": "Musician and Composer",
    "education": "Juilliard",
    "accomplishments": "Graced the local theater with enchanting symphonies"
  },
  {
    "name": "Isabella Torres",
    "age": null,
    "profession": "Chef",
    "education": "Self-taught",
    "accomplishments": "Created a culinary sensation with her farm-to-table restaurant, which became a must-visit destination for food lovers"
  }
]

import anthropic

client = anthropic.Anthropic(
    # defaults to os.environ.get("ANTHROPIC_API_KEY")
    api_key="my_api_key",
)
message = client.messages.create(
    model="claude-opus-4-20250514",
    max_tokens=1000,
    temperature=0,
    system="Your task is to take the unstructured text provided and convert it into a well-organized table format using JSON. Identify the main entities, attributes, or categories mentioned in the text and use them as keys in the JSON object. Then, extract the relevant information from the text and populate the corresponding values in the JSON object. Ensure that the data is accurately represented and properly formatted within the JSON structure. The resulting JSON table should provide a clear, structured overview of the information presented in the original text.",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "Silvermist Hollow, a charming village, was home to an extraordinary group of individuals. Among them was Dr. Liam Patel, a 45-year-old Yale-taught neurosurgeon who revolutionized surgical techniques at the regional medical center. Olivia Chen, at 28, was an innovative architect from UC Berkeley who transformed the village's landscape with her sustainable and breathtaking designs. The local theater was graced by the enchanting symphonies of Ethan Kovacs, a 72-year-old Juilliard-trained musician and composer. Isabella Torres, a self-taught chef with a passion for locally sourced ingredients, created a culinary sensation with her farm-to-table restaurant, which became a must-visit destination for food lovers. These remarkable individuals, each with their distinct talents, contributed to the vibrant tapestry of life in Silvermist Hollow."
                }
            ]
        }
    ]
)
print(message.content)