Skip to main content

Run prompts against models hosted on AWS Bedrock

Project description

llm-bedrock

PyPI Changelog Tests License

Run prompts against models hosted on AWS Bedrock

Installation

Install this plugin in the same environment as LLM.

llm install llm-bedrock

You'll need an access key and a secret key to use this plugin, with permission granted to access the Bedrock models. These step by step instructions can help you obtain those credentials.

Combine those into a access_key:secret_key format (joined by a colon) and paste that into:

llm keys set bedrock
# paste access_key:secret_key here

Usage

Run llm models to see the list of models. The Amazon Nova models are:

  • us.amazon.nova-micro-v1:0 (alias: nova-micro) - cheapest and fastest, text only
  • us.amazon.nova-lite-v1:0 (alias: nova-lite) - can handle text, images and PDFs
  • us.amazon.nova-pro-v1:0 (alias: nova-pro) - can handle text, images and PDFs, best and most expensive

Run a prompt like this:

llm -m nova-pro 'a happy poem about a pelican with a secret'

Images and PDFs can be provided using the -a option, which takes a file path or a URL:

llm -m nova-lite 'describe this image' -a https://static.simonwillison.net/static/2024/pelicans.jpg

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd llm-bedrock
python -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

llm install -e '.[test]'

To run the tests:

python -m pytest

To regenerate the captured HTTP responses:

PYTEST_BEDROCK_API_KEY="$(llm keys get bedrock)" python -m pytest --record-mode all

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-0.2.1.tar.gz (7.9 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-0.2.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file llm_bedrock-0.2.1.tar.gz.

File metadata

  • Download URL: llm_bedrock-0.2.1.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for llm_bedrock-0.2.1.tar.gz
Algorithm Hash digest
SHA256 93dfd824f5e6d9bc5e66182f077a1b53900bbd64d648eec631c51c0794cf93e5
MD5 b469f8a98d6fa6211b904d7952480fc0
BLAKE2b-256 0f80bd3153bc0c729d24d04f8f7bc4effe7c1302023d417a20544be802d1d953

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_bedrock-0.2.1.tar.gz:

Publisher: publish.yml on simonw/llm-bedrock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llm_bedrock-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: llm_bedrock-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for llm_bedrock-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b997e5b05e987e46e86f9acec2c12b8ae61c7fa41d6530dbc55e63b778f1f316
MD5 bb31f7defd1678de0327fc54e1d9b036
BLAKE2b-256 41d931b1c3520bb7c10d52d48d08e468c22867a42bd4e1b1897bf0d0ddd309ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_bedrock-0.2.1-py3-none-any.whl:

Publisher: publish.yml on simonw/llm-bedrock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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