@workglow/ai 0.2.15 → 0.2.17
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 +11 -15
- package/dist/browser.js +544 -1033
- package/dist/browser.js.map +17 -20
- package/dist/bun.js +544 -1033
- package/dist/bun.js.map +17 -20
- package/dist/node.js +544 -1033
- package/dist/node.js.map +17 -20
- package/dist/provider/AiProvider.d.ts +8 -8
- package/dist/provider/AiProvider.d.ts.map +1 -1
- package/dist/provider/AiProviderRegistry.d.ts +16 -16
- package/dist/provider/AiProviderRegistry.d.ts.map +1 -1
- package/dist/task/ChunkRetrievalTask.d.ts +32 -49
- package/dist/task/ChunkRetrievalTask.d.ts.map +1 -1
- package/dist/task/ChunkVectorUpsertTask.d.ts +107 -24
- package/dist/task/ChunkVectorUpsertTask.d.ts.map +1 -1
- package/dist/task/ContextBuilderTask.d.ts +3 -2
- package/dist/task/ContextBuilderTask.d.ts.map +1 -1
- package/dist/task/HierarchyJoinTask.d.ts +44 -42
- package/dist/task/HierarchyJoinTask.d.ts.map +1 -1
- package/dist/task/QueryExpanderTask.d.ts +5 -31
- package/dist/task/QueryExpanderTask.d.ts.map +1 -1
- package/dist/task/RerankerTask.d.ts +7 -89
- package/dist/task/RerankerTask.d.ts.map +1 -1
- package/dist/task/TextChunkerTask.d.ts +139 -37
- package/dist/task/TextChunkerTask.d.ts.map +1 -1
- package/dist/task/VectorQuantizeTask.d.ts +2 -1
- package/dist/task/VectorQuantizeTask.d.ts.map +1 -1
- package/dist/task/VectorSimilarityTask.d.ts +2 -4
- package/dist/task/VectorSimilarityTask.d.ts.map +1 -1
- package/dist/task/base/AiTask.d.ts +4 -4
- package/dist/task/base/AiTask.d.ts.map +1 -1
- package/dist/task/index.d.ts +1 -7
- package/dist/task/index.d.ts.map +1 -1
- package/dist/worker.js +25 -26
- package/dist/worker.js.map +4 -4
- package/package.json +11 -11
- package/dist/task/ChunkToVectorTask.d.ts +0 -210
- package/dist/task/ChunkToVectorTask.d.ts.map +0 -1
- package/dist/task/ChunkVectorHybridSearchTask.d.ts +0 -167
- package/dist/task/ChunkVectorHybridSearchTask.d.ts.map +0 -1
- package/dist/task/ChunkVectorSearchTask.d.ts +0 -139
- package/dist/task/ChunkVectorSearchTask.d.ts.map +0 -1
|
@@ -25,22 +25,6 @@ declare const inputSchema: {
|
|
|
25
25
|
readonly additionalProperties: true;
|
|
26
26
|
}];
|
|
27
27
|
};
|
|
28
|
-
readonly chunks: {
|
|
29
|
-
readonly type: "array";
|
|
30
|
-
readonly items: {
|
|
31
|
-
readonly type: "string";
|
|
32
|
-
};
|
|
33
|
-
readonly title: "Chunks";
|
|
34
|
-
readonly description: "Retrieved text chunks";
|
|
35
|
-
};
|
|
36
|
-
readonly chunk_ids: {
|
|
37
|
-
readonly type: "array";
|
|
38
|
-
readonly items: {
|
|
39
|
-
readonly type: "string";
|
|
40
|
-
};
|
|
41
|
-
readonly title: "Chunk IDs";
|
|
42
|
-
readonly description: "IDs of retrieved chunks";
|
|
43
|
-
};
|
|
44
28
|
readonly metadata: {
|
|
45
29
|
readonly type: "array";
|
|
46
30
|
readonly items: {
|
|
@@ -139,13 +123,29 @@ declare const inputSchema: {
|
|
|
139
123
|
readonly title: "Chunk Records";
|
|
140
124
|
readonly description: "Array of chunk records";
|
|
141
125
|
};
|
|
126
|
+
readonly chunks: {
|
|
127
|
+
readonly type: "array";
|
|
128
|
+
readonly items: {
|
|
129
|
+
readonly type: "string";
|
|
130
|
+
};
|
|
131
|
+
readonly title: "Chunks";
|
|
132
|
+
readonly description: "Retrieved text chunks (pass-through)";
|
|
133
|
+
};
|
|
134
|
+
readonly chunk_ids: {
|
|
135
|
+
readonly type: "array";
|
|
136
|
+
readonly items: {
|
|
137
|
+
readonly type: "string";
|
|
138
|
+
};
|
|
139
|
+
readonly title: "Chunk IDs";
|
|
140
|
+
readonly description: "IDs of retrieved chunks (pass-through)";
|
|
141
|
+
};
|
|
142
142
|
readonly scores: {
|
|
143
143
|
readonly type: "array";
|
|
144
144
|
readonly items: {
|
|
145
145
|
readonly type: "number";
|
|
146
146
|
};
|
|
147
147
|
readonly title: "Scores";
|
|
148
|
-
readonly description: "Similarity scores
|
|
148
|
+
readonly description: "Similarity scores (pass-through)";
|
|
149
149
|
};
|
|
150
150
|
readonly includeParentSummaries: {
|
|
151
151
|
readonly type: "boolean";
|
|
@@ -160,28 +160,12 @@ declare const inputSchema: {
|
|
|
160
160
|
readonly default: true;
|
|
161
161
|
};
|
|
162
162
|
};
|
|
163
|
-
readonly required: readonly ["knowledgeBase", "
|
|
163
|
+
readonly required: readonly ["knowledgeBase", "metadata"];
|
|
164
164
|
readonly additionalProperties: false;
|
|
165
165
|
};
|
|
166
166
|
declare const outputSchema: {
|
|
167
167
|
readonly type: "object";
|
|
168
168
|
readonly properties: {
|
|
169
|
-
readonly chunks: {
|
|
170
|
-
readonly type: "array";
|
|
171
|
-
readonly items: {
|
|
172
|
-
readonly type: "string";
|
|
173
|
-
};
|
|
174
|
-
readonly title: "Chunks";
|
|
175
|
-
readonly description: "Retrieved text chunks";
|
|
176
|
-
};
|
|
177
|
-
readonly chunk_ids: {
|
|
178
|
-
readonly type: "array";
|
|
179
|
-
readonly items: {
|
|
180
|
-
readonly type: "string";
|
|
181
|
-
};
|
|
182
|
-
readonly title: "Chunk IDs";
|
|
183
|
-
readonly description: "IDs of retrieved chunks";
|
|
184
|
-
};
|
|
185
169
|
readonly metadata: {
|
|
186
170
|
readonly type: "array";
|
|
187
171
|
readonly items: {
|
|
@@ -280,29 +264,47 @@ declare const outputSchema: {
|
|
|
280
264
|
readonly title: "Chunk Records";
|
|
281
265
|
readonly description: "Array of chunk records";
|
|
282
266
|
};
|
|
267
|
+
readonly chunks: {
|
|
268
|
+
readonly type: "array";
|
|
269
|
+
readonly items: {
|
|
270
|
+
readonly type: "string";
|
|
271
|
+
};
|
|
272
|
+
readonly title: "Chunks";
|
|
273
|
+
readonly description: "Retrieved text chunks (pass-through)";
|
|
274
|
+
};
|
|
275
|
+
readonly chunk_ids: {
|
|
276
|
+
readonly type: "array";
|
|
277
|
+
readonly items: {
|
|
278
|
+
readonly type: "string";
|
|
279
|
+
};
|
|
280
|
+
readonly title: "Chunk IDs";
|
|
281
|
+
readonly description: "IDs of retrieved chunks (pass-through)";
|
|
282
|
+
};
|
|
283
283
|
readonly scores: {
|
|
284
284
|
readonly type: "array";
|
|
285
285
|
readonly items: {
|
|
286
286
|
readonly type: "number";
|
|
287
287
|
};
|
|
288
288
|
readonly title: "Scores";
|
|
289
|
-
readonly description: "Similarity scores";
|
|
289
|
+
readonly description: "Similarity scores (pass-through)";
|
|
290
290
|
};
|
|
291
291
|
readonly count: {
|
|
292
292
|
readonly type: "number";
|
|
293
293
|
readonly title: "Count";
|
|
294
|
-
readonly description: "Number of
|
|
294
|
+
readonly description: "Number of enriched records";
|
|
295
295
|
};
|
|
296
296
|
};
|
|
297
|
-
readonly required: readonly ["
|
|
297
|
+
readonly required: readonly ["metadata", "count"];
|
|
298
298
|
readonly additionalProperties: false;
|
|
299
299
|
};
|
|
300
300
|
export type HierarchyJoinTaskInput = FromSchema<typeof inputSchema>;
|
|
301
301
|
export type HierarchyJoinTaskOutput = FromSchema<typeof outputSchema>;
|
|
302
302
|
export type HierarchyJoinTaskConfig = TaskConfig<HierarchyJoinTaskInput>;
|
|
303
303
|
/**
|
|
304
|
-
*
|
|
305
|
-
*
|
|
304
|
+
* Enrich retrieval metadata with document-hierarchy context (parent summaries,
|
|
305
|
+
* section titles, ancestor entities). Consumes only the `metadata` port of an
|
|
306
|
+
* upstream retrieval task; other retrieval ports (chunks, chunk_ids, scores)
|
|
307
|
+
* flow around this task via the workflow DAG.
|
|
306
308
|
*/
|
|
307
309
|
export declare class HierarchyJoinTask extends Task<HierarchyJoinTaskInput, HierarchyJoinTaskOutput, HierarchyJoinTaskConfig> {
|
|
308
310
|
static type: string;
|
|
@@ -315,8 +317,8 @@ export declare class HierarchyJoinTask extends Task<HierarchyJoinTaskInput, Hier
|
|
|
315
317
|
execute(input: HierarchyJoinTaskInput, context: IExecuteContext): Promise<HierarchyJoinTaskOutput>;
|
|
316
318
|
}
|
|
317
319
|
export declare const hierarchyJoin: (input: HierarchyJoinTaskInput, config?: HierarchyJoinTaskConfig) => Promise<{
|
|
318
|
-
chunk_ids
|
|
319
|
-
chunks
|
|
320
|
+
chunk_ids?: string[] | undefined;
|
|
321
|
+
chunks?: string[] | undefined;
|
|
320
322
|
count: number;
|
|
321
323
|
metadata: {
|
|
322
324
|
[x: string]: unknown;
|
|
@@ -336,7 +338,7 @@ export declare const hierarchyJoin: (input: HierarchyJoinTaskInput, config?: Hie
|
|
|
336
338
|
summary?: string | undefined;
|
|
337
339
|
text: string;
|
|
338
340
|
}[];
|
|
339
|
-
scores
|
|
341
|
+
scores?: number[] | undefined;
|
|
340
342
|
}>;
|
|
341
343
|
declare module "@workglow/task-graph" {
|
|
342
344
|
interface Workflow {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HierarchyJoinTask.d.ts","sourceRoot":"","sources":["../../src/task/HierarchyJoinTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,IAAI,EAAY,MAAM,sBAAsB,CAAC;AACvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnE,QAAA,MAAM,WAAW;mBACT,QAAQ;;iBAEZ,aAAa;;;;;;;;;;;;;;;;iBAIb,MAAM;qBACJ,IAAI,EAAE,OAAO;qBACb,KAAK;yBAAI,IAAI,EAAE,QAAQ;;qBACvB,KAAK,EAAE,QAAQ;qBACf,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"HierarchyJoinTask.d.ts","sourceRoot":"","sources":["../../src/task/HierarchyJoinTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,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AChB,aAAa,EAAE,cAAc,CAC3B,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,CACxB,CAAC;KACH;CACF"}
|
|
@@ -8,9 +8,7 @@ import type { TaskConfig } from "@workglow/task-graph";
|
|
|
8
8
|
import { DataPortSchema, FromSchema } from "@workglow/util/schema";
|
|
9
9
|
export declare const QueryExpansionMethod: {
|
|
10
10
|
readonly MULTI_QUERY: "multi-query";
|
|
11
|
-
readonly HYDE: "hyde";
|
|
12
11
|
readonly SYNONYMS: "synonyms";
|
|
13
|
-
readonly PARAPHRASE: "paraphrase";
|
|
14
12
|
};
|
|
15
13
|
export type QueryExpansionMethod = (typeof QueryExpansionMethod)[keyof typeof QueryExpansionMethod];
|
|
16
14
|
declare const inputSchema: {
|
|
@@ -23,7 +21,7 @@ declare const inputSchema: {
|
|
|
23
21
|
};
|
|
24
22
|
readonly method: {
|
|
25
23
|
readonly type: "string";
|
|
26
|
-
readonly enum: ("
|
|
24
|
+
readonly enum: ("multi-query" | "synonyms")[];
|
|
27
25
|
readonly title: "Expansion Method";
|
|
28
26
|
readonly description: "Method to use for query expansion";
|
|
29
27
|
readonly default: "multi-query";
|
|
@@ -36,11 +34,6 @@ declare const inputSchema: {
|
|
|
36
34
|
readonly maximum: 10;
|
|
37
35
|
readonly default: 3;
|
|
38
36
|
};
|
|
39
|
-
readonly model: {
|
|
40
|
-
readonly type: "string";
|
|
41
|
-
readonly title: "Model";
|
|
42
|
-
readonly description: "LLM model to use for expansion (for HyDE and paraphrase methods)";
|
|
43
|
-
};
|
|
44
37
|
};
|
|
45
38
|
readonly required: readonly ["query"];
|
|
46
39
|
readonly additionalProperties: false;
|
|
@@ -79,11 +72,10 @@ export type QueryExpanderTaskInput = FromSchema<typeof inputSchema>;
|
|
|
79
72
|
export type QueryExpanderTaskOutput = FromSchema<typeof outputSchema>;
|
|
80
73
|
export type QueryExpanderTaskConfig = TaskConfig<QueryExpanderTaskInput>;
|
|
81
74
|
/**
|
|
82
|
-
*
|
|
83
|
-
* Supports
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* For now, this implements simple rule-based expansion.
|
|
75
|
+
* Rule-based query expansion for improved retrieval recall.
|
|
76
|
+
* Supports `multi-query` (question-word variations) and `synonyms` (keyword swaps).
|
|
77
|
+
* Note: LLM-driven methods (HyDE, paraphrase) were removed until a real
|
|
78
|
+
* implementation lands — use a TextGenerationTask upstream for those.
|
|
87
79
|
*/
|
|
88
80
|
export declare class QueryExpanderTask extends Task<QueryExpanderTaskInput, QueryExpanderTaskOutput, QueryExpanderTaskConfig> {
|
|
89
81
|
static type: string;
|
|
@@ -94,26 +86,8 @@ export declare class QueryExpanderTask extends Task<QueryExpanderTaskInput, Quer
|
|
|
94
86
|
static inputSchema(): DataPortSchema;
|
|
95
87
|
static outputSchema(): DataPortSchema;
|
|
96
88
|
execute(input: QueryExpanderTaskInput, context: IExecuteContext): Promise<QueryExpanderTaskOutput>;
|
|
97
|
-
/**
|
|
98
|
-
* Multi-query expansion: Generate variations by rephrasing the question
|
|
99
|
-
*/
|
|
100
89
|
private multiQueryExpansion;
|
|
101
|
-
/**
|
|
102
|
-
* HyDE (Hypothetical Document Embeddings): Generate hypothetical answers
|
|
103
|
-
*/
|
|
104
|
-
private hydeExpansion;
|
|
105
|
-
/**
|
|
106
|
-
* Synonym expansion: Replace keywords with synonyms
|
|
107
|
-
*/
|
|
108
90
|
private synonymExpansion;
|
|
109
|
-
/**
|
|
110
|
-
* Paraphrase expansion: Rephrase the query
|
|
111
|
-
* TODO: This should use an LLM for better paraphrasing
|
|
112
|
-
*/
|
|
113
|
-
private paraphraseExpansion;
|
|
114
|
-
/**
|
|
115
|
-
* Preserve capitalization pattern from original to new query
|
|
116
|
-
*/
|
|
117
91
|
private preserveCapitalization;
|
|
118
92
|
}
|
|
119
93
|
export declare const queryExpander: (input: QueryExpanderTaskInput, config?: QueryExpanderTaskConfig) => Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryExpanderTask.d.ts","sourceRoot":"","sources":["../../src/task/QueryExpanderTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,IAAI,EAAY,MAAM,sBAAsB,CAAC;AAEvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnE,eAAO,MAAM,oBAAoB;aAC/B,WAAW,EAAE,aAAa;aAC1B,
|
|
1
|
+
{"version":3,"file":"QueryExpanderTask.d.ts","sourceRoot":"","sources":["../../src/task/QueryExpanderTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,IAAI,EAAY,MAAM,sBAAsB,CAAC;AAEvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnE,eAAO,MAAM,oBAAoB;aAC/B,WAAW,EAAE,aAAa;aAC1B,QAAQ,EAAE,UAAU;CACZ,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAC;AAEpG,QAAA,MAAM,WAAW;mBACT,QAAQ;;iBAEZ,KAAK;qBACH,IAAI,EAAE,QAAQ;qBACd,KAAK,EAAE,OAAO;qBACd,WAAW,EAAE,8BAA8B;;iBAE7C,MAAM;qBACJ,IAAI,EAAE,QAAQ;qBACd,IAAI;qBACJ,KAAK,EAAE,kBAAkB;qBACzB,WAAW,EAAE,mCAAmC;qBAChD,OAAO;;iBAET,aAAa;qBACX,IAAI,EAAE,QAAQ;qBACd,KAAK,EAAE,sBAAsB;qBAC7B,WAAW,EAAE,wCAAwC;qBACrD,OAAO,EAAE,CAAC;qBACV,OAAO,EAAE,EAAE;qBAC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aAAa,UAAW,sBAAsB,WAAW,uBAAuB;;;;;EAE5F,CAAC;AAEF,OAAO,QAAQ,sBAAsB,CAAC,CAAC;IACrC,UAAU,QAAQ;QAChB,aAAa,EAAE,cAAc,CAC3B,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,CACxB,CAAC;KACH;CACF"}
|
|
@@ -48,85 +48,11 @@ declare const inputSchema: {
|
|
|
48
48
|
};
|
|
49
49
|
readonly method: {
|
|
50
50
|
readonly type: "string";
|
|
51
|
-
readonly enum: readonly ["
|
|
51
|
+
readonly enum: readonly ["reciprocal-rank-fusion", "simple"];
|
|
52
52
|
readonly title: "Reranking Method";
|
|
53
53
|
readonly description: "Method to use for reranking";
|
|
54
54
|
readonly default: "simple";
|
|
55
55
|
};
|
|
56
|
-
readonly model: {
|
|
57
|
-
readonly oneOf: readonly [{
|
|
58
|
-
readonly title: "Model";
|
|
59
|
-
readonly description: `The model ${string}`;
|
|
60
|
-
} & {
|
|
61
|
-
title: string;
|
|
62
|
-
description: string;
|
|
63
|
-
} & {
|
|
64
|
-
readonly format: import("./base/AiTaskSchemas").TypeModelSemantic;
|
|
65
|
-
readonly type: "string";
|
|
66
|
-
}, {
|
|
67
|
-
readonly type: "object";
|
|
68
|
-
readonly properties: {
|
|
69
|
-
readonly model_id: {
|
|
70
|
-
readonly type: "string";
|
|
71
|
-
};
|
|
72
|
-
readonly tasks: {
|
|
73
|
-
readonly type: "array";
|
|
74
|
-
readonly items: {
|
|
75
|
-
readonly type: "string";
|
|
76
|
-
};
|
|
77
|
-
readonly "x-ui-editor": "multiselect";
|
|
78
|
-
};
|
|
79
|
-
readonly title: {
|
|
80
|
-
readonly type: "string";
|
|
81
|
-
};
|
|
82
|
-
readonly description: {
|
|
83
|
-
readonly type: "string";
|
|
84
|
-
readonly "x-ui-editor": "textarea";
|
|
85
|
-
};
|
|
86
|
-
readonly provider: {
|
|
87
|
-
readonly type: "string";
|
|
88
|
-
};
|
|
89
|
-
readonly provider_config: {
|
|
90
|
-
readonly type: "object";
|
|
91
|
-
readonly properties: {
|
|
92
|
-
readonly credential_key: {
|
|
93
|
-
readonly type: "string";
|
|
94
|
-
readonly format: "credential";
|
|
95
|
-
readonly "x-ui-hidden": true;
|
|
96
|
-
};
|
|
97
|
-
readonly native_dimensions: {
|
|
98
|
-
readonly type: "integer";
|
|
99
|
-
readonly description: "Native output vector dimensions for embedding models";
|
|
100
|
-
};
|
|
101
|
-
readonly mrl: {
|
|
102
|
-
readonly type: "boolean";
|
|
103
|
-
readonly description: "Whether the model supports Matryoshka Representation Learning";
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
readonly additionalProperties: true;
|
|
107
|
-
readonly default: {};
|
|
108
|
-
};
|
|
109
|
-
readonly metadata: {
|
|
110
|
-
readonly type: "object";
|
|
111
|
-
readonly default: {};
|
|
112
|
-
readonly "x-ui-hidden": true;
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
|
-
readonly required: readonly ["provider", "provider_config"];
|
|
116
|
-
readonly format: "model";
|
|
117
|
-
readonly additionalProperties: true;
|
|
118
|
-
} & {
|
|
119
|
-
title: string;
|
|
120
|
-
description: string;
|
|
121
|
-
} & {
|
|
122
|
-
readonly format: import("./base/AiTaskSchemas").TypeModelSemantic;
|
|
123
|
-
}];
|
|
124
|
-
} & {
|
|
125
|
-
title: string;
|
|
126
|
-
description: string;
|
|
127
|
-
} & {
|
|
128
|
-
readonly format: import("./base/AiTaskSchemas").TypeModelSemantic;
|
|
129
|
-
};
|
|
130
56
|
};
|
|
131
57
|
readonly required: readonly ["query", "chunks"];
|
|
132
58
|
readonly additionalProperties: false;
|
|
@@ -181,11 +107,10 @@ export type RerankerTaskInput = FromSchema<typeof inputSchema>;
|
|
|
181
107
|
export type RerankerTaskOutput = FromSchema<typeof outputSchema>;
|
|
182
108
|
export type RerankerTaskConfig = TaskConfig<RerankerTaskInput>;
|
|
183
109
|
/**
|
|
184
|
-
*
|
|
185
|
-
* Supports
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
* For now, this implements simple heuristic-based reranking.
|
|
110
|
+
* Rerank retrieved chunks to improve relevance using in-process heuristics.
|
|
111
|
+
* Supports `simple` (keyword overlap + position) and `reciprocal-rank-fusion`.
|
|
112
|
+
* Note: a `cross-encoder` method will be added when a real cross-encoder
|
|
113
|
+
* task exists; until then, use a dedicated model task upstream.
|
|
189
114
|
*/
|
|
190
115
|
export declare class RerankerTask extends Task<RerankerTaskInput, RerankerTaskOutput, RerankerTaskConfig> {
|
|
191
116
|
static type: string;
|
|
@@ -196,16 +121,9 @@ export declare class RerankerTask extends Task<RerankerTaskInput, RerankerTaskOu
|
|
|
196
121
|
static inputSchema(): DataPortSchema;
|
|
197
122
|
static outputSchema(): DataPortSchema;
|
|
198
123
|
execute(input: RerankerTaskInput, context: IExecuteContext): Promise<RerankerTaskOutput>;
|
|
199
|
-
|
|
200
|
-
private extractCrossEncoderScore;
|
|
201
|
-
/**
|
|
202
|
-
* Simple heuristic-based reranking using keyword matching and position
|
|
203
|
-
*/
|
|
124
|
+
/** Simple heuristic reranking: keyword overlap + exact match bonus - position penalty */
|
|
204
125
|
private simpleRerank;
|
|
205
|
-
/**
|
|
206
|
-
* Reciprocal Rank Fusion for combining multiple rankings
|
|
207
|
-
* Useful when you have multiple retrieval methods
|
|
208
|
-
*/
|
|
126
|
+
/** Reciprocal Rank Fusion: 1 / (k + rank) — useful when combining multiple rankings */
|
|
209
127
|
private reciprocalRankFusion;
|
|
210
128
|
}
|
|
211
129
|
export declare const reranker: (input: RerankerTaskInput, config?: RerankerTaskConfig) => Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RerankerTask.d.ts","sourceRoot":"","sources":["../../src/task/RerankerTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,IAAI,EAAY,MAAM,sBAAsB,CAAC;AAEvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBA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I,cAAc,CAEpD;IAEc,OAAO,CACpB,KAAK,EAAE,iBAAiB,EACxB,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,kBAAkB,CAAC,CAyB7B;IAED,yFAAyF;IACzF,OAAO,CAAC,YAAY;IAoCpB,uFAAuF;IACvF,OAAO,CAAC,oBAAoB;CAW7B;AAED,eAAO,MAAM,QAAQ,UAAW,iBAAiB,WAAW,kBAAkB;;;;;;;;EAE7E,CAAC;AAEF,OAAO,QAAQ,sBAAsB,CAAC,CAAC;IACrC,UAAU,QAAQ;QAChB,QAAQ,EAAE,cAAc,CAAC,iBAAiB,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;KACrF;CACF"}
|
|
@@ -21,6 +21,11 @@ declare const inputSchema: {
|
|
|
21
21
|
readonly title: "Text";
|
|
22
22
|
readonly description: "The text to chunk";
|
|
23
23
|
};
|
|
24
|
+
readonly doc_id: {
|
|
25
|
+
readonly type: "string";
|
|
26
|
+
readonly title: "Document ID";
|
|
27
|
+
readonly description: "Optional document ID stamped onto each chunk. When omitted, chunks are emitted without a doc_id and the output also has no doc_id.";
|
|
28
|
+
};
|
|
24
29
|
readonly chunkSize: {
|
|
25
30
|
readonly type: "number";
|
|
26
31
|
readonly title: "Chunk Size";
|
|
@@ -49,47 +54,136 @@ declare const inputSchema: {
|
|
|
49
54
|
declare const outputSchema: {
|
|
50
55
|
readonly type: "object";
|
|
51
56
|
readonly properties: {
|
|
52
|
-
readonly
|
|
53
|
-
readonly type: "
|
|
54
|
-
readonly
|
|
55
|
-
|
|
56
|
-
};
|
|
57
|
-
readonly title: "Text Chunks";
|
|
58
|
-
readonly description: "The chunked text segments";
|
|
57
|
+
readonly doc_id: {
|
|
58
|
+
readonly type: "string";
|
|
59
|
+
readonly title: "Document ID";
|
|
60
|
+
readonly description: "The document ID (only emitted when provided in input)";
|
|
59
61
|
};
|
|
60
|
-
readonly
|
|
62
|
+
readonly chunks: {
|
|
61
63
|
readonly type: "array";
|
|
62
64
|
readonly items: {
|
|
63
65
|
readonly type: "object";
|
|
64
66
|
readonly properties: {
|
|
65
|
-
readonly
|
|
66
|
-
readonly type: "
|
|
67
|
+
readonly chunkId: {
|
|
68
|
+
readonly type: "string";
|
|
69
|
+
readonly title: "Chunk ID";
|
|
70
|
+
readonly description: "Unique identifier for this chunk";
|
|
71
|
+
};
|
|
72
|
+
readonly doc_id: {
|
|
73
|
+
readonly type: "string";
|
|
74
|
+
readonly title: "Document ID";
|
|
75
|
+
readonly description: "ID of the parent document";
|
|
76
|
+
};
|
|
77
|
+
readonly text: {
|
|
78
|
+
readonly type: "string";
|
|
79
|
+
readonly title: "Text";
|
|
80
|
+
readonly description: "Text content of the chunk";
|
|
81
|
+
};
|
|
82
|
+
readonly nodePath: {
|
|
83
|
+
readonly type: "array";
|
|
84
|
+
readonly items: {
|
|
85
|
+
readonly type: "string";
|
|
86
|
+
};
|
|
87
|
+
readonly title: "Node Path";
|
|
88
|
+
readonly description: "Node IDs from root to leaf";
|
|
67
89
|
};
|
|
68
|
-
readonly
|
|
69
|
-
readonly type: "
|
|
90
|
+
readonly depth: {
|
|
91
|
+
readonly type: "integer";
|
|
92
|
+
readonly title: "Depth";
|
|
93
|
+
readonly description: "Depth in the document tree";
|
|
70
94
|
};
|
|
71
|
-
readonly
|
|
72
|
-
readonly type: "
|
|
95
|
+
readonly leafNodeId: {
|
|
96
|
+
readonly type: "string";
|
|
97
|
+
readonly title: "Leaf Node ID";
|
|
98
|
+
readonly description: "ID of the leaf node this chunk belongs to";
|
|
73
99
|
};
|
|
74
|
-
readonly
|
|
75
|
-
readonly type: "
|
|
100
|
+
readonly summary: {
|
|
101
|
+
readonly type: "string";
|
|
102
|
+
readonly title: "Summary";
|
|
103
|
+
readonly description: "Summary of the chunk content";
|
|
104
|
+
};
|
|
105
|
+
readonly entities: {
|
|
106
|
+
readonly type: "array";
|
|
107
|
+
readonly items: {
|
|
108
|
+
readonly type: "object";
|
|
109
|
+
readonly properties: {
|
|
110
|
+
readonly text: {
|
|
111
|
+
readonly type: "string";
|
|
112
|
+
readonly title: "Text";
|
|
113
|
+
readonly description: "Entity text";
|
|
114
|
+
};
|
|
115
|
+
readonly type: {
|
|
116
|
+
readonly type: "string";
|
|
117
|
+
readonly title: "Type";
|
|
118
|
+
readonly description: "Entity type (e.g., PERSON, ORG, LOC)";
|
|
119
|
+
};
|
|
120
|
+
readonly score: {
|
|
121
|
+
readonly type: "number";
|
|
122
|
+
readonly title: "Score";
|
|
123
|
+
readonly description: "Confidence score";
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
readonly required: readonly ["text", "type", "score"];
|
|
127
|
+
readonly additionalProperties: false;
|
|
128
|
+
};
|
|
129
|
+
readonly title: "Entities";
|
|
130
|
+
readonly description: "Named entities extracted from the chunk";
|
|
131
|
+
};
|
|
132
|
+
readonly parentSummaries: {
|
|
133
|
+
readonly type: "array";
|
|
134
|
+
readonly items: {
|
|
135
|
+
readonly type: "string";
|
|
136
|
+
};
|
|
137
|
+
readonly title: "Parent Summaries";
|
|
138
|
+
readonly description: "Summaries from ancestor nodes";
|
|
139
|
+
};
|
|
140
|
+
readonly sectionTitles: {
|
|
141
|
+
readonly type: "array";
|
|
142
|
+
readonly items: {
|
|
143
|
+
readonly type: "string";
|
|
144
|
+
};
|
|
145
|
+
readonly title: "Section Titles";
|
|
146
|
+
readonly description: "Titles of ancestor section nodes";
|
|
147
|
+
};
|
|
148
|
+
readonly doc_title: {
|
|
149
|
+
readonly type: "string";
|
|
150
|
+
readonly title: "Document Title";
|
|
151
|
+
readonly description: "Title of the parent document";
|
|
76
152
|
};
|
|
77
153
|
};
|
|
78
|
-
readonly
|
|
154
|
+
readonly required: readonly ["chunkId", "doc_id", "text", "nodePath", "depth"];
|
|
155
|
+
readonly additionalProperties: true;
|
|
156
|
+
};
|
|
157
|
+
readonly title: "Chunk Records";
|
|
158
|
+
readonly description: "Array of chunk records";
|
|
159
|
+
};
|
|
160
|
+
readonly text: {
|
|
161
|
+
readonly type: "array";
|
|
162
|
+
readonly items: {
|
|
163
|
+
readonly type: "string";
|
|
79
164
|
};
|
|
80
|
-
readonly title: "
|
|
81
|
-
readonly description: "
|
|
165
|
+
readonly title: "Texts";
|
|
166
|
+
readonly description: "Chunk texts (for TextEmbeddingTask)";
|
|
167
|
+
};
|
|
168
|
+
readonly count: {
|
|
169
|
+
readonly type: "number";
|
|
170
|
+
readonly title: "Count";
|
|
171
|
+
readonly description: "Number of chunks generated";
|
|
82
172
|
};
|
|
83
173
|
};
|
|
84
|
-
readonly required: readonly ["chunks", "
|
|
174
|
+
readonly required: readonly ["chunks", "text", "count"];
|
|
85
175
|
readonly additionalProperties: false;
|
|
86
176
|
};
|
|
87
177
|
export type TextChunkerTaskInput = FromSchema<typeof inputSchema>;
|
|
88
178
|
export type TextChunkerTaskOutput = FromSchema<typeof outputSchema>;
|
|
89
179
|
export type TextChunkerTaskConfig = TaskConfig<TextChunkerTaskInput>;
|
|
90
180
|
/**
|
|
91
|
-
* Task for chunking text into smaller segments with configurable strategies.
|
|
92
|
-
*
|
|
181
|
+
* Task for chunking plain text into smaller segments with configurable strategies.
|
|
182
|
+
* Emits `ChunkRecord[]` so the output is interchangeable with HierarchicalChunkerTask
|
|
183
|
+
* and can feed directly into TextEmbeddingTask → ChunkVectorUpsertTask.
|
|
184
|
+
*
|
|
185
|
+
* Deterministic: identical inputs produce identical `chunkId`s (no random UUIDs),
|
|
186
|
+
* so this task is safe to mark cacheable.
|
|
93
187
|
*/
|
|
94
188
|
export declare class TextChunkerTask extends Task<TextChunkerTaskInput, TextChunkerTaskOutput, TextChunkerTaskConfig> {
|
|
95
189
|
static type: string;
|
|
@@ -100,27 +194,35 @@ export declare class TextChunkerTask extends Task<TextChunkerTaskInput, TextChun
|
|
|
100
194
|
static inputSchema(): DataPortSchema;
|
|
101
195
|
static outputSchema(): DataPortSchema;
|
|
102
196
|
execute(input: TextChunkerTaskInput, context: IExecuteContext): Promise<TextChunkerTaskOutput>;
|
|
103
|
-
/**
|
|
104
|
-
* Fixed-size chunking with overlap
|
|
105
|
-
*/
|
|
197
|
+
/** Fixed-size chunking with overlap */
|
|
106
198
|
private chunkFixed;
|
|
107
|
-
/**
|
|
108
|
-
* Sentence-based chunking that respects sentence boundaries
|
|
109
|
-
*/
|
|
199
|
+
/** Sentence-based chunking that respects sentence boundaries */
|
|
110
200
|
private chunkBySentence;
|
|
111
|
-
/**
|
|
112
|
-
* Paragraph-based chunking that respects paragraph boundaries
|
|
113
|
-
*/
|
|
201
|
+
/** Paragraph-based chunking that respects paragraph boundaries */
|
|
114
202
|
private chunkByParagraph;
|
|
115
203
|
}
|
|
116
204
|
export declare const textChunker: (input: TextChunkerTaskInput, config?: TextChunkerTaskConfig) => Promise<{
|
|
117
|
-
chunks:
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
205
|
+
chunks: {
|
|
206
|
+
[x: string]: unknown;
|
|
207
|
+
chunkId: string;
|
|
208
|
+
depth: number;
|
|
209
|
+
doc_id: string;
|
|
210
|
+
doc_title?: string | undefined;
|
|
211
|
+
entities?: {
|
|
212
|
+
score: number;
|
|
213
|
+
text: string;
|
|
214
|
+
type: string;
|
|
215
|
+
}[] | undefined;
|
|
216
|
+
leafNodeId?: string | undefined;
|
|
217
|
+
nodePath: string[];
|
|
218
|
+
parentSummaries?: string[] | undefined;
|
|
219
|
+
sectionTitles?: string[] | undefined;
|
|
220
|
+
summary?: string | undefined;
|
|
221
|
+
text: string;
|
|
123
222
|
}[];
|
|
223
|
+
count: number;
|
|
224
|
+
doc_id?: string | undefined;
|
|
225
|
+
text: string[];
|
|
124
226
|
}>;
|
|
125
227
|
declare module "@workglow/task-graph" {
|
|
126
228
|
interface Workflow {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextChunkerTask.d.ts","sourceRoot":"","sources":["../../src/task/TextChunkerTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"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;;;;;;;;;;;;;;;;;;;;;EAEtF,CAAC;AAEF,OAAO,QAAQ,sBAAsB,CAAC,CAAC;IACrC,UAAU,QAAQ;QAChB,WAAW,EAAE,cAAc,CAAC,oBAAoB,EAAE,qBAAqB,EAAE,qBAAqB,CAAC,CAAC;KACjG;CACF"}
|
|
@@ -96,7 +96,8 @@ export declare class VectorQuantizeTask extends Task<VectorQuantizeTaskInput, Ve
|
|
|
96
96
|
static cacheable: boolean;
|
|
97
97
|
static inputSchema(): DataPortSchema;
|
|
98
98
|
static outputSchema(): DataPortSchema;
|
|
99
|
-
|
|
99
|
+
execute(input: VectorQuantizeTaskInput): Promise<VectorQuantizeTaskOutput>;
|
|
100
|
+
executePreview(input: VectorQuantizeTaskInput): Promise<VectorQuantizeTaskOutput>;
|
|
100
101
|
private getVectorType;
|
|
101
102
|
private vectorQuantize;
|
|
102
103
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorQuantizeTask.d.ts","sourceRoot":"","sources":["../../src/task/VectorQuantizeTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,IAAI,EAAY,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,cAAc,EACd,UAAU,EAGV,UAAU,EAEV,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAE/B,QAAA,MAAM,WAAW;mBACT,QAAQ;;;;;;;;;+BASA,OAAO;;;;;;;;4BAOV,iBAAiB;kCACX,wCAAwC;;;qBAGrD,IAAI,EAAE,QAAQ;qBACd,IAAI;qBACJ,KAAK,EAAE,aAAa;qBACpB,WAAW,EAAE,0BAA0B;qBACvC,OAAO;;;qBAGP,IAAI,EAAE,SAAS;qBACf,KAAK,EAAE,WAAW;qBAClB,WAAW,EAAE,sCAAsC;qBACnD,OAAO;;;;;CAKsB,CAAC;AAEpC,QAAA,MAAM,YAAY;m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