@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
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { TaskInput, TaskOutput } from "@workglow/task-graph";
|
|
7
7
|
import type { WorkerServerBase as WorkerServer } from "@workglow/util/worker";
|
|
8
8
|
import type { ModelConfig } from "../model/ModelSchema";
|
|
9
|
-
import type {
|
|
9
|
+
import type { AiProviderPreviewRunFn, AiProviderRunFn, AiProviderStreamFn } from "./AiProviderRegistry";
|
|
10
10
|
/**
|
|
11
11
|
* Job queue concurrency: one limit for the primary ({@link QueuedAiProvider} hardware) queue,
|
|
12
12
|
* or per-slot limits. Hugging Face Transformers ONNX uses `gpu` and `cpu` for its two queues.
|
|
@@ -115,12 +115,12 @@ export declare abstract class AiProvider<TModelConfig extends ModelConfig = Mode
|
|
|
115
115
|
*/
|
|
116
116
|
protected readonly streamTasks?: Record<string, AiProviderStreamFn<any, any, TModelConfig>>;
|
|
117
117
|
/**
|
|
118
|
-
* Map of task type names to their
|
|
118
|
+
* Map of task type names to their preview run functions.
|
|
119
119
|
* Injected via constructor alongside `tasks`. Only needed for tasks that
|
|
120
|
-
* provide lightweight
|
|
120
|
+
* provide lightweight previews via executePreview().
|
|
121
121
|
*/
|
|
122
|
-
protected readonly
|
|
123
|
-
constructor(tasks?: Record<string, AiProviderRunFn<any, any, TModelConfig>>, streamTasks?: Record<string, AiProviderStreamFn<any, any, TModelConfig>>,
|
|
122
|
+
protected readonly previewTasks?: Record<string, AiProviderPreviewRunFn<any, any, TModelConfig>>;
|
|
123
|
+
constructor(tasks?: Record<string, AiProviderRunFn<any, any, TModelConfig>>, streamTasks?: Record<string, AiProviderStreamFn<any, any, TModelConfig>>, previewTasks?: Record<string, AiProviderPreviewRunFn<any, any, TModelConfig>>);
|
|
124
124
|
/** Get all task type names this provider supports */
|
|
125
125
|
get supportedTaskTypes(): readonly string[];
|
|
126
126
|
/**
|
|
@@ -136,11 +136,11 @@ export declare abstract class AiProvider<TModelConfig extends ModelConfig = Mode
|
|
|
136
136
|
*/
|
|
137
137
|
getStreamFn<I extends TaskInput = TaskInput, O extends TaskOutput = TaskOutput>(taskType: string): AiProviderStreamFn<I, O, TModelConfig> | undefined;
|
|
138
138
|
/**
|
|
139
|
-
* Get the
|
|
139
|
+
* Get the preview run function for a specific task type.
|
|
140
140
|
* @param taskType - The task type name (e.g., "CountTokensTask")
|
|
141
|
-
* @returns The
|
|
141
|
+
* @returns The preview function, or undefined if not supported for this task type
|
|
142
142
|
*/
|
|
143
|
-
|
|
143
|
+
getPreviewRunFn<I extends TaskInput = TaskInput, O extends TaskOutput = TaskOutput>(taskType: string): AiProviderPreviewRunFn<I, O, TModelConfig> | undefined;
|
|
144
144
|
/**
|
|
145
145
|
* Register this provider on the main thread.
|
|
146
146
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiProvider.d.ts","sourceRoot":"","sources":["../../src/provider/AiProvider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"AiProvider.d.ts","sourceRoot":"","sources":["../../src/provider/AiProvider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE9E,OAAO,KAAK,E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AAC,EAAE,YAAY,CAAC,GAAG,SAAS,CAEpD;IAED;;;;OAIG;IACH,eAAe,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,EAAE,CAAC,SAAS,UAAU,GAAG,UAAU,EAChF,QAAQ,EAAE,MAAM,GACf,sBAAsB,CAAC,CAAC,EAAE,CAAC,EAAE,YAAY,CAAC,GAAG,SAAS,CAExD;IAED;;;;;;;;;OASG;IACG,QAAQ,CAAC,OAAO,GAAE,yBAA8B,GAAG,OAAO,CAAC,IAAI,CAAC,CAgErE;IAED;;;;;;;;OAQG;IACH,sBAAsB,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI,CAoBvD;IAED;;;;OAIG;IACH,UAAgB,YAAY,CAAC,QAAQ,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAG;IAEnF;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAG;IAEjC;;;;;;;OAOG;IACH,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAEzC;IAED;;;;OAIG;IACG,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAG;IAE1D;;;;OAIG;IACH,UAAgB,aAAa,CAAC,QAAQ,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAG;CACrF"}
|
|
@@ -17,11 +17,11 @@ import type { AiProvider } from "./AiProvider";
|
|
|
17
17
|
*/
|
|
18
18
|
export type AiProviderRunFn<Input extends TaskInput = TaskInput, Output extends TaskOutput = TaskOutput, Model extends ModelConfig = ModelConfig> = (input: Input, model: Model | undefined, update_progress: (progress: number, message?: string, details?: any) => void, signal: AbortSignal, outputSchema?: JsonSchema, sessionId?: string) => Promise<Output>;
|
|
19
19
|
/**
|
|
20
|
-
* Type for the
|
|
21
|
-
*
|
|
22
|
-
* No `signal` or `update_progress` --
|
|
20
|
+
* Type for the preview run function for AiTask.executePreview().
|
|
21
|
+
* Computes a fast preview from input alone -- no prior output needed.
|
|
22
|
+
* No `signal` or `update_progress` -- preview execution is lightweight and synchronous-ish.
|
|
23
23
|
*/
|
|
24
|
-
export type
|
|
24
|
+
export type AiProviderPreviewRunFn<Input extends TaskInput = TaskInput, Output extends TaskOutput = TaskOutput, Model extends ModelConfig = ModelConfig> = (input: Input, model: Model | undefined) => Promise<Output | undefined>;
|
|
25
25
|
/**
|
|
26
26
|
* Type for the streaming run function for the AiJob.
|
|
27
27
|
* Returns an AsyncIterable of StreamEvents instead of a Promise.
|
|
@@ -53,7 +53,7 @@ export type AiProviderStreamFn<Input extends TaskInput = TaskInput, Output exten
|
|
|
53
53
|
export declare class AiProviderRegistry {
|
|
54
54
|
runFnRegistry: Map<string, Map<string, AiProviderRunFn<any, any>>>;
|
|
55
55
|
streamFnRegistry: Map<string, Map<string, AiProviderStreamFn<any, any>>>;
|
|
56
|
-
|
|
56
|
+
previewRunFnRegistry: Map<string, Map<string, AiProviderPreviewRunFn<any, any>>>;
|
|
57
57
|
private providers;
|
|
58
58
|
private strategyResolvers;
|
|
59
59
|
private defaultStrategy;
|
|
@@ -63,7 +63,7 @@ export declare class AiProviderRegistry {
|
|
|
63
63
|
*/
|
|
64
64
|
registerProvider(provider: AiProvider<any>): void;
|
|
65
65
|
/**
|
|
66
|
-
* Removes a previously registered provider and all of its run/stream/
|
|
66
|
+
* Removes a previously registered provider and all of its run/stream/preview functions.
|
|
67
67
|
* Used for cleanup when provider initialization fails partway through.
|
|
68
68
|
* @param name - The provider name to unregister
|
|
69
69
|
*/
|
|
@@ -142,21 +142,21 @@ export declare class AiProviderRegistry {
|
|
|
142
142
|
*/
|
|
143
143
|
getStreamFn<Input extends TaskInput = TaskInput, Output extends TaskOutput = TaskOutput>(modelProvider: string, taskType: string): AiProviderStreamFn<Input, Output> | undefined;
|
|
144
144
|
/**
|
|
145
|
-
* Registers a worker-proxied
|
|
146
|
-
* Creates a proxy that delegates
|
|
147
|
-
* Returns undefined (non-throwing) if the worker has no
|
|
145
|
+
* Registers a worker-proxied preview function for a specific task type and model provider.
|
|
146
|
+
* Creates a proxy that delegates preview execution to a Web Worker via WorkerManager.
|
|
147
|
+
* Returns undefined (non-throwing) if the worker has no preview function for the task type.
|
|
148
148
|
*/
|
|
149
|
-
|
|
149
|
+
registerAsWorkerPreviewRunFn<Input extends TaskInput = TaskInput, Output extends TaskOutput = TaskOutput>(modelProvider: string, taskType: string): void;
|
|
150
150
|
/**
|
|
151
|
-
* Registers a
|
|
152
|
-
* Called by AiTask.
|
|
151
|
+
* Registers a preview execution function for a specific task type and model provider.
|
|
152
|
+
* Called by AiTask.executePreview() to provide a fast, lightweight preview without a network call.
|
|
153
153
|
*/
|
|
154
|
-
|
|
154
|
+
registerPreviewRunFn<Input extends TaskInput = TaskInput, Output extends TaskOutput = TaskOutput>(modelProvider: string, taskType: string, previewRunFn: AiProviderPreviewRunFn<Input, Output>): void;
|
|
155
155
|
/**
|
|
156
|
-
* Retrieves the
|
|
157
|
-
* Returns undefined if no
|
|
156
|
+
* Retrieves the preview execution function for a task type and model provider.
|
|
157
|
+
* Returns undefined if no preview function is registered (fallback to default behavior).
|
|
158
158
|
*/
|
|
159
|
-
|
|
159
|
+
getPreviewRunFn<Input extends TaskInput = TaskInput, Output extends TaskOutput = TaskOutput>(modelProvider: string, taskType: string): AiProviderPreviewRunFn<Input, Output> | undefined;
|
|
160
160
|
/**
|
|
161
161
|
* Retrieves the direct execution function for a task type and model
|
|
162
162
|
* Bypasses the job queue system for immediate execution
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiProviderRegistry.d.ts","sourceRoot":"","sources":["../../src/provider/AiProviderRegistry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAA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,KAAK,SAAS,SAAS,GAAG,SAAS,EAAE,MAAM,SAAS,UAAU,GAAG,UAAU,EACzF,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,GACf,sBAAsB,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,SAAS,CAGnD;IAED;;;OAGG;IACH,cAAc,CAAC,KAAK,SAAS,SAAS,GAAG,SAAS,EAAE,MAAM,SAAS,UAAU,GAAG,UAAU,EACxF,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM;;;;;;;;;;;;;;;;OAkBjB;CACF;AAID,wBAAgB,qBAAqB,uBAEpC;AACD,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,kBAAkB,QAE3D"}
|
|
@@ -26,32 +26,16 @@ declare const inputSchema: {
|
|
|
26
26
|
}];
|
|
27
27
|
};
|
|
28
28
|
readonly query: {
|
|
29
|
-
readonly
|
|
30
|
-
readonly
|
|
31
|
-
readonly type: "string";
|
|
32
|
-
}, {
|
|
33
|
-
readonly type: "array";
|
|
34
|
-
readonly format: "TypedArray";
|
|
35
|
-
readonly title: "Typed Array";
|
|
36
|
-
readonly description: "A typed array (Float32Array, Int8Array, etc.)";
|
|
37
|
-
}];
|
|
38
|
-
readonly title: "Query";
|
|
39
|
-
readonly description: "Query string or pre-computed query vector";
|
|
29
|
+
readonly oneOf: readonly [{
|
|
30
|
+
readonly type: "string";
|
|
40
31
|
}, {
|
|
41
32
|
readonly type: "array";
|
|
42
|
-
readonly
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}, {
|
|
46
|
-
readonly type: "array";
|
|
47
|
-
readonly format: "TypedArray";
|
|
48
|
-
readonly title: "Typed Array";
|
|
49
|
-
readonly description: "A typed array (Float32Array, Int8Array, etc.)";
|
|
50
|
-
}];
|
|
51
|
-
readonly title: "Query";
|
|
52
|
-
readonly description: "Query string or pre-computed query vector";
|
|
53
|
-
};
|
|
33
|
+
readonly format: "TypedArray";
|
|
34
|
+
readonly title: "Typed Array";
|
|
35
|
+
readonly description: "A typed array (Float32Array, Int8Array, etc.)";
|
|
54
36
|
}];
|
|
37
|
+
readonly title: "Query";
|
|
38
|
+
readonly description: "Query string (requires `model`) or pre-computed query vector";
|
|
55
39
|
};
|
|
56
40
|
readonly model: {
|
|
57
41
|
readonly oneOf: readonly [{
|
|
@@ -127,6 +111,13 @@ declare const inputSchema: {
|
|
|
127
111
|
} & {
|
|
128
112
|
readonly format: import("./base/AiTaskSchemas").TypeModelSemantic;
|
|
129
113
|
};
|
|
114
|
+
readonly method: {
|
|
115
|
+
readonly type: "string";
|
|
116
|
+
readonly enum: readonly ["similarity", "hybrid"];
|
|
117
|
+
readonly title: "Retrieval Method";
|
|
118
|
+
readonly description: "Retrieval strategy: 'similarity' (vector only) or 'hybrid' (vector + full-text).";
|
|
119
|
+
readonly default: "similarity";
|
|
120
|
+
};
|
|
130
121
|
readonly topK: {
|
|
131
122
|
readonly type: "number";
|
|
132
123
|
readonly title: "Top K";
|
|
@@ -147,6 +138,14 @@ declare const inputSchema: {
|
|
|
147
138
|
readonly maximum: 1;
|
|
148
139
|
readonly default: 0;
|
|
149
140
|
};
|
|
141
|
+
readonly vectorWeight: {
|
|
142
|
+
readonly type: "number";
|
|
143
|
+
readonly title: "Vector Weight";
|
|
144
|
+
readonly description: "For hybrid method: weight for vector similarity (0-1), remainder goes to text relevance";
|
|
145
|
+
readonly minimum: 0;
|
|
146
|
+
readonly maximum: 1;
|
|
147
|
+
readonly default: 0.7;
|
|
148
|
+
};
|
|
150
149
|
readonly returnVectors: {
|
|
151
150
|
readonly type: "boolean";
|
|
152
151
|
readonly title: "Return Vectors";
|
|
@@ -222,32 +221,16 @@ declare const outputSchema: {
|
|
|
222
221
|
readonly description: "Number of results returned";
|
|
223
222
|
};
|
|
224
223
|
readonly query: {
|
|
225
|
-
readonly
|
|
226
|
-
readonly
|
|
227
|
-
readonly type: "string";
|
|
228
|
-
}, {
|
|
229
|
-
readonly type: "array";
|
|
230
|
-
readonly format: "TypedArray";
|
|
231
|
-
readonly title: "Typed Array";
|
|
232
|
-
readonly description: "A typed array (Float32Array, Int8Array, etc.)";
|
|
233
|
-
}];
|
|
234
|
-
readonly title: "Query";
|
|
235
|
-
readonly description: "The query used for retrieval (pass-through)";
|
|
224
|
+
readonly oneOf: readonly [{
|
|
225
|
+
readonly type: "string";
|
|
236
226
|
}, {
|
|
237
227
|
readonly type: "array";
|
|
238
|
-
readonly
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
}, {
|
|
242
|
-
readonly type: "array";
|
|
243
|
-
readonly format: "TypedArray";
|
|
244
|
-
readonly title: "Typed Array";
|
|
245
|
-
readonly description: "A typed array (Float32Array, Int8Array, etc.)";
|
|
246
|
-
}];
|
|
247
|
-
readonly title: "Query";
|
|
248
|
-
readonly description: "The query used for retrieval (pass-through)";
|
|
249
|
-
};
|
|
228
|
+
readonly format: "TypedArray";
|
|
229
|
+
readonly title: "Typed Array";
|
|
230
|
+
readonly description: "A typed array (Float32Array, Int8Array, etc.)";
|
|
250
231
|
}];
|
|
232
|
+
readonly title: "Query";
|
|
233
|
+
readonly description: "The query used for retrieval (pass-through)";
|
|
251
234
|
};
|
|
252
235
|
};
|
|
253
236
|
readonly required: readonly ["chunks", "chunk_ids", "metadata", "scores", "count", "query"];
|
|
@@ -257,8 +240,8 @@ export type ChunkRetrievalTaskInput = FromSchema<typeof inputSchema, TypedArrayS
|
|
|
257
240
|
export type ChunkRetrievalTaskOutput = FromSchema<typeof outputSchema, TypedArraySchemaOptions>;
|
|
258
241
|
export type ChunkRetrievalTaskConfig = TaskConfig<ChunkRetrievalTaskInput>;
|
|
259
242
|
/**
|
|
260
|
-
* End-to-end retrieval task that combines embedding
|
|
261
|
-
*
|
|
243
|
+
* End-to-end retrieval task that combines query embedding (if needed), vector
|
|
244
|
+
* search, and optional hybrid full-text search in a single step.
|
|
262
245
|
*/
|
|
263
246
|
export declare class ChunkRetrievalTask extends Task<ChunkRetrievalTaskInput, ChunkRetrievalTaskOutput, ChunkRetrievalTaskConfig> {
|
|
264
247
|
static type: string;
|
|
@@ -277,7 +260,7 @@ export declare const chunkRetrieval: (input: ChunkRetrievalTaskInput, config?: C
|
|
|
277
260
|
metadata: {
|
|
278
261
|
[x: string]: unknown;
|
|
279
262
|
}[];
|
|
280
|
-
query: string |
|
|
263
|
+
query: string | TypedArray;
|
|
281
264
|
scores: number[];
|
|
282
265
|
vectors?: TypedArray[] | undefined;
|
|
283
266
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChunkRetrievalTask.d.ts","sourceRoot":"","sources":["../../src/task/ChunkRetrievalTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,IAAI,EAAY,MAAM,sBAAsB,CAAC;AACvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,cAAc,EACd,UAAU,EAEV,UAAU,EAEV,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAK/B,QAAA,MAAM,WAAW;mBACT,QAAQ
|
|
1
|
+
{"version":3,"file":"ChunkRetrievalTask.d.ts","sourceRoot":"","sources":["../../src/task/ChunkRetrievalTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,IAAI,EAAY,MAAM,sBAAsB,CAAC;AACvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,cAAc,EACd,UAAU,EAEV,UAAU,EAEV,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAK/B,QAAA,MAAM,WAAW;mBACT,QAAQ;;;;;;;;;;;;;;;;;;;;+BAQA,QAAQ;;;;;;;4BAMX,OAAO;kCACD,8DAA8D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAQ3E,IAAI,EAA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AuB,EACvB,wBAAwB,EACxB,wBAAwB,CACzB,CAAC;KACH;CACF"}
|
|
@@ -25,12 +25,105 @@ declare const inputSchema: {
|
|
|
25
25
|
readonly additionalProperties: true;
|
|
26
26
|
}];
|
|
27
27
|
};
|
|
28
|
-
readonly
|
|
29
|
-
readonly type: "
|
|
30
|
-
readonly
|
|
31
|
-
|
|
28
|
+
readonly chunks: {
|
|
29
|
+
readonly type: "array";
|
|
30
|
+
readonly items: {
|
|
31
|
+
readonly type: "object";
|
|
32
|
+
readonly properties: {
|
|
33
|
+
readonly chunkId: {
|
|
34
|
+
readonly type: "string";
|
|
35
|
+
readonly title: "Chunk ID";
|
|
36
|
+
readonly description: "Unique identifier for this chunk";
|
|
37
|
+
};
|
|
38
|
+
readonly doc_id: {
|
|
39
|
+
readonly type: "string";
|
|
40
|
+
readonly title: "Document ID";
|
|
41
|
+
readonly description: "ID of the parent document";
|
|
42
|
+
};
|
|
43
|
+
readonly text: {
|
|
44
|
+
readonly type: "string";
|
|
45
|
+
readonly title: "Text";
|
|
46
|
+
readonly description: "Text content of the chunk";
|
|
47
|
+
};
|
|
48
|
+
readonly nodePath: {
|
|
49
|
+
readonly type: "array";
|
|
50
|
+
readonly items: {
|
|
51
|
+
readonly type: "string";
|
|
52
|
+
};
|
|
53
|
+
readonly title: "Node Path";
|
|
54
|
+
readonly description: "Node IDs from root to leaf";
|
|
55
|
+
};
|
|
56
|
+
readonly depth: {
|
|
57
|
+
readonly type: "integer";
|
|
58
|
+
readonly title: "Depth";
|
|
59
|
+
readonly description: "Depth in the document tree";
|
|
60
|
+
};
|
|
61
|
+
readonly leafNodeId: {
|
|
62
|
+
readonly type: "string";
|
|
63
|
+
readonly title: "Leaf Node ID";
|
|
64
|
+
readonly description: "ID of the leaf node this chunk belongs to";
|
|
65
|
+
};
|
|
66
|
+
readonly summary: {
|
|
67
|
+
readonly type: "string";
|
|
68
|
+
readonly title: "Summary";
|
|
69
|
+
readonly description: "Summary of the chunk content";
|
|
70
|
+
};
|
|
71
|
+
readonly entities: {
|
|
72
|
+
readonly type: "array";
|
|
73
|
+
readonly items: {
|
|
74
|
+
readonly type: "object";
|
|
75
|
+
readonly properties: {
|
|
76
|
+
readonly text: {
|
|
77
|
+
readonly type: "string";
|
|
78
|
+
readonly title: "Text";
|
|
79
|
+
readonly description: "Entity text";
|
|
80
|
+
};
|
|
81
|
+
readonly type: {
|
|
82
|
+
readonly type: "string";
|
|
83
|
+
readonly title: "Type";
|
|
84
|
+
readonly description: "Entity type (e.g., PERSON, ORG, LOC)";
|
|
85
|
+
};
|
|
86
|
+
readonly score: {
|
|
87
|
+
readonly type: "number";
|
|
88
|
+
readonly title: "Score";
|
|
89
|
+
readonly description: "Confidence score";
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
readonly required: readonly ["text", "type", "score"];
|
|
93
|
+
readonly additionalProperties: false;
|
|
94
|
+
};
|
|
95
|
+
readonly title: "Entities";
|
|
96
|
+
readonly description: "Named entities extracted from the chunk";
|
|
97
|
+
};
|
|
98
|
+
readonly parentSummaries: {
|
|
99
|
+
readonly type: "array";
|
|
100
|
+
readonly items: {
|
|
101
|
+
readonly type: "string";
|
|
102
|
+
};
|
|
103
|
+
readonly title: "Parent Summaries";
|
|
104
|
+
readonly description: "Summaries from ancestor nodes";
|
|
105
|
+
};
|
|
106
|
+
readonly sectionTitles: {
|
|
107
|
+
readonly type: "array";
|
|
108
|
+
readonly items: {
|
|
109
|
+
readonly type: "string";
|
|
110
|
+
};
|
|
111
|
+
readonly title: "Section Titles";
|
|
112
|
+
readonly description: "Titles of ancestor section nodes";
|
|
113
|
+
};
|
|
114
|
+
readonly doc_title: {
|
|
115
|
+
readonly type: "string";
|
|
116
|
+
readonly title: "Document Title";
|
|
117
|
+
readonly description: "Title of the parent document";
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
readonly required: readonly ["chunkId", "doc_id", "text", "nodePath", "depth"];
|
|
121
|
+
readonly additionalProperties: true;
|
|
122
|
+
};
|
|
123
|
+
readonly title: "Chunk Records";
|
|
124
|
+
readonly description: "Array of chunk records";
|
|
32
125
|
};
|
|
33
|
-
readonly
|
|
126
|
+
readonly vector: {
|
|
34
127
|
readonly anyOf: readonly [{
|
|
35
128
|
readonly type: "array";
|
|
36
129
|
readonly format: "TypedArray";
|
|
@@ -46,24 +139,13 @@ declare const inputSchema: {
|
|
|
46
139
|
};
|
|
47
140
|
}];
|
|
48
141
|
};
|
|
49
|
-
readonly
|
|
50
|
-
readonly
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
readonly description: "Metadata associated with the vector";
|
|
54
|
-
readonly additionalProperties: true;
|
|
55
|
-
}, {
|
|
56
|
-
readonly type: "array";
|
|
57
|
-
readonly items: {
|
|
58
|
-
readonly type: "object";
|
|
59
|
-
readonly title: "Metadata";
|
|
60
|
-
readonly description: "Metadata associated with the vector";
|
|
61
|
-
readonly additionalProperties: true;
|
|
62
|
-
};
|
|
63
|
-
}];
|
|
142
|
+
readonly doc_title: {
|
|
143
|
+
readonly type: "string";
|
|
144
|
+
readonly title: "Document Title";
|
|
145
|
+
readonly description: "Optional human-readable title stamped onto each chunk's metadata";
|
|
64
146
|
};
|
|
65
147
|
};
|
|
66
|
-
readonly required: readonly ["knowledgeBase", "
|
|
148
|
+
readonly required: readonly ["knowledgeBase", "chunks", "vector"];
|
|
67
149
|
readonly additionalProperties: false;
|
|
68
150
|
};
|
|
69
151
|
declare const outputSchema: {
|
|
@@ -77,7 +159,7 @@ declare const outputSchema: {
|
|
|
77
159
|
readonly doc_id: {
|
|
78
160
|
readonly type: "string";
|
|
79
161
|
readonly title: "Document ID";
|
|
80
|
-
readonly description: "The document ID";
|
|
162
|
+
readonly description: "The document ID (read from the first chunk)";
|
|
81
163
|
};
|
|
82
164
|
readonly chunk_ids: {
|
|
83
165
|
readonly type: "array";
|
|
@@ -95,8 +177,9 @@ export type VectorStoreUpsertTaskInput = FromSchema<typeof inputSchema, TypedArr
|
|
|
95
177
|
export type VectorStoreUpsertTaskOutput = FromSchema<typeof outputSchema>;
|
|
96
178
|
export type ChunkVectorUpsertTaskConfig = TaskConfig<VectorStoreUpsertTaskInput>;
|
|
97
179
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
180
|
+
* Upsert chunks + their embeddings into a knowledge base in a single step.
|
|
181
|
+
* Consumes the output of `HierarchicalChunkerTask` (chunks) and
|
|
182
|
+
* `TextEmbeddingTask` (vector) directly — no intermediate transform task needed.
|
|
100
183
|
*/
|
|
101
184
|
export declare class ChunkVectorUpsertTask extends Task<VectorStoreUpsertTaskInput, VectorStoreUpsertTaskOutput, ChunkVectorUpsertTaskConfig> {
|
|
102
185
|
static type: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChunkVectorUpsertTask.d.ts","sourceRoot":"","sources":["../../src/task/ChunkVectorUpsertTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"ChunkVectorUpsertTask.d.ts","sourceRoot":"","sources":["../../src/task/ChunkVectorUpsertTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,IAAI,EAAY,MAAM,sBAAsB,CAAC;AACvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,cAAc,EACd,UAAU,EAGV,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAG/B,QAAA,MAAM,WAAW;mBACT,QAAQ;;iBAEZ,aAAa;;;;;;;;;;;;;;;;iBAIb,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBACN,MAAM;;;;;;;;;;;;;;;;iBAMN,SAAS;qBACP,IAAI,EAAE,QAAQ;qBACd,KAAK,EAAE,gBAAgB;qBACvB,WAAW,EAAE,kEAAkE;;;;;CAKlD,C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;KACH;CACF"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { CreateWorkflow,
|
|
6
|
+
import { CreateWorkflow, IExecuteContext, IExecutePreviewContext, Task } from "@workglow/task-graph";
|
|
7
7
|
import type { TaskConfig } from "@workglow/task-graph";
|
|
8
8
|
import { DataPortSchema, FromSchema } from "@workglow/util/schema";
|
|
9
9
|
export declare const ContextFormat: {
|
|
@@ -200,7 +200,8 @@ export declare class ContextBuilderTask extends Task<ContextBuilderTaskInput, Co
|
|
|
200
200
|
static cacheable: boolean;
|
|
201
201
|
static inputSchema(): DataPortSchema;
|
|
202
202
|
static outputSchema(): DataPortSchema;
|
|
203
|
-
|
|
203
|
+
execute(input: ContextBuilderTaskInput, context: IExecuteContext): Promise<ContextBuilderTaskOutput>;
|
|
204
|
+
executePreview(input: ContextBuilderTaskInput, context: IExecutePreviewContext): Promise<ContextBuilderTaskOutput>;
|
|
204
205
|
private formatChunk;
|
|
205
206
|
private formatNumbered;
|
|
206
207
|
private formatXML;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextBuilderTask.d.ts","sourceRoot":"","sources":["../../src/task/ContextBuilderTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"ContextBuilderTask.d.ts","sourceRoot":"","sources":["../../src/task/ContextBuilderTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,IAAI,EAEL,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInE,eAAO,MAAM,aAAa;aACxB,MAAM,EAAE,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