@activepieces/piece-llmrails 0.0.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.
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-llmrails",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"@sinclair/typebox": "^0.26.3",
|
|
6
|
+
"axios": "1.4.0",
|
|
7
|
+
"dayjs": "^1.11.8",
|
|
8
|
+
"is-base64": "^1.1.0",
|
|
9
|
+
"lodash": "4.17.21",
|
|
10
|
+
"nanoid": "^3.3.4",
|
|
11
|
+
"semver": "7.5.4",
|
|
12
|
+
"@activepieces/pieces-common": "0.2.3",
|
|
13
|
+
"@activepieces/pieces-framework": "0.6.18",
|
|
14
|
+
"@activepieces/shared": "0.8.3",
|
|
15
|
+
"tslib": "2.6.1"
|
|
16
|
+
},
|
|
17
|
+
"main": "./src/index.js",
|
|
18
|
+
"types": "./src/index.d.ts"
|
|
19
|
+
}
|
package/src/index.d.ts
ADDED
package/src/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.llmrails = exports.llmrailsAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const datastore_search_1 = require("./lib/actions/datastore-search");
|
|
7
|
+
const markdownDescription = `
|
|
8
|
+
Follow these instructions to get your LLMRails API Key:
|
|
9
|
+
|
|
10
|
+
1. Visit the following website: https://console.llmrails.com/api-keys.
|
|
11
|
+
2. Once on the website, click on create a key.
|
|
12
|
+
3. Once you have created a key, copy it and use it for the Api key field on the site.
|
|
13
|
+
`;
|
|
14
|
+
exports.llmrailsAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
15
|
+
displayName: 'API Key',
|
|
16
|
+
description: markdownDescription,
|
|
17
|
+
required: true,
|
|
18
|
+
validate: ({ auth }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
+
if (auth.startsWith('api_')) {
|
|
20
|
+
return {
|
|
21
|
+
valid: true,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
valid: false,
|
|
26
|
+
error: 'Invalid Api Key'
|
|
27
|
+
};
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
exports.llmrails = (0, pieces_framework_1.createPiece)({
|
|
31
|
+
displayName: "Llmrails",
|
|
32
|
+
minimumSupportedRelease: '0.5.0',
|
|
33
|
+
logoUrl: "https://cdn.llmrails.com/icon-black.png",
|
|
34
|
+
authors: ["w95"],
|
|
35
|
+
auth: exports.llmrailsAuth,
|
|
36
|
+
actions: [datastore_search_1.datastoreSearch],
|
|
37
|
+
triggers: []
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/llmrails/src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,qEAAiE;AAEjE,MAAM,mBAAmB,GAAG;;;;;;CAM3B,CAAC;AAEW,QAAA,YAAY,GAAG,4BAAS,CAAC,UAAU,CAAC;IAChD,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,mBAAmB;IAChC,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,CAAO,EAAC,IAAI,EAAC,EAAE,EAAE;QAC1B,IAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAC;YAC1B,OAAO;gBACN,KAAK,EAAE,IAAI;aACX,CAAA;SACD;QACD,OAAO;YACN,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,iBAAiB;SACxB,CAAA;IACF,CAAC,CAAA;CACD,CAAC,CAAC;AAEU,QAAA,QAAQ,GAAG,IAAA,8BAAW,EAAC;IACnC,WAAW,EAAE,UAAU;IACvB,uBAAuB,EAAE,OAAO;IAChC,OAAO,EAAE,yCAAyC;IAClD,OAAO,EAAE,CAAC,KAAK,CAAC;IAChB,IAAI,EAAE,oBAAY;IAClB,OAAO,EAAE,CAAC,kCAAe,CAAC;IAC1B,QAAQ,EAAE,EAAE;CACZ,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const datastoreSearch: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
datastoreId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
text: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
hybrid: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
5
|
+
summarize: import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.datastoreSearch = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const __1 = require("../..");
|
|
8
|
+
exports.datastoreSearch = (0, pieces_framework_1.createAction)({
|
|
9
|
+
auth: __1.llmrailsAuth,
|
|
10
|
+
name: 'search',
|
|
11
|
+
displayName: 'Datastore search',
|
|
12
|
+
description: 'Search in datastore',
|
|
13
|
+
props: {
|
|
14
|
+
datastoreId: pieces_framework_1.Property.ShortText({
|
|
15
|
+
displayName: 'Datastore ID',
|
|
16
|
+
required: true
|
|
17
|
+
}),
|
|
18
|
+
text: pieces_framework_1.Property.ShortText({
|
|
19
|
+
displayName: 'Text',
|
|
20
|
+
required: true,
|
|
21
|
+
description: 'Search query'
|
|
22
|
+
}),
|
|
23
|
+
hybrid: pieces_framework_1.Property.Checkbox({
|
|
24
|
+
displayName: 'Hybrid search',
|
|
25
|
+
description: 'Hybrid search is combining dense and sparse embeddings.',
|
|
26
|
+
required: true,
|
|
27
|
+
defaultValue: true
|
|
28
|
+
}),
|
|
29
|
+
summarize: pieces_framework_1.Property.Checkbox({
|
|
30
|
+
displayName: 'Summarize',
|
|
31
|
+
description: 'Summarizes the datastore search results',
|
|
32
|
+
required: true,
|
|
33
|
+
defaultValue: true
|
|
34
|
+
})
|
|
35
|
+
},
|
|
36
|
+
run(context) {
|
|
37
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const datastoreId = context.propsValue.datastoreId;
|
|
39
|
+
const request = {
|
|
40
|
+
url: `https://api.llmrails.com/v1/datastores/${datastoreId}/search`,
|
|
41
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
42
|
+
body: {
|
|
43
|
+
text: context.propsValue.text,
|
|
44
|
+
summarize: context.propsValue.summarize,
|
|
45
|
+
hybrid: context.propsValue.hybrid
|
|
46
|
+
},
|
|
47
|
+
headers: {
|
|
48
|
+
'X-API-KEY': context.auth,
|
|
49
|
+
Accept: 'application/json'
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const response = yield pieces_common_1.httpClient.sendRequest(request);
|
|
53
|
+
return response.body;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=datastore-search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datastore-search.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/llmrails/src/lib/actions/datastore-search.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAiF;AACjF,6BAAqC;AAExB,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,gBAAY;IAClB,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,kBAAkB;IAC/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