@workglow/ai 0.0.84 → 0.0.86
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 +166 -35
- package/dist/browser.js +3947 -1449
- package/dist/browser.js.map +49 -38
- package/dist/bun.js +3947 -1449
- package/dist/bun.js.map +49 -38
- package/dist/common.d.ts +0 -3
- package/dist/common.d.ts.map +1 -1
- package/dist/model/ModelRegistry.d.ts +2 -2
- package/dist/model/ModelRegistry.d.ts.map +1 -1
- package/dist/model/ModelRepository.d.ts +3 -3
- package/dist/model/ModelRepository.d.ts.map +1 -1
- package/dist/node.js +3947 -1449
- package/dist/node.js.map +49 -38
- package/dist/task/BackgroundRemovalTask.d.ts +121 -289
- package/dist/task/BackgroundRemovalTask.d.ts.map +1 -1
- package/dist/task/ChunkRetrievalTask.d.ts +243 -0
- package/dist/task/ChunkRetrievalTask.d.ts.map +1 -0
- package/dist/task/ChunkToVectorTask.d.ts +183 -0
- package/dist/task/ChunkToVectorTask.d.ts.map +1 -0
- package/dist/task/ChunkVectorHybridSearchTask.d.ts +160 -0
- package/dist/task/ChunkVectorHybridSearchTask.d.ts.map +1 -0
- package/dist/task/ChunkVectorSearchTask.d.ts +137 -0
- package/dist/task/ChunkVectorSearchTask.d.ts.map +1 -0
- package/dist/task/ChunkVectorUpsertTask.d.ts +120 -0
- package/dist/task/ChunkVectorUpsertTask.d.ts.map +1 -0
- package/dist/task/ContextBuilderTask.d.ts +131 -0
- package/dist/task/ContextBuilderTask.d.ts.map +1 -0
- package/dist/task/DocumentEnricherTask.d.ts +232 -0
- package/dist/task/DocumentEnricherTask.d.ts.map +1 -0
- package/dist/task/DownloadModelTask.d.ts +79 -208
- package/dist/task/DownloadModelTask.d.ts.map +1 -1
- package/dist/task/FaceDetectorTask.d.ts +117 -272
- package/dist/task/FaceDetectorTask.d.ts.map +1 -1
- package/dist/task/FaceLandmarkerTask.d.ts +117 -272
- package/dist/task/FaceLandmarkerTask.d.ts.map +1 -1
- package/dist/task/GestureRecognizerTask.d.ts +129 -284
- package/dist/task/GestureRecognizerTask.d.ts.map +1 -1
- package/dist/task/HandLandmarkerTask.d.ts +125 -280
- package/dist/task/HandLandmarkerTask.d.ts.map +1 -1
- package/dist/task/HierarchicalChunkerTask.d.ts +212 -0
- package/dist/task/HierarchicalChunkerTask.d.ts.map +1 -0
- package/dist/task/HierarchyJoinTask.d.ts +318 -0
- package/dist/task/HierarchyJoinTask.d.ts.map +1 -0
- package/dist/task/ImageClassificationTask.d.ts +117 -272
- package/dist/task/ImageClassificationTask.d.ts.map +1 -1
- package/dist/task/ImageEmbeddingTask.d.ts +125 -446
- package/dist/task/ImageEmbeddingTask.d.ts.map +1 -1
- package/dist/task/ImageSegmentationTask.d.ts +117 -272
- package/dist/task/ImageSegmentationTask.d.ts.map +1 -1
- package/dist/task/ImageToTextTask.d.ts +117 -272
- package/dist/task/ImageToTextTask.d.ts.map +1 -1
- package/dist/task/ObjectDetectionTask.d.ts +119 -274
- package/dist/task/ObjectDetectionTask.d.ts.map +1 -1
- package/dist/task/PoseLandmarkerTask.d.ts +117 -272
- package/dist/task/PoseLandmarkerTask.d.ts.map +1 -1
- package/dist/task/QueryExpanderTask.d.ts +129 -0
- package/dist/task/QueryExpanderTask.d.ts.map +1 -0
- package/dist/task/RerankerTask.d.ts +209 -0
- package/dist/task/RerankerTask.d.ts.map +1 -0
- package/dist/task/StructuralParserTask.d.ts +91 -0
- package/dist/task/StructuralParserTask.d.ts.map +1 -0
- package/dist/task/TextChunkerTask.d.ts +129 -0
- package/dist/task/TextChunkerTask.d.ts.map +1 -0
- package/dist/task/TextClassificationTask.d.ts +42 -115
- package/dist/task/TextClassificationTask.d.ts.map +1 -1
- package/dist/task/TextEmbeddingTask.d.ts +55 -277
- package/dist/task/TextEmbeddingTask.d.ts.map +1 -1
- package/dist/task/TextFillMaskTask.d.ts +42 -115
- package/dist/task/TextFillMaskTask.d.ts.map +1 -1
- package/dist/task/TextGenerationTask.d.ts +44 -128
- package/dist/task/TextGenerationTask.d.ts.map +1 -1
- package/dist/task/TextLanguageDetectionTask.d.ts +42 -115
- package/dist/task/TextLanguageDetectionTask.d.ts.map +1 -1
- package/dist/task/TextNamedEntityRecognitionTask.d.ts +42 -115
- package/dist/task/TextNamedEntityRecognitionTask.d.ts.map +1 -1
- package/dist/task/TextQuestionAnswerTask.d.ts +47 -144
- package/dist/task/TextQuestionAnswerTask.d.ts.map +1 -1
- package/dist/task/TextRewriterTask.d.ts +45 -131
- package/dist/task/TextRewriterTask.d.ts.map +1 -1
- package/dist/task/TextSummaryTask.d.ts +42 -115
- package/dist/task/TextSummaryTask.d.ts.map +1 -1
- package/dist/task/TextTranslationTask.d.ts +54 -168
- package/dist/task/TextTranslationTask.d.ts.map +1 -1
- package/dist/task/TopicSegmenterTask.d.ts +148 -0
- package/dist/task/TopicSegmenterTask.d.ts.map +1 -0
- package/dist/task/UnloadModelTask.d.ts +79 -208
- package/dist/task/UnloadModelTask.d.ts.map +1 -1
- package/dist/task/VectorQuantizeTask.d.ts +120 -0
- package/dist/task/VectorQuantizeTask.d.ts.map +1 -0
- package/dist/task/VectorSimilarityTask.d.ts +18 -253
- package/dist/task/VectorSimilarityTask.d.ts.map +1 -1
- package/dist/task/base/AiTask.d.ts +24 -22
- package/dist/task/base/AiTask.d.ts.map +1 -1
- package/dist/task/base/AiTaskSchemas.d.ts +3 -127
- package/dist/task/base/AiTaskSchemas.d.ts.map +1 -1
- package/dist/task/base/AiVisionTask.d.ts +1 -4
- package/dist/task/base/AiVisionTask.d.ts.map +1 -1
- package/dist/task/index.d.ts +54 -1
- package/dist/task/index.d.ts.map +1 -1
- package/package.json +14 -9
- package/dist/source/Document.d.ts +0 -56
- package/dist/source/Document.d.ts.map +0 -1
- package/dist/source/DocumentConverter.d.ts +0 -15
- package/dist/source/DocumentConverter.d.ts.map +0 -1
- package/dist/source/DocumentConverterMarkdown.d.ts +0 -13
- package/dist/source/DocumentConverterMarkdown.d.ts.map +0 -1
- package/dist/source/DocumentConverterText.d.ts +0 -13
- package/dist/source/DocumentConverterText.d.ts.map +0 -1
- package/dist/source/MasterDocument.d.ts +0 -27
- package/dist/source/MasterDocument.d.ts.map +0 -1
- package/dist/source/index.d.ts +0 -10
- package/dist/source/index.d.ts.map +0 -1
- package/dist/task/DocumentSplitterTask.d.ts +0 -58
- package/dist/task/DocumentSplitterTask.d.ts.map +0 -1
|
@@ -6,177 +6,76 @@
|
|
|
6
6
|
import { CreateWorkflow, JobQueueTaskConfig } from "@workglow/task-graph";
|
|
7
7
|
import { DataPortSchema, FromSchema } from "@workglow/util";
|
|
8
8
|
import { AiTask } from "./base/AiTask";
|
|
9
|
-
import { DeReplicateFromSchema } from "./base/AiTaskSchemas";
|
|
10
9
|
export declare const TextTranslationInputSchema: {
|
|
11
10
|
readonly type: "object";
|
|
12
11
|
readonly properties: {
|
|
13
12
|
readonly text: {
|
|
14
|
-
readonly "
|
|
15
|
-
readonly
|
|
16
|
-
readonly
|
|
17
|
-
type: "string";
|
|
18
|
-
title: string;
|
|
19
|
-
description: string;
|
|
20
|
-
}, {
|
|
21
|
-
readonly type: "array";
|
|
22
|
-
readonly items: {
|
|
23
|
-
type: "string";
|
|
24
|
-
title: string;
|
|
25
|
-
description: string;
|
|
26
|
-
};
|
|
27
|
-
}];
|
|
28
|
-
readonly title: string | undefined;
|
|
29
|
-
readonly description: string | undefined;
|
|
13
|
+
readonly type: "string";
|
|
14
|
+
readonly title: "Text";
|
|
15
|
+
readonly description: "The text to translate";
|
|
30
16
|
};
|
|
31
17
|
readonly source_lang: {
|
|
32
|
-
readonly "
|
|
33
|
-
readonly
|
|
34
|
-
readonly
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
readonly description: "The language to use";
|
|
38
|
-
readonly maxLength: 2;
|
|
39
|
-
readonly minLength: 2;
|
|
40
|
-
}, {
|
|
41
|
-
readonly type: "array";
|
|
42
|
-
readonly items: {
|
|
43
|
-
readonly type: "string";
|
|
44
|
-
readonly title: "Language";
|
|
45
|
-
readonly description: "The language to use";
|
|
46
|
-
readonly maxLength: 2;
|
|
47
|
-
readonly minLength: 2;
|
|
48
|
-
};
|
|
49
|
-
}];
|
|
50
|
-
readonly title: string | undefined;
|
|
51
|
-
readonly description: string | undefined;
|
|
18
|
+
readonly type: "string";
|
|
19
|
+
readonly title: "Language";
|
|
20
|
+
readonly description: "The language to use";
|
|
21
|
+
readonly maxLength: 2;
|
|
22
|
+
readonly minLength: 2;
|
|
52
23
|
};
|
|
53
24
|
readonly target_lang: {
|
|
54
|
-
readonly "
|
|
55
|
-
readonly
|
|
56
|
-
readonly
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
readonly description: "The language to use";
|
|
60
|
-
readonly maxLength: 2;
|
|
61
|
-
readonly minLength: 2;
|
|
62
|
-
}, {
|
|
63
|
-
readonly type: "array";
|
|
64
|
-
readonly items: {
|
|
65
|
-
readonly type: "string";
|
|
66
|
-
readonly title: "Language";
|
|
67
|
-
readonly description: "The language to use";
|
|
68
|
-
readonly maxLength: 2;
|
|
69
|
-
readonly minLength: 2;
|
|
70
|
-
};
|
|
71
|
-
}];
|
|
72
|
-
readonly title: string | undefined;
|
|
73
|
-
readonly description: string | undefined;
|
|
25
|
+
readonly type: "string";
|
|
26
|
+
readonly title: "Language";
|
|
27
|
+
readonly description: "The language to use";
|
|
28
|
+
readonly maxLength: 2;
|
|
29
|
+
readonly minLength: 2;
|
|
74
30
|
};
|
|
75
31
|
readonly model: {
|
|
76
|
-
readonly "x-replicate": true;
|
|
77
|
-
readonly format?: string | undefined;
|
|
78
32
|
readonly oneOf: readonly [{
|
|
79
|
-
readonly
|
|
80
|
-
|
|
81
|
-
readonly description: `The model ${string}`;
|
|
82
|
-
} & {
|
|
83
|
-
readonly format: import(".").TypeModelSemantic;
|
|
84
|
-
readonly type: "string";
|
|
85
|
-
}, {
|
|
86
|
-
readonly type: "object";
|
|
87
|
-
readonly properties: {
|
|
88
|
-
readonly model_id: {
|
|
89
|
-
readonly type: "string";
|
|
90
|
-
};
|
|
91
|
-
readonly tasks: {
|
|
92
|
-
readonly type: "array";
|
|
93
|
-
readonly items: {
|
|
94
|
-
readonly type: "string";
|
|
95
|
-
};
|
|
96
|
-
readonly "x-ui-editor": "multiselect";
|
|
97
|
-
};
|
|
98
|
-
readonly title: {
|
|
99
|
-
readonly type: "string";
|
|
100
|
-
};
|
|
101
|
-
readonly description: {
|
|
102
|
-
readonly type: "string";
|
|
103
|
-
readonly "x-ui-editor": "textarea";
|
|
104
|
-
};
|
|
105
|
-
readonly provider: {
|
|
106
|
-
readonly type: "string";
|
|
107
|
-
};
|
|
108
|
-
readonly provider_config: {
|
|
109
|
-
readonly type: "object";
|
|
110
|
-
readonly default: {};
|
|
111
|
-
};
|
|
112
|
-
readonly metadata: {
|
|
113
|
-
readonly type: "object";
|
|
114
|
-
readonly default: {};
|
|
115
|
-
readonly "x-ui-hidden": true;
|
|
116
|
-
};
|
|
117
|
-
};
|
|
118
|
-
readonly required: readonly ["provider", "provider_config"];
|
|
119
|
-
readonly format: "model";
|
|
120
|
-
readonly additionalProperties: false;
|
|
121
|
-
} & {
|
|
122
|
-
readonly format: import(".").TypeModelSemantic;
|
|
123
|
-
}];
|
|
33
|
+
readonly title: "Model";
|
|
34
|
+
readonly description: `The model ${string}`;
|
|
124
35
|
} & {
|
|
125
36
|
readonly format: import(".").TypeModelSemantic;
|
|
37
|
+
readonly type: "string";
|
|
126
38
|
}, {
|
|
127
|
-
readonly type: "
|
|
128
|
-
readonly
|
|
129
|
-
readonly
|
|
130
|
-
readonly title: "Model";
|
|
131
|
-
readonly description: `The model ${string}`;
|
|
132
|
-
} & {
|
|
133
|
-
readonly format: import(".").TypeModelSemantic;
|
|
39
|
+
readonly type: "object";
|
|
40
|
+
readonly properties: {
|
|
41
|
+
readonly model_id: {
|
|
134
42
|
readonly type: "string";
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
readonly
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
};
|
|
141
|
-
readonly tasks: {
|
|
142
|
-
readonly type: "array";
|
|
143
|
-
readonly items: {
|
|
144
|
-
readonly type: "string";
|
|
145
|
-
};
|
|
146
|
-
readonly "x-ui-editor": "multiselect";
|
|
147
|
-
};
|
|
148
|
-
readonly title: {
|
|
149
|
-
readonly type: "string";
|
|
150
|
-
};
|
|
151
|
-
readonly description: {
|
|
152
|
-
readonly type: "string";
|
|
153
|
-
readonly "x-ui-editor": "textarea";
|
|
154
|
-
};
|
|
155
|
-
readonly provider: {
|
|
156
|
-
readonly type: "string";
|
|
157
|
-
};
|
|
158
|
-
readonly provider_config: {
|
|
159
|
-
readonly type: "object";
|
|
160
|
-
readonly default: {};
|
|
161
|
-
};
|
|
162
|
-
readonly metadata: {
|
|
163
|
-
readonly type: "object";
|
|
164
|
-
readonly default: {};
|
|
165
|
-
readonly "x-ui-hidden": true;
|
|
166
|
-
};
|
|
43
|
+
};
|
|
44
|
+
readonly tasks: {
|
|
45
|
+
readonly type: "array";
|
|
46
|
+
readonly items: {
|
|
47
|
+
readonly type: "string";
|
|
167
48
|
};
|
|
168
|
-
readonly
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
49
|
+
readonly "x-ui-editor": "multiselect";
|
|
50
|
+
};
|
|
51
|
+
readonly title: {
|
|
52
|
+
readonly type: "string";
|
|
53
|
+
};
|
|
54
|
+
readonly description: {
|
|
55
|
+
readonly type: "string";
|
|
56
|
+
readonly "x-ui-editor": "textarea";
|
|
57
|
+
};
|
|
58
|
+
readonly provider: {
|
|
59
|
+
readonly type: "string";
|
|
60
|
+
};
|
|
61
|
+
readonly provider_config: {
|
|
62
|
+
readonly type: "object";
|
|
63
|
+
readonly default: {};
|
|
64
|
+
};
|
|
65
|
+
readonly metadata: {
|
|
66
|
+
readonly type: "object";
|
|
67
|
+
readonly default: {};
|
|
68
|
+
readonly "x-ui-hidden": true;
|
|
69
|
+
};
|
|
176
70
|
};
|
|
71
|
+
readonly required: readonly ["provider", "provider_config"];
|
|
72
|
+
readonly format: "model";
|
|
73
|
+
readonly additionalProperties: false;
|
|
74
|
+
} & {
|
|
75
|
+
readonly format: import(".").TypeModelSemantic;
|
|
177
76
|
}];
|
|
178
|
-
|
|
179
|
-
readonly
|
|
77
|
+
} & {
|
|
78
|
+
readonly format: import(".").TypeModelSemantic;
|
|
180
79
|
};
|
|
181
80
|
};
|
|
182
81
|
readonly required: readonly ["text", "source_lang", "target_lang", "model"];
|
|
@@ -186,18 +85,7 @@ export declare const TextTranslationOutputSchema: {
|
|
|
186
85
|
readonly type: "object";
|
|
187
86
|
readonly properties: {
|
|
188
87
|
readonly text: {
|
|
189
|
-
readonly
|
|
190
|
-
readonly type: "string";
|
|
191
|
-
readonly title: "Text";
|
|
192
|
-
readonly description: "The translated text";
|
|
193
|
-
}, {
|
|
194
|
-
readonly type: "array";
|
|
195
|
-
readonly items: {
|
|
196
|
-
readonly type: "string";
|
|
197
|
-
readonly title: "Text";
|
|
198
|
-
readonly description: "The translated text";
|
|
199
|
-
};
|
|
200
|
-
}];
|
|
88
|
+
readonly type: "string";
|
|
201
89
|
readonly title: "Text";
|
|
202
90
|
readonly description: "The translated text";
|
|
203
91
|
};
|
|
@@ -214,8 +102,6 @@ export declare const TextTranslationOutputSchema: {
|
|
|
214
102
|
};
|
|
215
103
|
export type TextTranslationTaskInput = FromSchema<typeof TextTranslationInputSchema>;
|
|
216
104
|
export type TextTranslationTaskOutput = FromSchema<typeof TextTranslationOutputSchema>;
|
|
217
|
-
export type TextTranslationTaskExecuteInput = DeReplicateFromSchema<typeof TextTranslationInputSchema>;
|
|
218
|
-
export type TextTranslationTaskExecuteOutput = DeReplicateFromSchema<typeof TextTranslationOutputSchema>;
|
|
219
105
|
/**
|
|
220
106
|
* This translates text from one language to another
|
|
221
107
|
*/
|
|
@@ -234,7 +120,7 @@ export declare class TextTranslationTask extends AiTask<TextTranslationTaskInput
|
|
|
234
120
|
* @returns Promise resolving to the translated text output(s)
|
|
235
121
|
*/
|
|
236
122
|
export declare const textTranslation: (input: TextTranslationTaskInput, config?: JobQueueTaskConfig) => Promise<{
|
|
237
|
-
text: string
|
|
123
|
+
text: string;
|
|
238
124
|
target_lang: string;
|
|
239
125
|
}>;
|
|
240
126
|
declare module "@workglow/task-graph" {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextTranslationTask.d.ts","sourceRoot":"","sources":["../../src/task/TextTranslationTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"TextTranslationTask.d.ts","sourceRoot":"","sources":["../../src/task/TextTranslationTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAY,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAWvC,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwBJ,CAAC;AAEpC,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;CAaL,CAAC;AAEpC,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC;AACrF,MAAM,MAAM,yBAAyB,GAAG,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEvF;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,MAAM,CAC7C,wBAAwB,EACxB,yBAAyB,CAC1B;IACC,OAAc,IAAI,SAAyB;IAC3C,OAAc,QAAQ,SAAmB;IACzC,OAAc,KAAK,SAAsB;IACzC,OAAc,WAAW,SAAwE;WACnF,WAAW,IAAI,cAAc;WAG7B,YAAY,IAAI,cAAc;CAG7C;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,wBAAwB,EAAE,SAAS,kBAAkB;;;EAE3F,CAAC;AAEF,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,QAAQ;QAChB,eAAe,EAAE,cAAc,CAC7B,wBAAwB,EACxB,yBAAyB,EACzB,kBAAkB,CACnB,CAAC;KACH;CACF"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { CreateWorkflow, IExecuteContext, JobQueueTaskConfig, Task } from "@workglow/task-graph";
|
|
7
|
+
import { DataPortSchema, FromSchema } from "@workglow/util";
|
|
8
|
+
export declare const SegmentationMethod: {
|
|
9
|
+
readonly HEURISTIC: "heuristic";
|
|
10
|
+
readonly EMBEDDING_SIMILARITY: "embedding-similarity";
|
|
11
|
+
readonly HYBRID: "hybrid";
|
|
12
|
+
};
|
|
13
|
+
export type SegmentationMethod = (typeof SegmentationMethod)[keyof typeof SegmentationMethod];
|
|
14
|
+
declare const inputSchema: {
|
|
15
|
+
readonly type: "object";
|
|
16
|
+
readonly properties: {
|
|
17
|
+
readonly text: {
|
|
18
|
+
readonly type: "string";
|
|
19
|
+
readonly title: "Text";
|
|
20
|
+
readonly description: "The text to segment into topics";
|
|
21
|
+
};
|
|
22
|
+
readonly method: {
|
|
23
|
+
readonly type: "string";
|
|
24
|
+
readonly enum: ("heuristic" | "embedding-similarity" | "hybrid")[];
|
|
25
|
+
readonly title: "Segmentation Method";
|
|
26
|
+
readonly description: "Method to use for topic segmentation";
|
|
27
|
+
readonly default: "heuristic";
|
|
28
|
+
};
|
|
29
|
+
readonly minSegmentSize: {
|
|
30
|
+
readonly type: "number";
|
|
31
|
+
readonly title: "Min Segment Size";
|
|
32
|
+
readonly description: "Minimum segment size in characters";
|
|
33
|
+
readonly minimum: 50;
|
|
34
|
+
readonly default: 100;
|
|
35
|
+
};
|
|
36
|
+
readonly maxSegmentSize: {
|
|
37
|
+
readonly type: "number";
|
|
38
|
+
readonly title: "Max Segment Size";
|
|
39
|
+
readonly description: "Maximum segment size in characters";
|
|
40
|
+
readonly minimum: 100;
|
|
41
|
+
readonly default: 2000;
|
|
42
|
+
};
|
|
43
|
+
readonly similarityThreshold: {
|
|
44
|
+
readonly type: "number";
|
|
45
|
+
readonly title: "Similarity Threshold";
|
|
46
|
+
readonly description: "Threshold for embedding similarity (0-1, lower = more splits)";
|
|
47
|
+
readonly minimum: 0;
|
|
48
|
+
readonly maximum: 1;
|
|
49
|
+
readonly default: 0.5;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
readonly required: readonly ["text"];
|
|
53
|
+
readonly additionalProperties: false;
|
|
54
|
+
};
|
|
55
|
+
declare const outputSchema: {
|
|
56
|
+
readonly type: "object";
|
|
57
|
+
readonly properties: {
|
|
58
|
+
readonly segments: {
|
|
59
|
+
readonly type: "array";
|
|
60
|
+
readonly items: {
|
|
61
|
+
readonly type: "object";
|
|
62
|
+
readonly properties: {
|
|
63
|
+
readonly text: {
|
|
64
|
+
readonly type: "string";
|
|
65
|
+
};
|
|
66
|
+
readonly startOffset: {
|
|
67
|
+
readonly type: "number";
|
|
68
|
+
};
|
|
69
|
+
readonly endOffset: {
|
|
70
|
+
readonly type: "number";
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
readonly required: readonly ["text", "startOffset", "endOffset"];
|
|
74
|
+
readonly additionalProperties: false;
|
|
75
|
+
};
|
|
76
|
+
readonly title: "Segments";
|
|
77
|
+
readonly description: "Detected topic segments";
|
|
78
|
+
};
|
|
79
|
+
readonly count: {
|
|
80
|
+
readonly type: "number";
|
|
81
|
+
readonly title: "Count";
|
|
82
|
+
readonly description: "Number of segments detected";
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
readonly required: readonly ["segments", "count"];
|
|
86
|
+
readonly additionalProperties: false;
|
|
87
|
+
};
|
|
88
|
+
export type TopicSegmenterTaskInput = FromSchema<typeof inputSchema>;
|
|
89
|
+
export type TopicSegmenterTaskOutput = FromSchema<typeof outputSchema>;
|
|
90
|
+
/**
|
|
91
|
+
* Task for segmenting text into topic-based sections
|
|
92
|
+
* Uses hybrid approach: heuristics + optional embedding similarity
|
|
93
|
+
*/
|
|
94
|
+
export declare class TopicSegmenterTask extends Task<TopicSegmenterTaskInput, TopicSegmenterTaskOutput, JobQueueTaskConfig> {
|
|
95
|
+
static type: string;
|
|
96
|
+
static category: string;
|
|
97
|
+
static title: string;
|
|
98
|
+
static description: string;
|
|
99
|
+
static cacheable: boolean;
|
|
100
|
+
private static readonly EMBEDDING_DIMENSIONS;
|
|
101
|
+
static inputSchema(): DataPortSchema;
|
|
102
|
+
static outputSchema(): DataPortSchema;
|
|
103
|
+
execute(input: TopicSegmenterTaskInput, context: IExecuteContext): Promise<TopicSegmenterTaskOutput>;
|
|
104
|
+
/**
|
|
105
|
+
* Embedding-based segmentation using hashed token vectors and cosine similarity
|
|
106
|
+
*/
|
|
107
|
+
private embeddingSegmentation;
|
|
108
|
+
/**
|
|
109
|
+
* Heuristic segmentation based on paragraph breaks and transition markers
|
|
110
|
+
*/
|
|
111
|
+
private heuristicSegmentation;
|
|
112
|
+
/**
|
|
113
|
+
* Create a hashed token embedding for fast similarity checks
|
|
114
|
+
*/
|
|
115
|
+
private embedParagraph;
|
|
116
|
+
private cosineSimilarityWithNorms;
|
|
117
|
+
/**
|
|
118
|
+
* Split text into paragraphs with offsets
|
|
119
|
+
*/
|
|
120
|
+
private splitIntoParagraphs;
|
|
121
|
+
/**
|
|
122
|
+
* Check if paragraph contains transition markers
|
|
123
|
+
*/
|
|
124
|
+
private hasTransitionMarker;
|
|
125
|
+
/**
|
|
126
|
+
* Create a segment from paragraphs
|
|
127
|
+
*/
|
|
128
|
+
private createSegment;
|
|
129
|
+
/**
|
|
130
|
+
* Merge segments that are too small
|
|
131
|
+
*/
|
|
132
|
+
private mergeSmallSegments;
|
|
133
|
+
}
|
|
134
|
+
export declare const topicSegmenter: (input: TopicSegmenterTaskInput, config?: JobQueueTaskConfig) => Promise<{
|
|
135
|
+
count: number;
|
|
136
|
+
segments: {
|
|
137
|
+
text: string;
|
|
138
|
+
startOffset: number;
|
|
139
|
+
endOffset: number;
|
|
140
|
+
}[];
|
|
141
|
+
}>;
|
|
142
|
+
declare module "@workglow/task-graph" {
|
|
143
|
+
interface Workflow {
|
|
144
|
+
topicSegmenter: CreateWorkflow<TopicSegmenterTaskInput, TopicSegmenterTaskOutput, JobQueueTaskConfig>;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
export {};
|
|
148
|
+
//# sourceMappingURL=TopicSegmenterTask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TopicSegmenterTask.d.ts","sourceRoot":"","sources":["../../src/task/TopicSegmenterTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,IAAI,EAEL,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5D,eAAO,MAAM,kBAAkB;;;;CAIrB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE9F,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCkB,CAAC;AAEpC,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BiB,CAAC;AAEpC,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AACrE,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AAEvE;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,IAAI,CAC1C,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,CACnB;IACC,OAAc,IAAI,SAAwB;IAC1C,OAAc,QAAQ,SAAc;IACpC,OAAc,KAAK,SAAqB;IACxC,OAAc,WAAW,SAAkE;IAC3F,OAAc,SAAS,UAAQ;IAC/B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAO;WAErC,WAAW,IAAI,cAAc;WAI7B,YAAY,IAAI,cAAc;IAItC,OAAO,CACX,KAAK,EAAE,uBAAuB,EAC9B,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,wBAAwB,CAAC;IAqCpC;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAuD7B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IA0D7B;;OAEG;IACH,OAAO,CAAC,cAAc;IA0BtB,OAAO,CAAC,yBAAyB;IAkBjC;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAiB3B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAU3B;;OAEG;IACH,OAAO,CAAC,aAAa;IAarB;;OAEG;IACH,OAAO,CAAC,kBAAkB;CAyC3B;AAED,eAAO,MAAM,cAAc,GAAI,OAAO,uBAAuB,EAAE,SAAS,kBAAkB;;;;;;;EAEzF,CAAC;AAEF,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,QAAQ;QAChB,cAAc,EAAE,cAAc,CAC5B,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,CACnB,CAAC;KACH;CACF"}
|