跳到主要内容
AI21 实验室是一家专注于自然语言处理 (NLP) 的公司,开发能够理解和生成自然语言的 AI 系统。
本页面介绍了如何在 LangChain 中使用 AI21 生态系统。

安装和设置

  • 获取 AI21 API 密钥并将其设置为环境变量(AI21_API_KEY
  • 安装 Python 包
pip install langchain-ai21

聊天模型

AI21 聊天

请参阅使用示例
from langchain_ai21 import ChatAI21

已弃用功能

:::caution 以下功能已弃用。::

AI21 LLM

from langchain_ai21 import AI21LLM

AI21 上下文回答

from langchain_ai21 import AI21ContextualAnswers

文本分割器

AI21 语义文本分割器

from langchain_ai21 import AI21SemanticTextSplitter

以编程方式连接这些文档到 Claude、VSCode 等,通过 MCP 获取实时答案。
© . This site is unofficial and not affiliated with LangChain, Inc.