Anthropic
Anthropic 是一家 AI 安全與研究公司,也是
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 參考:ChatAnthropic
LLM
[舊版] AnthropicLLM
注意:AnthropicLLM
僅支援舊版 Claude 2
模型。若要使用最新的 Claude 3
模型,請改用 ChatAnthropic
。
請參閱使用範例。
from langchain_anthropic import AnthropicLLM
model = AnthropicLLM(model='claude-2.1')
API 參考:AnthropicLLM