Skip to main content

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

Credentials

You'll need an access key and a secret key to use this plugin, with permission granted to access the Bedrock Nova models.

If you have already configured the AWS CLI on your machine you may be able to skip this step, as the plugin will automatically use the credentials from the CLI.

You still need to request access to the Bedrock models in the AWS console, which should be provisioned automatically within seconds of you filing the request.

If you want to use the plugin with dedicated IAM credentials (an access key and a secret key) follow these step by step instructions by Nils Durner.

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 videos 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

Release files for llm-bedrock 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llm-bedrock 0.4
File Size Uploaded
llm_bedrock-0.4.tar.gz 8.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llm-bedrock 0.4
File Interpreter ABI Platform
llm_bedrock-0.4-py3-none-any.whl Python 3 none any Details

Total release size: 17.0 kB

Release files / llm_bedrock-0.4.tar.gz

Download URL llm_bedrock-0.4.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ba46b3199adbf1fa153b69d3f48578079156de4d5b74552931922eba94bf2571
BLAKE2b-256 checksum
How to use checksums
c821d184dd8e094fff1490067b97dac1b9b0e87ec83ccb677086fa0ae696acbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2024.

Transparency log

Release files / llm_bedrock-0.4-py3-none-any.whl

Download URL llm_bedrock-0.4-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
128d56b73308f862fea89e727dc18d762f1a6d52a02215d9d45bb79c9c8022a0
BLAKE2b-256 checksum
How to use checksums
d995b14378bf770b54c765d2c0538150f577e8c94f045e1fed6c230d91cd38b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2024.

Transparency log

Release history Release notifications | RSS feed

This release

0.4 This release

2 release files

0.3.1

2 release files

0.3

2 release files

0.2.1

2 release files

0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page