Skip to main content

Anthropic

Anthropic 是一家人工智能安全和研究公司,也是 Claude 的创造者。 本页面涵盖了 Anthropic 模型与 LangChain 之间的所有集成。

安装与设置

要使用 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')

LLMs

[遗留] AnthropicLLM

注意: AnthropicLLM 仅支持遗留的 Claude 2 模型。
要使用最新的 Claude 3 模型,请改用 ChatAnthropic

请参见 使用示例

from langchain_anthropic import AnthropicLLM

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

此页面是否有帮助?


您还可以留下详细的反馈 在 GitHub 上