import boto3
import json
# Make client with dummy creds
session = boto3.Session(aws_access_key_id="dummy", aws_secret_access_key="dummy",)
bedrock = session.client(service_name="bedrock-runtime", region_name="private", endpoint_url="http://127.0.0.1:8000")
# Call API
response = bedrock.invoke_model(
modelId="anthropic.claude-v2",
body=json.dumps({"prompt": "Human: What is the difference between eel (unagi) and conger eel (anago)?\nAssistant: ", "max_tokens_to_sample": 100})
)
# Show response
print(json.loads(response["body"].read()))
To use Claude2 on AWS Bedrock, instantiate
Claude2Proxy
and add route to it.Client side. We test API with boto3.