Introductie tot Amazon Bedrock
Nikhil Rangarajan
Data Scientist



Andere modellen in Amazon Bedrock:
Meta’s Llama
Stability AI’s Stable Diffusion
AI21’s Jurassic

import json
bedrock = boto3.client('bedrock-runtime', region_name='us-east-1')
response = bedrock.invoke_model(modelId='amazon.nova-lite-v1:0',body=json.dumps(input_dictionary))
response = bedrock.invoke_model( modelId='anthropic.claude-3-5-sonnet-v2:0', body=json.dumps({"anthropic_version": "bedrock-2023-05-31","max_tokens": 100,"messages": [{ "role": "user", "content": [{"type": "text", "text": "your prompt here"}], }],}))
response = bedrock.invoke_model( modelId='amazon.nova-lite-v1:0', body=json.dumps({"messages":[{"role": "user", "content": [{"text": "your prompt here"}] }]}))
print("Claude:",json.loads( claude_response['body'].read() )["content"][0]["text"])
Hallo! Leuk je te ontmoeten. Hoe kan ik je vandaag helpen?
print("Nova:",json.loads( nova_response.get("body").read().decode() )["output"]["message"]["content"][0]["text"])
Hallo! Hoe kan ik je vandaag helpen?
Introductie tot Amazon Bedrock