llm-bedrock


Namellm-bedrock JSON
Version 0.4 PyPI version JSON
download
home_pageNone
SummaryRun prompts against models hosted on AWS Bedrock
upload_time2024-12-04 15:40:10
maintainerNone
docs_urlNone
authorSimon Willison
requires_python>=3.9
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # llm-bedrock

[![PyPI](https://img.shields.io/pypi/v/llm-bedrock.svg)](https://pypi.org/project/llm-bedrock/)
[![Changelog](https://img.shields.io/github/v/release/simonw/llm-bedrock?include_prereleases&label=changelog)](https://github.com/simonw/llm-bedrock/releases)
[![Tests](https://github.com/simonw/llm-bedrock/actions/workflows/test.yml/badge.svg)](https://github.com/simonw/llm-bedrock/actions/workflows/test.yml)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/llm-bedrock/blob/main/LICENSE)

Run prompts against models hosted on AWS Bedrock

## Installation

Install this plugin in the same environment as [LLM](https://llm.datasette.io/).
```bash
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](https://us-west-2.console.aws.amazon.com/bedrock/home?region=us-west-2#/), 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](https://ndurner.github.io/amazon-nova) by Nils Durner.

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

```bash
llm keys set bedrock
# paste access_key:secret_key here
```

## Usage

Run `llm models` to see the list of models. The [Amazon Nova](https://aws.amazon.com/blogs/aws/introducing-amazon-nova-frontier-intelligence-and-industry-leading-price-performance/) 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:

```bash
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:

```bash
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:
```bash
cd llm-bedrock
python -m venv venv
source venv/bin/activate
```
Now install the dependencies and test dependencies:
```bash
llm install -e '.[test]'
```
To run the tests:
```bash
python -m pytest
```
To regenerate the captured HTTP responses:
```bash
PYTEST_BEDROCK_API_KEY="$(llm keys get bedrock)" python -m pytest --record-mode all
```


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "llm-bedrock",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Simon Willison",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/c8/21/d184dd8e094fff1490067b97dac1b9b0e87ec83ccb677086fa0ae696acbd/llm_bedrock-0.4.tar.gz",
    "platform": null,
    "description": "# llm-bedrock\n\n[![PyPI](https://img.shields.io/pypi/v/llm-bedrock.svg)](https://pypi.org/project/llm-bedrock/)\n[![Changelog](https://img.shields.io/github/v/release/simonw/llm-bedrock?include_prereleases&label=changelog)](https://github.com/simonw/llm-bedrock/releases)\n[![Tests](https://github.com/simonw/llm-bedrock/actions/workflows/test.yml/badge.svg)](https://github.com/simonw/llm-bedrock/actions/workflows/test.yml)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/llm-bedrock/blob/main/LICENSE)\n\nRun prompts against models hosted on AWS Bedrock\n\n## Installation\n\nInstall this plugin in the same environment as [LLM](https://llm.datasette.io/).\n```bash\nllm install llm-bedrock\n```\n\n### Credentials\n\nYou'll need an access key and a secret key to use this plugin, with permission granted to access the Bedrock Nova models.\n\nIf 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.\n\nYou still need to request access to the Bedrock models [in the AWS console](https://us-west-2.console.aws.amazon.com/bedrock/home?region=us-west-2#/), which should be provisioned automatically within seconds of you filing the request.\n\nIf you want to use the plugin with dedicated IAM credentials (an access key and a secret key) follow these [step by step instructions](https://ndurner.github.io/amazon-nova) by Nils Durner.\n\nCombine those into a `access_key:secret_key` format (joined by a colon) and paste that into:\n\n```bash\nllm keys set bedrock\n# paste access_key:secret_key here\n```\n\n## Usage\n\nRun `llm models` to see the list of models. The [Amazon Nova](https://aws.amazon.com/blogs/aws/introducing-amazon-nova-frontier-intelligence-and-industry-leading-price-performance/) models are:\n\n- `us.amazon.nova-micro-v1:0` (alias: `nova-micro`) - cheapest and fastest, text only\n- `us.amazon.nova-lite-v1:0` (alias: `nova-lite`) - can handle text, images and PDFs\n- `us.amazon.nova-pro-v1:0` (alias: `nova-pro`) - can handle text, images and PDFs, best and most expensive\n\nRun a prompt like this:\n\n```bash\nllm -m nova-pro 'a happy poem about a pelican with a secret'\n```\nImages and videos and PDFs can be provided using the `-a` option, which takes a file path or a URL:\n\n```bash\nllm -m nova-lite 'describe this image' -a https://static.simonwillison.net/static/2024/pelicans.jpg\n```\n\n## Development\n\nTo set up this plugin locally, first checkout the code. Then create a new virtual environment:\n```bash\ncd llm-bedrock\npython -m venv venv\nsource venv/bin/activate\n```\nNow install the dependencies and test dependencies:\n```bash\nllm install -e '.[test]'\n```\nTo run the tests:\n```bash\npython -m pytest\n```\nTo regenerate the captured HTTP responses:\n```bash\nPYTEST_BEDROCK_API_KEY=\"$(llm keys get bedrock)\" python -m pytest --record-mode all\n```\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Run prompts against models hosted on AWS Bedrock",
    "version": "0.4",
    "project_urls": {
        "CI": "https://github.com/simonw/llm-bedrock/actions",
        "Changelog": "https://github.com/simonw/llm-bedrock/releases",
        "Homepage": "https://github.com/simonw/llm-bedrock",
        "Issues": "https://github.com/simonw/llm-bedrock/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d995b14378bf770b54c765d2c0538150f577e8c94f045e1fed6c230d91cd38b3",
                "md5": "bb9d2ad88a8fd45b35a9522165a0ad30",
                "sha256": "128d56b73308f862fea89e727dc18d762f1a6d52a02215d9d45bb79c9c8022a0"
            },
            "downloads": -1,
            "filename": "llm_bedrock-0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bb9d2ad88a8fd45b35a9522165a0ad30",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 8538,
            "upload_time": "2024-12-04T15:40:08",
            "upload_time_iso_8601": "2024-12-04T15:40:08.778154Z",
            "url": "https://files.pythonhosted.org/packages/d9/95/b14378bf770b54c765d2c0538150f577e8c94f045e1fed6c230d91cd38b3/llm_bedrock-0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c821d184dd8e094fff1490067b97dac1b9b0e87ec83ccb677086fa0ae696acbd",
                "md5": "b04a77eff0be98a70a22710f2987ed95",
                "sha256": "ba46b3199adbf1fa153b69d3f48578079156de4d5b74552931922eba94bf2571"
            },
            "downloads": -1,
            "filename": "llm_bedrock-0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "b04a77eff0be98a70a22710f2987ed95",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 8456,
            "upload_time": "2024-12-04T15:40:10",
            "upload_time_iso_8601": "2024-12-04T15:40:10.542817Z",
            "url": "https://files.pythonhosted.org/packages/c8/21/d184dd8e094fff1490067b97dac1b9b0e87ec83ccb677086fa0ae696acbd/llm_bedrock-0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-04 15:40:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "simonw",
    "github_project": "llm-bedrock",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "llm-bedrock"
}
        
Elapsed time: 0.82156s