@workglow/ai 0.0.85 → 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.
Files changed (114) hide show
  1. package/README.md +165 -34
  2. package/dist/browser.js +3947 -1449
  3. package/dist/browser.js.map +49 -38
  4. package/dist/bun.js +3947 -1449
  5. package/dist/bun.js.map +49 -38
  6. package/dist/common.d.ts +0 -3
  7. package/dist/common.d.ts.map +1 -1
  8. package/dist/model/ModelRegistry.d.ts +2 -2
  9. package/dist/model/ModelRegistry.d.ts.map +1 -1
  10. package/dist/model/ModelRepository.d.ts +3 -3
  11. package/dist/model/ModelRepository.d.ts.map +1 -1
  12. package/dist/node.js +3947 -1449
  13. package/dist/node.js.map +49 -38
  14. package/dist/task/BackgroundRemovalTask.d.ts +121 -289
  15. package/dist/task/BackgroundRemovalTask.d.ts.map +1 -1
  16. package/dist/task/ChunkRetrievalTask.d.ts +243 -0
  17. package/dist/task/ChunkRetrievalTask.d.ts.map +1 -0
  18. package/dist/task/ChunkToVectorTask.d.ts +183 -0
  19. package/dist/task/ChunkToVectorTask.d.ts.map +1 -0
  20. package/dist/task/ChunkVectorHybridSearchTask.d.ts +160 -0
  21. package/dist/task/ChunkVectorHybridSearchTask.d.ts.map +1 -0
  22. package/dist/task/ChunkVectorSearchTask.d.ts +137 -0
  23. package/dist/task/ChunkVectorSearchTask.d.ts.map +1 -0
  24. package/dist/task/ChunkVectorUpsertTask.d.ts +120 -0
  25. package/dist/task/ChunkVectorUpsertTask.d.ts.map +1 -0
  26. package/dist/task/ContextBuilderTask.d.ts +131 -0
  27. package/dist/task/ContextBuilderTask.d.ts.map +1 -0
  28. package/dist/task/DocumentEnricherTask.d.ts +232 -0
  29. package/dist/task/DocumentEnricherTask.d.ts.map +1 -0
  30. package/dist/task/DownloadModelTask.d.ts +79 -208
  31. package/dist/task/DownloadModelTask.d.ts.map +1 -1
  32. package/dist/task/FaceDetectorTask.d.ts +117 -272
  33. package/dist/task/FaceDetectorTask.d.ts.map +1 -1
  34. package/dist/task/FaceLandmarkerTask.d.ts +117 -272
  35. package/dist/task/FaceLandmarkerTask.d.ts.map +1 -1
  36. package/dist/task/GestureRecognizerTask.d.ts +129 -284
  37. package/dist/task/GestureRecognizerTask.d.ts.map +1 -1
  38. package/dist/task/HandLandmarkerTask.d.ts +125 -280
  39. package/dist/task/HandLandmarkerTask.d.ts.map +1 -1
  40. package/dist/task/HierarchicalChunkerTask.d.ts +212 -0
  41. package/dist/task/HierarchicalChunkerTask.d.ts.map +1 -0
  42. package/dist/task/HierarchyJoinTask.d.ts +318 -0
  43. package/dist/task/HierarchyJoinTask.d.ts.map +1 -0
  44. package/dist/task/ImageClassificationTask.d.ts +117 -272
  45. package/dist/task/ImageClassificationTask.d.ts.map +1 -1
  46. package/dist/task/ImageEmbeddingTask.d.ts +125 -446
  47. package/dist/task/ImageEmbeddingTask.d.ts.map +1 -1
  48. package/dist/task/ImageSegmentationTask.d.ts +117 -272
  49. package/dist/task/ImageSegmentationTask.d.ts.map +1 -1
  50. package/dist/task/ImageToTextTask.d.ts +117 -272
  51. package/dist/task/ImageToTextTask.d.ts.map +1 -1
  52. package/dist/task/ObjectDetectionTask.d.ts +119 -274
  53. package/dist/task/ObjectDetectionTask.d.ts.map +1 -1
  54. package/dist/task/PoseLandmarkerTask.d.ts +117 -272
  55. package/dist/task/PoseLandmarkerTask.d.ts.map +1 -1
  56. package/dist/task/QueryExpanderTask.d.ts +129 -0
  57. package/dist/task/QueryExpanderTask.d.ts.map +1 -0
  58. package/dist/task/RerankerTask.d.ts +209 -0
  59. package/dist/task/RerankerTask.d.ts.map +1 -0
  60. package/dist/task/StructuralParserTask.d.ts +91 -0
  61. package/dist/task/StructuralParserTask.d.ts.map +1 -0
  62. package/dist/task/TextChunkerTask.d.ts +129 -0
  63. package/dist/task/TextChunkerTask.d.ts.map +1 -0
  64. package/dist/task/TextClassificationTask.d.ts +42 -115
  65. package/dist/task/TextClassificationTask.d.ts.map +1 -1
  66. package/dist/task/TextEmbeddingTask.d.ts +55 -277
  67. package/dist/task/TextEmbeddingTask.d.ts.map +1 -1
  68. package/dist/task/TextFillMaskTask.d.ts +42 -115
  69. package/dist/task/TextFillMaskTask.d.ts.map +1 -1
  70. package/dist/task/TextGenerationTask.d.ts +44 -128
  71. package/dist/task/TextGenerationTask.d.ts.map +1 -1
  72. package/dist/task/TextLanguageDetectionTask.d.ts +42 -115
  73. package/dist/task/TextLanguageDetectionTask.d.ts.map +1 -1
  74. package/dist/task/TextNamedEntityRecognitionTask.d.ts +42 -115
  75. package/dist/task/TextNamedEntityRecognitionTask.d.ts.map +1 -1
  76. package/dist/task/TextQuestionAnswerTask.d.ts +47 -144
  77. package/dist/task/TextQuestionAnswerTask.d.ts.map +1 -1
  78. package/dist/task/TextRewriterTask.d.ts +45 -131
  79. package/dist/task/TextRewriterTask.d.ts.map +1 -1
  80. package/dist/task/TextSummaryTask.d.ts +42 -115
  81. package/dist/task/TextSummaryTask.d.ts.map +1 -1
  82. package/dist/task/TextTranslationTask.d.ts +54 -168
  83. package/dist/task/TextTranslationTask.d.ts.map +1 -1
  84. package/dist/task/TopicSegmenterTask.d.ts +148 -0
  85. package/dist/task/TopicSegmenterTask.d.ts.map +1 -0
  86. package/dist/task/UnloadModelTask.d.ts +79 -208
  87. package/dist/task/UnloadModelTask.d.ts.map +1 -1
  88. package/dist/task/VectorQuantizeTask.d.ts +120 -0
  89. package/dist/task/VectorQuantizeTask.d.ts.map +1 -0
  90. package/dist/task/VectorSimilarityTask.d.ts +18 -253
  91. package/dist/task/VectorSimilarityTask.d.ts.map +1 -1
  92. package/dist/task/base/AiTask.d.ts +24 -22
  93. package/dist/task/base/AiTask.d.ts.map +1 -1
  94. package/dist/task/base/AiTaskSchemas.d.ts +3 -127
  95. package/dist/task/base/AiTaskSchemas.d.ts.map +1 -1
  96. package/dist/task/base/AiVisionTask.d.ts +1 -4
  97. package/dist/task/base/AiVisionTask.d.ts.map +1 -1
  98. package/dist/task/index.d.ts +54 -1
  99. package/dist/task/index.d.ts.map +1 -1
  100. package/package.json +14 -9
  101. package/dist/source/Document.d.ts +0 -56
  102. package/dist/source/Document.d.ts.map +0 -1
  103. package/dist/source/DocumentConverter.d.ts +0 -15
  104. package/dist/source/DocumentConverter.d.ts.map +0 -1
  105. package/dist/source/DocumentConverterMarkdown.d.ts +0 -13
  106. package/dist/source/DocumentConverterMarkdown.d.ts.map +0 -1
  107. package/dist/source/DocumentConverterText.d.ts +0 -13
  108. package/dist/source/DocumentConverterText.d.ts.map +0 -1
  109. package/dist/source/MasterDocument.d.ts +0 -27
  110. package/dist/source/MasterDocument.d.ts.map +0 -1
  111. package/dist/source/index.d.ts +0 -10
  112. package/dist/source/index.d.ts.map +0 -1
  113. package/dist/task/DocumentSplitterTask.d.ts +0 -58
  114. package/dist/task/DocumentSplitterTask.d.ts.map +0 -1
