Skip to main content

LLM plugin for Anthropic's Claude

Project description

llm-claude

PyPI Changelog Tests License

Plugin for LLM adding support for Anthropic's Claude model.

Installation

Install this plugin in the same environment as LLM.

llm install llm-claude

Configuration

You will need an API key from Anthropic. Request access at https://www.anthropic.com/earlyaccess then go to https://console.anthropic.com/account/keys

You can set that as an environment variable called ANTHROPIC_API_KEY, or add it to the llm set of saved keys using:

llm keys set claude
Enter key: <paste key here>

Usage

This plugin adds models called claude and claude-instant.

Anthropic describes them as:

two families of models, both of which support 100,000 token context windows:

  • Claude Instant: low-latency, high throughput
  • Claude: superior performance on tasks that require complex reasoning

You can execute them like this:

llm -m claude-instant "Ten great names for a new space station"
llm -m claude "Compare and contrast the leadership styles of Abraham Lincoln and Boris Johnson."

Options

  • max_tokens_to_sample, default 10_000: The maximum number of tokens to generate before stopping

Use like this:

llm -m claude -o max_tokens_to_sample 20 "Sing me the alphabet"
 Here is the alphabet song:

A B C D E F G
H I J

Development

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

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

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest

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-0.3.0.tar.gz (37.2 kB view details)

Uploaded Source

Built Distribution

llm_claude-0.3.0-py3-none-any.whl (44.4 kB view details)

Uploaded Python 3

File details

Details for the file llm-claude-0.3.0.tar.gz.

File metadata

  • Download URL: llm-claude-0.3.0.tar.gz
  • Upload date:
  • Size: 37.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for llm-claude-0.3.0.tar.gz
Algorithm Hash digest
SHA256 c6908b5ef1967b52f3deae5a7cfc890012c5ce58a395a82bbd402385a5746d51
MD5 f400dee492a984d5761fa57f838ae0e5
BLAKE2b-256 1fa392263c07653c4ff54ffc9e5136aceb2a94617ef04c8ade4967ff39ae3192

See more details on using hashes here.

File details

Details for the file llm_claude-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: llm_claude-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 44.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for llm_claude-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e825c8148eb51a1439a6de8d64dad76a820764c6b8cb92226bea5dc26759787a
MD5 1f0e623b9d00582e2fdd0273f23aac37
BLAKE2b-256 6f239d5ed1952cc33f25c5d1526ecfa5f99e0d86747e4428312549c67b5d2f9a

See more details on using hashes here.

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