AI21 Labs
AI21 Labs is a company specializing in Natural Language Processing (NLP), which develops AI systems that can understand and generate natural language.
This page covers how to use the AI21
ecosystem within LangChain
.
Installation and Setupβ
- Get an AI21 api key and set it as an environment variable (
AI21_API_KEY
) - Install the Python package:
pip install langchain-ai21
LLMsβ
See a usage example.
AI21 LLMβ
from langchain_ai21 import AI21LLM
API Reference:
AI21 Contextual Answerβ
You can use AI21βs contextual answers model to receive text or document, serving as a context, and a question and return an answer based entirely on this context.
from langchain_ai21 import AI21ContextualAnswers
API Reference:
Chat modelsβ
AI21 Chatβ
See a usage example.
from langchain_ai21 import ChatAI21
API Reference:
Embedding modelsβ
AI21 Embeddingsβ
See a usage example.
from langchain_ai21 import AI21Embeddings
API Reference:
Text splittersβ
AI21 Semantic Text Splitterβ
See a usage example.
from langchain_ai21 import AI21SemanticTextSplitter