UNPKG

n8n-nodes-gigachat

Version:

A user-friendly GigaChat AI (Sber) nodes for n8n

29 lines 1.61 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GigaChatEmbeddingsLcClient = void 0; const langchain_gigachat_1 = require("langchain-gigachat"); const HttpsAgent_1 = require("./HttpsAgent"); const GigaChatApiClient_1 = require("./GigaChatApiClient"); class GigaChatEmbeddingsLcClientInstance extends langchain_gigachat_1.GigaChatEmbeddings { constructor(config) { var _a, _b; super({ ...config, httpsAgent: HttpsAgent_1.HttpsAgent, model: (_a = config.model) !== null && _a !== void 0 ? _a : 'Embeddings' }); this.authorizationKey = null; this.model = 'Embeddings'; this.model = (_b = config.model) !== null && _b !== void 0 ? _b : 'Embeddings'; } async updateConfig(config) { var _a, _b, _c; const modelChanged = this.model !== ((_a = config.model) !== null && _a !== void 0 ? _a : 'Embeddings'); const credentialsChanged = this.authorizationKey !== config.credentials; if (credentialsChanged || modelChanged) { this.authorizationKey = (_b = config.credentials) !== null && _b !== void 0 ? _b : null; this.model = (_c = config.model) !== null && _c !== void 0 ? _c : 'Embeddings'; await GigaChatApiClient_1.GigaChatApiClient.updateConfig(config); this.clientConfig = { ...this.clientConfig, ...config, model: this.model }; this._client = GigaChatApiClient_1.GigaChatApiClient; } } } exports.GigaChatEmbeddingsLcClient = new GigaChatEmbeddingsLcClientInstance({}); //# sourceMappingURL=GigaChatEmbeddingsLcClient.js.map