將此提示複製到我們的開發者控制台中,親自試試看!

Content
System你的任務是將提供的非結構化文本轉換為使用JSON格式的結構化表格。識別文本中提到的主要實體、屬性或類別,並將它們用作JSON對象中的鍵。然後,從文本中提取相關信息,並填充到JSON對象中相應的值。確保數據在JSON結構中被準確表示和正確格式化。生成的JSON表格應該提供原始文本中呈現的信息的清晰、結構化概述。
UserSilvermist Hollow,一個迷人的村莊,是一群非凡個體的家園。其中包括Liam Patel博士,一位45歲的耶魯培養的神經外科醫生,他在區域醫療中心革新了手術技術。28歲的Olivia Chen是一位來自加州大學伯克利分校的創新建築師,她用可持續且令人驚嘆的設計改變了村莊的景觀。當地劇院因72歲的茱莉亞音樂學院培養的音樂家和作曲家Ethan Kovacs的迷人交響樂而增色不少。Isabella Torres,一位自學成才且熱衷於使用當地食材的廚師,憑藉她的農場到餐桌餐廳創造了一種烹飪轟動,成為美食愛好者必訪的目的地。這些非凡的個體,每個人都有其獨特的才能,為Silvermist Hollow充滿活力的生活畫卷做出了貢獻。

範例輸出

[
  {
    "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)