mirror of
https://github.com/simonw/llm-claude-3.git
synced 2025-01-23 19:28:29 +03:00
94456fdf8e8b8236a900b35a378adff6912463dd
llm-claude-3
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
Description
Languages
Python
100%