AI21
You can get started with AI21Labs' Jurassic family of models, as well as see a full list of available foundational models, by signing up for an API key on their website.
Here's an example of initializing an instance in LangChain.js:
- npm
- Yarn
- pnpm
npm install @langchain/community @langchain/core
yarn add @langchain/community @langchain/core
pnpm add @langchain/community @langchain/core
import { AI21 } from "@langchain/community/llms/ai21";
const model = new AI21({
ai21ApiKey: "YOUR_AI21_API_KEY", // Or set as process.env.AI21_API_KEY
});
const res = await model.invoke(`Translate "I love programming" into German.`);
console.log({ res });
/*
{
res: "\nIch liebe das Programmieren."
}
*/
API Reference:
- AI21 from
@langchain/community/llms/ai21
Related
- LLM conceptual guide
- LLM how-to guides