Skip to main content

LLM access to Claude 3 by Anthropic

Project description

llm-claude-3

PyPI Changelog Tests License

LLM access to Claude 3 by Anthropic

Installation

Install this plugin in the same environment as LLM.

llm install llm-claude-3

Usage

First, set an API key for Claude 3:

llm keys set claude
# Paste key here

You can also set the key in the environment variable ANTHROPIC_API_KEY

Run llm models to list the models, and llm models --options to include a list of their options.

Run prompts like this:

llm -m claude-3.5-sonnet 'Fun facts about pelicans'
llm -m claude-3.5-haiku 'Fun facts about armadillos'
llm -m claude-3-opus 'Fun facts about squirrels'

Images are supported too:

llm -m claude-3.5-sonnet 'describe this image' -a https://static.simonwillison.net/static/2024/pelicans.jpg
llm -m claude-3-haiku 'extract text' -a page.png

Development

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

cd llm-claude-3
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

llm install -e '.[test]'

To run the tests:

pytest

This project uses pytest-recording to record Anthropic API responses for the tests.

If you add a new test that calls the API you can capture the API response like this:

PYTEST_ANTHROPIC_API_KEY="$(llm keys get claude)" pytest --record-mode once

You will need to have stored a valid Anthropic API key using this command first:

llm keys set claude
# Paste key here

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_claude_3-0.9.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

llm_claude_3-0.9-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file llm_claude_3-0.9.tar.gz.

File metadata

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

File hashes

Hashes for llm_claude_3-0.9.tar.gz
Algorithm Hash digest
SHA256 f400be32111cd6fca21674b92285f30d2ca57d99e7424e343c83e6fec30de38e
MD5 ce310ece2b6261ffa63840cc779613c2
BLAKE2b-256 4e9f889a209ff7fc1ab0dd80c21a2c38222a64d477b1d5fcc361c264a9b91fb4

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_claude_3-0.9.tar.gz:

Publisher: publish.yml on simonw/llm-claude-3

Attestations:

File details

Details for the file llm_claude_3-0.9-py3-none-any.whl.

File metadata

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

File hashes

Hashes for llm_claude_3-0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 cc3fb807fac6916d3c4b544e2c1852c2b4639b5e5774ec524a69a1a2e01dc212
MD5 5b0a657629717fc2b6435a8aee0180f5
BLAKE2b-256 385b2f6a261c6d2e8778a442be7ce9bc144ecbf84c7f5cce02a886f59d99203f

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_claude_3-0.9-py3-none-any.whl:

Publisher: publish.yml on simonw/llm-claude-3

Attestations:

Supported by

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