Saltar al contenido

Analista de códigos de aeropuertos (Claude Prompt Sample)

    Find and extract airport codes from text.

    Content
    System
    Your task is to analyze the provided text and identify any airport codes mentioned within it. Present these airport codes as a list in the order they appear in the text. If no airport codes are found, return an empty list.
    User
    My next trip involves flying from Seattle-Tacoma International Airport to Amsterdam Airport Schiphol (AMS). I'll be spending a few days in Amsterdam before heading to Paris Charles de Gaulle Airport (CDG) for a connecting flight to Rome-Fiumicino International Airport (FCO).

    Example output

    Airport codes:
    
    SEA
    AMS
    CDG
    FCO

    API request

    PythonTypeScript
    import anthropic
    
    client = anthropic.Anthropic(
        # defaults to os.environ.get("ANTHROPIC_API_KEY")
        api_key="my_api_key",
    )
    message = client.messages.create(
        model="claude-3-opus-20240229",
        max_tokens=1000,
        temperature=0,
        system="Your task is to analyze the provided text and identify any airport codes mentioned within it. Present these airport codes as a list in the order they appear in the text. If no airport codes are found, return an empty list.",
        messages=[
            {"role": "user", "content": "My next trip involves flying from Seattle-Tacoma International Airport to Amsterdam Airport Schiphol (AMS). I'll be spending a few days in Amsterdam before heading to Paris Charles de Gaulle Airport (CDG) for a connecting flight to Rome-Fiumicino International Airport (FCO)."}
        ]
    )
    print(message.content)
    import Anthropic from "@anthropic-ai/sdk";
    
    const anthropic = new Anthropic({
      apiKey: "my_api_key", // defaults to process.env["ANTHROPIC_API_KEY"]
    });
    
    const msg = await anthropic.messages.create({
      model: "claude-3-opus-20240229",
      max_tokens: 1000,
      temperature: 0,
      system: "Your task is to analyze the provided text and identify any airport codes mentioned within it. Present these airport codes as a list in the order they appear in the text. If no airport codes are found, return an empty list.",
      messages: [
        {"role": "user", "content": "My next trip involves flying from Seattle-Tacoma International Airport to Amsterdam Airport Schiphol (AMS). I'll be spending a few days in Amsterdam before heading to Paris Charles de Gaulle Airport (CDG) for a connecting flight to Rome-Fiumicino International Airport (FCO)."}
      ]
    });
    console.log(msg);

    Source: