직접 시도해보려면 이 프롬프트를 개발자 Console에 복사하세요!

Content
System제공된 텍스트를 분석하여 그 안에 언급된 모든 공항 코드를 식별하는 것이 당신의 임무입니다. 이러한 공항 코드들을 텍스트에 나타나는 순서대로 목록으로 제시하세요. 공항 코드가 발견되지 않으면 빈 목록을 반환하세요.
User다음 여행에서는 시애틀에서 암스테르담으로 비행합니다. 암스테르담에서 며칠을 보낸 후 파리로 가서 로마행 연결 비행편을 탈 예정입니다.

출력 예시

다음은 텍스트에서 언급된 공항 코드 목록이며, 나타나는 순서대로 정렬되어 있습니다:

  1. SEA (시애틀)
  2. AMS (암스테르담)
  3. CDG (파리)
  4. FCO (로마)

API 요청

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-7-sonnet-20250219",
    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": [
                {
                    "type": "text",
                    "text": "My next trip involves flying from Seattle to Amsterdam. I'll be spending a few days in Amsterdam before heading to Paris for a connecting flight to Rome."
                }
            ]
        }
    ]
)
print(message.content)

Was this page helpful?