Skip to main content
在 GitHub 上打开

Anthropic

Anthropic 是一家 AI 安全和研究公司,是Claude. 本页介绍了Anthropicmodels 和LangChain.

安装和设置

要使用Anthropicmodels,你需要安装一个 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

LLM

[旧版]AnthropicLLM 硕士

注意AnthropicLLM仅支持旧版Claude 2模型。 要使用最新的Claude 3型号,请使用ChatAnthropic相反。

请参阅使用示例

from langchain_anthropic import AnthropicLLM

model = AnthropicLLM(model='claude-2.1')
API 参考:AnthropicLLM