Claude 3 Opus が Amazon Bedrock で利用可能になりました

Anthropic の Claude 3 で 最も高性能とされるモデル Opus が Amazon Bedrock で利用可能となったので試してみました
2024.04.17

2024年4月16日、Amazon Bedrockのモデルとして Anthropic の Claude 3 Opus が利用可能になりました。

その動作を試す機会がありましたので、紹介させていただきます。

当記事の公開直後、AWS公式ブログでも Claude 3 Opus リリース案内がありました。

Anthropic’s Claude 3 Opus model is now available on Amazon Bedrock

モデルアクセス

オレゴンリージョンの Bedrockで、 Anthropic の Claude 3 Opus がリクエスト可能となりました。

モデルアクセスを管理

モデルアクセスを管理画面を利用して、「Claude 3 Opus」をチェック、

Opus-02

「変更を保存」した後、数分でアクセス可能となりました。

チャット

チャットのプレイグランドで、モデルとして「Claude 3 Opus」を選択。

Anthropic Claude 3 の画像処理をBedrockで試してみた

で利用した写真の説明を、英語で求めてみました。

ラスベガス上空

fybr8wyw2bo6rtkepoqh

  • 回答文
The photo shows an aerial night view of Las Vegas, Nevada. The image captures the dazzling lights and expansive cityscape of the famous Las Vegas Strip and surrounding metropolitan area.

In the foreground, a bright red circular structure stands out amidst the sea of lights - this appears to be the High Roller observation wheel at the LINQ. The dense concentration of illuminated buildings, hotels and casinos along the Strip forms the vibrant core of the scene, with landmarks like the Luxor pyramid visible.

Countless lights from streets, buildings and vehicles create an luminous grid stretching out into the distance. The glowing arteries of major roads slice through the urban landscape. In the background, the city spreads out in all directions with light clusters indicating other built-up areas.

The vantage point provides a sweeping perspective emphasizing the immense scale and electric nocturnal energy of Las Vegas. Overall, it's a striking shot showcasing the city's famous glitzy, always-on character from a dramatic bird's-eye view after dark. The blanket of lights creates an almost surreal, captivating visual tapestry.

雷門

wan1p3qlrcbywalnszxe

  • 回答文
This photo shows the interior of a traditional Japanese temple or shrine structure. The image is looking up towards the ceiling, revealing an intricate wooden framework with exposed beams arranged in a grid pattern. Hanging from the ceiling are several white rectangular panels, likely made of paper or fabric, that help diffuse the light.

The most striking feature is the large red lantern hanging in the center. It has Japanese characters written on it in black ink, though I cannot provide a translation. The lantern adds a vibrant pop of color to the earthy wood tones of the ceiling.

At the top of the image, small windows allow some natural light to filter in, creating an interplay of light and shadow on the wooden surfaces. The repeating patterns, clean lines, and combination of natural materials and bold accents are all characteristic of traditional Japanese architecture.

Overall, the photo captures a serene, symmetrical scene that showcases the craftsmanship and aesthetics of this sacred Japanese structure's interior. The perspective looking straight up emphasizes the lofty height and draws the eye to the beautiful details overhead.

日本語

先に確認したラスベガスの写真、日本語のプロンプト応答を Opus、Sonnet、Haiku で評価。 Opus が最も詳細な回答を戻すことを確認できました。

この写真について、日本語で説明をしてください。

Bedrock_Chat_モデル比較

Opus

この写真は、夜のラスベガスの街並みを上空から撮影したものです。無数のネオンや照明に照らされた建物やカジノが、まるで宝石箱のようにきらめいています。

画像の中央には、ラスベガス・ストリップと呼ばれる大通りが見えます。有名なカジノホテルが立ち並び、特に目を引くのは赤く光る巨大な蓮の造形物です。これはおそらく、ウィン・ラスベガスというホテルの屋上にあるアトラクションだと思われます。

街全体が煌めく光に包まれ、活気に満ちた雰囲気が伝わってきます。遠景には、砂漠に囲まれたラスベガスの街の広がりも見て取れます。

この1枚の写真は、エンターテインメントとナイトライフの中心地として知られるラスベガスの、ダイナミックでゴージャスな夜景を見事に捉えています。まさに「眠らない街」という表現がぴったりの、圧巻の光景だと言えるでしょう。

