6
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Global Cross Region Inference を試す最も短いコード

Last updated at Posted at 2025-09-04

GCRI キタ━━━━(゚∀゚)━━━━!!

今まで定められたリージョン間での推論だったのが、グローバルで推論できるようになりました。

推論方法は Inference Profile Id で Global が生えているのでそれを使うだけです。

$ aws bedrock list-inference-profiles | grep anthropic | grep inferenceProfileArn | grep global
"inferenceProfileArn": "arn:aws:bedrock:us-east-1:290000338583:inference-profile/global.anthropic.claude-sonnet-4-20250514-v1:0",

試すならこれがとても短くて良い。(しらんけど)

import boto3
boto3.client("bedrock-runtime").converse(modelId="arn:aws:bedrock:us-east-1:290000338583:inference-profile/global.anthropic.claude-sonnet-4-20250514-v1:0",messages=[{"role":"user","content":[{"text":"Hi"}]}])

response
{'ResponseMetadata': {'RequestId': '64a7b8c5-ec99-4fb3-ab6f-a7a66adc5695',
  'HTTPStatusCode': 200,
  'HTTPHeaders': {'date': 'Thu, 04 Sep 2025 01:48:18 GMT',
   'content-type': 'application/json',
   'content-length': '361',
   'connection': 'keep-alive',
   'x-amzn-requestid': '64a7b8c5-ec99-4fb3-ab6f-a7a66adc5695'},
  'RetryAttempts': 0},
 'output': {'message': {'role': 'assistant',
   'content': [{'text': 'Hello! How are you doing today? Is there anything I can help you with?'}]}},
 'stopReason': 'end_turn',
 'usage': {'inputTokens': 8,
  'outputTokens': 20,
  'totalTokens': 28,
  'cacheReadInputTokens': 0,
  'cacheWriteInputTokens': 0},
 'metrics': {'latencyMs': 1061}}
6
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?