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')
API Reference:ChatAnthropic
大型语言模型
[旧版] AnthropicLLM
注意: AnthropicLLM 仅支持旧版的 Claude 2 模型。
要使用最新的 Claude 3 模型,请改用 ChatAnthropic。
查看一个使用示例。
from langchain_anthropic import AnthropicLLM
model = AnthropicLLM(model='claude-2.1')
API Reference:AnthropicLLM