@n8n/ai-utilities 0.33.1 → 0.34.0
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/dist/cjs/model-discovery/index.d.ts +2 -2
- package/dist/cjs/model-discovery/index.js +3 -1
- package/dist/cjs/model-discovery/index.js.map +1 -1
- package/dist/cjs/model-discovery/providers/alibaba.d.ts +1 -0
- package/dist/cjs/model-discovery/providers/alibaba.js +14 -1
- package/dist/cjs/model-discovery/providers/alibaba.js.map +1 -1
- package/dist/cjs/model-discovery/providers/google.d.ts +4 -0
- package/dist/cjs/model-discovery/providers/google.js +13 -2
- package/dist/cjs/model-discovery/providers/google.js.map +1 -1
- package/dist/cjs/typecheck.tsbuildinfo +1 -1
- package/dist/cjs/utils/credential-description.d.ts +2 -0
- package/dist/cjs/utils/credential-description.js +16 -0
- package/dist/cjs/utils/credential-description.js.map +1 -0
- package/dist/cjs/utils/vector-store/createVectorStoreNode/createVectorStoreNode.d.ts +12 -3
- package/dist/cjs/utils/vector-store/createVectorStoreNode/operations/loadOperation.js +3 -2
- package/dist/cjs/utils/vector-store/createVectorStoreNode/operations/loadOperation.js.map +1 -1
- package/dist/cjs/utils/vector-store/createVectorStoreNode/operations/retrieveAsToolExecuteOperation.js +3 -2
- package/dist/cjs/utils/vector-store/createVectorStoreNode/operations/retrieveAsToolExecuteOperation.js.map +1 -1
- package/dist/cjs/utils/vector-store/createVectorStoreNode/operations/retrieveAsToolOperation.js +3 -2
- package/dist/cjs/utils/vector-store/createVectorStoreNode/operations/retrieveAsToolOperation.js.map +1 -1
- package/dist/cjs/utils/vector-store/createVectorStoreNode/types.d.ts +3 -12
- package/dist/esm/model-discovery/index.d.ts +2 -2
- package/dist/esm/model-discovery/index.js +3 -1
- package/dist/esm/model-discovery/index.js.map +1 -1
- package/dist/esm/model-discovery/providers/alibaba.d.ts +1 -0
- package/dist/esm/model-discovery/providers/alibaba.js +14 -1
- package/dist/esm/model-discovery/providers/alibaba.js.map +1 -1
- package/dist/esm/model-discovery/providers/google.d.ts +4 -0
- package/dist/esm/model-discovery/providers/google.js +13 -2
- package/dist/esm/model-discovery/providers/google.js.map +1 -1
- package/dist/esm/typecheck.tsbuildinfo +1 -1
- package/dist/esm/utils/credential-description.d.ts +2 -0
- package/dist/esm/utils/credential-description.js +16 -0
- package/dist/esm/utils/credential-description.js.map +1 -0
- package/dist/esm/utils/vector-store/createVectorStoreNode/createVectorStoreNode.d.ts +12 -3
- package/dist/esm/utils/vector-store/createVectorStoreNode/operations/loadOperation.js +3 -2
- package/dist/esm/utils/vector-store/createVectorStoreNode/operations/loadOperation.js.map +1 -1
- package/dist/esm/utils/vector-store/createVectorStoreNode/operations/retrieveAsToolExecuteOperation.js +3 -2
- package/dist/esm/utils/vector-store/createVectorStoreNode/operations/retrieveAsToolExecuteOperation.js.map +1 -1
- package/dist/esm/utils/vector-store/createVectorStoreNode/operations/retrieveAsToolOperation.js +3 -2
- package/dist/esm/utils/vector-store/createVectorStoreNode/operations/retrieveAsToolOperation.js.map +1 -1
- package/dist/esm/utils/vector-store/createVectorStoreNode/types.d.ts +3 -12
- package/package.json +13 -5
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CREDENTIAL_DESCRIPTION_PREVIEW_MAX_LENGTH = void 0;
|
|
4
|
+
exports.getCredentialDescriptionPreview = getCredentialDescriptionPreview;
|
|
5
|
+
const truncate_1 = require("@n8n/utils/string/truncate");
|
|
6
|
+
exports.CREDENTIAL_DESCRIPTION_PREVIEW_MAX_LENGTH = 256;
|
|
7
|
+
function getCredentialDescriptionPreview(description) {
|
|
8
|
+
if (!description)
|
|
9
|
+
return null;
|
|
10
|
+
if (description.length <= exports.CREDENTIAL_DESCRIPTION_PREVIEW_MAX_LENGTH)
|
|
11
|
+
return description;
|
|
12
|
+
const prefixLength = exports.CREDENTIAL_DESCRIPTION_PREVIEW_MAX_LENGTH - '...'.length;
|
|
13
|
+
const splitsCharacter = (description.codePointAt(prefixLength - 1) ?? 0) > 0xffff;
|
|
14
|
+
return (0, truncate_1.truncate)(description, splitsCharacter ? prefixLength - 1 : prefixLength);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=credential-description.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-description.js","sourceRoot":"","sources":["../../../src/utils/credential-description.ts"],"names":[],"mappings":";;;;AAAA,yDAAsD;AAGzC,QAAA,yCAAyC,GAAG,GAAG,CAAC;AAE7D,yCACC,WAAsC;IAEtC,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAC;IAC9B,IAAI,WAAW,CAAC,MAAM,IAAI,QAAA,yCAAyC;QAAE,OAAO,WAAW,CAAC;IAGxF,MAAM,YAAY,GAAG,QAAA,yCAAyC,GAAG,KAAK,CAAC,MAAM,CAAC;IAE9E,MAAM,eAAe,GAAG,CAAC,WAAW,CAAC,WAAW,CAAC,YAAY,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC;IAClF,OAAO,IAAA,mBAAQ,EAAC,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;AACjF,CAAC"}
|
|
@@ -5,15 +5,24 @@ export declare const createVectorStoreNode: <T extends VectorStore = VectorStore
|
|
|
5
5
|
new (): {
|
|
6
6
|
description: INodeTypeDescription;
|
|
7
7
|
methods: {
|
|
8
|
+
loadOptions?: {
|
|
9
|
+
[key: string]: (this: import("n8n-workflow").ILoadOptionsFunctions) => Promise<import("n8n-workflow").INodePropertyOptions[]>;
|
|
10
|
+
};
|
|
8
11
|
listSearch?: {
|
|
9
12
|
[key: string]: (this: import("n8n-workflow").ILoadOptionsFunctions, filter?: string, paginationToken?: string) => Promise<import("n8n-workflow").INodeListSearchResult>;
|
|
10
13
|
};
|
|
11
|
-
actionHandler?: {
|
|
12
|
-
[functionName: string]: (this: import("n8n-workflow").ILoadOptionsFunctions, payload: import("n8n-workflow").IDataObject | string | undefined) => Promise<import("n8n-workflow").NodeParameterValueType>;
|
|
13
|
-
};
|
|
14
14
|
credentialTest?: {
|
|
15
15
|
[functionName: string]: import("n8n-workflow").ICredentialTestFunction;
|
|
16
16
|
};
|
|
17
|
+
resourceMapping?: {
|
|
18
|
+
[functionName: string]: (this: import("n8n-workflow").ILoadOptionsFunctions) => Promise<import("n8n-workflow").ResourceMapperFields>;
|
|
19
|
+
};
|
|
20
|
+
localResourceMapping?: {
|
|
21
|
+
[functionName: string]: (this: import("n8n-workflow").ILocalLoadOptionsFunctions) => Promise<import("n8n-workflow").ResourceMapperFields>;
|
|
22
|
+
};
|
|
23
|
+
actionHandler?: {
|
|
24
|
+
[functionName: string]: (this: import("n8n-workflow").ILoadOptionsFunctions, payload: import("n8n-workflow").IDataObject | string | undefined) => Promise<import("n8n-workflow").NodeParameterValueType>;
|
|
25
|
+
};
|
|
17
26
|
} | undefined;
|
|
18
27
|
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
19
28
|
supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData>;
|
|
@@ -12,8 +12,9 @@ async function handleLoadOperation(context, args, embeddings, itemIndex) {
|
|
|
12
12
|
const topK = context.getNodeParameter('topK', itemIndex, 4);
|
|
13
13
|
const useReranker = context.getNodeParameter('useReranker', itemIndex, false);
|
|
14
14
|
const includeDocumentMetadata = context.getNodeParameter('includeDocumentMetadata', itemIndex, true);
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
let docs = args.searchByText === true
|
|
16
|
+
? await vectorStore.similaritySearchWithScore(prompt, topK, filter)
|
|
17
|
+
: await vectorStore.similaritySearchVectorWithScore(await embeddings.embedQuery(prompt), topK, filter);
|
|
17
18
|
if (useReranker && docs.length > 0) {
|
|
18
19
|
const reranker = (await context.getInputConnectionData(n8n_workflow_1.NodeConnectionTypes.AiReranker, 0));
|
|
19
20
|
const documents = docs.map(([doc]) => doc);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadOperation.js","sourceRoot":"","sources":["../../../../../../src/utils/vector-store/createVectorStoreNode/operations/loadOperation.ts"],"names":[],"mappings":";;;AAGA,+CAAmD;AAGnD,8CAA4D;AAC5D,wDAAmD;AAO5C,KAAK,8BACX,OAA0B,EAC1B,IAAuC,EACvC,UAAsB,EACtB,SAAiB;IAEjB,MAAM,MAAM,GAAG,IAAA,kCAAwB,EAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC5D,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAClD,OAAO,EAEP,SAAS,EACT,UAAU,EACV,SAAS,CACT,CAAC;IAEF,IAAI,CAAC;QAEJ,MAAM,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,SAAS,CAAW,CAAC;QACvE,MAAM,IAAI,GAAG,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAW,CAAC;QACtE,MAAM,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC,aAAa,EAAE,SAAS,EAAE,KAAK,CAAY,CAAC;QAEzF,MAAM,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CACvD,yBAAyB,EACzB,SAAS,EACT,IAAI,CACO,CAAC;QAGb,
|
|
1
|
+
{"version":3,"file":"loadOperation.js","sourceRoot":"","sources":["../../../../../../src/utils/vector-store/createVectorStoreNode/operations/loadOperation.ts"],"names":[],"mappings":";;;AAGA,+CAAmD;AAGnD,8CAA4D;AAC5D,wDAAmD;AAO5C,KAAK,8BACX,OAA0B,EAC1B,IAAuC,EACvC,UAAsB,EACtB,SAAiB;IAEjB,MAAM,MAAM,GAAG,IAAA,kCAAwB,EAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC5D,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAClD,OAAO,EAEP,S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;gBAC3D,OAAO,CAAC,EAAE,GAAG,GAAG,EAAE,QAAQ,EAAE,EAAE,cAAc,CAAC,CAAC;YAC/C,CAAC,CAAC,CAAC;QACJ,CAAC;QAGD,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YAChD,MAAM,QAAQ,GAAG;gBAChB,WAAW,EAAE,GAAG,CAAC,WAAW;gBAC5B,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC9D,CAAC;YAEF,OAAO;gBACN,IAAI,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE;gBACzB,UAAU,EAAE;oBACX,IAAI,EAAE,SAAS;iBACf;aACD,CAAC;QACH,CAAC,CAAC,CAAC;QAGH,IAAA,yBAAU,EAAC,OAAO,EAAE,0BAA0B,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;QAEnE,OAAO,cAAc,CAAC;IACvB,CAAC;YAAS,CAAC;QAEV,IAAI,CAAC,wBAAwB,EAAE,CAAC,WAAW,CAAC,CAAC;IAC9C,CAAC;AACF,CAAC"}
|
|
@@ -20,8 +20,9 @@ async function handleRetrieveAsToolExecuteOperation(context, args, embeddings, i
|
|
|
20
20
|
(0, n8n_workflow_1.assertParamIsBoolean)('useReranker', useReranker, context.getNode());
|
|
21
21
|
const includeDocumentMetadata = context.getNodeParameter('includeDocumentMetadata', itemIndex, true);
|
|
22
22
|
(0, n8n_workflow_1.assertParamIsBoolean)('includeDocumentMetadata', includeDocumentMetadata, context.getNode());
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
let docs = args.searchByText === true
|
|
24
|
+
? await vectorStore.similaritySearchWithScore(query, topK, filter)
|
|
25
|
+
: await vectorStore.similaritySearchVectorWithScore(await embeddings.embedQuery(query), topK, filter);
|
|
25
26
|
if (useReranker && docs.length > 0) {
|
|
26
27
|
const reranker = (await context.getInputConnectionData(n8n_workflow_1.NodeConnectionTypes.AiReranker, 0));
|
|
27
28
|
const documents = docs.map(([doc]) => doc);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retrieveAsToolExecuteOperation.js","sourceRoot":"","sources":["../../../../../../src/utils/vector-store/createVectorStoreNode/operations/retrieveAsToolExecuteOperation.ts"],"names":[],"mappings":";;;AAGA,+CAA8F;AAG9F,8CAA4D;AAC5D,wDAAmD;AAQ5C,KAAK,+CACX,OAA0B,EAC1B,IAAuC,EACvC,UAAsB,EACtB,SAAiB;IAEjB,MAAM,MAAM,GAAG,IAAA,kCAAwB,EAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC5D,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAClD,OAAO,EAEP,SAAS,EACT,UAAU,EACV,SAAS,CACT,CAAC;IAEF,IAAI,CAAC;QAEJ,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;QACzC,MAAM,IAAI,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;QAClC,MAAM,KAAK,GAAG,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QAEhF,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;QAClF,CAAC;QAED,MAAM,IAAI,GAAG,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;QAC5D,IAAA,kCAAmB,EAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QACrD,MAAM,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC,aAAa,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAC9E,IAAA,mCAAoB,EAAC,aAAa,EAAE,WAAW,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QAEpE,MAAM,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CACvD,yBAAyB,EACzB,SAAS,EACT,IAAI,CACJ,CAAC;QACF,IAAA,mCAAoB,EAAC,yBAAyB,EAAE,uBAAuB,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QAG5F,
|
|
1
|
+
{"version":3,"file":"retrieveAsToolExecuteOperation.js","sourceRoot":"","sources":["../../../../../../src/utils/vector-store/createVectorStoreNode/operations/retrieveAsToolExecuteOperation.ts"],"names":[],"mappings":";;;AAGA,+CAA8F;AAG9F,8CAA4D;AAC5D,wDAAmD;AAQ5C,KAAK,+CACX,OAA0B,EAC1B,IAAuC,EACvC,UAAsB,EACtB,SAAiB;IAEjB,MAAM,MAAM,GAAG,IAAA,kCAAwB,EAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC5D,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAClD,OAAO,EAEP,SAAS,EACT,UAAU,EACV,SAAS,CACT,CAAC;IAEF,IAAI,CAAC;QAEJ,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;QACzC,MAAM,IAAI,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;QAClC,MAAM,KAAK,GAAG,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QAEhF,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;QAClF,CAAC;QAED,MAAM,IAAI,GAAG,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC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,EAAE,GAAG,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC;gBAC3D,OAAO,CAAC,EAAE,GAAG,GAAG,EAAE,QAAQ,EAAE,EAAE,cAAc,IAAI,CAAC,CAAC,CAAC;YACpD,CAAC,CAAC,CAAC;QACJ,CAAC;QAGD,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE;YACzC,IAAI,uBAAuB,EAAE,CAAC;gBAC7B,OAAO;oBACN,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC;iBAChC,CAAC;YACH,CAAC;iBAAM,CAAC;gBACP,OAAO;oBACN,IAAI,EAAE,MAAM;oBACZ,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,WAAW,EAAE,GAAG,CAAC,WAAW,EAAE,CAAC;iBAC7D,CAAC;YACH,CAAC;QACF,CAAC,CAAC,CAAC;QAGH,IAAA,yBAAU,EAAC,OAAO,EAAE,0BAA0B,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QAElE,OAAO;YACN;gBACC,IAAI,EAAE;oBACL,QAAQ,EAAE,cAAc;iBACxB;gBACD,UAAU,EAAE;oBACX,IAAI,EAAE,SAAS;iBACf;aACD;SACD,CAAC;IACH,CAAC;YAAS,CAAC;QAEV,IAAI,CAAC,wBAAwB,EAAE,CAAC,WAAW,CAAC,CAAC;IAC9C,CAAC;AACF,CAAC"}
|
package/dist/cjs/utils/vector-store/createVectorStoreNode/operations/retrieveAsToolOperation.js
CHANGED
|
@@ -25,8 +25,9 @@ async function handleRetrieveAsToolOperation(context, args, embeddings, itemInde
|
|
|
25
25
|
(0, n8n_workflow_1.assert)(typeof queryString === 'string', 'Query must be of type string');
|
|
26
26
|
const vectorStore = await args.getVectorStoreClient(context, undefined, embeddings, itemIndex);
|
|
27
27
|
try {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
let documents = args.searchByText === true
|
|
29
|
+
? await vectorStore.similaritySearchWithScore(queryString, topK, filter)
|
|
30
|
+
: await vectorStore.similaritySearchVectorWithScore(await embeddings.embedQuery(queryString), topK, filter);
|
|
30
31
|
if (useReranker && documents.length > 0) {
|
|
31
32
|
const reranker = (await context.getInputConnectionData(n8n_workflow_1.NodeConnectionTypes.AiReranker, 0));
|
|
32
33
|
const docs = documents.map(([doc]) => doc);
|
package/dist/cjs/utils/vector-store/createVectorStoreNode/operations/retrieveAsToolOperation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retrieveAsToolOperation.js","sourceRoot":"","sources":["../../../../../../src/utils/vector-store/createVectorStoreNode/operations/retrieveAsToolOperation.ts"],"names":[],"mappings":";;;AAGA,+CAA+E;AAG/E,sEAAkE;AAClE,8CAA4D;AAC5D,sDAAkD;AAO3C,KAAK,wCACX,OAA6B,EAC7B,IAAuC,EACvC,UAAsB,EACtB,SAAiB;IAGjB,MAAM,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,SAAS,CAAW,CAAC;IAEzF,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAC/B,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;IAC7B,MAAM,QAAQ,GACb,WAAW,GAAG,GAAG;QAChB,CAAC,CAAE,OAAO,CAAC,gBAAgB,CAAC,UAAU,EAAE,SAAS,CAAY;QAC7D,CAAC,CAAC,IAAA,iCAAkB,EAAC,IAAI,CAAC,CAAC;IAG7B,MAAM,eAAe,GAAG,IAAA,wCAAkB,EAAC,IAAI,EAAE;QAChD,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,eAAe;QAC5B,SAAS,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;QAC3E,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACrB,MAAM,IAAI,GAAG,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAW,CAAC;YACtE,MAAM,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC,aAAa,EAAE,SAAS,EAAE,KAAK,CAAY,CAAC;YACzF,MAAM,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CACvD,yBAAyB,EACzB,SAAS,EACT,IAAI,CACO,CAAC;YAGb,MAAM,MAAM,GAAG,IAAA,kCAAwB,EAAC,OAAO,EAAE,SAAS,CAAC,CAAC;YAG5D,MAAM,WAAW,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;YACpE,IAAA,qBAAM,EAAC,OAAO,WAAW,KAAK,QAAQ,EAAE,8BAA8B,CAAC,CAAC;YAKxE,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAClD,OAAO,EACP,SAAS,EACT,UAAU,EACV,SAAS,CACT,CAAC;YAEF,IAAI,CAAC;gBAEJ,
|
|
1
|
+
{"version":3,"file":"retrieveAsToolOperation.js","sourceRoot":"","sources":["../../../../../../src/utils/vector-store/createVectorStoreNode/operations/retrieveAsToolOperation.ts"],"names":[],"mappings":";;;AAGA,+CAA+E;AAG/E,sEAAkE;AAClE,8CAA4D;AAC5D,sDAAkD;AAO3C,KAAK,wCACX,OAA6B,EAC7B,IAAuC,EACvC,UAAsB,EACtB,SAAiB;IAGjB,MAAM,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,SAAS,CAAW,CAAC;IAEzF,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAC/B,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;IAC7B,MAAM,QAAQ,GACb,WAAW,GAAG,GAAG;QAChB,CAAC,CAAE,OAAO,CAAC,gBAAgB,CAAC,UAAU,EAAE,SAAS,CAAY;QAC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WAAW,CAAC,CAAC;YAC9C,CAAC;QACF,CAAC;KACD,CAAC,CAAC;IAGH,OAAO;QACN,QAAQ,EAAE,IAAA,wBAAU,EAAC,eAAe,EAAE,OAAO,CAAC;KAC9C,CAAC;AACH,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Document } from '@langchain/core/documents';
|
|
2
2
|
import type { Embeddings } from '@langchain/core/embeddings';
|
|
3
3
|
import type { VectorStore } from '@langchain/core/vectorstores';
|
|
4
|
-
import type {
|
|
4
|
+
import type { IExecuteFunctions, INodeCredentialDescription, INodeProperties, INodeType, Icon, ISupplyDataFunctions, ThemeIconColor, IBuilderHint } from 'n8n-workflow';
|
|
5
5
|
export type NodeOperationMode = 'insert' | 'load' | 'retrieve' | 'update' | 'retrieve-as-tool';
|
|
6
6
|
export interface NodeMeta {
|
|
7
7
|
displayName: string;
|
|
@@ -19,23 +19,14 @@ export interface NodeMeta {
|
|
|
19
19
|
}
|
|
20
20
|
export interface VectorStoreNodeConstructorArgs<T extends VectorStore = VectorStore> {
|
|
21
21
|
meta: NodeMeta;
|
|
22
|
-
methods?:
|
|
23
|
-
listSearch?: {
|
|
24
|
-
[key: string]: (this: ILoadOptionsFunctions, filter?: string, paginationToken?: string) => Promise<INodeListSearchResult>;
|
|
25
|
-
};
|
|
26
|
-
actionHandler?: {
|
|
27
|
-
[functionName: string]: (this: ILoadOptionsFunctions, payload: IDataObject | string | undefined) => Promise<NodeParameterValueType>;
|
|
28
|
-
};
|
|
29
|
-
credentialTest?: {
|
|
30
|
-
[functionName: string]: ICredentialTestFunction;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
22
|
+
methods?: INodeType['methods'];
|
|
33
23
|
sharedFields: INodeProperties[];
|
|
34
24
|
insertFields?: INodeProperties[];
|
|
35
25
|
loadFields?: INodeProperties[];
|
|
36
26
|
retrieveFields?: INodeProperties[];
|
|
37
27
|
updateFields?: INodeProperties[];
|
|
38
28
|
hidden?: true;
|
|
29
|
+
searchByText?: true;
|
|
39
30
|
beforeInsert?: (context: IExecuteFunctions | ISupplyDataFunctions, embeddings: Embeddings, itemIndex: number) => Promise<void>;
|
|
40
31
|
populateVectorStore: (context: IExecuteFunctions | ISupplyDataFunctions, embeddings: Embeddings, documents: Array<Document<Record<string, unknown>>>, itemIndex: number) => Promise<void>;
|
|
41
32
|
getVectorStoreClient: (context: IExecuteFunctions | ISupplyDataFunctions, filter: Record<string, never> | undefined, embeddings: Embeddings, itemIndex: number) => Promise<T>;
|
|
@@ -3,11 +3,11 @@ export declare const MODEL_DISCOVERY_PROVIDERS: Record<string, ListModelsFn>;
|
|
|
3
3
|
export declare function isModelDiscoveryProvider(provider: string): boolean;
|
|
4
4
|
export declare function listModelsForProvider(provider: string, options: ListModelsOptions): Promise<ProviderModel[]>;
|
|
5
5
|
export { classifyChatModelFailure, type ChatModelFailureKind, } from './chat-model-errors';
|
|
6
|
-
export { listAlibabaModels } from './providers/alibaba';
|
|
6
|
+
export { listAlibabaModels, shouldIncludeAlibabaModel } from './providers/alibaba';
|
|
7
7
|
export { listAnthropicModels } from './providers/anthropic';
|
|
8
8
|
export { listCohereModels } from './providers/cohere';
|
|
9
9
|
export { listDeepSeekModels } from './providers/deepseek';
|
|
10
|
-
export { listGoogleModels } from './providers/google';
|
|
10
|
+
export { listGoogleModels, shouldIncludeGoogleModel } from './providers/google';
|
|
11
11
|
export { listGroqModels } from './providers/groq';
|
|
12
12
|
export { listMiniMaxModels } from './providers/minimax';
|
|
13
13
|
export { listMistralModels } from './providers/mistral';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ensureUrlPathSuffix = exports.listXaiModels = exports.listVercelModels = exports.listOpenRouterModels = exports.isOpenAiCustomEndpoint = exports.OFFICIAL_OPENAI_HOSTNAMES = exports.shouldIncludeOpenAiModel = exports.listOpenAiModels = exports.listNvidiaModels = exports.listMoonshotAiModels = exports.listMistralModels = exports.listMiniMaxModels = exports.listGroqModels = exports.listGoogleModels = exports.listDeepSeekModels = exports.listCohereModels = exports.listAnthropicModels = exports.listAlibabaModels = exports.classifyChatModelFailure = exports.MODEL_DISCOVERY_PROVIDERS = void 0;
|
|
3
|
+
exports.ensureUrlPathSuffix = exports.listXaiModels = exports.listVercelModels = exports.listOpenRouterModels = exports.isOpenAiCustomEndpoint = exports.OFFICIAL_OPENAI_HOSTNAMES = exports.shouldIncludeOpenAiModel = exports.listOpenAiModels = exports.listNvidiaModels = exports.listMoonshotAiModels = exports.listMistralModels = exports.listMiniMaxModels = exports.listGroqModels = exports.shouldIncludeGoogleModel = exports.listGoogleModels = exports.listDeepSeekModels = exports.listCohereModels = exports.listAnthropicModels = exports.shouldIncludeAlibabaModel = exports.listAlibabaModels = exports.classifyChatModelFailure = exports.MODEL_DISCOVERY_PROVIDERS = void 0;
|
|
4
4
|
exports.isModelDiscoveryProvider = isModelDiscoveryProvider;
|
|
5
5
|
exports.listModelsForProvider = listModelsForProvider;
|
|
6
6
|
const alibaba_1 = require("./providers/alibaba");
|
|
@@ -47,6 +47,7 @@ var chat_model_errors_1 = require("./chat-model-errors");
|
|
|
47
47
|
Object.defineProperty(exports, "classifyChatModelFailure", { enumerable: true, get: function () { return chat_model_errors_1.classifyChatModelFailure; } });
|
|
48
48
|
var alibaba_2 = require("./providers/alibaba");
|
|
49
49
|
Object.defineProperty(exports, "listAlibabaModels", { enumerable: true, get: function () { return alibaba_2.listAlibabaModels; } });
|
|
50
|
+
Object.defineProperty(exports, "shouldIncludeAlibabaModel", { enumerable: true, get: function () { return alibaba_2.shouldIncludeAlibabaModel; } });
|
|
50
51
|
var anthropic_2 = require("./providers/anthropic");
|
|
51
52
|
Object.defineProperty(exports, "listAnthropicModels", { enumerable: true, get: function () { return anthropic_2.listAnthropicModels; } });
|
|
52
53
|
var cohere_2 = require("./providers/cohere");
|
|
@@ -55,6 +56,7 @@ var deepseek_2 = require("./providers/deepseek");
|
|
|
55
56
|
Object.defineProperty(exports, "listDeepSeekModels", { enumerable: true, get: function () { return deepseek_2.listDeepSeekModels; } });
|
|
56
57
|
var google_2 = require("./providers/google");
|
|
57
58
|
Object.defineProperty(exports, "listGoogleModels", { enumerable: true, get: function () { return google_2.listGoogleModels; } });
|
|
59
|
+
Object.defineProperty(exports, "shouldIncludeGoogleModel", { enumerable: true, get: function () { return google_2.shouldIncludeGoogleModel; } });
|
|
58
60
|
var groq_2 = require("./providers/groq");
|
|
59
61
|
Object.defineProperty(exports, "listGroqModels", { enumerable: true, get: function () { return groq_2.listGroqModels; } });
|
|
60
62
|
var minimax_2 = require("./providers/minimax");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/model-discovery/index.ts"],"names":[],"mappings":";;;;;AAAA,iDAAwD;AACxD,qDAA4D;AAC5D,+CAAsD;AACtD,mDAA0D;AAC1D,+CAAsD;AACtD,2CAAkD;AAClD,iDAAwD;AACxD,iDAAwD;AACxD,uDAA8D;AAC9D,+CAAsD;AACtD,+CAAsD;AACtD,uDAA8D;AAC9D,+CAAsD;AACtD,yCAAgD;AAcnC,QAAA,yBAAyB,GAAiC;IACtE,OAAO,EAAE,2BAAiB;IAC1B,SAAS,EAAE,+BAAmB;IAC9B,MAAM,EAAE,yBAAgB;IACxB,QAAQ,EAAE,6BAAkB;IAC5B,MAAM,EAAE,yBAAgB;IACxB,IAAI,EAAE,qBAAc;IACpB,OAAO,EAAE,2BAAiB;IAC1B,OAAO,EAAE,2BAAiB;IAC1B,UAAU,EAAE,iCAAoB;IAChC,MAAM,EAAE,yBAAgB;IACxB,MAAM,EAAE,yBAAgB;IACxB,UAAU,EAAE,iCAAoB;IAChC,MAAM,EAAE,yBAAgB;IACxB,GAAG,EAAE,mBAAa;CAClB,CAAC;AAEF,kCAAyC,QAAgB;IACxD,OAAO,QAAQ,IAAI,QAAA,yBAAyB,CAAC;AAC9C,CAAC;AAEM,KAAK,gCACX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AC;QACjB,MAAM,IAAI,KAAK,CAAC,sCAAsC,QAAQ,GAAG,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC;AAED,yDAG6B;AAF5B,6HAAA,wBAAwB,OAAA;AAGzB,+CAAmF;AAA1E,4GAAA,iBAAiB,OAAA;AAAE,oHAAA,yBAAyB,OAAA;AACrD,mDAA4D;AAAnD,gHAAA,mBAAmB,OAAA;AAC5B,6CAAsD;AAA7C,0GAAA,gBAAgB,OAAA;AACzB,iDAA0D;AAAjD,8GAAA,kBAAkB,OAAA;AAC3B,6CAAgF;AAAvE,0GAAA,gBAAgB,OAAA;AAAE,kHAAA,wBAAwB,OAAA;AACnD,yCAAkD;AAAzC,sGAAA,cAAc,OAAA;AACvB,+CAAwD;AAA/C,4GAAA,iBAAiB,OAAA;AAC1B,+CAAwD;AAA/C,4GAAA,iBAAiB,OAAA;AAC1B,qDAA8D;AAArD,kHAAA,oBAAoB,OAAA;AAC7B,6CAAsD;AAA7C,0GAAA,gBAAgB,OAAA;AACzB,6CAK4B;AAJ3B,0GAAA,gBAAgB,OAAA;AAChB,kHAAA,wBAAwB,OAAA;AACxB,mHAAA,yBAAyB,OAAA;AACzB,gHAAA,sBAAsB,OAAA;AAEvB,qDAA8D;AAArD,kHAAA,oBAAoB,OAAA;AAC7B,6CAAsD;AAA7C,0GAAA,gBAAgB,OAAA;AACzB,uCAAgD;AAAvC,oGAAA,aAAa,OAAA;AACtB,qCAAgD;AAAvC,8GAAA,mBAAmB,OAAA"}
|
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.listAlibabaModels = void 0;
|
|
4
|
+
exports.shouldIncludeAlibabaModel = shouldIncludeAlibabaModel;
|
|
4
5
|
const request_1 = require("../request");
|
|
5
6
|
const COMPATIBLE_MODE_SUFFIX = '/compatible-mode/v1';
|
|
6
7
|
const DEFAULT_BASE_URL = `https://dashscope-intl.aliyuncs.com${COMPATIBLE_MODE_SUFFIX}`;
|
|
8
|
+
function shouldIncludeAlibabaModel(id) {
|
|
9
|
+
return (!id.includes('embedding') &&
|
|
10
|
+
!id.includes('rerank') &&
|
|
11
|
+
!id.includes('image') &&
|
|
12
|
+
!id.includes('-mt-') &&
|
|
13
|
+
!id.includes('t2i') &&
|
|
14
|
+
!id.includes('i2i') &&
|
|
15
|
+
!id.includes('t2v') &&
|
|
16
|
+
!id.includes('i2v'));
|
|
17
|
+
}
|
|
7
18
|
const listAlibabaModels = async (options) => {
|
|
8
19
|
const resolvedBaseUrl = (0, request_1.ensureUrlPathSuffix)((0, request_1.baseUrl)(options, DEFAULT_BASE_URL), COMPATIBLE_MODE_SUFFIX);
|
|
9
20
|
const data = (await (0, request_1.getJson)(`${resolvedBaseUrl}/models`, (0, request_1.bearerHeaders)(options), options, 'alibaba'));
|
|
10
|
-
return (0, request_1.idsToModels)(data.data ?? [])
|
|
21
|
+
return (0, request_1.idsToModels)(data.data ?? [])
|
|
22
|
+
.filter((model) => shouldIncludeAlibabaModel(model.id))
|
|
23
|
+
.sort(request_1.byName);
|
|
11
24
|
};
|
|
12
25
|
exports.listAlibabaModels = listAlibabaModels;
|
|
13
26
|
//# sourceMappingURL=alibaba.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alibaba.js","sourceRoot":"","sources":["../../../../src/model-discovery/providers/alibaba.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"alibaba.js","sourceRoot":"","sources":["../../../../src/model-discovery/providers/alibaba.ts"],"names":[],"mappings":";;;;AAAA,wCAOoB;AAIpB,MAAM,sBAAsB,GAAG,qBAAqB,CAAC;AACrD,MAAM,gBAAgB,GAAG,sCAAsC,sBAAsB,EAAE,CAAC;AAUxF,mCAA0C,EAAU;IACnD,OAAO,CACN,CAAC,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC;QACzB,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACtB,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;QACrB,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC;QACpB,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC;QACnB,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC;QACnB,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC;QACnB,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CACnB,CAAC;AACH,CAAC;AASM,MAAM,iBAAiB,GAAiB,KAAK,EAAE,OAAO,EAAE,EAAE;IAChE,MAAM,eAAe,GAAG,IAAA,6BAAmB,EAC1C,IAAA,iBAAO,EAAC,OAAO,EAAE,gBAAgB,CAAC,EAClC,sBAAsB,CACtB,CAAC;IACF,MAAM,IAAI,GAAG,CAAC,MAAM,IAAA,iBAAO,EAC1B,GAAG,eAAe,SAAS,EAC3B,IAAA,uBAAa,EAAC,OAAO,CAAC,EACtB,OAAO,EACP,SAAS,CACT,CAAwB,CAAC;IAC1B,OAAO,IAAA,qBAAW,EAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;SACjC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,yBAAyB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;SACtD,IAAI,CAAC,gBAAM,CAAC,CAAC;AAChB,CAAC,CAAC;AAdW,QAAA,iBAAiB,GAAjB,iBAAiB,CAc5B"}
|
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.listGoogleModels = void 0;
|
|
4
|
+
exports.shouldIncludeGoogleModel = shouldIncludeGoogleModel;
|
|
4
5
|
const request_1 = require("../request");
|
|
6
|
+
function shouldIncludeGoogleModel(model) {
|
|
7
|
+
const methods = model.supportedGenerationMethods;
|
|
8
|
+
const supportsChat = Array.isArray(methods) && methods.includes('generateContent');
|
|
9
|
+
return (supportsChat &&
|
|
10
|
+
!model.name.includes('image') &&
|
|
11
|
+
!model.name.includes('tts') &&
|
|
12
|
+
!model.name.includes('embedding'));
|
|
13
|
+
}
|
|
5
14
|
const listGoogleModels = async (options) => {
|
|
6
15
|
const base = (0, request_1.baseUrl)(options, 'https://generativelanguage.googleapis.com');
|
|
7
16
|
const data = (await (0, request_1.getJson)(`${base}/v1beta/models`, { 'x-goog-api-key': options.apiKey }, options, 'google'));
|
|
8
17
|
return (data.models ?? [])
|
|
9
18
|
.filter((model) => typeof model.name === 'string' &&
|
|
10
|
-
|
|
11
|
-
|
|
19
|
+
shouldIncludeGoogleModel({
|
|
20
|
+
name: model.name,
|
|
21
|
+
supportedGenerationMethods: model.supportedGenerationMethods,
|
|
22
|
+
}))
|
|
12
23
|
.map((model) => ({ id: model.name, name: model.name }))
|
|
13
24
|
.sort(request_1.byName);
|
|
14
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google.js","sourceRoot":"","sources":["../../../../src/model-discovery/providers/google.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"google.js","sourceRoot":"","sources":["../../../../src/model-discovery/providers/google.ts"],"names":[],"mappings":";;;;AAAA,wCAAsD;AAYtD,kCAAyC,KAGxC;IACA,MAAM,OAAO,GAAG,KAAK,CAAC,0BAA0B,CAAC;IACjD,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IACnF,OAAO,CACN,YAAY;QACZ,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;QAC7B,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAC3B,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CACjC,CAAC;AACH,CAAC;AASM,MAAM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