@taskmagic/apps-metatext 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 +7 -0
- package/package.json +47 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +36 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/classify-text.d.ts +9 -0
- package/src/lib/actions/classify-text.js +81 -0
- package/src/lib/actions/classify-text.js.map +1 -0
- package/src/lib/actions/extract-text.d.ts +7 -0
- package/src/lib/actions/extract-text.js +62 -0
- package/src/lib/actions/extract-text.js.map +1 -0
- package/src/lib/actions/finetune-model.d.ts +6 -0
- package/src/lib/actions/finetune-model.js +64 -0
- package/src/lib/actions/finetune-model.js.map +1 -0
- package/src/lib/actions/index.d.ts +3 -0
- package/src/lib/actions/index.js +7 -0
- package/src/lib/actions/index.js.map +1 -0
- package/src/lib/auth.d.ts +1 -0
- package/src/lib/auth.js +10 -0
- package/src/lib/auth.js.map +1 -0
- package/src/lib/common/client.d.ts +14 -0
- package/src/lib/common/client.js +38 -0
- package/src/lib/common/client.js.map +1 -0
- package/src/lib/common/index.d.ts +1 -0
- package/src/lib/common/index.js +5 -0
- package/src/lib/common/index.js.map +1 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@taskmagic/apps-metatext",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"@anthropic-ai/sdk": "0.33.1",
|
|
6
|
+
"@sinclair/typebox": "0.34.11",
|
|
7
|
+
"axios": "1.17.0",
|
|
8
|
+
"axios-retry": "4.4.1",
|
|
9
|
+
"deepmerge-ts": "7.1.0",
|
|
10
|
+
"mime-types": "2.1.35",
|
|
11
|
+
"nanoid": "3.3.8",
|
|
12
|
+
"openai": "4.67.1",
|
|
13
|
+
"replicate": "0.34.1",
|
|
14
|
+
"semver": "7.6.0",
|
|
15
|
+
"zod": "3.25.76",
|
|
16
|
+
"@taskmagic/pieces-common": "0.4.4",
|
|
17
|
+
"@taskmagic/pieces-framework": "0.7.46",
|
|
18
|
+
"@taskmagic/shared": "0.10.171",
|
|
19
|
+
"tslib": "1.14.1"
|
|
20
|
+
},
|
|
21
|
+
"overrides": {
|
|
22
|
+
"cross-spawn": "7.0.6",
|
|
23
|
+
"elliptic": "^6.6.1",
|
|
24
|
+
"fast-xml-parser": "^4.4.1",
|
|
25
|
+
"protobufjs": "^7.5.5",
|
|
26
|
+
"tmp": "^0.2.4",
|
|
27
|
+
"koa": "^2.16.4",
|
|
28
|
+
"picomatch": "^4.0.4",
|
|
29
|
+
"langsmith": "^0.6.0",
|
|
30
|
+
"serialize-javascript": "^6.0.2",
|
|
31
|
+
"elevenlabs": {
|
|
32
|
+
"form-data": "^4.0.4"
|
|
33
|
+
},
|
|
34
|
+
"@tryfabric/martian": {
|
|
35
|
+
"@notionhq/client": "$@notionhq/client"
|
|
36
|
+
},
|
|
37
|
+
"vite": {
|
|
38
|
+
"rollup": "npm:@rollup/wasm-node@^4.61.1"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"resolutions": {
|
|
42
|
+
"rollup": "npm:@rollup/wasm-node@^4.61.1"
|
|
43
|
+
},
|
|
44
|
+
"types": "./src/index.d.ts",
|
|
45
|
+
"main": "./src/index.js",
|
|
46
|
+
"type": "commonjs"
|
|
47
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const metatext: import("@taskmagic/pieces-framework").Piece<import("@taskmagic/pieces-framework").SecretTextProperty<true>>;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.metatext = void 0;
|
|
4
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
5
|
+
const shared_1 = require("@taskmagic/shared");
|
|
6
|
+
const extract_text_1 = require("./lib/actions/extract-text");
|
|
7
|
+
const classify_text_1 = require("./lib/actions/classify-text");
|
|
8
|
+
const finetune_model_1 = require("./lib/actions/finetune-model");
|
|
9
|
+
const auth_1 = require("./lib/auth");
|
|
10
|
+
exports.metatext = (0, pieces_framework_1.createPiece)({
|
|
11
|
+
displayName: 'Metatext',
|
|
12
|
+
description: 'AI content moderation and safety guard API',
|
|
13
|
+
auth: auth_1.metatextAuth,
|
|
14
|
+
minimumSupportedRelease: '0.30.0',
|
|
15
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/metatext.png',
|
|
16
|
+
categories: [shared_1.PieceCategory.ARTIFICIAL_INTELLIGENCE],
|
|
17
|
+
authors: ['onyedikachi-david'],
|
|
18
|
+
ai: {
|
|
19
|
+
description: 'Analyze text with Metatext AI projects: classify text into sentiment/intent/topic labels, extract entities and keywords, and launch fine-tuning jobs for your own models.',
|
|
20
|
+
keywords: [
|
|
21
|
+
'text classification',
|
|
22
|
+
'classify text',
|
|
23
|
+
'extract entities',
|
|
24
|
+
'keyword extraction',
|
|
25
|
+
'sentiment analysis',
|
|
26
|
+
'intent detection',
|
|
27
|
+
'fine-tune model',
|
|
28
|
+
'nlp',
|
|
29
|
+
'content moderation',
|
|
30
|
+
'metatext',
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
actions: [extract_text_1.extractText, classify_text_1.classifyText, finetune_model_1.finetuneModel],
|
|
34
|
+
triggers: [],
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/metatext/src/index.ts"],"names":[],"mappings":";;;AAAA,kEAA0D;AAC1D,8CAAkD;AAClD,6DAAyD;AACzD,+DAA2D;AAC3D,iEAA6D;AAC7D,qCAA0C;AAE7B,QAAA,QAAQ,GAAG,IAAA,8BAAW,EAAC;IAClC,WAAW,EAAE,UAAU;IACvB,WAAW,EAAE,4CAA4C;IACzD,IAAI,EAAE,mBAAY;IAClB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,kDAAkD;IAC3D,UAAU,EAAE,CAAC,sBAAa,CAAC,uBAAuB,CAAC;IACnD,OAAO,EAAE,CAAC,mBAAmB,CAAC;IAC9B,EAAE,EAAE;QACF,WAAW,EACT,2KAA2K;QAC7K,QAAQ,EAAE;YACR,qBAAqB;YACrB,eAAe;YACf,kBAAkB;YAClB,oBAAoB;YACpB,oBAAoB;YACpB,kBAAkB;YAClB,iBAAiB;YACjB,KAAK;YACL,oBAAoB;YACpB,UAAU;SACX;KACF;IACD,OAAO,EAAE,CAAC,0BAAW,EAAE,4BAAY,EAAE,8BAAa,CAAC;IACnD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const classifyText: import("@taskmagic/pieces-framework").IAction<import("@taskmagic/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
project_id: import("@taskmagic/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
text: import("@taskmagic/pieces-framework").LongTextProperty<true>;
|
|
4
|
+
model: import("@taskmagic/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
threshold: import("@taskmagic/pieces-framework").NumberProperty<false>;
|
|
6
|
+
top_labels: import("@taskmagic/pieces-framework").NumberProperty<false>;
|
|
7
|
+
refresh: import("@taskmagic/pieces-framework").CheckboxProperty<false>;
|
|
8
|
+
version: import("@taskmagic/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.classifyText = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
exports.classifyText = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.metatextAuth,
|
|
11
|
+
name: 'classify_text',
|
|
12
|
+
displayName: 'Classify Text',
|
|
13
|
+
description: 'Classify text into categories (sentiment, intent, topic, custom models)',
|
|
14
|
+
props: {
|
|
15
|
+
project_id: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Project ID',
|
|
17
|
+
description: 'The ID of your classification project',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
text: pieces_framework_1.Property.LongText({
|
|
21
|
+
displayName: 'Text',
|
|
22
|
+
description: 'The text to classify',
|
|
23
|
+
required: true,
|
|
24
|
+
}),
|
|
25
|
+
model: pieces_framework_1.Property.ShortText({
|
|
26
|
+
displayName: 'Model',
|
|
27
|
+
description: 'The model to use for classification',
|
|
28
|
+
required: false,
|
|
29
|
+
}),
|
|
30
|
+
threshold: pieces_framework_1.Property.Number({
|
|
31
|
+
displayName: 'Threshold',
|
|
32
|
+
description: 'Minimum confidence score for predictions',
|
|
33
|
+
required: false,
|
|
34
|
+
}),
|
|
35
|
+
top_labels: pieces_framework_1.Property.Number({
|
|
36
|
+
displayName: 'Top Labels',
|
|
37
|
+
description: 'Maximum number of labels to return',
|
|
38
|
+
required: false,
|
|
39
|
+
}),
|
|
40
|
+
refresh: pieces_framework_1.Property.Checkbox({
|
|
41
|
+
displayName: 'Refresh',
|
|
42
|
+
description: 'Force refresh the classification',
|
|
43
|
+
required: false,
|
|
44
|
+
defaultValue: false,
|
|
45
|
+
}),
|
|
46
|
+
version: pieces_framework_1.Property.ShortText({
|
|
47
|
+
displayName: 'Version',
|
|
48
|
+
description: 'Model version to use',
|
|
49
|
+
required: false,
|
|
50
|
+
}),
|
|
51
|
+
},
|
|
52
|
+
run(_a) {
|
|
53
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
54
|
+
const { project_id, text, model, threshold, top_labels, refresh, version } = propsValue;
|
|
55
|
+
const body = { text };
|
|
56
|
+
if (model) {
|
|
57
|
+
body['model'] = model;
|
|
58
|
+
}
|
|
59
|
+
const options = {};
|
|
60
|
+
if (threshold !== undefined)
|
|
61
|
+
options['threshold'] = threshold;
|
|
62
|
+
if (top_labels !== undefined)
|
|
63
|
+
options['top_labels'] = top_labels;
|
|
64
|
+
if (refresh !== undefined)
|
|
65
|
+
options['refresh'] = refresh;
|
|
66
|
+
if (version)
|
|
67
|
+
options['version'] = version;
|
|
68
|
+
if (Object.keys(options).length > 0) {
|
|
69
|
+
body['options'] = options;
|
|
70
|
+
}
|
|
71
|
+
const response = yield (0, common_1.metatextApiCall)({
|
|
72
|
+
apiKey: auth,
|
|
73
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
74
|
+
endpoint: `/v2/classify/${project_id}`,
|
|
75
|
+
body,
|
|
76
|
+
});
|
|
77
|
+
return response;
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=classify-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classify-text.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/metatext/src/lib/actions/classify-text.ts"],"names":[],"mappings":";;;;AAAA,kEAAqE;AACrE,4DAAsD;AACtD,kCAAuC;AACvC,sCAA4C;AAE/B,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACvC,IAAI,EAAE,mBAAY;IAClB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,eAAe;IAC5B,WAAW,EACT,yEAAyE;IAC3E,KAAK,EAAE;QACL,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,uCAAuC;YACpD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACtB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,sBAAsB;YACnC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,qCAAqC;YAClD,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACzB,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,0CAA0C;YACvD,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC1B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,oCAAoC;YACjD,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACzB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,kCAAkC;YAC/C,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,KAAK;SACpB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,sBAAsB;YACnC,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE;YAC5B,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,GACxE,UAAU,CAAC;YAEb,MAAM,IAAI,GAA4B,EAAE,IAAI,EAAE,CAAC;YAE/C,IAAI,KAAK,EAAE,CAAC;gBACV,IAAI,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;YACxB,CAAC;YAED,MAAM,OAAO,GAA4B,EAAE,CAAC;YAC5C,IAAI,SAAS,KAAK,SAAS;gBAAE,OAAO,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC;YAC9D,IAAI,UAAU,KAAK,SAAS;gBAAE,OAAO,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC;YACjE,IAAI,OAAO,KAAK,SAAS;gBAAE,OAAO,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC;YACxD,IAAI,OAAO;gBAAE,OAAO,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC;YAE1C,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACpC,IAAI,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC;YAC5B,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAe,EAAC;gBACrC,MAAM,EAAE,IAAc;gBACtB,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,QAAQ,EAAE,gBAAgB,UAAU,EAAE;gBACtC,IAAI;aACL,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const extractText: import("@taskmagic/pieces-framework").IAction<import("@taskmagic/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
project_id: import("@taskmagic/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
text: import("@taskmagic/pieces-framework").LongTextProperty<true>;
|
|
4
|
+
model: import("@taskmagic/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
refresh: import("@taskmagic/pieces-framework").CheckboxProperty<false>;
|
|
6
|
+
version: import("@taskmagic/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractText = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
exports.extractText = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.metatextAuth,
|
|
11
|
+
name: 'extract_text',
|
|
12
|
+
displayName: 'Extract Text',
|
|
13
|
+
description: 'Extract information from text (entities, keywords, custom models)',
|
|
14
|
+
props: {
|
|
15
|
+
project_id: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Project ID',
|
|
17
|
+
description: 'The ID of your extraction project',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
text: pieces_framework_1.Property.LongText({
|
|
21
|
+
displayName: 'Text',
|
|
22
|
+
description: 'The text to extract information from',
|
|
23
|
+
required: true,
|
|
24
|
+
}),
|
|
25
|
+
model: pieces_framework_1.Property.ShortText({
|
|
26
|
+
displayName: 'Model',
|
|
27
|
+
description: 'The model to use for extraction',
|
|
28
|
+
required: false,
|
|
29
|
+
}),
|
|
30
|
+
refresh: pieces_framework_1.Property.Checkbox({
|
|
31
|
+
displayName: 'Refresh',
|
|
32
|
+
description: 'Force refresh the extraction',
|
|
33
|
+
required: false,
|
|
34
|
+
defaultValue: false,
|
|
35
|
+
}),
|
|
36
|
+
version: pieces_framework_1.Property.ShortText({
|
|
37
|
+
displayName: 'Version',
|
|
38
|
+
description: 'Model version to use',
|
|
39
|
+
required: false,
|
|
40
|
+
}),
|
|
41
|
+
},
|
|
42
|
+
run(_a) {
|
|
43
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
44
|
+
const { project_id, text, model, refresh, version } = propsValue;
|
|
45
|
+
const body = { text };
|
|
46
|
+
if (model) {
|
|
47
|
+
body['model'] = model;
|
|
48
|
+
}
|
|
49
|
+
if (refresh !== undefined || version) {
|
|
50
|
+
body['options'] = Object.assign(Object.assign({}, (refresh !== undefined && { refresh })), (version && { version }));
|
|
51
|
+
}
|
|
52
|
+
const response = yield (0, common_1.metatextApiCall)({
|
|
53
|
+
apiKey: auth,
|
|
54
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
55
|
+
endpoint: `/v2/extract/${project_id}`,
|
|
56
|
+
body,
|
|
57
|
+
});
|
|
58
|
+
return response;
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=extract-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract-text.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/metatext/src/lib/actions/extract-text.ts"],"names":[],"mappings":";;;;AAAA,kEAAqE;AACrE,4DAAsD;AACtD,kCAAuC;AACvC,sCAA4C;AAE/B,QAAA,WAAW,GAAG,IAAA,+BAAY,EAAC;IACtC,IAAI,EAAE,mBAAY;IAClB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,mEAAmE;IAChF,KAAK,EAAE;QACL,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,mCAAmC;YAChD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACtB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,sCAAsC;YACnD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,iCAAiC;YAC9C,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACzB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,8BAA8B;YAC3C,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,KAAK;SACpB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,sBAAsB;YACnC,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE;YAC5B,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC;YAEjE,MAAM,IAAI,GAA4B,EAAE,IAAI,EAAE,CAAC;YAE/C,IAAI,KAAK,EAAE,CAAC;gBACV,IAAI,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;YACxB,CAAC;YAED,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,EAAE,CAAC;gBACrC,IAAI,CAAC,SAAS,CAAC,mCACV,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,CAAC,GACtC,CAAC,OAAO,IAAI,EAAE,OAAO,EAAE,CAAC,CAC5B,CAAC;YACJ,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAe,EAAC;gBACrC,MAAM,EAAE,IAAc;gBACtB,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,QAAQ,EAAE,eAAe,UAAU,EAAE;gBACrC,IAAI;aACL,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const finetuneModel: import("@taskmagic/pieces-framework").IAction<import("@taskmagic/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
project_id: import("@taskmagic/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
taskType: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, true>;
|
|
4
|
+
modelBase: import("@taskmagic/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
hyperparameters: import("@taskmagic/pieces-framework").ObjectProperty<false>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.finetuneModel = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
exports.finetuneModel = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.metatextAuth,
|
|
11
|
+
name: 'finetune_model',
|
|
12
|
+
displayName: 'Fine-tune Model',
|
|
13
|
+
description: 'Initiate a fine-tuning job for your model',
|
|
14
|
+
props: {
|
|
15
|
+
project_id: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Project ID',
|
|
17
|
+
description: 'The ID of your project',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
taskType: pieces_framework_1.Property.StaticDropdown({
|
|
21
|
+
displayName: 'Task Type',
|
|
22
|
+
description: 'The type of task for fine-tuning',
|
|
23
|
+
required: true,
|
|
24
|
+
options: {
|
|
25
|
+
options: [
|
|
26
|
+
{ label: 'Classification', value: 'classification' },
|
|
27
|
+
{ label: 'Extraction', value: 'extraction' },
|
|
28
|
+
{ label: 'Generation', value: 'generation' },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
modelBase: pieces_framework_1.Property.ShortText({
|
|
33
|
+
displayName: 'Base Model',
|
|
34
|
+
description: 'The base model to fine-tune (e.g., BERT)',
|
|
35
|
+
required: true,
|
|
36
|
+
}),
|
|
37
|
+
hyperparameters: pieces_framework_1.Property.Object({
|
|
38
|
+
displayName: 'Hyperparameters',
|
|
39
|
+
description: 'Custom hyperparameters for fine-tuning',
|
|
40
|
+
required: false,
|
|
41
|
+
}),
|
|
42
|
+
},
|
|
43
|
+
run(_a) {
|
|
44
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
45
|
+
const { project_id, taskType, modelBase, hyperparameters } = propsValue;
|
|
46
|
+
const body = {
|
|
47
|
+
taskType,
|
|
48
|
+
modelBase,
|
|
49
|
+
};
|
|
50
|
+
if (hyperparameters && Object.keys(hyperparameters).length > 0) {
|
|
51
|
+
body['hyperparameters'] = hyperparameters;
|
|
52
|
+
}
|
|
53
|
+
const response = yield (0, common_1.metatextApiCall)({
|
|
54
|
+
apiKey: auth,
|
|
55
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
56
|
+
endpoint: `/v2/projects/${project_id}/finetune`,
|
|
57
|
+
authType: 'bearer',
|
|
58
|
+
body,
|
|
59
|
+
});
|
|
60
|
+
return response;
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=finetune-model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finetune-model.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/metatext/src/lib/actions/finetune-model.ts"],"names":[],"mappings":";;;;AAAA,kEAAqE;AACrE,4DAAsD;AACtD,kCAAuC;AACvC,sCAA4C;AAE/B,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,mBAAY;IAClB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EAAE,2CAA2C;IACxD,KAAK,EAAE;QACL,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,wBAAwB;YACrC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAChC,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,kCAAkC;YAC/C,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,gBAAgB,EAAE;oBACpD,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE;oBAC5C,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE;iBAC7C;aACF;SACF,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,0CAA0C;YACvD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,eAAe,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC/B,WAAW,EAAE,iBAAiB;YAC9B,WAAW,EAAE,wCAAwC;YACrD,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE;YAC5B,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,UAAU,CAAC;YAExE,MAAM,IAAI,GAA4B;gBACpC,QAAQ;gBACR,SAAS;aACV,CAAC;YAEF,IAAI,eAAe,IAAI,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC/D,IAAI,CAAC,iBAAiB,CAAC,GAAG,eAAe,CAAC;YAC5C,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAe,EAAC;gBACrC,MAAM,EAAE,IAAc;gBACtB,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,QAAQ,EAAE,gBAAgB,UAAU,WAAW;gBAC/C,QAAQ,EAAE,QAAQ;gBAClB,IAAI;aACL,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./extract-text"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./classify-text"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./finetune-model"), exports);
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/metatext/src/lib/actions/index.ts"],"names":[],"mappings":";;;AAAA,yDAA+B;AAC/B,0DAAgC;AAChC,2DAAiC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const metatextAuth: import("@taskmagic/pieces-framework").SecretTextProperty<true>;
|
package/src/lib/auth.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.metatextAuth = void 0;
|
|
4
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
5
|
+
exports.metatextAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
6
|
+
displayName: 'API Key',
|
|
7
|
+
description: 'Contact support@metatext.io to get your API key.',
|
|
8
|
+
required: true,
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/community/metatext/src/lib/auth.ts"],"names":[],"mappings":";;;AAAA,kEAAwD;AAE3C,QAAA,YAAY,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC/C,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,kDAAkD;IAC/D,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HttpMethod, HttpMessageBody } from '@taskmagic/pieces-common';
|
|
2
|
+
export declare const METATEXT_API_URL = "https://api.metatext.ai";
|
|
3
|
+
export declare const METATEXT_GUARD_URL = "https://guard-api.metatext.ai";
|
|
4
|
+
export type AuthType = 'bearer' | 'x-api-key';
|
|
5
|
+
export type MetatextApiCallParams = {
|
|
6
|
+
apiKey: string;
|
|
7
|
+
method: HttpMethod;
|
|
8
|
+
endpoint: string;
|
|
9
|
+
baseUrl?: string;
|
|
10
|
+
authType?: AuthType;
|
|
11
|
+
query?: Record<string, string | number | string[] | undefined>;
|
|
12
|
+
body?: unknown;
|
|
13
|
+
};
|
|
14
|
+
export declare function metatextApiCall<T extends HttpMessageBody>({ apiKey, method, endpoint, baseUrl, authType, query, body, }: MetatextApiCallParams): Promise<T>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.METATEXT_GUARD_URL = exports.METATEXT_API_URL = void 0;
|
|
4
|
+
exports.metatextApiCall = metatextApiCall;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
7
|
+
exports.METATEXT_API_URL = 'https://api.metatext.ai';
|
|
8
|
+
exports.METATEXT_GUARD_URL = 'https://guard-api.metatext.ai';
|
|
9
|
+
function metatextApiCall(_a) {
|
|
10
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ apiKey, method, endpoint, baseUrl = exports.METATEXT_API_URL, authType = 'x-api-key', query, body, }) {
|
|
11
|
+
const qs = {};
|
|
12
|
+
if (query) {
|
|
13
|
+
for (const [key, value] of Object.entries(query)) {
|
|
14
|
+
if (value !== null && value !== undefined) {
|
|
15
|
+
qs[key] = String(value);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const headers = authType === 'bearer'
|
|
20
|
+
? {
|
|
21
|
+
Authorization: `Bearer ${apiKey}`,
|
|
22
|
+
'Content-Type': 'application/json',
|
|
23
|
+
}
|
|
24
|
+
: {
|
|
25
|
+
'x-api-key': apiKey,
|
|
26
|
+
'Content-Type': 'application/json',
|
|
27
|
+
};
|
|
28
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
29
|
+
method,
|
|
30
|
+
url: `${baseUrl}${endpoint}`,
|
|
31
|
+
headers,
|
|
32
|
+
queryParams: qs,
|
|
33
|
+
body,
|
|
34
|
+
});
|
|
35
|
+
return response.body;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/metatext/src/lib/common/client.ts"],"names":[],"mappings":";;;AAsBA,0CAuCC;;AA7DD,4DAKkC;AAErB,QAAA,gBAAgB,GAAG,yBAAyB,CAAC;AAC7C,QAAA,kBAAkB,GAAG,+BAA+B,CAAC;AAclE,SAAsB,eAAe;iEAA4B,EAC/D,MAAM,EACN,MAAM,EACN,QAAQ,EACR,OAAO,GAAG,wBAAgB,EAC1B,QAAQ,GAAG,WAAW,EACtB,KAAK,EACL,IAAI,GACkB;QACtB,MAAM,EAAE,GAAgB,EAAE,CAAC;QAE3B,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBACjD,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBAC1C,EAAE,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;gBAC1B,CAAC;YACH,CAAC;QACH,CAAC;QAED,MAAM,OAAO,GACX,QAAQ,KAAK,QAAQ;YACnB,CAAC,CAAC;gBACE,aAAa,EAAE,UAAU,MAAM,EAAE;gBACjC,cAAc,EAAE,kBAAkB;aACnC;YACH,CAAC,CAAC;gBACE,WAAW,EAAE,MAAM;gBACnB,cAAc,EAAE,kBAAkB;aACnC,CAAC;QAER,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAI;YAC/C,MAAM;YACN,GAAG,EAAE,GAAG,OAAO,GAAG,QAAQ,EAAE;YAC5B,OAAO;YACP,WAAW,EAAE,EAAE;YACf,IAAI;SACL,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './client';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/metatext/src/lib/common/index.ts"],"names":[],"mappings":";;;AAAA,mDAAyB"}
|