Name | llm-anthropic JSON |
Version |
0.11
JSON |
| download |
home_page | None |
Summary | LLM access to models by Anthropic, including the Claude series |
upload_time | 2024-12-17 20:43:30 |
maintainer | None |
docs_url | None |
author | Simon Willison |
requires_python | None |
license | Apache-2.0 |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# llm-anthropic
[![PyPI](https://img.shields.io/pypi/v/llm-anthropic.svg)](https://pypi.org/project/llm-anthropic/)
[![Changelog](https://img.shields.io/github/v/release/simonw/llm-anthropic?include_prereleases&label=changelog)](https://github.com/simonw/llm-anthropic/releases)
[![Tests](https://github.com/simonw/llm-anthropic/actions/workflows/test.yml/badge.svg)](https://github.com/simonw/llm-anthropic/actions/workflows/test.yml)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/llm-anthropic/blob/main/LICENSE)
LLM access to models by Anthropic, including the Claude series
## Installation
Install this plugin in the same environment as [LLM](https://llm.datasette.io/).
```bash
llm install llm-anthropic
```
## Usage
First, set [an API key](https://console.anthropic.com/settings/keys) for Anthropic:
```bash
llm keys set anthropic
# 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:
```bash
llm -m anthropic/claude-3.5-sonnet 'Fun facts about pelicans'
llm -m anthropic/claude-3.5-haiku 'Fun facts about armadillos'
llm -m anthropic/claude-3-opus 'Fun facts about squirrels'
```
Images are supported too, for models other than Claude 3.5 Haiku:
```bash
llm -m anthropic/claude-3.5-sonnet 'describe this image' -a https://static.simonwillison.net/static/2024/pelicans.jpg
llm -m anthropic/claude-3-haiku 'extract text' -a page.png
```
Claude 3.5 Sonnet can handle PDF files:
```bash
llm -m anthropic/claude-3.5-sonnet 'extract text' -a page.pdf
```
The plugin sets up `claude-3.5-sonnet` and similar as aliases, usable like this:
```bash
llm -m claude-3.5-sonnet 'Fun facts about pelicans'
```
## Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
```bash
cd llm-anthropic
python3 -m venv venv
source venv/bin/activate
```
Now install the dependencies and test dependencies:
```bash
llm install -e '.[test]'
```
To run the tests:
```bash
pytest
```
This project uses [pytest-recording](https://github.com/kiwicom/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:
```bash
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:
```bash
llm keys set claude
# Paste key here
```
Raw data
{
"_id": null,
"home_page": null,
"name": "llm-anthropic",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Simon Willison",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/36/cb/c9378f58b73b56a58f20a48e14ca8991ecb0ce842b2cdd73101cf8d9da7a/llm_anthropic-0.11.tar.gz",
"platform": null,
"description": "# llm-anthropic\n\n[![PyPI](https://img.shields.io/pypi/v/llm-anthropic.svg)](https://pypi.org/project/llm-anthropic/)\n[![Changelog](https://img.shields.io/github/v/release/simonw/llm-anthropic?include_prereleases&label=changelog)](https://github.com/simonw/llm-anthropic/releases)\n[![Tests](https://github.com/simonw/llm-anthropic/actions/workflows/test.yml/badge.svg)](https://github.com/simonw/llm-anthropic/actions/workflows/test.yml)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/llm-anthropic/blob/main/LICENSE)\n\nLLM access to models by Anthropic, including the Claude series\n\n## Installation\n\nInstall this plugin in the same environment as [LLM](https://llm.datasette.io/).\n```bash\nllm install llm-anthropic\n```\n\n## Usage\n\nFirst, set [an API key](https://console.anthropic.com/settings/keys) for Anthropic:\n```bash\nllm keys set anthropic\n# Paste key here\n```\n\nYou can also set the key in the environment variable `ANTHROPIC_API_KEY`\n\nRun `llm models` to list the models, and `llm models --options` to include a list of their options.\n\nRun prompts like this:\n```bash\nllm -m anthropic/claude-3.5-sonnet 'Fun facts about pelicans'\nllm -m anthropic/claude-3.5-haiku 'Fun facts about armadillos'\nllm -m anthropic/claude-3-opus 'Fun facts about squirrels'\n```\nImages are supported too, for models other than Claude 3.5 Haiku:\n```bash\nllm -m anthropic/claude-3.5-sonnet 'describe this image' -a https://static.simonwillison.net/static/2024/pelicans.jpg\nllm -m anthropic/claude-3-haiku 'extract text' -a page.png\n```\nClaude 3.5 Sonnet can handle PDF files:\n```bash\nllm -m anthropic/claude-3.5-sonnet 'extract text' -a page.pdf\n```\nThe plugin sets up `claude-3.5-sonnet` and similar as aliases, usable like this:\n```bash\nllm -m claude-3.5-sonnet 'Fun facts about pelicans'\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-anthropic\npython3 -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\npytest\n```\n\nThis project uses [pytest-recording](https://github.com/kiwicom/pytest-recording) to record Anthropic API responses for the tests.\n\nIf you add a new test that calls the API you can capture the API response like this:\n```bash\nPYTEST_ANTHROPIC_API_KEY=\"$(llm keys get claude)\" pytest --record-mode once\n```\nYou will need to have stored a valid Anthropic API key using this command first:\n```bash\nllm keys set claude\n# Paste key here\n```\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "LLM access to models by Anthropic, including the Claude series",
"version": "0.11",
"project_urls": {
"CI": "https://github.com/simonw/llm-anthropic/actions",
"Changelog": "https://github.com/simonw/llm-anthropic/releases",
"Homepage": "https://github.com/simonw/llm-anthropic",
"Issues": "https://github.com/simonw/llm-anthropic/issues"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "243c0f38d9d186b84bccfa085ce8bd29582b841cdce3809ac31dd1889cbec780",
"md5": "4c704bb8580974a6f9794978080fe77e",
"sha256": "44c557d10a7d8616607075d2a3787476e6bebe77e4f7c4946a5555ca705b6d2a"
},
"downloads": -1,
"filename": "llm_anthropic-0.11-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4c704bb8580974a6f9794978080fe77e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 9239,
"upload_time": "2024-12-17T20:43:28",
"upload_time_iso_8601": "2024-12-17T20:43:28.918908Z",
"url": "https://files.pythonhosted.org/packages/24/3c/0f38d9d186b84bccfa085ce8bd29582b841cdce3809ac31dd1889cbec780/llm_anthropic-0.11-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "36cbc9378f58b73b56a58f20a48e14ca8991ecb0ce842b2cdd73101cf8d9da7a",
"md5": "133edbe4bba2f2a49f8c2b9b9249346c",
"sha256": "eef9cf1ebe7cb5461847b495a8695ec82da452381dc81c3e8b1573b58d95c395"
},
"downloads": -1,
"filename": "llm_anthropic-0.11.tar.gz",
"has_sig": false,
"md5_digest": "133edbe4bba2f2a49f8c2b9b9249346c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9795,
"upload_time": "2024-12-17T20:43:30",
"upload_time_iso_8601": "2024-12-17T20:43:30.168914Z",
"url": "https://files.pythonhosted.org/packages/36/cb/c9378f58b73b56a58f20a48e14ca8991ecb0ce842b2cdd73101cf8d9da7a/llm_anthropic-0.11.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-17 20:43:30",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "simonw",
"github_project": "llm-anthropic",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "llm-anthropic"
}