YandexGPT
LangChain.js supports calling YandexGPT LLMs.
Setup
First, you should create service account with the ai.languageModels.user
role.
Next, you have two authentication options:
- IAM token.
You can specify the token in a constructor parameter
iam_token
or in an environment variableYC_IAM_TOKEN
. - API key
You can specify the key in a constructor parameter
api_key
or in an environment variableYC_API_KEY
.
Usage
- npm
- Yarn
- pnpm
npm install @langchain/yandex
yarn add @langchain/yandex
pnpm add @langchain/yandex
import { YandexGPT } from "@langchain/yandex/llms";
const model = new YandexGPT();
const res = await model.invoke(['Translate "I love programming" into French.']);
console.log({ res });
API Reference:
- YandexGPT from
@langchain/yandex/llms