Skip to main content

LLM plugin for Anthropic's Claude on AWS Bedrock

Project description

llm-bedrock-anthropic

PyPI License

Plugin for LLM adding support for Anthropic's Claude models.

New: claude opus model

claude-3-opus available on us-west-2

Installation

Install this plugin in the same environment as LLM. From the current directory

llm install llm-bedrock-anthropic

Configuration

You will need to specify AWS Configuration with the normal boto3 and environment variables.

For example, to use the region us-west-2 and AWS credentials under the personal profile, set the environment variables

export AWS_DEFAULT_REGION=us-west-2
export AWS_PROFILE=personal

Usage

This plugin adds models called bedrock-claude and bedrock-claude-instant.

You can query them like this:

llm -m bedrock-claude-instant "Ten great names for a new space station"
llm -m bedrock-claude "Compare and contrast the leadership styles of Abraham Lincoln and Boris Johnson."

Options

  • max_tokens_to_sample, default 8_191: The maximum number of tokens to generate before stopping

Use like this:

llm -m bedrock-claude -o max_tokens_to_sample 20 "Sing me the alphabet"
 Here is the alphabet song:

A B C D E F G
H I J
  • bedrock_model_id: allows you to override the model_id passed to Bedrock.

Can be a base model ID or ARN from https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html#model-ids-arns

Can also be an ARN of provisioned throughput for a base or custom model.

Use it like this:

llm -m bedrock-claude-haiku -o bedrock_model_id anthropic.claude-3-sonnet-20240229-v1:0 "Remind me how to post a new version to PyPI"
  • bedrock_attach: allows you to attach one or more (comma-separated) image or document files to your prompt.

See the Amazon Bedrock documentation for details about which file types are supported with which models: https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference.html

Use it like this:

llm -m bedrock-claude-haiku -o bedrock_attach cat.jpg "Describe this picture."
llm -m bedrock-claude-haiku -o bedrock_attach cat.jpg,mouse.jpg "What do these animals have in common?"
llm -m bedrock-claude-haiku -o bedrock_attach Model_Card_Claude_3_Addendum.pdf "Summarize this document."

The newer command line parameters -a, --attachment, --at, and --attachment-type are also supported. The bedrock_atach option is retained for backwards compatibility, and will be removed in the next major version.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_bedrock_anthropic-0.4.7.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_bedrock_anthropic-0.4.7-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file llm_bedrock_anthropic-0.4.7.tar.gz.

File metadata

  • Download URL: llm_bedrock_anthropic-0.4.7.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for llm_bedrock_anthropic-0.4.7.tar.gz
Algorithm Hash digest
SHA256 4ca2a310d025fa35935a13004083f1c0ce996af02a53ceabba5364731427c6a5
MD5 da1c4d0e01ab863228f74bf729182a83
BLAKE2b-256 f36a9491e6fbd2f10ca31a89848fc80a847ab287e0c3814347d4f932f012fe4c

See more details on using hashes here.

File details

Details for the file llm_bedrock_anthropic-0.4.7-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_bedrock_anthropic-0.4.7-py3-none-any.whl
Algorithm Hash digest
SHA256 55362f9d5d64b74d857817c5f6b62ac0095e0c35c5b6ce06324c56eb80b4bc0d
MD5 146131d974b5935afbc5bbd5c623170d
BLAKE2b-256 c07101be1ff3a36513da87edbf986fb57aa2d9a0c822e83083c6c4e223f2093c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page