Back

Airport code analyst

Find and extract airport codes from text.

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).

The airport codes mentioned in the given text are:

  1. SEA (Seattle-Tacoma International Airport)
  2. AMS (Amsterdam Airport Schiphol)
  3. CDG (Paris Charles de Gaulle Airport)
  4. FCO (Rome-Fiumicino International Airport)

Based on the airports mentioned in the text, the list of airport codes in the order they appear is:

SEA, AMS, CDG, FCO

[SEA, AMS, CDG, FCO]

API request

python
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=2000, 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)
typescript
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: 2000, 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);