n8n-nodes-gigachat
Version:
A user-friendly GigaChat AI (Sber) nodes for n8n
140 lines • 5.35 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LmGigaChat = void 0;
const Disclaimers_1 = require("../../shared/Disclaimers");
const utils_1 = require("./utils");
class LmGigaChat {
constructor() {
this.description = {
displayName: 'GigaChat Model',
name: 'lmGigaChat',
icon: 'file:../../gigachat.svg',
group: ['transform'],
version: 1,
description: 'Языковые модели от Сбера',
defaults: {
name: 'GigaChat Model',
},
codex: {
categories: ['AI'],
subcategories: {
AI: ['Language Models'],
'Language Models': ['Text Completion Models'],
},
},
inputs: [],
outputs: ['ai_languageModel'],
outputNames: ['Model'],
credentials: [
{
name: 'gigaChatApi',
required: true,
},
],
requestDefaults: {
ignoreHttpStatusErrors: true,
baseURL: 'https://gigachat.devices.sberbank.ru/api/v1',
skipSslCertificateValidation: true,
headers: {
Authorization: 'Bearer {{$execution.token}}',
},
},
properties: [
{
...Disclaimers_1.disclaimerBlocks,
displayName: 'Имя модели',
name: 'model',
type: 'options',
description: 'Какую модель использовать для чата',
default: '',
typeOptions: {
loadOptionsMethod: 'getGigaChatModels',
},
routing: {
send: {
type: 'body',
property: 'model',
},
},
},
{
displayName: 'Настройки',
name: 'options',
placeholder: 'Добавить настройку',
description: 'Дополнительные настройки для модели',
type: 'collection',
default: {},
options: [
{
displayName: 'Макс. токенов',
name: 'maxTokens',
type: 'number',
default: 1000,
typeOptions: {
minValue: 1,
},
routing: {
send: {
type: 'body',
property: 'max_tokens',
},
},
},
{
displayName: 'Температура',
name: 'temperature',
type: 'number',
default: 0.8,
typeOptions: {
minValue: 0,
maxValue: 3,
},
routing: {
send: {
type: 'body',
property: 'temperature',
},
},
},
{
displayName: 'Top P',
name: 'topP',
type: 'number',
default: 1,
typeOptions: {
minValue: 0,
maxValue: 1,
},
routing: {
send: {
type: 'body',
property: 'top_p',
},
},
},
{
displayName: 'Repetition Penalty',
name: 'repetitionPenalty',
type: 'number',
default: 1,
routing: {
send: {
type: 'body',
property: 'repetition_penalty',
},
},
},
],
},
],
};
this.supplyData = utils_1.supplyLangchainGigaChatInstance;
this.methods = {
loadOptions: {
getGigaChatModels: utils_1.getLangchainGigaChatModels,
},
};
}
}
exports.LmGigaChat = LmGigaChat;
//# sourceMappingURL=LmGigaChat.node.js.map