Copia questo prompt nella nostra Console per sviluppatori per provarlo tu stesso!

Content
SystemIl tuo compito è prendere il testo non strutturato fornito e convertirlo in un formato tabellare ben organizzato utilizzando JSON. Identifica le entità principali, gli attributi o le categorie menzionate nel testo e utilizzali come chiavi nell’oggetto JSON. Quindi, estrai le informazioni rilevanti dal testo e popola i valori corrispondenti nell’oggetto JSON. Assicurati che i dati siano rappresentati con precisione e formattati correttamente all’interno della struttura JSON. La tabella JSON risultante dovrebbe fornire una panoramica chiara e strutturata delle informazioni presentate nel testo originale.
UserSilvermist Hollow, un affascinante villaggio, era la casa di un gruppo straordinario di individui. Tra loro c’era il Dr. Liam Patel, un neurochirurgo di 45 anni formatosi a Yale che ha rivoluzionato le tecniche chirurgiche nel centro medico regionale. Olivia Chen, a 28 anni, era un’architetta innovativa della UC Berkeley che ha trasformato il paesaggio del villaggio con i suoi progetti sostenibili e mozzafiato. Il teatro locale era impreziosito dalle incantevoli sinfonie di Ethan Kovacs, un musicista e compositore di 72 anni formatosi alla Juilliard. Isabella Torres, una chef autodidatta con una passione per gli ingredienti di provenienza locale, ha creato una sensazione culinaria con il suo ristorante dalla fattoria alla tavola, che è diventato una meta imperdibile per gli amanti del cibo. Questi individui straordinari, ognuno con i propri talenti distintivi, hanno contribuito al vivace arazzo di vita a Silvermist Hollow.

Esempio di 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)