😽
Claude 3.7 Sonnet が登場! Google CloudのVertexAIからも使ってみた
Google CloudのVertexAIでも、Claude 3.7 Sonnetが使えるようになっています。
Claude 3.7 Sonnetで使える機能
Extend thinking思考モードのほか、Prompt Cachingも対応してそうです。
価格
3.5 Sonnet v2と同じ模様
実際使ってみました
下記画像を分析させてみました。
import base64
import httpx
from anthropic import AnthropicVertex
LOCATION="us-east5"
client = AnthropicVertex(region=LOCATION, project_id="PROJECT_ID")
image1_url = "https://pbs.twimg.com/media/GklAAlxbkAECDWq?format=jpg&name=large"
image1_media_type = "image/jpeg"
image1_data = base64.b64encode(httpx.get(image1_url).content).decode("utf-8")
message = client.messages.create(
max_tokens=2048,
messages=[
{
"role": "user",
"content": [
{
"type": "image",
"source": {
"type": "base64",
"media_type": image1_media_type,
"data": image1_data,
},
},
{
"type": "text",
"text": "この画像について説明して"
}
],
}
],
thinking={
"type": "enabled",
"budget_tokens": 1024
},
model="claude-3-7-sonnet@20250219"
)
print(message.model_dump_json(indent=2))
日本語も大丈夫そうです。
{
"id": "msg_vrtx_01USF4vk2jhKun5qbbq3R6MY",
"content": [
{
"signature": "EugBCkYQAhgCIkA/hMhitRDPEe10jJYXnxzg13MOiORzgrglNaJ6mH4FM9b7nZh+uAzFBwKuVsehkIfPIGDYMVar7ohWALkC4xOSEgy0tnmitTHAL9M7tyQaDL9e8r44fcOUH/XkHSIwcy9/AU6mWJ1z2b36/3MHJtRCqnl3KvYGltfN15DK4hOcHWenG9grQq1JHZ4s9rs4KlB+qNdc/pOEGlLKY1QyxQ/nL/er9SOwJpuMKQBm0PLf6/TEEFH0CKEKdbS5GE38Vp1oilo0H7FmbEm/Eo6XnUbG7qDY1uZM1rxB7UyNHbMBFQ==",
"thinking": "This image appears to be showing a timeline or roadmap for the development of Claude (an AI assistant developed by Anthropic). The text is mostly in English with a Japanese request asking me to explain the image. The timeline shows three stages of Claude's development:\n\n1. 2024: \"Claude assists\" - Claude helps individuals do their current work better, making each person the best version of themselves.\n\n2. 2025: \"Claude collaborates\" - Claude does hours of independent work for you, on par with experts, expanding what every person or team is capable of.\n\n3. 2027: \"Claude pioneers\" - Claude finds breakthrough solutions to challenging problems that would have taken teams years to achieve.\n\nThe image shows an upward curve with these milestones marked, suggesting progressive advancement in Claude's capabilities over time. Each stage has a simple geometric icon above it.",
"type": "thinking"
},
{
"citations": null,
"text": "この画像はClaudeの将来の発展計画を示すタイムラインです。3つの発展段階が表示されています:\n\n1. 2024年: 「Claude assists(クロードがアシスト)」- Claudeは個人の仕事をサポートし、より効率的に作業できるよう手助けします。ユーザーが最高のパフォーマンスを発揮できるようサポートします。\n\n2. 2025年: 「Claude collaborates(クロードが協働)」- Claudeは専門家レベルの独立した作業を何時間も行い、個人やチームの能力を拡張します。\n\n3. 2027年: 「Claude pioneers(クロードが先駆ける)」- Claudeはチームが何年もかかるような難題に対して画期的な解決策を見つけ出します。\n\nグラフは右上がりの曲線で、時間の経過とともにClaudeの能力が向上していくことを示しています。各段階には幾何学的なアイコンが添えられており、進化するAI技術を表現しています。このビジョンはAnthropicがClaudeの将来の発展方向について描いているものです。",
"type": "text"
}
],
"model": "claude-3-7-sonnet-20250219",
"role": "assistant",
"stop_reason": "end_turn",
"stop_sequence": null,
"type": "message",
"usage": {
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"input_tokens": 1607,
"output_tokens": 539
}
}
Discussion