Skip to content

Commit abaf8fa

Browse files
committed
Rename to llm-anthropic, add anthropic/ prefix
keys.json name is now anthropic, not claude Refs simonw/llm-claude-3#31
1 parent 8c08d56 commit abaf8fa

File tree

3 files changed

+33
-31
lines changed

3 files changed

+33
-31
lines changed

README.md

+24-16
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
# llm-claude-3
1+
# llm-anthropic
22

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

8-
LLM access to Claude 3 by Anthropic
8+
LLM access to models by Anthropic, including the Claude series
99

1010
## Installation
1111

1212
Install this plugin in the same environment as [LLM](https://llm.datasette.io/).
1313
```bash
14-
llm install llm-claude-3
14+
llm install llm-anthropic
1515
```
1616

1717
## Usage
1818

19-
First, set [an API key](https://console.anthropic.com/settings/keys) for Claude 3:
19+
First, set [an API key](https://console.anthropic.com/settings/keys) for Anthropic:
2020
```bash
21-
llm keys set claude
21+
llm keys set anthropic
2222
# Paste key here
2323
```
2424

@@ -28,21 +28,29 @@ Run `llm models` to list the models, and `llm models --options` to include a lis
2828

2929
Run prompts like this:
3030
```bash
31-
llm -m claude-3.5-sonnet 'Fun facts about pelicans'
32-
llm -m claude-3.5-haiku 'Fun facts about armadillos'
33-
llm -m claude-3-opus 'Fun facts about squirrels'
31+
llm -m anthropic/claude-3.5-sonnet 'Fun facts about pelicans'
32+
llm -m anthropic/claude-3.5-haiku 'Fun facts about armadillos'
33+
llm -m anthropic/claude-3-opus 'Fun facts about squirrels'
34+
```
35+
Images are supported too, for models other than Claude 3.5 Haiku:
36+
```bash
37+
llm -m anthropic/claude-3.5-sonnet 'describe this image' -a https://static.simonwillison.net/static/2024/pelicans.jpg
38+
llm -m anthropic/claude-3-haiku 'extract text' -a page.png
3439
```
35-
Images are supported too:
40+
Claude 3.5 Sonnet can handle PDF files:
3641
```bash
37-
llm -m claude-3.5-sonnet 'describe this image' -a https://static.simonwillison.net/static/2024/pelicans.jpg
38-
llm -m claude-3-haiku 'extract text' -a page.png
42+
llm -m anthropic/claude-3.5-sonnet 'extract text' -a page.pdf
43+
```
44+
The plugin sets up `claude-3.5-sonnet` and similar as aliases, usable like this:
45+
```bash
46+
llm -m claude-3.5-sonnet 'Fun facts about pelicans'
3947
```
4048

4149
## Development
4250

4351
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
4452
```bash
45-
cd llm-claude-3
53+
cd llm-anthropic
4654
python3 -m venv venv
4755
source venv/bin/activate
4856
```

llm_claude_3.py llm_anthropic.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def validate_temperature_top_p(self):
116116

117117

118118
class _Shared:
119-
needs_key = "claude"
119+
needs_key = "anthropic"
120120
key_env_var = "ANTHROPIC_API_KEY"
121121
can_stream = True
122122

@@ -126,15 +126,11 @@ def __init__(
126126
self,
127127
model_id,
128128
claude_model_id=None,
129-
extra_headers=None,
130129
supports_images=True,
131130
supports_pdf=False,
132131
):
133-
self.model_id = model_id
132+
self.model_id = 'anthropic/' + model_id
134133
self.claude_model_id = claude_model_id or model_id
135-
self.extra_headers = extra_headers or {}
136-
if supports_pdf:
137-
self.extra_headers["anthropic-beta"] = "pdfs-2024-09-25"
138134
self.attachment_types = set()
139135
if supports_images:
140136
self.attachment_types.update(
@@ -227,8 +223,6 @@ def build_kwargs(self, prompt, conversation):
227223
if prompt.system:
228224
kwargs["system"] = prompt.system
229225

230-
if self.extra_headers:
231-
kwargs["extra_headers"] = self.extra_headers
232226
return kwargs
233227

234228
def set_usage(self, response):

pyproject.toml

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
2-
name = "llm-claude-3"
2+
name = "llm-anthropic"
33
version = "0.10"
4-
description = "LLM access to Claude 3 by Anthropic"
4+
description = "LLM access to models by Anthropic, including the Claude series"
55
readme = "README.md"
66
authors = [{name = "Simon Willison"}]
77
license = {text = "Apache-2.0"}
@@ -14,13 +14,13 @@ dependencies = [
1414
]
1515

1616
[project.urls]
17-
Homepage = "https://github.com/simonw/llm-claude-3"
18-
Changelog = "https://github.com/simonw/llm-claude-3/releases"
19-
Issues = "https://github.com/simonw/llm-claude-3/issues"
20-
CI = "https://github.com/simonw/llm-claude-3/actions"
17+
Homepage = "https://github.com/simonw/llm-anthropic"
18+
Changelog = "https://github.com/simonw/llm-anthropic/releases"
19+
Issues = "https://github.com/simonw/llm-anthropic/issues"
20+
CI = "https://github.com/simonw/llm-anthropic/actions"
2121

2222
[project.entry-points.llm]
23-
claude_3 = "llm_claude_3"
23+
anthropic = "llm_anthropic"
2424

2525
[project.optional-dependencies]
2626
test = ["pytest", "pytest-recording", "pytest-asyncio"]

0 commit comments

Comments
 (0)