Interact with your Anthropic models using LLMstudios LLM.

Supported models

  1. claude-3-opus-20240229
  2. claude-3-sonnet-2024022
  3. claude-3-haiku-20240307
  4. claude-2.1
  5. claude-2
  6. claude-instant-1.2

Parameters

An Anthropic LLM interface can have the following parameters:

ParameterTypeDescription
api_keystrThe API key for authentication.
temperaturefloatThe temperature parameter for the model.
top_pfloatThe top-p parameter for the model.
max_tokensintThe maximum number of tokens for the model’s output.
top_kintThe top-k parameter for the model.

Usage

Here is how you setup an interface to interact with your Anthropic models.

1

Create a .env file with you ANTHROPIC_API_KEY

Make sure you call your environment variable ANTHROPIC_API_KEY
ANTHROPIC_API_KEY="YOUR-KEY"
2

In your python code, import LLM from llmstudio.

from llmstudio import LLM
3

Create your llm instance.

llm = LLM('anthropic/{model}')
4

Optional: You can add your parameters as follows:

llm = LLM('anthropic/model', 
temperature= ...,
max_tokens= ...,
top_p= ...,
frequency_penalty= ...,
presence_penalty= ...)
You are done setting up your Anthropic LLM!

What’s next?