Files
llm-claude-3/README.md
Simon Willison e065c6d48c Fix typo in README
Refs #19
2024-10-29 10:14:11 -07:00

2.0 KiB

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

The plugin may fail to install on Python 3.13 due to a dependency problem. A temporary workaround for that problem is to run this:

llm install https://github.com/simonw/anthropic-sdk-python/archive/9c13bb441ee4eb88a100ed363fc431ec8fd30c43.zip
llm install llm-claude-3

See this issue for further details.

Usage

First, set an API key for Claude 3:

llm keys set claude
# Paste key here

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-opus 'Fun facts about squirrels'
llm -m claude-3-sonnet 'Fun facts about walruses'
llm -m claude-3-haiku 'Fun facts about armadillos'

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