This is an example code for request (with AWS Key)
import json
import boto3
bedrock_runtime = boto3.client("bedrock-runtime", region_name="us-east-1")
prompt = """
Human: Tell me today's weather
Assistant:
"""
body = json.dumps(
{
"prompt": prompt,
"max_tokens_to_sample": 500,
}
)
resp = bedrock_runtime.invoke_model(
modelId="anthropic.claude-instant-v1",
body=body,
contentType="application/json",
accept="*/*",
)
#print(resp)
answer = resp["body"].read().decode()
#print(answer)
print(json.loads(answer)["completion"])