@n8n/n8n-nodes-langchain 2.4.3 → 2.5.1

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.
Files changed (59) hide show
  1. package/dist/credentials/ChromaCloudApi.credentials.js +82 -0
  2. package/dist/credentials/ChromaCloudApi.credentials.js.map +1 -0
  3. package/dist/credentials/ChromaSelfHostedApi.credentials.js +105 -0
  4. package/dist/credentials/ChromaSelfHostedApi.credentials.js.map +1 -0
  5. package/dist/known/credentials.json +14 -0
  6. package/dist/known/nodes.json +4 -0
  7. package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/helpers/runAgent.js +3 -2
  8. package/dist/nodes/agents/Agent/agents/ToolsAgent/V3/helpers/runAgent.js.map +1 -1
  9. package/dist/nodes/code/Code.node.js +1 -1
  10. package/dist/nodes/code/Code.node.js.map +1 -1
  11. package/dist/nodes/embeddings/EmbeddingsAzureOpenAi/EmbeddingsAzureOpenAi.node.js +2 -1
  12. package/dist/nodes/embeddings/EmbeddingsAzureOpenAi/EmbeddingsAzureOpenAi.node.js.map +1 -1
  13. package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js +3 -5
  14. package/dist/nodes/embeddings/EmbeddingsOpenAI/EmbeddingsOpenAi.node.js.map +1 -1
  15. package/dist/nodes/llms/LMChatAnthropic/LmChatAnthropic.node.js.map +1 -1
  16. package/dist/nodes/llms/LMChatLemonade/LmChatLemonade.node.js +4 -0
  17. package/dist/nodes/llms/LMChatLemonade/LmChatLemonade.node.js.map +1 -1
  18. package/dist/nodes/llms/LMChatOllama/LmChatOllama.node.js +4 -1
  19. package/dist/nodes/llms/LMChatOllama/LmChatOllama.node.js.map +1 -1
  20. package/dist/nodes/llms/LMChatOpenAi/LmChatOpenAi.node.js +15 -10
  21. package/dist/nodes/llms/LMChatOpenAi/LmChatOpenAi.node.js.map +1 -1
  22. package/dist/nodes/llms/LMOpenAi/LmOpenAi.node.js +6 -2
  23. package/dist/nodes/llms/LMOpenAi/LmOpenAi.node.js.map +1 -1
  24. package/dist/nodes/llms/LmChatAzureOpenAi/LmChatAzureOpenAi.node.js +6 -2
  25. package/dist/nodes/llms/LmChatAzureOpenAi/LmChatAzureOpenAi.node.js.map +1 -1
  26. package/dist/nodes/llms/LmChatDeepSeek/LmChatDeepSeek.node.js +6 -2
  27. package/dist/nodes/llms/LmChatDeepSeek/LmChatDeepSeek.node.js.map +1 -1
  28. package/dist/nodes/llms/LmChatMistralCloud/LmChatMistralCloud.node.js +5 -0
  29. package/dist/nodes/llms/LmChatMistralCloud/LmChatMistralCloud.node.js.map +1 -1
  30. package/dist/nodes/llms/LmChatOpenRouter/LmChatOpenRouter.node.js +6 -2
  31. package/dist/nodes/llms/LmChatOpenRouter/LmChatOpenRouter.node.js.map +1 -1
  32. package/dist/nodes/llms/LmChatVercelAiGateway/LmChatVercelAiGateway.node.js +6 -2
  33. package/dist/nodes/llms/LmChatVercelAiGateway/LmChatVercelAiGateway.node.js.map +1 -1
  34. package/dist/nodes/llms/LmChatXAiGrok/LmChatXAiGrok.node.js +6 -2
  35. package/dist/nodes/llms/LmChatXAiGrok/LmChatXAiGrok.node.js.map +1 -1
  36. package/dist/nodes/mcp/shared/utils.js +4 -2
  37. package/dist/nodes/mcp/shared/utils.js.map +1 -1
  38. package/dist/nodes/trigger/ChatTrigger/Chat.node.js +118 -108
  39. package/dist/nodes/trigger/ChatTrigger/Chat.node.js.map +1 -1
  40. package/dist/nodes/trigger/ChatTrigger/ChatTrigger.node.js +22 -13
  41. package/dist/nodes/trigger/ChatTrigger/ChatTrigger.node.js.map +1 -1
  42. package/dist/nodes/trigger/ChatTrigger/constants.js +28 -18
  43. package/dist/nodes/trigger/ChatTrigger/constants.js.map +1 -1
  44. package/dist/nodes/trigger/ChatTrigger/util.js +75 -4
  45. package/dist/nodes/trigger/ChatTrigger/util.js.map +1 -1
  46. package/dist/nodes/vector_store/VectorStoreChromaDB/VectorStoreChromaDB.node.js +356 -0
  47. package/dist/nodes/vector_store/VectorStoreChromaDB/VectorStoreChromaDB.node.js.map +1 -0
  48. package/dist/nodes/vector_store/VectorStoreChromaDB/chroma.svg +9 -0
  49. package/dist/nodes/vector_store/shared/descriptions.js +24 -0
  50. package/dist/nodes/vector_store/shared/descriptions.js.map +1 -1
  51. package/dist/nodes/vendors/OpenAi/v1/actions/assistant/message.operation.js +6 -2
  52. package/dist/nodes/vendors/OpenAi/v1/actions/assistant/message.operation.js.map +1 -1
  53. package/dist/types/credentials.json +2 -0
  54. package/dist/types/nodes.json +4 -3
  55. package/dist/utils/httpProxyAgent.js +15 -4
  56. package/dist/utils/httpProxyAgent.js.map +1 -1
  57. package/dist/utils/tracing.js +1 -1
  58. package/dist/utils/tracing.js.map +1 -1
  59. package/package.json +14 -10
@@ -0,0 +1,356 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var VectorStoreChromaDB_node_exports = {};
20
+ __export(VectorStoreChromaDB_node_exports, {
21
+ VectorStoreChromaDB: () => VectorStoreChromaDB
22
+ });
23
+ module.exports = __toCommonJS(VectorStoreChromaDB_node_exports);
24
+ var import_chroma = require("@langchain/community/vectorstores/chroma");
25
+ var import_chromadb = require("chromadb");
26
+ var import_n8n_workflow = require("n8n-workflow");
27
+ var import_sharedFields = require("../../../utils/sharedFields");
28
+ var import_createVectorStoreNode = require("../shared/createVectorStoreNode/createVectorStoreNode");
29
+ var import_descriptions = require("../shared/descriptions");
30
+ function getCredentialType(context) {
31
+ try {
32
+ const authentication = context.getNodeParameter("authentication", 0);
33
+ if (typeof authentication === "string") {
34
+ return authentication;
35
+ }
36
+ } catch (error) {
37
+ }
38
+ const node = context.getNode();
39
+ if (node.credentials?.chromaCloudApi) {
40
+ return "chromaCloudApi";
41
+ }
42
+ if (node.credentials?.chromaSelfHostedApi) {
43
+ return "chromaSelfHostedApi";
44
+ }
45
+ return "chromaSelfHostedApi";
46
+ }
47
+ async function getChromaClient(context, itemIndex) {
48
+ const credentialType = getCredentialType(context);
49
+ const credentials = await context.getCredentials(credentialType, itemIndex);
50
+ if (credentialType === "chromaCloudApi") {
51
+ const apiKey = typeof credentials.apiKey === "string" ? credentials.apiKey : "";
52
+ const config = {
53
+ apiKey
54
+ };
55
+ if (typeof credentials.tenant === "string") {
56
+ config.tenant = credentials.tenant;
57
+ }
58
+ if (typeof credentials.database === "string") {
59
+ config.database = credentials.database;
60
+ }
61
+ return new import_chromadb.CloudClient(config);
62
+ } else {
63
+ const baseUrl = typeof credentials.baseUrl === "string" ? credentials.baseUrl : "";
64
+ const authentication = typeof credentials.authentication === "string" ? credentials.authentication : "";
65
+ const url = new URL(baseUrl);
66
+ const config = {
67
+ host: url.hostname,
68
+ port: url.port ? parseInt(url.port, 10) : 8e3,
69
+ ssl: url.protocol === "https:"
70
+ };
71
+ if (authentication === "apiKey" && typeof credentials.apiKey === "string") {
72
+ config.headers = {
73
+ Authorization: `Bearer ${credentials.apiKey}`
74
+ };
75
+ } else if (authentication === "token" && typeof credentials.token === "string") {
76
+ config.headers = {
77
+ "X-Chroma-Token": credentials.token
78
+ };
79
+ }
80
+ return new import_chromadb.ChromaClient(config);
81
+ }
82
+ }
83
+ async function getChromaLibConfig(context, collectionName, itemIndex) {
84
+ const credentialType = getCredentialType(context);
85
+ const credentials = await context.getCredentials(credentialType, itemIndex);
86
+ if (credentialType === "chromaCloudApi") {
87
+ const cloudClientParams = {
88
+ apiKey: typeof credentials.apiKey === "string" ? credentials.apiKey : ""
89
+ };
90
+ if (typeof credentials.tenant === "string") {
91
+ cloudClientParams.tenant = credentials.tenant;
92
+ }
93
+ if (typeof credentials.database === "string") {
94
+ cloudClientParams.database = credentials.database;
95
+ }
96
+ const config = {
97
+ collectionName,
98
+ clientParams: cloudClientParams
99
+ };
100
+ return config;
101
+ } else {
102
+ const baseUrl = typeof credentials.baseUrl === "string" ? credentials.baseUrl : "";
103
+ const authentication = typeof credentials.authentication === "string" ? credentials.authentication : "";
104
+ const url = new URL(baseUrl);
105
+ const clientParams = {
106
+ host: url.hostname,
107
+ port: url.port ? parseInt(url.port, 10) : 8e3,
108
+ ssl: url.protocol === "https:"
109
+ };
110
+ if (authentication === "apiKey" && typeof credentials.apiKey === "string") {
111
+ clientParams.headers = {
112
+ Authorization: `Bearer ${credentials.apiKey}`
113
+ };
114
+ } else if (authentication === "token" && typeof credentials.token === "string") {
115
+ clientParams.headers = {
116
+ "X-Chroma-Token": credentials.token
117
+ };
118
+ }
119
+ const config = {
120
+ collectionName,
121
+ clientParams
122
+ };
123
+ return config;
124
+ }
125
+ }
126
+ class ExtendedChroma extends import_chroma.Chroma {
127
+ async ensureCollection() {
128
+ if (!this.collection) {
129
+ if (!this.index) {
130
+ const clientParams = this.clientParams ?? {};
131
+ if ("apiKey" in clientParams && typeof clientParams.apiKey === "string") {
132
+ this.index = new import_chromadb.CloudClient({
133
+ apiKey: clientParams.apiKey,
134
+ tenant: typeof clientParams.tenant === "string" ? clientParams.tenant : void 0,
135
+ database: typeof clientParams.database === "string" ? clientParams.database : void 0
136
+ });
137
+ } else {
138
+ const { ChromaClient: ChromaClient2 } = await ExtendedChroma.imports();
139
+ const clientConfig = this.url ? { path: this.url, ...clientParams } : clientParams;
140
+ this.index = new ChromaClient2(clientConfig);
141
+ }
142
+ }
143
+ try {
144
+ this.collection = await this.index.getOrCreateCollection({
145
+ name: this.collectionName,
146
+ ...this.collectionMetadata && { metadata: this.collectionMetadata },
147
+ embeddingFunction: null
148
+ });
149
+ } catch (error) {
150
+ const message = error instanceof Error ? error.message : String(error);
151
+ throw new import_n8n_workflow.ApplicationError(`Chroma getOrCreateCollection error: ${message}`);
152
+ }
153
+ }
154
+ if (!this.collection) {
155
+ throw new import_n8n_workflow.ApplicationError("Failed to initialize Chroma collection");
156
+ }
157
+ return this.collection;
158
+ }
159
+ async similaritySearchVectorWithScore(query, k, filter) {
160
+ let flatQuery = [];
161
+ if (query.length > 0 && Array.isArray(query[0])) {
162
+ for (const element of query) {
163
+ if (Array.isArray(element)) {
164
+ flatQuery.push.apply(flatQuery, element);
165
+ } else {
166
+ flatQuery.push(element);
167
+ }
168
+ }
169
+ } else {
170
+ flatQuery = query;
171
+ }
172
+ return await super.similaritySearchVectorWithScore(flatQuery, k, filter);
173
+ }
174
+ }
175
+ const authenticationProperty = {
176
+ displayName: "Authentication",
177
+ name: "authentication",
178
+ type: "options",
179
+ options: [
180
+ {
181
+ name: "Self-Hosted",
182
+ value: "chromaSelfHostedApi",
183
+ description: "Connect to a self-hosted ChromaDB instance"
184
+ },
185
+ {
186
+ name: "Cloud",
187
+ value: "chromaCloudApi",
188
+ description: "Connect to Chroma Cloud"
189
+ }
190
+ ],
191
+ default: "chromaSelfHostedApi"
192
+ };
193
+ const sharedFields = [authenticationProperty, import_descriptions.chromaCollectionRLC];
194
+ const retrieveFields = [
195
+ {
196
+ displayName: "Options",
197
+ name: "options",
198
+ type: "collection",
199
+ placeholder: "Add Option",
200
+ default: {},
201
+ options: [import_sharedFields.metadataFilterField]
202
+ }
203
+ ];
204
+ const insertFields = [
205
+ {
206
+ displayName: "Options",
207
+ name: "options",
208
+ type: "collection",
209
+ placeholder: "Add Option",
210
+ default: {},
211
+ options: [
212
+ {
213
+ displayName: "Clear Collection",
214
+ name: "clearCollection",
215
+ type: "boolean",
216
+ default: false,
217
+ description: "Whether to clear the collection before inserting new data"
218
+ }
219
+ ]
220
+ }
221
+ ];
222
+ class VectorStoreChromaDB extends (0, import_createVectorStoreNode.createVectorStoreNode)({
223
+ meta: {
224
+ displayName: "Chroma Vector Store",
225
+ name: "vectorStoreChromaDB",
226
+ description: "Work with your data in Chroma Vector Store",
227
+ icon: { light: "file:chroma.svg", dark: "file:chroma.svg" },
228
+ docsUrl: "https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.vectorstorechromadb/",
229
+ credentials: [
230
+ {
231
+ name: "chromaSelfHostedApi",
232
+ required: true,
233
+ displayOptions: {
234
+ show: {
235
+ authentication: ["chromaSelfHostedApi"]
236
+ }
237
+ }
238
+ },
239
+ {
240
+ name: "chromaCloudApi",
241
+ required: true,
242
+ displayOptions: {
243
+ show: {
244
+ authentication: ["chromaCloudApi"]
245
+ }
246
+ }
247
+ }
248
+ ],
249
+ operationModes: ["load", "insert", "retrieve", "retrieve-as-tool"]
250
+ },
251
+ methods: {
252
+ listSearch: {
253
+ async chromaCollectionsSearch() {
254
+ try {
255
+ const client = await getChromaClient(this);
256
+ const collections = await client.listCollections();
257
+ if (Array.isArray(collections)) {
258
+ const results = collections.map((collection) => ({
259
+ name: collection.name,
260
+ value: collection.name
261
+ }));
262
+ return { results };
263
+ }
264
+ return { results: [] };
265
+ } catch (error) {
266
+ const errorMessage = error instanceof Error ? error.message : String(error);
267
+ if (errorMessage.includes("ECONNREFUSED") || errorMessage.includes("Failed to connect")) {
268
+ throw new import_n8n_workflow.NodeApiError(this.getNode(), {
269
+ message: "Cannot connect to ChromaDB. Please ensure ChromaDB is running and accessible at the configured URL."
270
+ });
271
+ }
272
+ if (errorMessage.includes("Unauthorized") || errorMessage.includes("401") || errorMessage.includes("403")) {
273
+ throw new import_n8n_workflow.NodeApiError(this.getNode(), {
274
+ message: "Authentication failed. Please check your API key or token in the credentials"
275
+ });
276
+ }
277
+ throw new import_n8n_workflow.NodeApiError(this.getNode(), {
278
+ message: `Failed to list ChromaDB collections: ${errorMessage}`
279
+ });
280
+ }
281
+ }
282
+ }
283
+ },
284
+ retrieveFields,
285
+ loadFields: retrieveFields,
286
+ insertFields,
287
+ sharedFields,
288
+ async getVectorStoreClient(context, _filter, embeddings, itemIndex) {
289
+ const collection = context.getNodeParameter("chromaCollection", itemIndex, "", {
290
+ extractValue: true
291
+ });
292
+ if (typeof collection !== "string") {
293
+ throw new import_n8n_workflow.NodeOperationError(context.getNode(), "Collection must be a string");
294
+ }
295
+ try {
296
+ const config = await getChromaLibConfig(context, collection, itemIndex);
297
+ return await ExtendedChroma.fromExistingCollection(embeddings, config);
298
+ } catch (error) {
299
+ const message = error instanceof Error ? error.message : "Unknown error";
300
+ throw new import_n8n_workflow.NodeOperationError(context.getNode(), `Error connecting to ChromaDB: ${message}`, {
301
+ itemIndex
302
+ });
303
+ }
304
+ },
305
+ async populateVectorStore(context, embeddings, documents, itemIndex) {
306
+ const collection = context.getNodeParameter("chromaCollection", itemIndex, "", {
307
+ extractValue: true
308
+ });
309
+ if (typeof collection !== "string") {
310
+ throw new import_n8n_workflow.NodeOperationError(context.getNode(), "Collection must be a string");
311
+ }
312
+ const options = context.getNodeParameter("options", itemIndex, {});
313
+ const clearCollection = options.clearCollection === true;
314
+ if (clearCollection) {
315
+ try {
316
+ const client = await getChromaClient(context, itemIndex);
317
+ await client.deleteCollection({ name: collection });
318
+ context.logger.info(`Collection ${collection} deleted`);
319
+ } catch (error) {
320
+ context.logger.info(
321
+ `Collection ${collection} does not exist yet or could not be deleted (continuing)`
322
+ );
323
+ }
324
+ }
325
+ try {
326
+ const config = await getChromaLibConfig(context, collection, itemIndex);
327
+ await ExtendedChroma.fromDocuments(documents, embeddings, config);
328
+ } catch (error) {
329
+ const chromaError = error;
330
+ const errorMessage = chromaError.message ?? "Unknown error";
331
+ const detailMessage = chromaError.response?.data?.detail;
332
+ if (errorMessage.includes("embedding with dimension") || detailMessage?.includes("embedding with dimension")) {
333
+ const displayMessage = detailMessage ?? errorMessage;
334
+ throw new import_n8n_workflow.NodeOperationError(
335
+ context.getNode(),
336
+ `ChromaDB embedding dimension mismatch: ${displayMessage}`,
337
+ {
338
+ itemIndex,
339
+ description: 'The collection expects embeddings with different dimensions. Enable "Clear Collection" option to recreate the collection with correct dimensions, or use a different collection name.'
340
+ }
341
+ );
342
+ }
343
+ throw new import_n8n_workflow.NodeOperationError(
344
+ context.getNode(),
345
+ `Error inserting documents into ChromaDB: ${errorMessage}`,
346
+ { itemIndex }
347
+ );
348
+ }
349
+ }
350
+ }) {
351
+ }
352
+ // Annotate the CommonJS export names for ESM import in node:
353
+ 0 && (module.exports = {
354
+ VectorStoreChromaDB
355
+ });
356
+ //# sourceMappingURL=VectorStoreChromaDB.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../nodes/vector_store/VectorStoreChromaDB/VectorStoreChromaDB.node.ts"],"sourcesContent":["import type { ChromaLibArgs } from '@langchain/community/vectorstores/chroma';\nimport { Chroma } from '@langchain/community/vectorstores/chroma';\nimport type { Document } from '@langchain/core/documents';\nimport { ChromaClient, CloudClient, type Collection } from 'chromadb';\nimport {\n\tNodeOperationError,\n\ttype INodeProperties,\n\ttype IExecuteFunctions,\n\ttype ILoadOptionsFunctions,\n\ttype ISupplyDataFunctions,\n\tNodeApiError,\n\tApplicationError,\n} from 'n8n-workflow';\n\nimport { metadataFilterField } from '@utils/sharedFields';\n\nimport { createVectorStoreNode } from '../shared/createVectorStoreNode/createVectorStoreNode';\nimport { chromaCollectionRLC } from '../shared/descriptions';\n\ninterface ChromaError extends Error {\n\tresponse?: {\n\t\tdata?: {\n\t\t\tdetail?: string;\n\t\t};\n\t};\n}\n\n/**\n * Gets the credential type based on what credentials are actually configured on the node\n * Falls back to the authentication parameter if no credentials are found\n */\nfunction getCredentialType(\n\tcontext: IExecuteFunctions | ILoadOptionsFunctions | ISupplyDataFunctions,\n): string {\n\ttry {\n\t\tconst authentication = context.getNodeParameter('authentication', 0);\n\t\tif (typeof authentication === 'string') {\n\t\t\treturn authentication;\n\t\t}\n\t} catch (error) {\n\t\t// Fallback to credentials if parameter retrieval fails\n\t}\n\n\tconst node = context.getNode();\n\n\t// Check which credential type is actually configured on the node\n\tif (node.credentials?.chromaCloudApi) {\n\t\treturn 'chromaCloudApi';\n\t}\n\tif (node.credentials?.chromaSelfHostedApi) {\n\t\treturn 'chromaSelfHostedApi';\n\t}\n\n\treturn 'chromaSelfHostedApi';\n}\n\n/**\n * Gets ChromaDB client configuration from credentials\n * Returns either ChromaClient or CloudClient based on credential type\n */\nasync function getChromaClient(\n\tcontext: IExecuteFunctions | ILoadOptionsFunctions | ISupplyDataFunctions,\n\titemIndex?: number,\n): Promise<ChromaClient | CloudClient> {\n\tconst credentialType = getCredentialType(context);\n\tconst credentials = await context.getCredentials(credentialType, itemIndex);\n\n\tif (credentialType === 'chromaCloudApi') {\n\t\t// Use CloudClient for Chroma Cloud\n\t\tconst apiKey = typeof credentials.apiKey === 'string' ? credentials.apiKey : '';\n\t\tconst config: {\n\t\t\tapiKey: string;\n\t\t\ttenant?: string;\n\t\t\tdatabase?: string;\n\t\t} = {\n\t\t\tapiKey,\n\t\t};\n\n\t\t// Add optional tenant and database if provided\n\t\tif (typeof credentials.tenant === 'string') {\n\t\t\tconfig.tenant = credentials.tenant;\n\t\t}\n\t\tif (typeof credentials.database === 'string') {\n\t\t\tconfig.database = credentials.database;\n\t\t}\n\n\t\treturn new CloudClient(config);\n\t} else {\n\t\t// Use ChromaClient for self-hosted instances\n\t\tconst baseUrl = typeof credentials.baseUrl === 'string' ? credentials.baseUrl : '';\n\t\tconst authentication =\n\t\t\ttypeof credentials.authentication === 'string' ? credentials.authentication : '';\n\n\t\tconst url = new URL(baseUrl);\n\n\t\tconst config: {\n\t\t\thost: string;\n\t\t\tport: number;\n\t\t\tssl: boolean;\n\t\t\theaders?: Record<string, string>;\n\t\t} = {\n\t\t\thost: url.hostname,\n\t\t\tport: url.port ? parseInt(url.port, 10) : 8000,\n\t\t\tssl: url.protocol === 'https:',\n\t\t};\n\n\t\tif (authentication === 'apiKey' && typeof credentials.apiKey === 'string') {\n\t\t\tconfig.headers = {\n\t\t\t\tAuthorization: `Bearer ${credentials.apiKey}`,\n\t\t\t};\n\t\t} else if (authentication === 'token' && typeof credentials.token === 'string') {\n\t\t\tconfig.headers = {\n\t\t\t\t'X-Chroma-Token': credentials.token,\n\t\t\t};\n\t\t}\n\n\t\treturn new ChromaClient(config);\n\t}\n}\n/*\n * Returns the config for the Langchain ChromaDB\n */\nasync function getChromaLibConfig(\n\tcontext: IExecuteFunctions | ILoadOptionsFunctions | ISupplyDataFunctions,\n\tcollectionName: string,\n\titemIndex?: number,\n): Promise<ChromaLibArgs> {\n\tconst credentialType = getCredentialType(context);\n\tconst credentials = await context.getCredentials(credentialType, itemIndex);\n\n\tif (credentialType === 'chromaCloudApi') {\n\t\t// Configuration for Chroma Cloud\n\t\tconst cloudClientParams: {\n\t\t\tapiKey: string;\n\t\t\ttenant?: string;\n\t\t\tdatabase?: string;\n\t\t} = {\n\t\t\tapiKey: typeof credentials.apiKey === 'string' ? credentials.apiKey : '',\n\t\t};\n\n\t\tif (typeof credentials.tenant === 'string') {\n\t\t\tcloudClientParams.tenant = credentials.tenant;\n\t\t}\n\t\tif (typeof credentials.database === 'string') {\n\t\t\tcloudClientParams.database = credentials.database;\n\t\t}\n\n\t\tconst config: ChromaLibArgs = {\n\t\t\tcollectionName,\n\t\t\tclientParams: cloudClientParams as ChromaLibArgs['clientParams'],\n\t\t};\n\n\t\treturn config;\n\t} else {\n\t\t// Configuration for self-hosted ChromaDB\n\t\tconst baseUrl = typeof credentials.baseUrl === 'string' ? credentials.baseUrl : '';\n\t\tconst authentication =\n\t\t\ttypeof credentials.authentication === 'string' ? credentials.authentication : '';\n\n\t\tconst url = new URL(baseUrl);\n\n\t\tconst clientParams: {\n\t\t\thost: string;\n\t\t\tport: number;\n\t\t\tssl: boolean;\n\t\t\theaders?: Record<string, string>;\n\t\t} = {\n\t\t\thost: url.hostname,\n\t\t\tport: url.port ? parseInt(url.port, 10) : 8000,\n\t\t\tssl: url.protocol === 'https:',\n\t\t};\n\n\t\tif (authentication === 'apiKey' && typeof credentials.apiKey === 'string') {\n\t\t\tclientParams.headers = {\n\t\t\t\tAuthorization: `Bearer ${credentials.apiKey}`,\n\t\t\t};\n\t\t} else if (authentication === 'token' && typeof credentials.token === 'string') {\n\t\t\tclientParams.headers = {\n\t\t\t\t'X-Chroma-Token': credentials.token,\n\t\t\t};\n\t\t}\n\n\t\tconst config: ChromaLibArgs = {\n\t\t\tcollectionName,\n\t\t\tclientParams,\n\t\t};\n\n\t\treturn config;\n\t}\n}\n\nclass ExtendedChroma extends Chroma {\n\tasync ensureCollection(): Promise<Collection> {\n\t\tif (!this.collection) {\n\t\t\tif (!this.index) {\n\t\t\t\tconst clientParams = this.clientParams ?? {};\n\n\t\t\t\t// Check if this is a Cloud\n\t\t\t\tif ('apiKey' in clientParams && typeof clientParams.apiKey === 'string') {\n\t\t\t\t\t// Use CloudClient for Chroma Cloud\n\t\t\t\t\tthis.index = new CloudClient({\n\t\t\t\t\t\tapiKey: clientParams.apiKey,\n\t\t\t\t\t\ttenant: typeof clientParams.tenant === 'string' ? clientParams.tenant : undefined,\n\t\t\t\t\t\tdatabase: typeof clientParams.database === 'string' ? clientParams.database : undefined,\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t// Use ChromaClient for self-hosted instances\n\t\t\t\t\tconst { ChromaClient } = await ExtendedChroma.imports();\n\t\t\t\t\tconst clientConfig = this.url ? { path: this.url, ...clientParams } : clientParams;\n\n\t\t\t\t\tthis.index = new ChromaClient(clientConfig);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tthis.collection = await this.index.getOrCreateCollection({\n\t\t\t\t\tname: this.collectionName,\n\t\t\t\t\t...(this.collectionMetadata && { metadata: this.collectionMetadata }),\n\t\t\t\t\tembeddingFunction: null,\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\tthrow new ApplicationError(`Chroma getOrCreateCollection error: ${message}`);\n\t\t\t}\n\t\t}\n\n\t\tif (!this.collection) {\n\t\t\tthrow new ApplicationError('Failed to initialize Chroma collection');\n\t\t}\n\n\t\treturn this.collection;\n\t}\n\n\tasync similaritySearchVectorWithScore(\n\t\tquery: number[],\n\t\tk: number,\n\t\tfilter?: this['FilterType'],\n\t): Promise<Array<[Document, number]>> {\n\t\t// Handle the case where query might actually be a nested array which is usually the case.\n\n\t\tlet flatQuery: number[] = [];\n\n\t\tif (query.length > 0 && Array.isArray(query[0])) {\n\t\t\t// If the first element is an array, we need to flatten\n\t\t\tfor (const element of query) {\n\t\t\t\tif (Array.isArray(element)) {\n\t\t\t\t\tflatQuery.push.apply(flatQuery, element);\n\t\t\t\t} else {\n\t\t\t\t\tflatQuery.push(element);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tflatQuery = query;\n\t\t}\n\n\t\treturn await super.similaritySearchVectorWithScore(flatQuery, k, filter);\n\t}\n}\n\nconst authenticationProperty: INodeProperties = {\n\tdisplayName: 'Authentication',\n\tname: 'authentication',\n\ttype: 'options',\n\toptions: [\n\t\t{\n\t\t\tname: 'Self-Hosted',\n\t\t\tvalue: 'chromaSelfHostedApi',\n\t\t\tdescription: 'Connect to a self-hosted ChromaDB instance',\n\t\t},\n\t\t{\n\t\t\tname: 'Cloud',\n\t\t\tvalue: 'chromaCloudApi',\n\t\t\tdescription: 'Connect to Chroma Cloud',\n\t\t},\n\t],\n\tdefault: 'chromaSelfHostedApi',\n};\n\nconst sharedFields: INodeProperties[] = [authenticationProperty, chromaCollectionRLC];\n\nconst retrieveFields: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Options',\n\t\tname: 'options',\n\t\ttype: 'collection',\n\t\tplaceholder: 'Add Option',\n\t\tdefault: {},\n\t\toptions: [metadataFilterField],\n\t},\n];\n\nconst insertFields: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Options',\n\t\tname: 'options',\n\t\ttype: 'collection',\n\t\tplaceholder: 'Add Option',\n\t\tdefault: {},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Clear Collection',\n\t\t\t\tname: 'clearCollection',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t\tdescription: 'Whether to clear the collection before inserting new data',\n\t\t\t},\n\t\t],\n\t},\n];\n\nexport class VectorStoreChromaDB extends createVectorStoreNode<ExtendedChroma>({\n\tmeta: {\n\t\tdisplayName: 'Chroma Vector Store',\n\t\tname: 'vectorStoreChromaDB',\n\t\tdescription: 'Work with your data in Chroma Vector Store',\n\t\ticon: { light: 'file:chroma.svg', dark: 'file:chroma.svg' },\n\t\tdocsUrl:\n\t\t\t'https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.vectorstorechromadb/',\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'chromaSelfHostedApi',\n\t\t\t\trequired: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tauthentication: ['chromaSelfHostedApi'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'chromaCloudApi',\n\t\t\t\trequired: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tauthentication: ['chromaCloudApi'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\toperationModes: ['load', 'insert', 'retrieve', 'retrieve-as-tool'],\n\t},\n\tmethods: {\n\t\tlistSearch: {\n\t\t\tasync chromaCollectionsSearch(this: ILoadOptionsFunctions) {\n\t\t\t\ttry {\n\t\t\t\t\tconst client = await getChromaClient(this);\n\t\t\t\t\tconst collections = await client.listCollections();\n\n\t\t\t\t\tif (Array.isArray(collections)) {\n\t\t\t\t\t\tconst results = collections.map((collection: Collection) => ({\n\t\t\t\t\t\t\tname: collection.name,\n\t\t\t\t\t\t\tvalue: collection.name,\n\t\t\t\t\t\t}));\n\t\t\t\t\t\treturn { results };\n\t\t\t\t\t}\n\n\t\t\t\t\treturn { results: [] };\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst errorMessage = error instanceof Error ? error.message : String(error);\n\n\t\t\t\t\t// Check for connection errors\n\t\t\t\t\tif (errorMessage.includes('ECONNREFUSED') || errorMessage.includes('Failed to connect')) {\n\t\t\t\t\t\tthrow new NodeApiError(this.getNode(), {\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t'Cannot connect to ChromaDB. Please ensure ChromaDB is running and accessible at the configured URL.',\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\t// Check for authentication errors\n\t\t\t\t\tif (\n\t\t\t\t\t\terrorMessage.includes('Unauthorized') ||\n\t\t\t\t\t\terrorMessage.includes('401') ||\n\t\t\t\t\t\terrorMessage.includes('403')\n\t\t\t\t\t) {\n\t\t\t\t\t\tthrow new NodeApiError(this.getNode(), {\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t'Authentication failed. Please check your API key or token in the credentials',\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tthrow new NodeApiError(this.getNode(), {\n\t\t\t\t\t\tmessage: `Failed to list ChromaDB collections: ${errorMessage}`,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\tretrieveFields,\n\tloadFields: retrieveFields,\n\tinsertFields,\n\tsharedFields,\n\n\tasync getVectorStoreClient(context, _filter, embeddings, itemIndex) {\n\t\tconst collection = context.getNodeParameter('chromaCollection', itemIndex, '', {\n\t\t\textractValue: true,\n\t\t});\n\n\t\tif (typeof collection !== 'string') {\n\t\t\tthrow new NodeOperationError(context.getNode(), 'Collection must be a string');\n\t\t}\n\n\t\ttry {\n\t\t\tconst config = await getChromaLibConfig(context, collection, itemIndex);\n\t\t\treturn await ExtendedChroma.fromExistingCollection(embeddings, config);\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : 'Unknown error';\n\t\t\tthrow new NodeOperationError(context.getNode(), `Error connecting to ChromaDB: ${message}`, {\n\t\t\t\titemIndex,\n\t\t\t});\n\t\t}\n\t},\n\n\tasync populateVectorStore(context, embeddings, documents, itemIndex) {\n\t\tconst collection = context.getNodeParameter('chromaCollection', itemIndex, '', {\n\t\t\textractValue: true,\n\t\t});\n\n\t\tif (typeof collection !== 'string') {\n\t\t\tthrow new NodeOperationError(context.getNode(), 'Collection must be a string');\n\t\t}\n\n\t\tconst options = context.getNodeParameter('options', itemIndex, {});\n\t\tconst clearCollection = options.clearCollection === true;\n\n\t\tif (clearCollection) {\n\t\t\ttry {\n\t\t\t\tconst client = await getChromaClient(context, itemIndex);\n\t\t\t\tawait client.deleteCollection({ name: collection });\n\t\t\t\tcontext.logger.info(`Collection ${collection} deleted`);\n\t\t\t} catch (error) {\n\t\t\t\tcontext.logger.info(\n\t\t\t\t\t`Collection ${collection} does not exist yet or could not be deleted (continuing)`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\ttry {\n\t\t\tconst config = await getChromaLibConfig(context, collection, itemIndex);\n\t\t\tawait ExtendedChroma.fromDocuments(documents, embeddings, config);\n\t\t} catch (error) {\n\t\t\tconst chromaError = error as ChromaError;\n\t\t\tconst errorMessage = chromaError.message ?? 'Unknown error';\n\t\t\tconst detailMessage = chromaError.response?.data?.detail;\n\n\t\t\t// Handle dimension mismatch error specifically\n\t\t\tif (\n\t\t\t\terrorMessage.includes('embedding with dimension') ||\n\t\t\t\tdetailMessage?.includes('embedding with dimension')\n\t\t\t) {\n\t\t\t\tconst displayMessage = detailMessage ?? errorMessage;\n\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\tcontext.getNode(),\n\t\t\t\t\t`ChromaDB embedding dimension mismatch: ${displayMessage}`,\n\t\t\t\t\t{\n\t\t\t\t\t\titemIndex,\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t'The collection expects embeddings with different dimensions. Enable \"Clear Collection\" option to recreate the collection with correct dimensions, or use a different collection name.',\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tcontext.getNode(),\n\t\t\t\t`Error inserting documents into ChromaDB: ${errorMessage}`,\n\t\t\t\t{ itemIndex },\n\t\t\t);\n\t\t}\n\t},\n}) {}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAAuB;AAEvB,sBAA2D;AAC3D,0BAQO;AAEP,0BAAoC;AAEpC,mCAAsC;AACtC,0BAAoC;AAcpC,SAAS,kBACR,SACS;AACT,MAAI;AACH,UAAM,iBAAiB,QAAQ,iBAAiB,kBAAkB,CAAC;AACnE,QAAI,OAAO,mBAAmB,UAAU;AACvC,aAAO;AAAA,IACR;AAAA,EACD,SAAS,OAAO;AAAA,EAEhB;AAEA,QAAM,OAAO,QAAQ,QAAQ;AAG7B,MAAI,KAAK,aAAa,gBAAgB;AACrC,WAAO;AAAA,EACR;AACA,MAAI,KAAK,aAAa,qBAAqB;AAC1C,WAAO;AAAA,EACR;AAEA,SAAO;AACR;AAMA,eAAe,gBACd,SACA,WACsC;AACtC,QAAM,iBAAiB,kBAAkB,OAAO;AAChD,QAAM,cAAc,MAAM,QAAQ,eAAe,gBAAgB,SAAS;AAE1E,MAAI,mBAAmB,kBAAkB;AAExC,UAAM,SAAS,OAAO,YAAY,WAAW,WAAW,YAAY,SAAS;AAC7E,UAAM,SAIF;AAAA,MACH;AAAA,IACD;AAGA,QAAI,OAAO,YAAY,WAAW,UAAU;AAC3C,aAAO,SAAS,YAAY;AAAA,IAC7B;AACA,QAAI,OAAO,YAAY,aAAa,UAAU;AAC7C,aAAO,WAAW,YAAY;AAAA,IAC/B;AAEA,WAAO,IAAI,4BAAY,MAAM;AAAA,E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CAAmB,QAAQ,QAAQ,GAAG,6BAA6B;AAAA,IAC9E;AAEA,UAAM,UAAU,QAAQ,iBAAiB,WAAW,WAAW,CAAC,CAAC;AACjE,UAAM,kBAAkB,QAAQ,oBAAoB;AAEpD,QAAI,iBAAiB;AACpB,UAAI;AACH,cAAM,SAAS,MAAM,gBAAgB,SAAS,SAAS;AACvD,cAAM,OAAO,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAClD,gBAAQ,OAAO,KAAK,cAAc,UAAU,UAAU;AAAA,MACvD,SAAS,OAAO;AACf,gBAAQ,OAAO;AAAA,UACd,cAAc,UAAU;AAAA,QACzB;AAAA,MACD;AAAA,IACD;AAEA,QAAI;AACH,YAAM,SAAS,MAAM,mBAAmB,SAAS,YAAY,SAAS;AACtE,YAAM,eAAe,cAAc,WAAW,YAAY,MAAM;AAAA,IACjE,SAAS,OAAO;AACf,YAAM,cAAc;AACpB,YAAM,eAAe,YAAY,WAAW;AAC5C,YAAM,gBAAgB,YAAY,UAAU,MAAM;AAGlD,UACC,aAAa,SAAS,0BAA0B,KAChD,eAAe,SAAS,0BAA0B,GACjD;AACD,cAAM,iBAAiB,iBAAiB;AACxC,cAAM,IAAI;AAAA,UACT,QAAQ,QAAQ;AAAA,UAChB,0CAA0C,cAAc;AAAA,UACxD;AAAA,YACC;AAAA,YACA,aACC;AAAA,UACF;AAAA,QACD;AAAA,MACD;AACA,YAAM,IAAI;AAAA,QACT,QAAQ,QAAQ;AAAA,QAChB,4CAA4C,YAAY;AAAA,QACxD,EAAE,UAAU;AAAA,MACb;AAAA,IACD;AAAA,EACD;AACD,CAAC,EAAE;AAAC;","names":["ChromaClient"]}
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="256px" height="164px" viewBox="0 0 256 164" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid">
3
+ <title>Chroma</title>
4
+ <g>
5
+ <ellipse fill="#FFDE2D" cx="170.666795" cy="81.9198362" rx="85.3332053" ry="81.9198362"></ellipse>
6
+ <ellipse fill="#327EFF" cx="85.3332053" cy="81.9198362" rx="85.3332053" ry="81.9198362"></ellipse>
7
+ <path d="M170.666795,81.9199642 C170.666795,127.163394 132.461431,163.83916 85.3330773,163.83916 L85.3330773,81.9199642 L170.666795,81.9199642 Z M85.3332053,81.9198362 C85.3332053,36.6767906 123.538185,8.95998209e-05 170.666795,8.95998209e-05 L170.666795,81.9198362 L85.3332053,81.9198362 Z" fill="#FF6446"></path>
8
+ </g>
9
+ </svg>
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var descriptions_exports = {};
20
20
  __export(descriptions_exports, {
21
+ chromaCollectionRLC: () => chromaCollectionRLC,
21
22
  milvusCollectionRLC: () => milvusCollectionRLC,
22
23
  pineconeIndexRLC: () => pineconeIndexRLC,
23
24
  qdrantCollectionRLC: () => qdrantCollectionRLC,
@@ -135,8 +136,31 @@ const weaviateCollectionRLC = {
135
136
  }
136
137
  ]
137
138
  };
