Skip to main content

AI21

你可以通过注册 API 密钥 在他们的网站上 来开始使用 AI21Labs 的侏罗纪系列模型,并查看可用的基础模型的完整列表。

¥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.

以下是在 LangChain.js 中初始化实例的示例:

¥Here's an example of initializing an instance in LangChain.js:

npm install @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