Anthropic
Anthropic is an AI safety and research company, and is the creator of
Claude. This page covers all integrations betweenAnthropicmodels andLangChain.
安装与设置
要使用 Anthropic 模型,你需要安装一个 Python 包:
pip install -U langchain-anthropic
你需要设置 ANTHROPIC_API_KEY 环境变量。
你可以在此处获取 Anthropic API 密钥 这里
聊天模型
ChatAnthropic
查看一个 使用示例。
from langchain_anthropic import ChatAnthropic
model = ChatAnthropic(model='claude-3-opus-20240229')
API 参考:ChatAnthropic
LLMs
[旧版] AnthropicLLM
注意: AnthropicLLM 仅支持旧版 Claude 2 模型。
要使用最新的 Claude 3 模型,请改用 ChatAnthropic。
查看一个 使用示例。
from langchain_anthropic import AnthropicLLM
model = AnthropicLLM(model='claude-2.1')
API 参考:AnthropicLLM