UNPKG

@n8n/n8n-nodes-langchain

Version:

![Banner image](https://user-images.githubusercontent.com/10284570/173569848-c624317f-42b1-45a6-ab09-f0ea3c247648.png)

60 lines 2.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EmbeddingsOllama = void 0; const ollama_1 = require("@langchain/ollama"); const n8n_workflow_1 = require("n8n-workflow"); const ai_utilities_1 = require("@n8n/ai-utilities"); const description_1 = require("../../llms/LMOllama/description"); class EmbeddingsOllama { constructor() { this.description = { displayName: 'Embeddings Ollama', name: 'embeddingsOllama', icon: 'file:ollama.svg', group: ['transform'], version: 1, description: 'Use Ollama Embeddings', defaults: { name: 'Embeddings Ollama', }, ...description_1.ollamaDescription, codex: { categories: ['AI'], subcategories: { AI: ['Embeddings'], }, resources: { primaryDocumentation: [ { url: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.embeddingsollama/', }, ], }, }, inputs: [], outputs: [n8n_workflow_1.NodeConnectionTypes.AiEmbedding], outputNames: ['Embeddings'], properties: [(0, ai_utilities_1.getConnectionHintNoticeField)([n8n_workflow_1.NodeConnectionTypes.AiVectorStore]), description_1.ollamaModel], }; } async supplyData(itemIndex) { this.logger.debug('Supply data for embeddings Ollama'); const modelName = this.getNodeParameter('model', itemIndex); const credentials = await this.getCredentials('ollamaApi'); const headers = credentials.apiKey ? { Authorization: `Bearer ${credentials.apiKey}`, } : undefined; const embeddings = new ollama_1.OllamaEmbeddings({ baseUrl: credentials.baseUrl, model: modelName, headers, }); return { response: (0, ai_utilities_1.logWrapper)(embeddings, this), }; } } exports.EmbeddingsOllama = EmbeddingsOllama; //# sourceMappingURL=EmbeddingsOllama.node.js.map