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

内容
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)