@sateeshreddy/n8n-nodes-nvidia-nim 1.0.3 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,9 +4,9 @@
4
4
 
5
5
  # n8n-nodes-nvidia-nim
6
6
 
7
- **Connect any free NVIDIA NIM language model to your n8n workflows — in one node.**
7
+ **Connect NVIDIA NIM language models and embedding models to your n8n workflows — in one package.**
8
8
 
9
- [![npm version](https://img.shields.io/npm/v/n8n-nodes-nvidia-nim?color=76b900&label=npm&style=flat-square)](https://www.npmjs.com/package/n8n-nodes-nvidia-nim)
9
+ [![npm version](https://img.shields.io/npm/v/@sateeshreddy/n8n-nodes-nvidia-nim?color=76b900&label=npm&style=flat-square)](https://www.npmjs.com/package/@sateeshreddy/n8n-nodes-nvidia-nim)
10
10
  [![n8n community node](https://img.shields.io/badge/n8n-community%20node-EA4B71?style=flat-square&logo=n8n)](https://n8n.io)
11
11
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue?style=flat-square)](LICENSE)
12
12
 
@@ -16,20 +16,30 @@
16
16
 
17
17
  ## Overview
18
18
 
19
- `n8n-nodes-nvidia-nim` is an n8n community node that gives you access to **NVIDIA NIM's free hosted language models** directly inside your workflows.
20
- It plugs into n8n's **AI Agent** as a drop-in language model — just like the built-in OpenAI or Anthropic nodes.
19
+ `@sateeshreddy/n8n-nodes-nvidia-nim` is an n8n community node package that gives you access to **NVIDIA NIM's free hosted models** directly inside your workflows.
20
+
21
+ This package includes **two nodes**:
22
+
23
+ | Node | Purpose |
24
+ |---|---|
25
+ | **NVIDIA NIM** | Language model — connects to AI Agent, LLM Chain, etc. |
26
+ | **NVIDIA NIM Embeddings** | Embeddings model — connects to Qdrant, Pinecone, PGVector, Supabase, Weaviate, etc. |
21
27
 
22
28
  ### Why use this?
23
29
 
24
30
  - ✅ Free tier models via [build.nvidia.com](https://build.nvidia.com)
25
- - ✅ Works as a proper **AI sub-node** (connect to any AI Agent)
26
- - ✅ Supports 17+ models including Llama 4, Mistral, Qwen3, Gemma, and more
31
+ - ✅ **Language model node** plugs into AI Agent, Basic LLM Chain, Summarization Chain
32
+ - ✅ **Embeddings node** plugs into any n8n vector store (Qdrant, Pinecone, PGVector, Supabase, Weaviate, Chroma)
33
+ - ✅ Supports 17+ chat models including Llama 4, Mistral, Qwen3, Gemma, and more
34
+ - ✅ Supports 5 embedding models including free hosted endpoints
27
35
  - ✅ Drop-in OpenAI-compatible API — no extra setup
28
36
 
29
37
  ---
30
38
 
31
39
  ## Supported Models
32
40
 
41
+ ### Chat / Language Models
42
+
33
43
  | Model | Value |
34
44
  |---|---|
35
45
  | Llama 4 Maverick 17B 128E Instruct *(default)* | `meta/llama-4-maverick-17b-128e-instruct` |
@@ -50,6 +60,16 @@ It plugs into n8n's **AI Agent** as a drop-in language model — just like the b
50
60
  | Nemotron Mini 4B Instruct | `nvidia/nemotron-mini-4b-instruct` |
51
61
  | Solar 10.7B Instruct | `upstage/solar-10.7b-instruct` |
52
62
 
63
+ ### Embedding Models
64
+
65
+ | Model | Value | Note |
66
+ |---|---|---|
67
+ | NV Embed v1 *(default)* | `nvidia/nv-embed-v1` | Free hosted endpoint |
68
+ | NV EmbedQA E5 v5 | `nvidia/nv-embedqa-e5-v5` | Best for RAG / QA pipelines |
69
+ | Llama Nemotron Embed 1B v2 | `nvidia/llama-nemotron-embed-1b-v2` | Multilingual, 26 languages |
70
+ | Llama Nemotron Embed VL 1B v2 | `nvidia/llama-nemotron-embed-vl-1b-v2` | Multimodal (text + image docs) |
71
+ | BGE-M3 | `BAAI/bge-m3` | Dense + multi-vector + sparse retrieval |
72
+
53
73
  ---
54
74
 
55
75
  ## Installation
@@ -59,17 +79,14 @@ It plugs into n8n's **AI Agent** as a drop-in language model — just like the b
59
79
  1. Open your n8n instance
60
80
  2. Go to **Settings → Community Nodes**
61
81
  3. Click **Install**
62
- 4. Enter `n8n-nodes-nvidia-nim` and confirm
82
+ 4. Enter `@sateeshreddy/n8n-nodes-nvidia-nim` and confirm
63
83
 
64
84
  ### Manual Installation
65
85
 
66
- ```bash
67
- # Navigate to your n8n custom nodes directory
68
- cd ~/.n8n/custom/
86
+ Navigate to your n8n custom nodes directory and install:
69
87
 
70
- # Install the package
71
- npm install n8n-nodes-nvidia-nim
72
- ```
88
+ cd ~/.n8n/custom/
89
+ npm install @sateeshreddy/n8n-nodes-nvidia-nim
73
90
 
74
91
  Then restart n8n.
75
92
 
@@ -88,146 +105,59 @@ Then restart n8n.
88
105
 
89
106
  ## Usage
90
107
 
91
- ### 1. Add Credentials
108
+ ### Setting Up Credentials
92
109
 
93
- In n8n, go to **Credentials → New → NVIDIA NIM API** and paste your API key.
110
+ In n8n, go to **Credentials → New → NVIDIA NIM API** and paste your API key. Both the chat node and the embeddings node share the same credential.
94
111
 
95
- ### 2. Add the Node to a Workflow
112
+ ---
96
113
 
97
- 1. Add an **AI Agent** node to your workflow
98
- 2. In the Agent's **Model** slot, click the `+` button
99
- 3. Search for **NVIDIA NIM** and select it
100
- 4. Configure the model, temperature, and max tokens
101
- 5. Run your workflow
114
+ ### NVIDIA NIM (Chat / Language Model)
102
115
 
103
- The node acts as a language model supplier — it connects to AI Agents, chains, and any other LangChain-compatible n8n node.
116
+ Use this node anywhere n8n expects a **language model**.
104
117
 
105
- ---
118
+ 1. Add an **AI Agent** (or Basic LLM Chain) node to your workflow
119
+ 2. In the **Model** slot, click `+`
120
+ 3. Search for **NVIDIA NIM** and select it
121
+ 4. Choose your model, set temperature and max tokens
122
+ 5. Run your workflow
106
123
 
107
- ## Configuration Options
124
+ **Configuration Options:**
108
125
 
109
126
  | Parameter | Type | Default | Description |
110
127
  |---|---|---|---|
111
- | **Model** | Dropdown | `llama-4-maverick-17b-128e-instruct` | The NIM model to use |
112
- | **Temperature** | Number (0–2) | `0.7` | Controls output randomness. Lower = more deterministic |
113
- | **Max Tokens** | Number (1–4096) | `1000` | Maximum tokens in the response |
128
+ | Model | Dropdown | `llama-4-maverick-17b-128e-instruct` | The NIM chat model to use |
129
+ | Temperature | Number (0–2) | `0.7` | Controls output randomness. Lower = more deterministic |
130
+ | Max Tokens | Number (1–4096) | `1000` | Maximum tokens in the response |
114
131
 
115
132
  ---
116
133
 
117
- ## Known Issue — Routing Light Not Animating
118
-
119
- > ⚠️ **This section documents a bug found in earlier versions of this node and how it was fixed.**
120
- > If you installed version `1.0.0` or earlier, please update to the latest version.
121
-
122
- ### What was happening
123
-
124
- When users ran a workflow containing this node, the **routing light** (the animated glow/pulse around a node that shows it is actively executing) never appeared — even though the node was working correctly behind the scenes.
125
-
126
- Every other node in the workflow showed the animation, but the NVIDIA NIM node stayed visually "dark" throughout execution.
127
-
128
- ### Root Cause
129
-
130
- This node uses n8n's `supplyData()` method instead of `execute()` — which is the correct pattern for **AI sub-nodes** (language model supply nodes that connect to AI Agents). However, `supplyData` has a different execution lifecycle than `execute`, and n8n tracks visual status through that lifecycle.
131
-
132
- Three things were missing:
133
-
134
- **1. No `closeFunction` returned**
135
-
136
- `supplyData` must return a `closeFunction` alongside the model response. n8n uses this callback as the signal that the node has finished its work — which is what triggers the routing light to complete its animation and mark the node as done.
134
+ ### NVIDIA NIM Embeddings
137
135
 
138
- ```ts
139
- // ❌ Before — n8n never knew the node finished
140
- return {
141
- response: chatModel,
142
- };
136
+ Use this node anywhere n8n expects an **embeddings model** — vector stores like Qdrant, Pinecone, PGVector, Supabase, Weaviate, and Chroma.
143
137
 
144
- // After n8n now correctly tracks completion
145
- return {
146
- response: chatModel,
147
- closeFunction: async () => {},
148
- };
149
- ```
150
-
151
- **2. Errors were not re-thrown as `NodeOperationError`**
152
-
153
- When the node threw an error (bad API key, network failure, etc.), n8n had no way to update the node's visual state to "failed". The routing light would simply never appear.
154
-
155
- ```ts
156
- // ❌ Before — silent failure, n8n UI stays blank
157
- } catch (error) {
158
- console.error(error);
159
- }
160
-
161
- // ✅ After — n8n marks the node as failed with an error badge
162
- } catch (error) {
163
- throw new NodeOperationError(this.getNode(), error as Error);
164
- }
165
- ```
166
-
167
- **3. Missing `outputConnectionTypes` in node descriptor**
168
-
169
- Without declaring `outputConnectionTypes`, n8n's UI couldn't properly register the node as a typed AI supply node, which prevented the execution tracker from attaching to it.
170
-
171
- ```json
172
- // ✅ Added to NvidiaNim.node.json
173
- "outputConnectionTypes": {
174
- "ai_languageModel": [{ "type": "ai_languageModel" }]
175
- }
176
- ```
177
-
178
- ### The Fix (v1.1.0+)
179
-
180
- All three issues were resolved in `v1.1.0`. The node now correctly shows the routing light animation during execution, displays an error badge on failure, and cleans up properly after each run.
181
-
182
- ---
183
-
184
- ## Development
185
-
186
- ```bash
187
- # Install dependencies
188
- npm install
189
-
190
- # TypeScript watch mode (auto-recompile on save)
191
- npm run dev
192
-
193
- # Build distributable files
194
- npm run build
195
-
196
- # Lint code
197
- npm run lint
198
-
199
- # Auto-fix lint issues
200
- npm run lintfix
138
+ 1. Add a **Qdrant Vector Store** (or any other vector store) node
139
+ 2. In the **Embeddings** slot, click `+`
140
+ 3. Search for **NVIDIA NIM Embeddings** and select it
141
+ 4. Choose your embedding model
142
+ 5. Run your workflow
201
143
 
202
- # Format with Prettier
203
- npm run format
204
- ```
144
+ **Configuration Options:**
205
145
 
206
- ### Project Structure
146
+ | Parameter | Type | Default | Description |
147
+ |---|---|---|---|
148
+ | Model | Dropdown | `nvidia/nv-embed-v1` | The NIM embedding model to use |
207
149
 
208
- ```
209
- n8n-nodes-nvidia-nim/
210
- ├── credentials/
211
- │ └── NvidiaNimApi.credentials.ts # API key credential definition
212
- ├── nodes/
213
- │ └── NvidiaNim/
214
- │ ├── NvidiaNim.node.ts # Node logic (supplyData)
215
- │ ├── NvidiaNim.node.json # Node descriptor & UI properties
216
- │ └── nvidia-nim.png # Node icon
217
- ├── dist/ # Compiled output (generated)
218
- ├── package.json
219
- └── README.md
220
- ```
150
+ **Compatible vector stores:** Qdrant · Pinecone · PGVector · Supabase · Weaviate · Chroma
221
151
 
222
152
  ---
223
153
 
224
154
  ## Contributing
225
155
 
226
- Pull requests are welcome! If you'd like to add a new model, fix a bug, or improve documentation:
156
+ Pull requests are welcome! To add a new model, fix a bug, or improve documentation:
227
157
 
228
158
  1. Fork the repo
229
- 2. Create a feature branch: `git checkout -b feat/your-feature`
230
- 3. Commit your changes: `git commit -m 'feat: add your feature'`
159
+ 2. Create a feature branch
160
+ 3. Commit your changes
231
161
  4. Push and open a PR
232
162
 
233
163
  ---
@@ -0,0 +1,6 @@
1
+ import { INodeType, INodeTypeDescription, ISupplyDataFunctions, SupplyData } from 'n8n-workflow';
2
+ export declare class NvidiaNimEmbeddings implements INodeType {
3
+ description: INodeTypeDescription;
4
+ supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData>;
5
+ }
6
+ //# sourceMappingURL=NvidiaNimEmbeddings.node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NvidiaNimEmbeddings.node.d.ts","sourceRoot":"","sources":["../../../nodes/NvidiaNim/NvidiaNimEmbeddings.node.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,SAAS,EACT,oBAAoB,EACpB,oBAAoB,EACpB,UAAU,EAEV,MAAM,cAAc,CAAC;AA2CtB,qBAAa,mBAAoB,YAAW,SAAS;IACpD,WAAW,EAAE,oBAAoB,CA4CI;IAE/B,UAAU,CAAC,IAAI,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;CAgBpF"}
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NvidiaNimEmbeddings = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const embeddings_1 = require("@langchain/core/embeddings");
6
+ class NvidiaNimEmbeddingsClass extends embeddings_1.Embeddings {
7
+ constructor(apiKey, model) {
8
+ super({});
9
+ this.apiKey = apiKey;
10
+ this.model = model;
11
+ }
12
+ async embedDocuments(texts) {
13
+ try {
14
+ const response = await fetch('https://integrate.api.nvidia.com/v1/embeddings', {
15
+ method: 'POST',
16
+ headers: {
17
+ 'Content-Type': 'application/json',
18
+ Authorization: `Bearer ${this.apiKey}`,
19
+ Accept: 'application/json',
20
+ },
21
+ body: JSON.stringify({
22
+ input: texts,
23
+ model: this.model,
24
+ input_type: 'query',
25
+ }),
26
+ });
27
+ if (!response.ok) {
28
+ const errorText = await response.text();
29
+ throw new Error(`NVIDIA NIM API Error: ${response.status} ${errorText}`);
30
+ }
31
+ const data = await response.json();
32
+ const sortedData = data.data.sort((a, b) => a.index - b.index);
33
+ return sortedData.map((item) => item.embedding);
34
+ }
35
+ catch (error) {
36
+ throw new Error(`Failed to generate embeddings: ${error.message}`);
37
+ }
38
+ }
39
+ async embedQuery(text) {
40
+ const docs = await this.embedDocuments([text]);
41
+ return docs[0];
42
+ }
43
+ }
44
+ class NvidiaNimEmbeddings {
45
+ constructor() {
46
+ this.description = {
47
+ displayName: 'NVIDIA NIM Embeddings',
48
+ name: 'nvidiaNimEmbeddings',
49
+ icon: 'file:nvidia-nim.png',
50
+ group: ['transform'],
51
+ version: 1,
52
+ description: 'Call any embeddings model from NVIDIA NIM',
53
+ defaults: {
54
+ name: 'NVIDIA NIM Embeddings',
55
+ },
56
+ inputs: [],
57
+ outputs: ['ai_embedding'],
58
+ outputNames: ['Embeddings'],
59
+ outputConnectionTypes: {
60
+ ai_embedding: [{ type: 'ai_embedding' }],
61
+ },
62
+ codex: {
63
+ categories: ['AI'],
64
+ subcategories: {
65
+ AI: ['Embeddings'],
66
+ },
67
+ resources: {},
68
+ },
69
+ credentials: [
70
+ {
71
+ name: 'nvidiaNimApi',
72
+ required: true,
73
+ },
74
+ ],
75
+ properties: [
76
+ {
77
+ displayName: 'Model',
78
+ name: 'model',
79
+ type: 'options',
80
+ options: [
81
+ { name: 'NV Embed v1 (Free Endpoint)', value: 'nvidia/nv-embed-v1' },
82
+ { name: 'NV EmbedQA E5 v5', value: 'nvidia/nv-embedqa-e5-v5' },
83
+ { name: 'Llama Nemotron Embed 1B v2', value: 'nvidia/llama-nemotron-embed-1b-v2' },
84
+ { name: 'Llama Nemotron Embed VL 1B v2 (Multimodal)', value: 'nvidia/llama-nemotron-embed-vl-1b-v2' },
85
+ { name: 'BGE-M3 (Dense + Sparse)', value: 'BAAI/bge-m3' },
86
+ ],
87
+ default: 'nvidia/nv-embed-v1',
88
+ },
89
+ ],
90
+ };
91
+ }
92
+ async supplyData(itemIndex) {
93
+ try {
94
+ const credentials = await this.getCredentials('nvidiaNimApi');
95
+ const apiKey = credentials.apiKey;
96
+ const model = this.getNodeParameter('model', itemIndex, '');
97
+ const embeddings = new NvidiaNimEmbeddingsClass(apiKey, model);
98
+ return {
99
+ response: embeddings,
100
+ closeFunction: async () => { },
101
+ };
102
+ }
103
+ catch (error) {
104
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), error);
105
+ }
106
+ }
107
+ }
108
+ exports.NvidiaNimEmbeddings = NvidiaNimEmbeddings;
109
+ //# sourceMappingURL=NvidiaNimEmbeddings.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NvidiaNimEmbeddings.node.js","sourceRoot":"","sources":["../../../nodes/NvidiaNim/NvidiaNimEmbeddings.node.ts"],"names":[],"mappings":";;;AAAA,+CAMsB;AACtB,2DAAwD;AAExD,MAAM,wBAAyB,SAAQ,uBAAU;IAChD,YAAoB,MAAc,EAAU,KAAa;QACxD,KAAK,CAAC,EAAE,CAAC,CAAC;QADS,WAAM,GAAN,MAAM,CAAQ;QAAU,UAAK,GAAL,KAAK,CAAQ;IAEzD,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,KAAe;QACnC,IAAI,CAAC;YACJ,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,gDAAgD,EAAE;gBAC9E,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACR,cAAc,EAAE,kBAAkB;oBAClC,aAAa,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE;oBACtC,MAAM,EAAE,kBAAkB;iBA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,EAAE,CAAW,CAAC;YAEtE,MAAM,UAAU,GAAG,IAAI,wBAAwB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YAE/D,OAAO;gBACN,QAAQ,EAAE,UAAU;gBACpB,aAAa,EAAE,KAAK,IAAI,EAAE,GAAE,CAAC;aAC7B,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAc,CAAC,CAAC;QAC9D,CAAC;IACF,CAAC;CACD;AA/DD,kDA+DC"}
@@ -0,0 +1,113 @@
1
+ import {
2
+ INodeType,
3
+ INodeTypeDescription,
4
+ ISupplyDataFunctions,
5
+ SupplyData,
6
+ NodeOperationError,
7
+ } from 'n8n-workflow';
8
+ import { Embeddings } from '@langchain/core/embeddings';
9
+
10
+ class NvidiaNimEmbeddingsClass extends Embeddings {
11
+ constructor(private apiKey: string, private model: string) {
12
+ super({});
13
+ }
14
+
15
+ async embedDocuments(texts: string[]): Promise<number[][]> {
16
+ try {
17
+ const response = await fetch('https://integrate.api.nvidia.com/v1/embeddings', {
18
+ method: 'POST',
19
+ headers: {
20
+ 'Content-Type': 'application/json',
21
+ Authorization: `Bearer ${this.apiKey}`,
22
+ Accept: 'application/json',
23
+ },
24
+ body: JSON.stringify({
25
+ input: texts,
26
+ model: this.model,
27
+ input_type: 'query',
28
+ }),
29
+ });
30
+
31
+ if (!response.ok) {
32
+ const errorText = await response.text();
33
+ throw new Error(`NVIDIA NIM API Error: ${response.status} ${errorText}`);
34
+ }
35
+
36
+ const data = await response.json();
37
+ const sortedData = data.data.sort((a: any, b: any) => a.index - b.index);
38
+ return sortedData.map((item: any) => item.embedding);
39
+ } catch (error) {
40
+ throw new Error(`Failed to generate embeddings: ${(error as Error).message}`);
41
+ }
42
+ }
43
+
44
+ async embedQuery(text: string): Promise<number[]> {
45
+ const docs = await this.embedDocuments([text]);
46
+ return docs[0];
47
+ }
48
+ }
49
+
50
+ export class NvidiaNimEmbeddings implements INodeType {
51
+ description: INodeTypeDescription = {
52
+ displayName: 'NVIDIA NIM Embeddings',
53
+ name: 'nvidiaNimEmbeddings',
54
+ icon: 'file:nvidia-nim.png',
55
+ group: ['transform'],
56
+ version: 1,
57
+ description: 'Call any embeddings model from NVIDIA NIM',
58
+ defaults: {
59
+ name: 'NVIDIA NIM Embeddings',
60
+ },
61
+ inputs: [],
62
+ outputs: ['ai_embedding'],
63
+ outputNames: ['Embeddings'],
64
+ outputConnectionTypes: {
65
+ ai_embedding: [{ type: 'ai_embedding' }],
66
+ },
67
+ codex: {
68
+ categories: ['AI'],
69
+ subcategories: {
70
+ AI: ['Embeddings'],
71
+ },
72
+ resources: {},
73
+ },
74
+ credentials: [
75
+ {
76
+ name: 'nvidiaNimApi',
77
+ required: true,
78
+ },
79
+ ],
80
+ properties: [
81
+ {
82
+ displayName: 'Model',
83
+ name: 'model',
84
+ type: 'options',
85
+ options: [
86
+ { name: 'NV Embed v1 (Free Endpoint)', value: 'nvidia/nv-embed-v1' },
87
+ { name: 'NV EmbedQA E5 v5', value: 'nvidia/nv-embedqa-e5-v5' },
88
+ { name: 'Llama Nemotron Embed 1B v2', value: 'nvidia/llama-nemotron-embed-1b-v2' },
89
+ { name: 'Llama Nemotron Embed VL 1B v2 (Multimodal)', value: 'nvidia/llama-nemotron-embed-vl-1b-v2' },
90
+ { name: 'BGE-M3 (Dense + Sparse)', value: 'BAAI/bge-m3' },
91
+ ],
92
+ default: 'nvidia/nv-embed-v1',
93
+ },
94
+ ],
95
+ } as unknown as INodeTypeDescription;
96
+
97
+ async supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {
98
+ try {
99
+ const credentials = await this.getCredentials('nvidiaNimApi');
100
+ const apiKey = credentials.apiKey as string;
101
+ const model = this.getNodeParameter('model', itemIndex, '') as string;
102
+
103
+ const embeddings = new NvidiaNimEmbeddingsClass(apiKey, model);
104
+
105
+ return {
106
+ response: embeddings,
107
+ closeFunction: async () => {},
108
+ };
109
+ } catch (error) {
110
+ throw new NodeOperationError(this.getNode(), error as Error);
111
+ }
112
+ }
113
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sateeshreddy/n8n-nodes-nvidia-nim",
3
- "version": "1.0.3",
3
+ "version": "1.0.6",
4
4
  "description": "n8n community node for NVIDIA NIM",
5
5
  "main": "dist/nodes/NvidiaNim/NvidiaNim.node.js",
6
6
  "scripts": {
@@ -24,6 +24,9 @@
24
24
  "@langchain/openai": "^1.4.5",
25
25
  "n8n-workflow": "^1.0.0"
26
26
  },
27
+ "overrides": {
28
+ "form-data": "^4.0.1"
29
+ },
27
30
  "devDependencies": {
28
31
  "@types/node": "^16.0.0",
29
32
  "@typescript-eslint/eslint-plugin": "^5.0.0",
@@ -37,7 +40,8 @@
37
40
  "n8n": {
38
41
  "n8nNodesApiVersion": 1,
39
42
  "nodes": [
40
- "dist/nodes/NvidiaNim/NvidiaNim.node.js"
43
+ "dist/nodes/NvidiaNim/NvidiaNim.node.js",
44
+ "dist/nodes/NvidiaNim/NvidiaNimEmbeddings.node.js"
41
45
  ],
42
46
  "credentials": [
43
47
  "dist/credentials/NvidiaNimApi.credentials.js"
package/tsconfig.json CHANGED
@@ -2,7 +2,10 @@
2
2
  "compilerOptions": {
3
3
  "target": "es2020",
4
4
  "module": "commonjs",
5
- "lib": ["es2020", "dom"],
5
+ "lib": [
6
+ "es2020",
7
+ "dom"
8
+ ],
6
9
  "outDir": "./dist",
7
10
  "rootDir": "./",
8
11
  "strict": true,