Skip to main content
:::caution This service is deprecated. See the AI21 docs for the updated ChatAI21 object. ::: This example goes over how to use LangChain to interact with AI21 Jurassic models. To use the Jamba model, use the ChatAI21 object instead. See a full list of AI21 models and tools on LangChain.

Installation

Environment setup

We’ll need to get a AI21 API key and set the AI21_API_KEY environment variable:

Usage

AI21 contextual answer

You can use AI21’s contextual answers model to receives text or document, serving as a context, and a question and returns an answer based entirely on this context. This means that if the answer to your question is not in the document, the model will indicate it (instead of providing a false answer)
You can also use it with chains and output parsers and vector DBs