Skip to content

T0R0NT0T0KY0/yandex-gpt-node

Repository files navigation

yandex-gpt Build Status

This library provides convenient access to YandexGPT from Node.js

Getting Started

Install the module with: npm install yandex-gpt-node

Import

from:

import { YandexGPT } from 'yandex-gpt-node';

require:

const YandexGPT = require('yandex-gpt-node').YandexGPT;

Start

Creating an Instance of a Class. quickstart / apiKey

const client = new YandexGPT(apiKey, folderId);
await client.createToken();

Use

const res = await client.generateText({
	modelUri: `gpt://${client.getFolderId()}/yandexgpt-lite`,
	completionOptions: {
		stream: false,
		temperature: 0.6,
		maxTokens: 100,
	},
	messages: [
		{
			role: Role.SYSTEM,
			text: "You are a smart assistant",
		},
		{
			role: Role.USER,
			text,
		},
	],
});

License

Copyright (c) 2024 T0R0NT0T0KY0
Licensed under the MIT license.