@@ -0,0 +1,243 @@
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, TypedArray, TypedArraySchemaOptions } from "@workglow/util";
8
+ declare const inputSchema: {
9
+ readonly type: "object";
10
+ readonly properties: {
11
+ readonly dataset: {
12
+ readonly title: "Document Chunk Dataset";
13
+ readonly description: "Dataset ID or instance for document chunk data storage";
14
+ } & {
15
+ title: string;
16
+ description: string;
17
+ } & {
18
+ readonly format: "dataset:document-chunk";
19
+ readonly anyOf: readonly [{
20
+ readonly type: "string";
21
+ readonly title: "Dataset ID";
22
+ }, {
23
+ readonly title: "Dataset Instance";
24
+ readonly additionalProperties: true;
25
+ }];
26
+ };
27
+ readonly query: {
28
+ readonly anyOf: readonly [{
29
+ readonly oneOf: readonly [{
30
+ readonly type: "string";
31
+ }, {
32
+ readonly type: "array";
33
+ readonly format: "TypedArray";
34
+ readonly title: "Typed Array";
35
+ readonly description: "A typed array (Float32Array, Int8Array, etc.)";
36
+ }];
37
+ readonly title: "Query";
38
+ readonly description: "Query string or pre-computed query vector";
39
+ }, {
40
+ readonly type: "array";
41
+ readonly items: {
42
+ readonly oneOf: readonly [{
43
+ readonly type: "string";
44
+ }, {
45
+ readonly type: "array";
46
+ readonly format: "TypedArray";
47
+ readonly title: "Typed Array";
48
+ readonly description: "A typed array (Float32Array, Int8Array, etc.)";
49
+ }];
50
+ readonly title: "Query";
51
+ readonly description: "Query string or pre-computed query vector";
52
+ };
53
+ }];
54
+ };
55
+ readonly model: {
56
+ readonly oneOf: readonly [{
57
+ readonly title: "Model";
58
+ readonly description: `The model ${string}`;
59
+ } & {
60
+ title: string;
61
+ description: string;
62
+ } & {
63
+ readonly format: import("./base/AiTaskSchemas").TypeModelSemantic;
64
+ readonly type: "string";
65
+ }, {
66
+ readonly type: "object";
67
+ readonly properties: {
68
+ readonly model_id: {
69
+ readonly type: "string";
70
+ };
71
+ readonly tasks: {
72
+ readonly type: "array";
73
+ readonly items: {
74
+ readonly type: "string";
75
+ };
76
+ readonly "x-ui-editor": "multiselect";
77
+ };
78
+ readonly title: {
79
+ readonly type: "string";
80
+ };
81
+ readonly description: {
82
+ readonly type: "string";
83
+ readonly "x-ui-editor": "textarea";
84
+ };
85
+ readonly provider: {
86
+ readonly type: "string";
87
+ };
88
+ readonly provider_config: {
89
+ readonly type: "object";
90
+ readonly default: {};
91
+ };
92
+ readonly metadata: {
93
+ readonly type: "object";
94
+ readonly default: {};
95
+ readonly "x-ui-hidden": true;
96
+ };
97
+ };
98
+ readonly required: readonly ["provider", "provider_config"];
99
+ readonly format: "model";
100
+ readonly additionalProperties: false;
101
+ } & {
102
+ title: string;
103
+ description: string;
104
+ } & {
105
+ readonly format: import("./base/AiTaskSchemas").TypeModelSemantic;
106
+ }];
107
+ } & {
108
+ title: string;
109
+ description: string;
110
+ } & {
111
+ readonly format: import("./base/AiTaskSchemas").TypeModelSemantic;
112
+ };
113
+ readonly topK: {
114
+ readonly type: "number";
115
+ readonly title: "Top K";
116
+ readonly description: "Number of top results to return";
117
+ readonly minimum: 1;
118
+ readonly default: 5;
119
+ };
120
+ readonly filter: {
121
+ readonly type: "object";
122
+ readonly title: "Metadata Filter";
123
+ readonly description: "Filter results by metadata fields";
124
+ };
125
+ readonly scoreThreshold: {
126
+ readonly type: "number";
127
+ readonly title: "Score Threshold";
128
+ readonly description: "Minimum similarity score threshold (0-1)";
129
+ readonly minimum: 0;
130
+ readonly maximum: 1;
131
+ readonly default: 0;
132
+ };
133
+ readonly returnVectors: {
134
+ readonly type: "boolean";
135
+ readonly title: "Return Vectors";
136
+ readonly description: "Whether to return vector embeddings in results";
137
+ readonly default: false;
138
+ };
139
+ };
140
+ readonly required: readonly ["dataset", "query"];
141
+ readonly if: {
142
+ readonly properties: {
143
+ readonly query: {
144
+ readonly type: "string";
145
+ };
146
+ };
147
+ };
148
+ readonly then: {
149
+ readonly required: readonly ["dataset", "query", "model"];
150
+ };
151
+ readonly else: {};
152
+ readonly additionalProperties: false;
153
+ };
154
+ declare const outputSchema: {
155
+ readonly type: "object";
156
+ readonly properties: {
157
+ readonly chunks: {
158
+ readonly type: "array";
159
+ readonly items: {
160
+ readonly type: "string";
161
+ };
162
+ readonly title: "Text Chunks";
163
+ readonly description: "Retrieved text chunks";
164
+ };
165
+ readonly chunk_ids: {
166
+ readonly type: "array";
167
+ readonly items: {
168
+ readonly type: "string";
169
+ };
170
+ readonly title: "IDs";
171
+ readonly description: "IDs of retrieved chunks";
172
+ };
173
+ readonly metadata: {
174
+ readonly type: "array";
175
+ readonly items: {
176
+ readonly type: "object";
177
+ readonly title: "Metadata";
178
+ readonly description: "Metadata of retrieved chunk";
179
+ };
180
+ readonly title: "Metadata";
181
+ readonly description: "Metadata of retrieved chunks";
182
+ };
183
+ readonly scores: {
184
+ readonly type: "array";
185
+ readonly items: {
186
+ readonly type: "number";
187
+ };
188
+ readonly title: "Scores";
189
+ readonly description: "Similarity scores for each result";
190
+ };
191
+ readonly vectors: {
192
+ readonly type: "array";
193
+ readonly items: {
194
+ readonly type: "array";
195
+ readonly format: "TypedArray";
196
+ readonly title: "Typed Array";
197
+ readonly description: "A typed array (Float32Array, Int8Array, etc.)";
198
+ };
199
+ readonly title: "Vectors";
200
+ readonly description: "Vector embeddings (if returnVectors is true)";
201
+ };
202
+ readonly count: {
203
+ readonly type: "number";
204
+ readonly title: "Count";
205
+ readonly description: "Number of results returned";
206
+ };
207
+ };
208
+ readonly required: readonly ["chunks", "chunk_ids", "metadata", "scores", "count"];
209
+ readonly additionalProperties: false;
210
+ };
211
+ export type ChunkRetrievalTaskInput = FromSchema<typeof inputSchema, TypedArraySchemaOptions>;
212
+ export type ChunkRetrievalTaskOutput = FromSchema<typeof outputSchema, TypedArraySchemaOptions>;
213
+ /**
214
+ * End-to-end retrieval task that combines embedding generation (if needed) and vector search.
215
+ * Simplifies the RAG pipeline by handling the full retrieval process.
216
+ */
217
+ export declare class ChunkRetrievalTask extends Task<ChunkRetrievalTaskInput, ChunkRetrievalTaskOutput, JobQueueTaskConfig> {
218
+ static type: string;
219
+ static category: string;
220
+ static title: string;
221
+ static description: string;
222
+ static cacheable: boolean;
223
+ static inputSchema(): DataPortSchema;
224
+ static outputSchema(): DataPortSchema;
225
+ execute(input: ChunkRetrievalTaskInput, context: IExecuteContext): Promise<ChunkRetrievalTaskOutput>;
226
+ }
227
+ export declare const chunkRetrieval: (input: ChunkRetrievalTaskInput, config?: JobQueueTaskConfig) => Promise<{
228
+ vectors?: TypedArray[] | undefined;
229
+ metadata: {
230
+ [x: string]: unknown;
231
+ }[];
232
+ chunks: string[];
233
+ scores: number[];
234
+ chunk_ids: string[];
235
+ count: number;
236
+ }>;
237
+ declare module "@workglow/task-graph" {
238
+ interface Workflow {
239
+ chunkRetrieval: CreateWorkflow<ChunkRetrievalTaskInput, ChunkRetrievalTaskOutput, JobQueueTaskConfig>;
240
+ }
241
+ }
242
+ export {};
243
+ //# sourceMappingUR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AuB,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"}
@@ -0,0 +1,183 @@
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, TypedArraySchemaOptions } from "@workglow/util";
8
+ declare const inputSchema: {
9
+ readonly type: "object";
10
+ readonly properties: {
11
+ readonly doc_id: {
12
+ readonly type: "string";
13
+ readonly title: "Document ID";
14
+ readonly description: "The document ID";
15
+ };
16
+ readonly chunks: {
17
+ readonly type: "array";
18
+ readonly items: {
19
+ readonly type: "object";
20
+ readonly properties: {
21
+ readonly chunkId: {
22
+ readonly type: "string";
23
+ readonly title: "Chunk ID";
24
+ readonly description: "Unique identifier for this chunk";
25
+ };
26
+ readonly doc_id: {
27
+ readonly type: "string";
28
+ readonly title: "Document ID";
29
+ readonly description: "ID of the parent document";
30
+ };
31
+ readonly text: {
32
+ readonly type: "string";
33
+ readonly title: "Text";
34
+ readonly description: "Text content of the chunk";
35
+ };
36
+ readonly nodePath: {
37
+ readonly type: "array";
38
+ readonly items: {
39
+ readonly type: "string";
40
+ };
41
+ readonly title: "Node Path";
42
+ readonly description: "Node IDs from root to leaf";
43
+ };
44
+ readonly depth: {
45
+ readonly type: "integer";
46
+ readonly title: "Depth";
47
+ readonly description: "Depth in the document tree";
48
+ };
49
+ readonly enrichment: {
50
+ readonly type: "object";
51
+ readonly properties: {
52
+ readonly summary: {
53
+ readonly type: "string";
54
+ readonly title: "Summary";
55
+ readonly description: "Summary of the chunk content";
56
+ };
57
+ readonly entities: {
58
+ readonly type: "array";
59
+ readonly items: {
60
+ readonly type: "object";
61
+ readonly properties: {
62
+ readonly text: {
63
+ readonly type: "string";
64
+ readonly title: "Text";
65
+ readonly description: "Entity text";
66
+ };
67
+ readonly type: {
68
+ readonly type: "string";
69
+ readonly title: "Type";
70
+ readonly description: "Entity type (e.g., PERSON, ORG, LOC)";
71
+ };
72
+ readonly score: {
73
+ readonly type: "number";
74
+ readonly title: "Score";
75
+ readonly description: "Confidence score";
76
+ };
77
+ };
78
+ readonly required: readonly ["text", "type", "score"];
79
+ readonly additionalProperties: false;
80
+ };
81
+ readonly title: "Entities";
82
+ readonly description: "Named entities extracted from the chunk";
83
+ };
84
+ };
85
+ readonly additionalProperties: false;
86
+ };
87
+ };
88
+ readonly required: readonly ["chunkId", "doc_id", "text", "nodePath", "depth"];
89
+ readonly additionalProperties: false;
90
+ };
91
+ readonly title: "Chunks";
92
+ readonly description: "Array of chunk nodes";
93
+ };
94
+ readonly vectors: {
95
+ readonly type: "array";
96
+ readonly items: {
97
+ readonly type: "array";
98
+ readonly format: "TypedArray";
99
+ readonly title: "Typed Array";
100
+ readonly description: "A typed array (Float32Array, Int8Array, etc.)";
101
+ };
102
+ readonly title: "Vectors";
103
+ readonly description: "Embeddings from TextEmbeddingTask";
104
+ };
105
+ };
106
+ readonly required: readonly ["chunks", "vectors"];
107
+ readonly additionalProperties: false;
108
+ };
109
+ declare const outputSchema: {
110
+ readonly type: "object";
111
+ readonly properties: {
112
+ readonly ids: {
113
+ readonly type: "array";
114
+ readonly items: {
115
+ readonly type: "string";
116
+ };
117
+ readonly title: "IDs";
118
+ readonly description: "Chunk IDs for vector store";
119
+ };
120
+ readonly vectors: {
121
+ readonly type: "array";
122
+ readonly items: {
123
+ readonly type: "array";
124
+ readonly format: "TypedArray";
125
+ readonly title: "Typed Array";
126
+ readonly description: "A typed array (Float32Array, Int8Array, etc.)";
127
+ };
128
+ readonly title: "Vectors";
129
+ readonly description: "Vector embeddings";
130
+ };
131
+ readonly metadata: {
132
+ readonly type: "array";
133
+ readonly items: {
134
+ readonly type: "object";
135
+ readonly title: "Metadata";
136
+ readonly description: "Metadata for vector store";
137
+ };
138
+ readonly title: "Metadata";
139
+ readonly description: "Metadata for each vector";
140
+ };
141
+ readonly texts: {
142
+ readonly type: "array";
143
+ readonly items: {
144
+ readonly type: "string";
145
+ };
146
+ readonly title: "Texts";
147
+ readonly description: "Chunk texts (for reference)";
148
+ };
149
+ };
150
+ readonly required: readonly ["ids", "vectors", "metadata", "texts"];
151
+ readonly additionalProperties: false;
152
+ };
153
+ export type ChunkToVectorTaskInput = FromSchema<typeof inputSchema, TypedArraySchemaOptions>;
154
+ export type ChunkToVectorTaskOutput = FromSchema<typeof outputSchema, TypedArraySchemaOptions>;
155
+ /**
156
+ * Task to transform chunk nodes and embeddings into vector store format
157
+ * Bridges HierarchicalChunker + TextEmbedding → VectorStoreUpsert
158
+ */
159
+ export declare class ChunkToVectorTask extends Task<ChunkToVectorTaskInput, ChunkToVectorTaskOutput, JobQueueTaskConfig> {
160
+ static type: string;
161
+ static category: string;
162
+ static title: string;
163
+ static description: string;
164
+ static cacheable: boolean;
165
+ static inputSchema(): DataPortSchema;
166
+ static outputSchema(): DataPortSchema;
167
+ execute(input: ChunkToVectorTaskInput, context: IExecuteContext): Promise<ChunkToVectorTaskOutput>;
168
+ }
169
+ export declare const chunkToVector: (input: ChunkToVectorTaskInput, config?: JobQueueTaskConfig) => Promise<{
170
+ metadata: {
171
+ [x: string]: unknown;
172
+ }[];
173
+ vectors: import("@workglow/util").TypedArray[];
174
+ ids: string[];
175
+ texts: string[];
176
+ }>;
177
+ declare module "@workglow/task-graph" {
178
+ interface Workflow {
179
+ chunkToVector: CreateWorkflow<ChunkToVectorTaskInput, ChunkToVectorTaskOutput, JobQueueTaskConfig>;
180
+ }
181
+ }
182
+ export {};
183
+ //# sourceMappingURL=ChunkToVectorTask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChunkToVectorTask.d.ts","sourceRoot":"","sources":["../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ACF"}
@@ -0,0 +1,160 @@
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, TypedArraySchemaOptions } from "@workglow/util";
8
+ declare const inputSchema: {
9
+ readonly type: "object";
10
+ readonly properties: {
11
+ readonly dataset: {
12
+ readonly title: "Document Chunk Dataset";
13
+ readonly description: "Dataset ID or instance for document chunk data storage";
14
+ } & {
15
+ title: string;
16
+ description: string;
17
+ } & {
18
+ readonly format: "dataset:document-chunk";
19
+ readonly anyOf: readonly [{
20
+ readonly type: "string";
21
+ readonly title: "Dataset ID";
22
+ }, {
23
+ readonly title: "Dataset Instance";
24
+ readonly additionalProperties: true;
25
+ }];
26
+ };
27
+ readonly queryVector: {
28
+ readonly type: "array";
29
+ readonly format: "TypedArray";
30
+ readonly title: "Typed Array";
31
+ readonly description: "A typed array (Float32Array, Int8Array, etc.)";
32
+ };
33
+ readonly queryText: {
34
+ readonly type: "string";
35
+ readonly title: "Query Text";
36
+ readonly description: "The query text for full-text search";
37
+ };
38
+ readonly topK: {
39
+ readonly type: "number";
40
+ readonly title: "Top K";
41
+ readonly description: "Number of top results to return";
42
+ readonly minimum: 1;
43
+ readonly default: 10;
44
+ };
45
+ readonly filter: {
46
+ readonly type: "object";
47
+ readonly title: "Metadata Filter";
48
+ readonly description: "Filter results by metadata fields";
49
+ };
50
+ readonly scoreThreshold: {
51
+ readonly type: "number";
52
+ readonly title: "Score Threshold";
53
+ readonly description: "Minimum combined score threshold (0-1)";
54
+ readonly minimum: 0;
55
+ readonly maximum: 1;
56
+ readonly default: 0;
57
+ };
58
+ readonly vectorWeight: {
59
+ readonly type: "number";
60
+ readonly title: "Vector Weight";
61
+ readonly description: "Weight for vector similarity (0-1), remainder goes to text relevance";
62
+ readonly minimum: 0;
63
+ readonly maximum: 1;
64
+ readonly default: 0.7;
65
+ };
66
+ readonly returnVectors: {
67
+ readonly type: "boolean";
68
+ readonly title: "Return Vectors";
69
+ readonly description: "Whether to return vector embeddings in results";
70
+ readonly default: false;
71
+ };
72
+ };
73
+ readonly required: readonly ["dataset", "queryVector", "queryText"];
74
+ readonly additionalProperties: false;
75
+ };
76
+ declare const outputSchema: {
77
+ readonly type: "object";
78
+ readonly properties: {
79
+ readonly chunks: {
80
+ readonly type: "array";
81
+ readonly items: {
82
+ readonly type: "string";
83
+ };
84
+ readonly title: "Text Chunks";
85
+ readonly description: "Retrieved text chunks";
86
+ };
87
+ readonly ids: {
88
+ readonly type: "array";
89
+ readonly items: {
90
+ readonly type: "string";
91
+ };
92
+ readonly title: "IDs";
93
+ readonly description: "IDs of retrieved chunks";
94
+ };
95
+ readonly metadata: {
96
+ readonly type: "array";
97
+ readonly items: {
98
+ readonly type: "object";
99
+ readonly title: "Metadata";
100
+ readonly description: "Metadata of retrieved chunk";
101
+ };
102
+ readonly title: "Metadata";
103
+ readonly description: "Metadata of retrieved chunks";
104
+ };
105
+ readonly scores: {
106
+ readonly type: "array";
107
+ readonly items: {
108
+ readonly type: "number";
109
+ };
110
+ readonly title: "Scores";
111
+ readonly description: "Combined relevance scores for each result";
112
+ };
113
+ readonly vectors: {
114
+ readonly type: "array";
115
+ readonly items: {
116
+ readonly type: "array";
117
+ readonly format: "TypedArray";
118
+ readonly title: "Typed Array";
119
+ readonly description: "A typed array (Float32Array, Int8Array, etc.)";
120
+ };
121
+ readonly title: "Vectors";
122
+ readonly description: "Vector embeddings (if returnVectors is true)";
123
+ };
124
+ readonly count: {
125
+ readonly type: "number";
126
+ readonly title: "Count";
127
+ readonly description: "Number of results returned";
128
+ };
129
+ };
130
+ readonly required: readonly ["chunks", "ids", "metadata", "scores", "count"];
131
+ readonly additionalProperties: false;
132
+ };
133
+ export type HybridSearchTaskInput = FromSchema<typeof inputSchema, TypedArraySchemaOptions>;
134
+ export type HybridSearchTaskOutput = FromSchema<typeof outputSchema, TypedArraySchemaOptions>;
135
+ /**
136
+ * Task for hybrid search combining vector similarity and full-text search.
137
+ * Requires a document chunk vector repository that supports hybridSearch (e.g., Postgres with pgvector).
138
+ *
139
+ * Hybrid search improves retrieval by combining:
140
+ * - Semantic similarity (vector search) - understands meaning
141
+ * - Keyword matching (full-text search) - finds exact terms
142
+ */
143
+ export declare class ChunkVectorHybridSearchTask extends Task<HybridSearchTaskInput, HybridSearchTaskOutput, JobQueueTaskConfig> {
144
+ static type: string;
145
+ static category: string;
146
+ static title: string;
147
+ static description: string;
148
+ static cacheable: boolean;
149
+ static inputSchema(): DataPortSchema;
150
+ static outputSchema(): DataPortSchema;
151
+ execute(input: HybridSearchTaskInput, context: IExecuteContext): Promise<HybridSearchTaskOutput>;
152
+ }
153
+ export declare const hybridSearch: (input: HybridSearchTaskInput, config?: JobQueueTaskConfig) => Promise<HybridSearchTaskOutput>;
154
+ declare module "@workglow/task-graph" {
155
+ interface Workflow {
156
+ hybridSearch: CreateWorkflow<HybridSearchTaskInput, HybridSearchTaskOutput, JobQueueTaskConfig>;
157
+ }
158
+ }
159
+ export {};
160
+ //# sourceMappingURL=ChunkVectorHybridSearchTask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChunkVectorHybridSearchTask.d.ts","sourceRoot":"","sources":["../../src/task/ChunkVectorHybridSearchTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,IAAI,EAEL,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,cAAc,EACd,UAAU,EAEV,uBAAuB,EACxB,MAAM,gBAAgB,CAAC;AAExB,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDkB,CAAC;AAEpC,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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