Sonnet

この写真は、夜の大都市ラスベガスの素晴らしい夜景を空から捉えたものです。ネオンライトが輝く賑やかなストリップ地区の高層ホテルや遊園地が一望できます。カラフルな照明が特徴的で、まるで夜の宝石箱のようです。中央には大きな球体の観覧車があり、周辺は海のように広がる夜の街の灯りに包まれています。ラスベガスならではの華やかで活気に満ちた光の景色が印象的な一枚です。

Haiku

この画像は、夜の照明で輝く賑やかな都市の空撮写真です。主要な建物やホテル、エンターテインメント施設が密集しており、全体として賑やかでダイナミックな雰囲気が感じられます。中央には大きなフェリス・ホイールが目を引きますが、その周囲に多数の高層ビルが立ち並び、まさに都市の華やかな姿が表現されています。全体的に色彩豊かで、照明に彩られた夜景が印象的な写真だと言えるでしょう。

Boto3

最新の Boto3を利用して、 SDK経由で日本語利用ができる事を確かめました。

boto3バージョン

最新バージョンのBoto3 (1.34.84)を利用しました。

$ pip install boto3 --upgrade
$ pip list | grep boto3
boto3                1.34.84

modelId

awscliを利用して 「claude-3-opus」 を含むモデルIDを求めました。

$ aws bedrock list-foundation-models  | jq '.[][] | select(.modelId | contains("claude-3-opus"))'
{
  "modelArn": "arn:aws:bedrock:us-west-2::foundation-model/anthropic.claude-3-opus-20240229-v1:0",
  "modelId": "anthropic.claude-3-opus-20240229-v1:0",
  "modelName": "Claude 3 Opus",
  "providerName": "Anthropic",
(略)

pythonコード

import json
import boto3

bedrock_runtime = boto3.client("bedrock-runtime", region_name="us-west-2")

body = json.dumps({
   "anthropic_version": "bedrock-2023-05-31",
   "max_tokens": 1000,
   "messages": [
       {
           "role": "user",
           "content": [{"type": "text", "text": "4月は東京を訪れるのに良い時期ですか?"}]
       }
   ]
})

modelId="anthropic.claude-3-opus-20240229-v1:0"
response = bedrock_runtime.invoke_model(body=body, modelId=modelId)
response_text = ''.join([chunk['delta']['text'] for chunk in response['content_block_deltas'] if chunk['delta']['type'] == 'text_delta'])

print(response_text)

「4月は東京を訪れるのに良い時期ですか?」と問いに対し、SDK (boto3) では、日本語での回答が得られました。

$ python3 opus.py
はい、4月は東京を訪れるのに良い時期だと思います。その理由は以下の通りです。

1. 桜の季節:4月上旬から中旬にかけては、東京の各所で桜が満開になります。上野公園、千鳥ヶ淵、新宿御苑などで美しい桜を楽しむことができます。

2. 過ごしやすい気候:4月は春の中盤で、気温は徐々に上昇し、過ごしやすい気候となります。日中の平均気温は15〜20度前後で、観光に適しています。

3. 各種イベント:4月には、東京の各地で様々なイベントが開催されます。例えば、4月上旬の隅田川花火大会、4月中旬の神田祭などがあります。

4. 混雑が比較的少ない:4月は春休みが終わり、ゴールデンウィーク前の時期なので、他の繁忙期と比べると観光地の混雑が比較的少ないです。

ただし、4月下旬はゴールデンウィークの始まりで混雑が予想されるため、旅行の日程は注意が必要です。また、4月は春の変わり目で、天候が不安定になることもあるので、雨対策も忘れずに。

価格

北米リージョンの Claude 3 Opus の利用費、1000トークンあたりの費用は 以下の通りでした。

Anthropic models Price per 1,000 input tokens Price per 1,000 output tokens
Claude 2.0/2.1 $0.00800 $0.02400
Claude 3 Opus* $0.01500 $0.07500
Claude 3 Sonnet $0.00300 $0.01500
Claude 3 Haiku $0.00025 $0.00125

まとめ

Anthropic の Claude 3、先行して利用できていた Sonnet、Haiku に続き、 最も高性能なモデル Opusも、Amazon Bedrockで利用可能になりました。

そう遠くないと予想される正式リリースを待ちたいと思います。