File size: 1,039 Bytes
2e44b1a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Anthropic

>[Anthropic](https://www.anthropic.com/) is an AI safety and research company, and is the creator of `Claude`.
This page covers all integrations between `Anthropic` models and `LangChain`.

## Installation and Setup

To use `Anthropic` models, you need to install a python package:

```bash
pip install -U langchain-anthropic
```

You need to set the `ANTHROPIC_API_KEY` environment variable.
You can get an Anthropic API key [here](https://console.anthropic.com/settings/keys)

## Chat Models

### ChatAnthropic

See a [usage example](/docs/integrations/chat/anthropic).

```python
from langchain_anthropic import ChatAnthropic

model = ChatAnthropic(model='claude-3-opus-20240229')
```


## LLMs

### [Legacy] AnthropicLLM

**NOTE**: `AnthropicLLM` only supports legacy `Claude 2` models. 
To use the newest `Claude 3` models, please use `ChatAnthropic` instead.

See a [usage example](/docs/integrations/llms/anthropic).

```python
from langchain_anthropic import AnthropicLLM

model = AnthropicLLM(model='claude-2.1')
```