139
+ const chromaCollectionRLC = {
140
+ displayName: "Chroma Collection",
141
+ name: "chromaCollection",
142
+ type: "resourceLocator",
143
+ default: { mode: "list", value: "" },
144
+ required: true,
145
+ modes: [
146
+ {
147
+ displayName: "From List",
148
+ name: "list",
149
+ type: "list",
150
+ typeOptions: {
151
+ searchListMethod: "chromaCollectionsSearch"
152
+ }
153
+ },
154
+ {
155
+ displayName: "ID",
156
+ name: "id",
157
+ type: "string"
158
+ }
159
+ ]
160
+ };
138
161
  // Annotate the CommonJS export names for ESM import in node:
139
162
  0 && (module.exports = {
163
+ chromaCollectionRLC,
140
164
  milvusCollectionRLC,
141
165
  pineconeIndexRLC,
142
166
  qdrantCollectionRLC,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../nodes/vector_store/shared/descriptions.ts"],"sourcesContent":["import type { INodeProperties } from 'n8n-workflow';\n\nexport const pineconeIndexRLC: INodeProperties = {\n\tdisplayName: 'Pinecone Index',\n\tname: 'pineconeIndex',\n\ttype: 'resourceLocator',\n\tdefault: { mode: 'list', value: '' },\n\trequired: true,\n\tmodes: [\n\t\t{\n\t\t\tdisplayName: 'From List',\n\t\t\tname: 'list',\n\t\t\ttype: 'list',\n\t\t\ttypeOptions: {\n\t\t\t\tsearchListMethod: 'pineconeIndexSearch',\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'ID',\n\t\t\tname: 'id',\n\t\t\ttype: 'string',\n\t\t},\n\t],\n};\n\nexport const supabaseTableNameRLC: INodeProperties = {\n\tdisplayName: 'Table Name',\n\tname: 'tableName',\n\ttype: 'resourceLocator',\n\tdefault: { mode: 'list', value: '' },\n\trequired: true,\n\tmodes: [\n\t\t{\n\t\t\tdisplayName: 'From List',\n\t\t\tname: 'list',\n\t\t\ttype: 'list',\n\t\t\ttypeOptions: {\n\t\t\t\tsearchListMethod: 'supabaseTableNameSearch',\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'ID',\n\t\t\tname: 'id',\n\t\t\ttype: 'string',\n\t\t},\n\t],\n};\n\nexport const qdrantCollectionRLC: INodeProperties = {\n\tdisplayName: 'Qdrant Collection',\n\tname: 'qdrantCollection',\n\ttype: 'resourceLocator',\n\tdefault: { mode: 'list', value: '' },\n\trequired: true,\n\tmodes: [\n\t\t{\n\t\t\tdisplayName: 'From List',\n\t\t\tname: 'list',\n\t\t\ttype: 'list',\n\t\t\ttypeOptions: {\n\t\t\t\tsearchListMethod: 'qdrantCollectionsSearch',\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'ID',\n\t\t\tname: 'id',\n\t\t\ttype: 'string',\n\t\t},\n\t],\n};\n\nexport const milvusCollectionRLC: INodeProperties = {\n\tdisplayName: 'Milvus Collection',\n\tname: 'milvusCollection',\n\ttype: 'resourceLocator',\n\tdefault: { mode: 'list', value: '' },\n\trequired: true,\n\tmodes: [\n\t\t{\n\t\t\tdisplayName: 'From List',\n\t\t\tname: 'list',\n\t\t\ttype: 'list',\n\t\t\ttypeOptions: {\n\t\t\t\tsearchListMethod: 'milvusCollectionsSearch',\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'ID',\n\t\t\tname: 'id',\n\t\t\ttype: 'string',\n\t\t},\n\t],\n};\n\nexport const weaviateCollectionRLC: INodeProperties = {\n\tdisplayName: 'Weaviate Collection',\n\tname: 'weaviateCollection',\n\ttype: 'resourceLocator',\n\tdefault: { mode: 'list', value: '' },\n\trequired: true,\n\tmodes: [\n\t\t{\n\t\t\tdisplayName: 'From List',\n\t\t\tname: 'list',\n\t\t\ttype: 'list',\n\t\t\ttypeOptions: {\n\t\t\t\tsearchListMethod: 'weaviateCollectionsSearch',\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'ID',\n\t\t\tname: 'id',\n\t\t\ttype: 'string',\n\t\t},\n\t],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,mBAAoC;AAAA,EAChD,aAAa;AAAA,EACb,MAAM;AAAA,EACN,MAAM;AAAA,EACN,SAAS,EAAE,MAAM,QAAQ,OAAO,GAAG;AAAA,EACnC,UAAU;AAAA,EACV,OAAO;AAAA,IACN;AAAA,MACC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,aAAa;AAAA,QACZ,kBAAkB;AAAA,MACnB;AAAA,IACD;AAAA,IACA;AAAA,MACC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,IACP;AAAA,EACD;AACD;AAEO,MAAM,uBAAwC;AAAA,EACpD,aAAa;AAAA,EACb,MAAM;AAAA,EACN,MAAM;AAAA,EACN,SAAS,EAAE,MAAM,QAAQ,OAAO,GAAG;AAAA,EACnC,UAAU;AAAA,EACV,OA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AA,MACC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,IACP;AAAA,EACD;AACD;","names":[]}
1
+ {"version":3,"sources":["../../../../nodes/vector_store/shared/descriptions.ts"],"sourcesContent":["import type { INodeProperties } from 'n8n-workflow';\n\nexport const pineconeIndexRLC: INodeProperties = {\n\tdisplayName: 'Pinecone Index',\n\tname: 'pineconeIndex',\n\ttype: 'resourceLocator',\n\tdefault: { mode: 'list', value: '' },\n\trequired: true,\n\tmodes: [\n\t\t{\n\t\t\tdisplayName: 'From List',\n\t\t\tname: 'list',\n\t\t\ttype: 'list',\n\t\t\ttypeOptions: {\n\t\t\t\tsearchListMethod: 'pineconeIndexSearch',\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'ID',\n\t\t\tname: 'id',\n\t\t\ttype: 'string',\n\t\t},\n\t],\n};\n\nexport const supabaseTableNameRLC: INodeProperties = {\n\tdisplayName: 'Table Name',\n\tname: 'tableName',\n\ttype: 'resourceLocator',\n\tdefault: { mode: 'list', value: '' },\n\trequired: true,\n\tmodes: [\n\t\t{\n\t\t\tdisplayName: 'From List',\n\t\t\tname: 'list',\n\t\t\ttype: 'list',\n\t\t\ttypeOptions: {\n\t\t\t\tsearchListMethod: 'supabaseTableNameSearch',\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'ID',\n\t\t\tname: 'id',\n\t\t\ttype: 'string',\n\t\t},\n\t],\n};\n\nexport const qdrantCollectionRLC: INodeProperties = {\n\tdisplayName: 'Qdrant Collection',\n\tname: 'qdrantCollection',\n\ttype: 'resourceLocator',\n\tdefault: { mode: 'list', value: '' },\n\trequired: true,\n\tmodes: [\n\t\t{\n\t\t\tdisplayName: 'From List',\n\t\t\tname: 'list',\n\t\t\ttype: 'list',\n\t\t\ttypeOptions: {\n\t\t\t\tsearchListMethod: 'qdrantCollectionsSearch',\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'ID',\n\t\t\tname: 'id',\n\t\t\ttype: 'string',\n\t\t},\n\t],\n};\n\nexport const milvusCollectionRLC: INodeProperties = {\n\tdisplayName: 'Milvus Collection',\n\tname: 'milvusCollection',\n\ttype: 'resourceLocator',\n\tdefault: { mode: 'list', value: '' },\n\trequired: true,\n\tmodes: [\n\t\t{\n\t\t\tdisplayName: 'From List',\n\t\t\tname: 'list',\n\t\t\ttype: 'list',\n\t\t\ttypeOptions: {\n\t\t\t\tsearchListMethod: 'milvusCollectionsSearch',\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'ID',\n\t\t\tname: 'id',\n\t\t\ttype: 'string',\n\t\t},\n\t],\n};\n\nexport const weaviateCollectionRLC: INodeProperties = {\n\tdisplayName: 'Weaviate Collection',\n\tname: 'weaviateCollection',\n\ttype: 'resourceLocator',\n\tdefault: { mode: 'list', value: '' },\n\trequired: true,\n\tmodes: [\n\t\t{\n\t\t\tdisplayName: 'From List',\n\t\t\tname: 'list',\n\t\t\ttype: 'list',\n\t\t\ttypeOptions: {\n\t\t\t\tsearchListMethod: 'weaviateCollectionsSearch',\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'ID',\n\t\t\tname: 'id',\n\t\t\ttype: 'string',\n\t\t},\n\t],\n};\nexport const chromaCollectionRLC: INodeProperties = {\n\tdisplayName: 'Chroma Collection',\n\tname: 'chromaCollection',\n\ttype: 'resourceLocator',\n\tdefault: { mode: 'list', value: '' },\n\trequired: true,\n\tmodes: [\n\t\t{\n\t\t\tdisplayName: 'From List',\n\t\t\tname: 'list',\n\t\t\ttype: 'list',\n\t\t\ttypeOptions: {\n\t\t\t\tsearchListMethod: 'chromaCollectionsSearch',\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'ID',\n\t\t\tname: 'id',\n\t\t\ttype: 'string',\n\t\t},\n\t],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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AAA,EACV,OAAO;AAAA,IACN;AAAA,MACC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,aAAa;AAAA,QACZ,kBAAkB;AAAA,MACnB;AAAA,IACD;AAAA,IACA;AAAA,MACC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,IACP;AAAA,EACD;AACD;AAEO,MAAM,wBAAyC;AAAA,EACrD,aAAa;AAAA,EACb,MAAM;AAAA,EACN,MAAM;AAAA,EACN,SAAS,EAAE,MAAM,QAAQ,OAAO,GAAG;AAAA,EACnC,UAAU;AAAA,EACV,OAAO;AAAA,IACN;AAAA,MACC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,aAAa;AAAA,QACZ,kBAAkB;AAAA,MACnB;AAAA,IACD;AAAA,IACA;AAAA,MACC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,IACP;AAAA,EACD;AACD;AACO,MAAM,sBAAuC;AAAA,EACnD,aAAa;AAAA,EACb,MAAM;AAAA,EACN,MAAM;AAAA,EACN,SAAS,EAAE,MAAM,QAAQ,OAAO,GAAG;AAAA,EACnC,UAAU;AAAA,EACV,OAAO;AAAA,IACN;AAAA,MACC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,aAAa;AAAA,QACZ,kBAAkB;AAAA,MACnB;AAAA,IACD;AAAA,IACA;AAAA,MACC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,IACP;AAAA,EACD;AACD;","names":[]}
@@ -184,13 +184,17 @@ async function execute(i) {
184
184
  const options = this.getNodeParameter("options", i, {});
185
185
  const baseURL = options.baseURL ?? credentials.url;
186
186
  const { openAiDefaultHeaders: defaultHeaders } = import_di.Container.get(import_config.AiConfig);
187
+ const timeout = options.timeout;
187
188
  const client = new import_openai.OpenAI({
188
189
  apiKey: credentials.apiKey,
189
190
  maxRetries: options.maxRetries ?? 2,
190
- timeout: options.timeout ?? 1e4,
191
+ timeout: timeout ?? 1e4,
191
192
  baseURL,
192
193
  fetchOptions: {
193
- dispatcher: (0, import_httpProxyAgent.getProxyAgent)(baseURL)
194
+ dispatcher: (0, import_httpProxyAgent.getProxyAgent)(baseURL, {
195
+ headersTimeout: timeout,
196
+ bodyTimeout: timeout
197
+ })
194
198
  },
195
199
  defaultHeaders
196
200
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../nodes/vendors/OpenAi/v1/actions/assistant/message.operation.ts"],"sourcesContent":["import type { BaseMessage } from '@langchain/core/messages';\nimport { AgentExecutor } from '@langchain/classic/agents';\nimport type { OpenAIToolType } from '@langchain/classic/dist/experimental/openai_assistant/schema';\nimport { OpenAIAssistantRunnable } from '@langchain/classic/experimental/openai_assistant';\nimport type { BufferWindowMemory } from '@langchain/classic/memory';\nimport omit from 'lodash/omit';\nimport type {\n\tIDataObject,\n\tIExecuteFunctions,\n\tINodeExecutionData,\n\tINodeProperties,\n} from 'n8n-workflow';\nimport {\n\tApplicationError,\n\tNodeConnectionTypes,\n\tNodeOperationError,\n\tupdateDisplayOptions,\n} from 'n8n-workflow';\nimport { OpenAI as OpenAIClient } from 'openai';\n\nimport { promptTypeOptionsDeprecated } from '@utils/descriptions';\nimport { getConnectedTools, getPromptInputByType } from '@utils/helpers';\nimport { getTracingConfig } from '@utils/tracing';\n\nimport { formatToOpenAIAssistantTool, getChatMessages } from '../../../helpers/utils';\nimport { assistantRLC } from '../descriptions';\nimport { getProxyAgent } from '@utils/httpProxyAgent';\nimport { Container } from '@n8n/di';\nimport { AiConfig } from '@n8n/config';\n\nconst properties: INodeProperties[] = [\n\tassistantRLC,\n\t{\n\t\t...promptTypeOptionsDeprecated,\n\t\tname: 'prompt',\n\t},\n\t{\n\t\tdisplayName: 'Prompt (User Message)',\n\t\tname: 'text',\n\t\ttype: 'string',\n\t\tdefault: '',\n\t\tplaceholder: 'e.g. Hello, how can you help me?',\n\t\ttypeOptions: {\n\t\t\trows: 2,\n\t\t},\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tprompt: ['define'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Memory',\n\t\tname: 'memory',\n\t\ttype: 'options',\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Use memory connector',\n\t\t\t\tvalue: 'connector',\n\t\t\t\tdescription: 'Connect one of the supported memory nodes',\n\t\t\t},\n\t\t\t{\n\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\tname: 'Use thread ID',\n\t\t\t\tvalue: 'threadId',\n\t\t\t\tdescription: 'Specify the ID of the thread to continue',\n\t\t\t},\n\t\t],\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'@version': [{ _cnd: { gte: 1.6 } }],\n\t\t\t},\n\t\t},\n\t\tdefault: 'connector',\n\t},\n\t{\n\t\tdisplayName: 'Thread ID',\n\t\tname: 'threadId',\n\t\ttype: 'string',\n\t\tdefault: '',\n\t\tplaceholder: '',\n\t\tdescription: 'The ID of the thread to continue, a new thread will be created if not specified',\n\t\thint: 'If the thread ID is empty or undefined a new thread will be created and included in the response',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'@version': [{ _cnd: { gte: 1.6 } }],\n\t\t\t\tmemory: ['threadId'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Connect your own custom n8n tools to this node on the canvas',\n\t\tname: 'noticeTools',\n\t\ttype: 'notice',\n\t\tdefault: '',\n\t},\n\t{\n\t\tdisplayName: 'Options',\n\t\tname: 'options',\n\t\tplaceholder: 'Add Option',\n\t\tdescription: 'Additional options to add',\n\t\ttype: 'collection',\n\t\tdefault: {},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Base URL',\n\t\t\t\tname: 'baseURL',\n\t\t\t\tdefault: 'https://api.openai.com/v1',\n\t\t\t\tdescription: 'Override the default base URL for the API',\n\t\t\t\ttype: 'string',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\thide: {\n\t\t\t\t\t\t'@version': [{ _cnd: { gte: 1.8 } }],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Max Retries',\n\t\t\t\tname: 'maxRetries',\n\t\t\t\tdefault: 2,\n\t\t\t\tdescription: 'Maximum number of retries to attempt',\n\t\t\t\ttype: 'number',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Timeout',\n\t\t\t\tname: 'timeout',\n\t\t\t\tdefault: 10000,\n\t\t\t\tdescription: 'Maximum amount of time a request is allowed to take in milliseconds',\n\t\t\t\ttype: 'number',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Preserve Original Tools',\n\t\t\t\tname: 'preserveOriginalTools',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: true,\n\t\t\t\tdescription:\n\t\t\t\t\t'Whether to preserve the original tools of the assistant after the execution of this node, otherwise the tools will be replaced with the connected tools, if any, default is true',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'@version': [{ _cnd: { gte: 1.3 } }],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['message'],\n\t\tresource: ['assistant'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\nconst mapChatMessageToThreadMessage = (\n\tmessage: BaseMessage,\n): OpenAIClient.Beta.Threads.ThreadCreateParams.Message => ({\n\trole: message._getType() === 'ai' ? 'assistant' : 'user',\n\tcontent: message.content.toString(),\n});\n\nexport async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {\n\tconst credentials = await this.getCredentials('openAiApi');\n\tconst nodeVersion = this.getNode().typeVersion;\n\n\tconst input = getPromptInputByType({\n\t\tctx: this,\n\t\ti,\n\t\tinputKey: 'text',\n\t\tpromptTypeKey: 'prompt',\n\t});\n\n\tconst assistantId = this.getNodeParameter('assistantId', i, '', { extractValue: true }) as string;\n\n\tconst options = this.getNodeParameter('options', i, {}) as {\n\t\tbaseURL?: string;\n\t\tmaxRetries: number;\n\t\ttimeout: number;\n\t\tpreserveOriginalTools?: boolean;\n\t};\n\n\tconst baseURL = (options.baseURL ?? credentials.url) as string;\n\tconst { openAiDefaultHeaders: defaultHeaders } = Container.get(AiConfig);\n\n\tconst client = new OpenAIClient({\n\t\tapiKey: credentials.apiKey as string,\n\t\tmaxRetries: options.maxRetries ?? 2,\n\t\ttimeout: options.timeout ?? 10000,\n\t\tbaseURL,\n\t\tfetchOptions: {\n\t\t\tdispatcher: getProxyAgent(baseURL),\n\t\t},\n\t\tdefaultHeaders,\n\t});\n\n\tconst agent = new OpenAIAssistantRunnable({ assistantId, client, asAgent: true });\n\n\tconst tools = await getConnectedTools(this, nodeVersion > 1, false);\n\tlet assistantTools;\n\n\tif (tools.length) {\n\t\tconst transformedConnectedTools = tools?.map(formatToOpenAIAssistantTool) ?? [];\n\t\tconst nativeToolsParsed: OpenAIToolType = [];\n\n\t\tassistantTools = (await client.beta.assistants.retrieve(assistantId)).tools;\n\n\t\tconst useCodeInterpreter = assistantTools.some((tool) => tool.type === 'code_interpreter');\n\t\tif (useCodeInterpreter) {\n\t\t\tnativeToolsParsed.push({\n\t\t\t\ttype: 'code_interpreter',\n\t\t\t});\n\t\t}\n\n\t\tconst useRetrieval = assistantTools.some((tool) => tool.type === 'file_search');\n\t\tif (useRetrieval) {\n\t\t\tnativeToolsParsed.push({\n\t\t\t\ttype: 'file_search',\n\t\t\t});\n\t\t}\n\n\t\tawait client.beta.assistants.update(assistantId, {\n\t\t\ttools: [...nativeToolsParsed, ...transformedConnectedTools],\n\t\t});\n\t}\n\n\tconst agentExecutor = AgentExecutor.fromAgentAndTools({\n\t\tagent,\n\t\ttools: tools ?? [],\n\t});\n\n\tconst useMemoryConnector =\n\t\tnodeVersion >= 1.6 && this.getNodeParameter('memory', i) === 'connector';\n\tconst memory =\n\t\tuseMemoryConnector || nodeVersion < 1.6\n\t\t\t? ((await this.getInputConnectionData(NodeConnectionTypes.AiMemory, 0)) as\n\t\t\t\t\t| BufferWindowMemory\n\t\t\t\t\t| undefined)\n\t\t\t: undefined;\n\n\tconst threadId =\n\t\tnodeVersion >= 1.6 && !useMemoryConnector\n\t\t\t? (this.getNodeParameter('threadId', i) as string)\n\t\t\t: undefined;\n\n\tconst chainValues: IDataObject = {\n\t\tcontent: input,\n\t\tsignal: this.getExecutionCancelSignal(),\n\t\ttimeout: options.timeout ?? 10000,\n\t};\n\tlet thread: OpenAIClient.Beta.Threads.Thread;\n\tif (memory) {\n\t\tconst chatMessages = await getChatMessages(memory);\n\n\t\t// Construct a new thread from the chat history to map the memory\n\t\tif (chatMessages.length) {\n\t\t\tconst first32Messages = chatMessages.slice(0, 32);\n\t\t\t// There is a undocumented limit of 32 messages per thread when creating a thread with messages\n\t\t\tconst mappedMessages: OpenAIClient.Beta.Threads.ThreadCreateParams.Message[] =\n\t\t\t\tfirst32Messages.map(mapChatMessageToThreadMessage);\n\n\t\t\tthread = await client.beta.threads.create({ messages: mappedMessages });\n\t\t\tconst overLimitMessages = chatMessages.slice(32).map(mapChatMessageToThreadMessage);\n\n\t\t\t// Send the remaining messages that exceed the limit of 32 sequentially\n\t\t\tfor (const message of overLimitMessages) {\n\t\t\t\tawait client.beta.threads.messages.create(thread.id, message);\n\t\t\t}\n\n\t\t\tchainValues.threadId = thread.id;\n\t\t}\n\t} else if (threadId) {\n\t\tchainValues.threadId = threadId;\n\t}\n\n\tlet filteredResponse: IDataObject = {};\n\ttry {\n\t\tconst response = await agentExecutor.withConfig(getTracingConfig(this)).invoke(chainValues);\n\t\tif (memory) {\n\t\t\tawait memory.saveContext({ input }, { output: response.output });\n\n\t\t\tif (response.threadId && response.runId) {\n\t\t\t\tconst threadRun = await client.beta.threads.runs.retrieve(response.runId, {\n\t\t\t\t\tthread_id: response.threadId,\n\t\t\t\t});\n\t\t\t\tresponse.usage = threadRun.usage;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\toptions.preserveOriginalTools !== false &&\n\t\t\tnodeVersion >= 1.3 &&\n\t\t\t(assistantTools ?? [])?.length\n\t\t) {\n\t\t\tawait client.beta.assistants.update(assistantId, {\n\t\t\t\ttools: assistantTools,\n\t\t\t});\n\t\t}\n\t\t// Remove configuration properties and runId added by Langchain that are not relevant to the user\n\t\tfilteredResponse = omit(response, ['signal', 'timeout', 'content', 'runId']) as IDataObject;\n\t} catch (error) {\n\t\tif (!(error instanceof ApplicationError)) {\n\t\t\tthrow new NodeOperationError(this.getNode(), error.message, { itemIndex: i });\n\t\t}\n\t}\n\n\treturn [{ json: filteredResponse, pairedItem: { item: i } }];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAA8B;AAE9B,8BAAwC;AAExC,kBAAiB;AAOjB,0BAKO;AACP,oBAAuC;AAEvC,0BAA4C;AAC5C,qBAAwD;AACxD,qBAAiC;AAEjC,mBAA6D;AAC7D,IAAAA,uBAA6B;AAC7B,4BAA8B;AAC9B,gBAA0B;AAC1B,oBAAyB;AAEzB,MAAM,aAAgC;AAAA,EACrC;AAAA,EACA;AAAA,IACC,GAAG;AAAA,IACH,MAAM;AAAA,EACP;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,IACb,aAAa;AAAA,MACZ,MAAM;AAAA,IACP;AAAA,IACA,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,QAAQ,CAAC,QAAQ;AAAA,MAClB;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,M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AE,MAAM,EAAE,EAAE,CAAC;AAC5D;","names":["import_descriptions","OpenAIClient","omit"]}
1
+ {"version":3,"sources":["../../../../../../../nodes/vendors/OpenAi/v1/actions/assistant/message.operation.ts"],"sourcesContent":["import type { BaseMessage } from '@langchain/core/messages';\nimport { AgentExecutor } from '@langchain/classic/agents';\nimport type { OpenAIToolType } from '@langchain/classic/dist/experimental/openai_assistant/schema';\nimport { OpenAIAssistantRunnable } from '@langchain/classic/experimental/openai_assistant';\nimport type { BufferWindowMemory } from '@langchain/classic/memory';\nimport omit from 'lodash/omit';\nimport type {\n\tIDataObject,\n\tIExecuteFunctions,\n\tINodeExecutionData,\n\tINodeProperties,\n} from 'n8n-workflow';\nimport {\n\tApplicationError,\n\tNodeConnectionTypes,\n\tNodeOperationError,\n\tupdateDisplayOptions,\n} from 'n8n-workflow';\nimport { OpenAI as OpenAIClient } from 'openai';\n\nimport { promptTypeOptionsDeprecated } from '@utils/descriptions';\nimport { getConnectedTools, getPromptInputByType } from '@utils/helpers';\nimport { getTracingConfig } from '@utils/tracing';\n\nimport { formatToOpenAIAssistantTool, getChatMessages } from '../../../helpers/utils';\nimport { assistantRLC } from '../descriptions';\nimport { getProxyAgent } from '@utils/httpProxyAgent';\nimport { Container } from '@n8n/di';\nimport { AiConfig } from '@n8n/config';\n\nconst properties: INodeProperties[] = [\n\tassistantRLC,\n\t{\n\t\t...promptTypeOptionsDeprecated,\n\t\tname: 'prompt',\n\t},\n\t{\n\t\tdisplayName: 'Prompt (User Message)',\n\t\tname: 'text',\n\t\ttype: 'string',\n\t\tdefault: '',\n\t\tplaceholder: 'e.g. Hello, how can you help me?',\n\t\ttypeOptions: {\n\t\t\trows: 2,\n\t\t},\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tprompt: ['define'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Memory',\n\t\tname: 'memory',\n\t\ttype: 'options',\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Use memory connector',\n\t\t\t\tvalue: 'connector',\n\t\t\t\tdescription: 'Connect one of the supported memory nodes',\n\t\t\t},\n\t\t\t{\n\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\tname: 'Use thread ID',\n\t\t\t\tvalue: 'threadId',\n\t\t\t\tdescription: 'Specify the ID of the thread to continue',\n\t\t\t},\n\t\t],\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'@version': [{ _cnd: { gte: 1.6 } }],\n\t\t\t},\n\t\t},\n\t\tdefault: 'connector',\n\t},\n\t{\n\t\tdisplayName: 'Thread ID',\n\t\tname: 'threadId',\n\t\ttype: 'string',\n\t\tdefault: '',\n\t\tplaceholder: '',\n\t\tdescription: 'The ID of the thread to continue, a new thread will be created if not specified',\n\t\thint: 'If the thread ID is empty or undefined a new thread will be created and included in the response',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'@version': [{ _cnd: { gte: 1.6 } }],\n\t\t\t\tmemory: ['threadId'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Connect your own custom n8n tools to this node on the canvas',\n\t\tname: 'noticeTools',\n\t\ttype: 'notice',\n\t\tdefault: '',\n\t},\n\t{\n\t\tdisplayName: 'Options',\n\t\tname: 'options',\n\t\tplaceholder: 'Add Option',\n\t\tdescription: 'Additional options to add',\n\t\ttype: 'collection',\n\t\tdefault: {},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Base URL',\n\t\t\t\tname: 'baseURL',\n\t\t\t\tdefault: 'https://api.openai.com/v1',\n\t\t\t\tdescription: 'Override the default base URL for the API',\n\t\t\t\ttype: 'string',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\thide: {\n\t\t\t\t\t\t'@version': [{ _cnd: { gte: 1.8 } }],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Max Retries',\n\t\t\t\tname: 'maxRetries',\n\t\t\t\tdefault: 2,\n\t\t\t\tdescription: 'Maximum number of retries to attempt',\n\t\t\t\ttype: 'number',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Timeout',\n\t\t\t\tname: 'timeout',\n\t\t\t\tdefault: 10000,\n\t\t\t\tdescription: 'Maximum amount of time a request is allowed to take in milliseconds',\n\t\t\t\ttype: 'number',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Preserve Original Tools',\n\t\t\t\tname: 'preserveOriginalTools',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: true,\n\t\t\t\tdescription:\n\t\t\t\t\t'Whether to preserve the original tools of the assistant after the execution of this node, otherwise the tools will be replaced with the connected tools, if any, default is true',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'@version': [{ _cnd: { gte: 1.3 } }],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['message'],\n\t\tresource: ['assistant'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\nconst mapChatMessageToThreadMessage = (\n\tmessage: BaseMessage,\n): OpenAIClient.Beta.Threads.ThreadCreateParams.Message => ({\n\trole: message._getType() === 'ai' ? 'assistant' : 'user',\n\tcontent: message.content.toString(),\n});\n\nexport async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {\n\tconst credentials = await this.getCredentials('openAiApi');\n\tconst nodeVersion = this.getNode().typeVersion;\n\n\tconst input = getPromptInputByType({\n\t\tctx: this,\n\t\ti,\n\t\tinputKey: 'text',\n\t\tpromptTypeKey: 'prompt',\n\t});\n\n\tconst assistantId = this.getNodeParameter('assistantId', i, '', { extractValue: true }) as string;\n\n\tconst options = this.getNodeParameter('options', i, {}) as {\n\t\tbaseURL?: string;\n\t\tmaxRetries: number;\n\t\ttimeout: number;\n\t\tpreserveOriginalTools?: boolean;\n\t};\n\n\tconst baseURL = (options.baseURL ?? credentials.url) as string;\n\tconst { openAiDefaultHeaders: defaultHeaders } = Container.get(AiConfig);\n\tconst timeout = options.timeout;\n\n\tconst client = new OpenAIClient({\n\t\tapiKey: credentials.apiKey as string,\n\t\tmaxRetries: options.maxRetries ?? 2,\n\t\ttimeout: timeout ?? 10000,\n\t\tbaseURL,\n\t\tfetchOptions: {\n\t\t\tdispatcher: getProxyAgent(baseURL, {\n\t\t\t\theadersTimeout: timeout,\n\t\t\t\tbodyTimeout: timeout,\n\t\t\t}),\n\t\t},\n\t\tdefaultHeaders,\n\t});\n\n\tconst agent = new OpenAIAssistantRunnable({ assistantId, client, asAgent: true });\n\n\tconst tools = await getConnectedTools(this, nodeVersion > 1, false);\n\tlet assistantTools;\n\n\tif (tools.length) {\n\t\tconst transformedConnectedTools = tools?.map(formatToOpenAIAssistantTool) ?? [];\n\t\tconst nativeToolsParsed: OpenAIToolType = [];\n\n\t\tassistantTools = (await client.beta.assistants.retrieve(assistantId)).tools;\n\n\t\tconst useCodeInterpreter = assistantTools.some((tool) => tool.type === 'code_interpreter');\n\t\tif (useCodeInterpreter) {\n\t\t\tnativeToolsParsed.push({\n\t\t\t\ttype: 'code_interpreter',\n\t\t\t});\n\t\t}\n\n\t\tconst useRetrieval = assistantTools.some((tool) => tool.type === 'file_search');\n\t\tif (useRetrieval) {\n\t\t\tnativeToolsParsed.push({\n\t\t\t\ttype: 'file_search',\n\t\t\t});\n\t\t}\n\n\t\tawait client.beta.assistants.update(assistantId, {\n\t\t\ttools: [...nativeToolsParsed, ...transformedConnectedTools],\n\t\t});\n\t}\n\n\tconst agentExecutor = AgentExecutor.fromAgentAndTools({\n\t\tagent,\n\t\ttools: tools ?? [],\n\t});\n\n\tconst useMemoryConnector =\n\t\tnodeVersion >= 1.6 && this.getNodeParameter('memory', i) === 'connector';\n\tconst memory =\n\t\tuseMemoryConnector || nodeVersion < 1.6\n\t\t\t? ((await this.getInputConnectionData(NodeConnectionTypes.AiMemory, 0)) as\n\t\t\t\t\t| BufferWindowMemory\n\t\t\t\t\t| undefined)\n\t\t\t: undefined;\n\n\tconst threadId =\n\t\tnodeVersion >= 1.6 && !useMemoryConnector\n\t\t\t? (this.getNodeParameter('threadId', i) as string)\n\t\t\t: undefined;\n\n\tconst chainValues: IDataObject = {\n\t\tcontent: input,\n\t\tsignal: this.getExecutionCancelSignal(),\n\t\ttimeout: options.timeout ?? 10000,\n\t};\n\tlet thread: OpenAIClient.Beta.Threads.Thread;\n\tif (memory) {\n\t\tconst chatMessages = await getChatMessages(memory);\n\n\t\t// Construct a new thread from the chat history to map the memory\n\t\tif (chatMessages.length) {\n\t\t\tconst first32Messages = chatMessages.slice(0, 32);\n\t\t\t// There is a undocumented limit of 32 messages per thread when creating a thread with messages\n\t\t\tconst mappedMessages: OpenAIClient.Beta.Threads.ThreadCreateParams.Message[] =\n\t\t\t\tfirst32Messages.map(mapChatMessageToThreadMessage);\n\n\t\t\tthread = await client.beta.threads.create({ messages: mappedMessages });\n\t\t\tconst overLimitMessages = chatMessages.slice(32).map(mapChatMessageToThreadMessage);\n\n\t\t\t// Send the remaining messages that exceed the limit of 32 sequentially\n\t\t\tfor (const message of overLimitMessages) {\n\t\t\t\tawait client.beta.threads.messages.create(thread.id, message);\n\t\t\t}\n\n\t\t\tchainValues.threadId = thread.id;\n\t\t}\n\t} else if (threadId) {\n\t\tchainValues.threadId = threadId;\n\t}\n\n\tlet filteredResponse: IDataObject = {};\n\ttry {\n\t\tconst response = await agentExecutor.withConfig(getTracingConfig(this)).invoke(chainValues);\n\t\tif (memory) {\n\t\t\tawait memory.saveContext({ input }, { output: response.output });\n\n\t\t\tif (response.threadId && response.runId) {\n\t\t\t\tconst threadRun = await client.beta.threads.runs.retrieve(response.runId, {\n\t\t\t\t\tthread_id: response.threadId,\n\t\t\t\t});\n\t\t\t\tresponse.usage = threadRun.usage;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\toptions.preserveOriginalTools !== false &&\n\t\t\tnodeVersion >= 1.3 &&\n\t\t\t(assistantTools ?? [])?.length\n\t\t) {\n\t\t\tawait client.beta.assistants.update(assistantId, {\n\t\t\t\ttools: assistantTools,\n\t\t\t});\n\t\t}\n\t\t// Remove configuration properties and runId added by Langchain that are not relevant to the user\n\t\tfilteredResponse = omit(response, ['signal', 'timeout', 'content', 'runId']) as IDataObject;\n\t} catch (error) {\n\t\tif (!(error instanceof ApplicationError)) {\n\t\t\tthrow new NodeOperationError(this.getNode(), error.message, { itemIndex: i });\n\t\t}\n\t}\n\n\treturn [{ json: filteredResponse, pairedItem: { item: i } }];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAA8B;AAE9B,8BAAwC;AAExC,kBAAiB;AAOjB,0BAKO;AACP,oBAAuC;AAEvC,0BAA4C;AAC5C,qBAAwD;AACxD,qBAAiC;AAEjC,mBAA6D;AAC7D,IAAAA,uBAA6B;AAC7B,4BAA8B;AAC9B,gBAA0B;AAC1B,oBAAyB;AAEzB,MAAM,aAAgC;AAAA,EACrC;AAAA,EACA;AAAA,IACC,GAAG;AAAA,IACH,MAAM;AAAA,EACP;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,IACb,aAAa;AAAA,MACZ,MAAM;AAAA,IACP;AAAA,IACA,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,QAAQ,CAAC,QAAQ;AAAA,MAClB;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,MACd;AAAA,MACA;AAAA;AAAA,QAEC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,MACd;AAAA,IACD;AA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;AAC5D;","names":["import_descriptions","OpenAIClient","omit"]}
@@ -3,6 +3,8 @@
3
3
  {"name":"azureAiSearchApi","displayName":"Azure AI Search API","documentationUrl":"azureaisearch","properties":[{"displayName":"Search Endpoint","name":"endpoint","type":"string","required":true,"default":"","placeholder":"https://your-search-service.search.windows.net"},{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":""}],"authenticate":{},"test":{"request":{"baseURL":"={{$credentials.endpoint}}/indexes","url":"","method":"GET","headers":{"accept":"application/json"},"qs":{"api-version":"2024-07-01"}}},"supportedNodes":["vectorStoreAzureAISearch"],"iconUrl":{"light":"icons/@n8n/n8n-nodes-langchain/dist/nodes/vector_store/VectorStoreAzureAISearch/azure-aisearch.svg","dark":"icons/@n8n/n8n-nodes-langchain/dist/nodes/vector_store/VectorStoreAzureAISearch/azure-aisearch.svg"}},
4
4
  {"name":"azureOpenAiApi","displayName":"Azure Open AI","documentationUrl":"azureopenai","properties":[{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":""},{"displayName":"Resource Name","name":"resourceName","type":"string","required":true,"default":""},{"displayName":"API Version","name":"apiVersion","type":"string","required":true,"default":"2025-03-01-preview"},{"displayName":"Endpoint","name":"endpoint","type":"string","placeholder":"https://westeurope.api.cognitive.microsoft.com"}],"authenticate":{"type":"generic","properties":{"headers":{"api-key":"={{$credentials.apiKey}}"}}},"supportedNodes":["embeddingsAzureOpenAi","lmChatAzureOpenAi"],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/embeddings/EmbeddingsAzureOpenAi/azure.svg"},
5
5
  {"name":"azureEntraCognitiveServicesOAuth2Api","displayName":"Azure Entra ID (Azure Active Directory) API","extends":["oAuth2Api"],"documentationUrl":"azureentracognitiveservicesoauth2api","properties":[{"displayName":"Grant Type","name":"grantType","type":"hidden","default":"authorizationCode"},{"displayName":"Resource Name","name":"resourceName","type":"string","required":true,"default":""},{"displayName":"API Version","name":"apiVersion","type":"string","required":true,"default":"2025-03-01-preview"},{"displayName":"Endpoint","name":"endpoint","type":"string","placeholder":"https://westeurope.api.cognitive.microsoft.com"},{"displayName":"Tenant ID","name":"tenantId","type":"string","default":"common","description":"Enter your Azure Tenant ID (Directory ID) or keep \"common\" for multi-tenant apps. Using a specific Tenant ID is generally recommended and required for certain authentication flows.","placeholder":"e.g., xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx or common"},{"displayName":"Authorization URL","name":"authUrl","type":"hidden","default":"=https://login.microsoftonline.com/{{$self[\"tenantId\"]}}/oauth2/authorize"},{"displayName":"Access Token URL","name":"accessTokenUrl","type":"hidden","default":"=https://login.microsoftonline.com/{{$self[\"tenantId\"]}}/oauth2/token"},{"displayName":"Additional Body Properties","name":"additionalBodyProperties","type":"hidden","default":"{\"grant_type\": \"client_credentials\", \"resource\": \"https://cognitiveservices.azure.com/\"}"},{"displayName":"Authentication","name":"authentication","type":"hidden","default":"body"},{"displayName":"Custom Scopes","name":"customScopes","type":"boolean","default":false,"description":"Define custom scopes. You might need this if the default scopes are not sufficient or if you want to minimize permissions. Ensure you include \"openid\" and \"offline_access\"."},{"displayName":"Auth URI Query Parameters","name":"authQueryParameters","type":"hidden","default":"","description":"For some services additional query parameters have to be set which can be defined here","placeholder":""},{"displayName":"Enabled Scopes","name":"enabledScopes","type":"string","displayOptions":{"show":{"customScopes":[true]}},"default":"openid offline_access","placeholder":"openid offline_access","description":"Space-separated list of scopes to request."},{"displayName":"Scope","name":"scope","type":"hidden","default":"={{ $self.customScopes ? $self.enabledScopes : \"openid offline_access\"}}"}],"supportedNodes":["lmChatAzureOpenAi"],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/llms/LmChatAzureOpenAi/azure.svg"},
6
+ {"name":"chromaSelfHostedApi","displayName":"ChromaDB Self-Hosted","documentationUrl":"chroma","properties":[{"displayName":"Base URL","name":"baseUrl","type":"string","default":"http://localhost:8000","placeholder":"http://localhost:8000","description":"The URL of your ChromaDB instance. Note that path prefixes are not supported, so the URL must point directly to the instance root."},{"displayName":"Authentication","name":"authentication","type":"options","options":[{"name":"None","value":"none"},{"name":"API Key","value":"apiKey"},{"name":"Token","value":"token"}],"default":"none"},{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"default":"","displayOptions":{"show":{"authentication":["apiKey"]}}},{"displayName":"Token","name":"token","type":"string","typeOptions":{"password":true},"default":"","displayOptions":{"show":{"authentication":["token"]}}}],"authenticate":{"type":"generic","properties":{"headers":{"Authorization":"={{$credentials.authentication === \"apiKey\" && $credentials.apiKey ? \"Bearer \" + $credentials.apiKey : \"\"}}","X-Chroma-Token":"={{$credentials.authentication === \"token\" && $credentials.token ? $credentials.token : \"\"}}"}}},"test":{"request":{"baseURL":"={{$credentials.baseUrl}}","url":"/api/v2/heartbeat","method":"GET"}},"supportedNodes":["vectorStoreChromaDB"],"iconUrl":{"light":"icons/@n8n/n8n-nodes-langchain/dist/nodes/vector_store/VectorStoreChromaDB/chroma.svg","dark":"icons/@n8n/n8n-nodes-langchain/dist/nodes/vector_store/VectorStoreChromaDB/chroma.svg"}},
7
+ {"name":"chromaCloudApi","displayName":"ChromaDB Cloud","documentationUrl":"chroma","properties":[{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"default":"","required":true,"description":"Your Chroma Cloud API key"},{"displayName":"Tenant ID","name":"tenant","type":"string","default":"","description":"Optional: Tenant ID (auto-resolved if API key is scoped to single DB)"},{"displayName":"Database Name","name":"database","type":"string","default":"","description":"Optional: Database name (auto-resolved if API key is scoped to single DB)"},{"displayName":"Base URL","name":"baseUrl","type":"string","default":"https://api.trychroma.com","required":true}],"authenticate":{"type":"generic","properties":{"headers":{"x-chroma-token":"={{$credentials.apiKey}}"}}},"test":{"request":{"baseURL":"={{$credentials.baseUrl}}","url":"/api/v2","method":"GET"}},"supportedNodes":["vectorStoreChromaDB"],"iconUrl":{"light":"icons/@n8n/n8n-nodes-langchain/dist/nodes/vector_store/VectorStoreChromaDB/chroma.svg","dark":"icons/@n8n/n8n-nodes-langchain/dist/nodes/vector_store/VectorStoreChromaDB/chroma.svg"}},
6
8
  {"name":"cohereApi","displayName":"CohereApi","documentationUrl":"cohere","properties":[{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":""},{"displayName":"Base URL","name":"url","type":"hidden","default":"https://api.cohere.ai"}],"authenticate":{"type":"generic","properties":{"headers":{"Authorization":"=Bearer {{$credentials.apiKey}}"}}},"test":{"request":{"baseURL":"={{ $credentials.url }}","url":"/v1/models?page_size=1"}},"supportedNodes":["embeddingsCohere","lmChatCohere","lmCohere","rerankerCohere"],"iconUrl":{"light":"icons/@n8n/n8n-nodes-langchain/dist/nodes/embeddings/EmbeddingsCohere/cohere.svg","dark":"icons/@n8n/n8n-nodes-langchain/dist/nodes/embeddings/EmbeddingsCohere/cohere.dark.svg"}},
7
9
  {"name":"deepSeekApi","displayName":"DeepSeek","documentationUrl":"deepseek","properties":[{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":""},{"displayName":"Base URL","name":"url","type":"hidden","default":"https://api.deepseek.com"}],"authenticate":{"type":"generic","properties":{"headers":{"Authorization":"=Bearer {{$credentials.apiKey}}"}}},"test":{"request":{"baseURL":"={{ $credentials.url }}","url":"/models"}},"supportedNodes":["lmChatDeepSeek"],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/llms/LmChatDeepSeek/deepseek.svg"},
8
10
  {"name":"googlePalmApi","displayName":"Google Gemini(PaLM) Api","documentationUrl":"google","properties":[{"displayName":"Host","name":"host","required":true,"type":"string","default":"https://generativelanguage.googleapis.com"},{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":""}],"authenticate":{"type":"generic","properties":{"qs":{"key":"={{$credentials.apiKey}}"}}},"test":{"request":{"baseURL":"={{$credentials.host}}/v1beta/models"}},"supportedNodes":["googleGemini","embeddingsGoogleGemini","lmChatGoogleGemini"],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/vendors/GoogleGemini/gemini.svg"},