Introduzione ad Amazon Bedrock
Nikhil Rangarajan
Data Scientist




Nota: In tutto il corso, Access Key e Secret Key sono già caricate.
'us-east-1')
# Non sicuro in produzione, solo per didattica AWS_REGION = 'us-east-1'AWS_ACCESS_KEY = 'your-access-key'AWS_SECRET_KEY = 'your-secret-key'
'bedrock-runtime' per l’inferenzaimport boto3
bedrock = boto3.client('bedrock-runtime', # use -runtime
region_name=AWS_REGION,
aws_access_key_id=AWS_ACCESS_KEY,
aws_secret_access_key=AWS_SECRET_KEY)
'bedrock' per richieste operative
# Verifica configurazione del client Bedrock import boto3 bedrock_client = boto3.client('bedrock', region_name='us-east-1')models = bedrock_client.list_foundation_models() print(f"Connected successfully! Found {len(models['modelSummaries'])} available models.")
Connected successfully! Found 13 available models.
get_foundation_model() per i dettagli del modello
amazon.nova-2-lite-v1:0, anthropic.claude-sonnet-4-5-20250929-v1:0
response = bedrock_client.get_foundation_model
(modelIdentifier='anthropic.claude-sonnet-4-5-20250929-v1:0')
print(response['modelDetails'])
{'modelArn': 'arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-sonnet-4-5...',
'modelId': 'anthropic.claude-sonnet-4-5-20250929-v1:0',
'modelName': 'Claude Sonnet 4.5',
'providerName': 'Anthropic',
'inputModalities': ['TEXT', 'IMAGE'],
'outputModalities': ['TEXT'],
'responseStreamingSupported': True,
'customizationsSupported': [],
'inferenceTypesSupported': ['INFERENCE_PROFILE'],
'modelLifecycle': {'status': 'ACTIVE', 'startOfLifeTime': ...}
Introduzione ad Amazon Bedrock