omarsol's picture
026b63d1b2534d37e2985f31ecf11f13a01a9f2306fd8e798775233f180f8ea7
7677e00 verified
raw
history blame
1.35 kB
# AI21 Labs
>[AI21 Labs](https://www.ai21.com/about) 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:
```bash
pip install langchain-ai21
```
## LLMs
See a [usage example](/docs/integrations/llms/ai21).
### AI21 LLM
```python
from langchain_ai21 import AI21LLM
```
### 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.
```python
from langchain_ai21 import AI21ContextualAnswers
```
## Chat models
### AI21 Chat
See a [usage example](/docs/integrations/chat/ai21).
```python
from langchain_ai21 import ChatAI21
```
## Embedding models
### AI21 Embeddings
See a [usage example](/docs/integrations/text_embedding/ai21).
```python
from langchain_ai21 import AI21Embeddings
```
## Text splitters
### AI21 Semantic Text Splitter
See a [usage example](/docs/integrations/document_transformers/ai21_semantic_text_splitter).
```python
from langchain_ai21 import AI21SemanticTextSplitter
```