Run prompts against models hosted on AWS Bedrock
Project description
llm-bedrock
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 onlyus.amazon.nova-lite-v1:0(alias:nova-lite) - can handle text, images and PDFsus.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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llm_bedrock-0.4.tar.gz.
File metadata
- Download URL: llm_bedrock-0.4.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba46b3199adbf1fa153b69d3f48578079156de4d5b74552931922eba94bf2571
|
|
| MD5 |
b04a77eff0be98a70a22710f2987ed95
|
|
| BLAKE2b-256 |
c821d184dd8e094fff1490067b97dac1b9b0e87ec83ccb677086fa0ae696acbd
|
Provenance
The following attestation bundles were made for llm_bedrock-0.4.tar.gz:
Publisher:
publish.yml on simonw/llm-bedrock
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llm_bedrock-0.4.tar.gz -
Subject digest:
ba46b3199adbf1fa153b69d3f48578079156de4d5b74552931922eba94bf2571 - Sigstore transparency entry: 153348588
- Sigstore integration time:
-
Permalink:
simonw/llm-bedrock@05ecd31a394b961bf146f2540e83459768e311bd -
Branch / Tag:
refs/tags/0.4 - Owner: https://github.com/simonw
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@05ecd31a394b961bf146f2540e83459768e311bd -
Trigger Event:
release
-
Statement type:
File details
Details for the file llm_bedrock-0.4-py3-none-any.whl.
File metadata
- Download URL: llm_bedrock-0.4-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
128d56b73308f862fea89e727dc18d762f1a6d52a02215d9d45bb79c9c8022a0
|
|
| MD5 |
bb9d2ad88a8fd45b35a9522165a0ad30
|
|
| BLAKE2b-256 |
d995b14378bf770b54c765d2c0538150f577e8c94f045e1fed6c230d91cd38b3
|
Provenance
The following attestation bundles were made for llm_bedrock-0.4-py3-none-any.whl:
Publisher:
publish.yml on simonw/llm-bedrock
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llm_bedrock-0.4-py3-none-any.whl -
Subject digest:
128d56b73308f862fea89e727dc18d762f1a6d52a02215d9d45bb79c9c8022a0 - Sigstore transparency entry: 153348592
- Sigstore integration time:
-
Permalink:
simonw/llm-bedrock@05ecd31a394b961bf146f2540e83459768e311bd -
Branch / Tag:
refs/tags/0.4 - Owner: https://github.com/simonw
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@05ecd31a394b961bf146f2540e83459768e311bd -
Trigger Event:
release
-
Statement type: