Introducing Anthropic Claude 3 Haiku: High-Speed, Cost-Effective LLM on Amazon Bedrock
The Anthropic Claude 3 Haiku is the latest addition to the Claude 3 family of large language models, now available on Amazon Bedrock. This model, identified by Model ID: anthropic.claude-3-haiku-20240307-v1:0, is designed to offer near-instant responsiveness at a fraction of the cost of its predecessors.
Here are the key characteristics that make Claude 3 Haiku a standout model:
- Speed and Cost: Claude 3 Haiku is optimized for rapid response times and is up to 68% cheaper per 1,000 input/output tokens compared to Claude Instant.
- Capabilities: The model supports both text and image inputs, generating text outputs with a robust 200k context window.
- Regions: Currently available in the US East (N. Virginia) and US West (Oregon) Regions.
For developers, using Claude 3 Haiku is straightforward with the Anthropic Messages API format, which accommodates complex interactions including image processing. Here’s a quick example of how you can call this model using Python:
def call_claude_haiku(base64_string):
prompt_config = {
"anthropic_version": "bedrock-2023-05-31",
"max_tokens": 4096,
"messages": [
{
"role": "user",
"content": [
{
"type": "image",
"source": {
"type": "base64",
"media_type": "image/png",
"data": base64_string,
},
},
{"type": "text", "text": "Provide a caption for this image"},
],
},
],
}
body = json.dumps(prompt_config)
modelId = "anthropic.claude-3-haiku-20240307-v1:0"
accept = "application/json"
contentType = "application/json"
response = bedrock_runtime.invoke_model(
body=body, modelId=modelId, accept=accept, contentType=contentType
)
response_body = json.loads(response.get("body").read())
results = response_body.get("content").get("text")
return results
To start using Claude 3 Haiku, ensure you have the AWS CLI version 2.13.23 or newer and configure your AWS credentials. You can request access to Anthropic models through the AWS Console by navigating to Bedrock > Model Access.
With its optimized performance and cost-effectiveness, Claude 3 Haiku is an excellent choice for applications that require quick and accurate responses. Start integrating it into your projects today to experience the benefits.