@workglow/ai 0.0.122 → 0.0.124

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 (107) hide show
  1. package/dist/browser.js +50 -13
  2. package/dist/browser.js.map +54 -54
  3. package/dist/bun.js +50 -13
  4. package/dist/bun.js.map +54 -54
  5. package/dist/job/AiJob.d.ts +1 -1
  6. package/dist/job/AiJob.d.ts.map +1 -1
  7. package/dist/node.js +50 -13
  8. package/dist/node.js.map +54 -54
  9. package/dist/provider/AiProvider.d.ts +4 -0
  10. package/dist/provider/AiProvider.d.ts.map +1 -1
  11. package/dist/provider/AiProviderRegistry.d.ts +11 -0
  12. package/dist/provider/AiProviderRegistry.d.ts.map +1 -1
  13. package/dist/task/BackgroundRemovalTask.d.ts +3 -3
  14. package/dist/task/BackgroundRemovalTask.d.ts.map +1 -1
  15. package/dist/task/ChunkRetrievalTask.d.ts +1 -1
  16. package/dist/task/ChunkRetrievalTask.d.ts.map +1 -1
  17. package/dist/task/ChunkToVectorTask.d.ts +3 -3
  18. package/dist/task/ChunkToVectorTask.d.ts.map +1 -1
  19. package/dist/task/ChunkVectorHybridSearchTask.d.ts +3 -3
  20. package/dist/task/ChunkVectorHybridSearchTask.d.ts.map +1 -1
  21. package/dist/task/ChunkVectorSearchTask.d.ts +3 -3
  22. package/dist/task/ChunkVectorSearchTask.d.ts.map +1 -1
  23. package/dist/task/ChunkVectorUpsertTask.d.ts +2 -2
  24. package/dist/task/ChunkVectorUpsertTask.d.ts.map +1 -1
  25. package/dist/task/ContextBuilderTask.d.ts +1 -1
  26. package/dist/task/ContextBuilderTask.d.ts.map +1 -1
  27. package/dist/task/CountTokensTask.d.ts +1 -1
  28. package/dist/task/CountTokensTask.d.ts.map +1 -1
  29. package/dist/task/DocumentEnricherTask.d.ts +1 -1
  30. package/dist/task/DocumentEnricherTask.d.ts.map +1 -1
  31. package/dist/task/DownloadModelTask.d.ts +1 -1
  32. package/dist/task/DownloadModelTask.d.ts.map +1 -1
  33. package/dist/task/FaceDetectorTask.d.ts +1 -1
  34. package/dist/task/FaceDetectorTask.d.ts.map +1 -1
  35. package/dist/task/FaceLandmarkerTask.d.ts +3 -3
  36. package/dist/task/FaceLandmarkerTask.d.ts.map +1 -1
  37. package/dist/task/GestureRecognizerTask.d.ts +1 -1
  38. package/dist/task/GestureRecognizerTask.d.ts.map +1 -1
  39. package/dist/task/HandLandmarkerTask.d.ts +1 -1
  40. package/dist/task/HandLandmarkerTask.d.ts.map +1 -1
  41. package/dist/task/HierarchicalChunkerTask.d.ts +1 -1
  42. package/dist/task/HierarchicalChunkerTask.d.ts.map +1 -1
  43. package/dist/task/HierarchyJoinTask.d.ts +1 -1
  44. package/dist/task/HierarchyJoinTask.d.ts.map +1 -1
  45. package/dist/task/ImageClassificationTask.d.ts +1 -1
  46. package/dist/task/ImageClassificationTask.d.ts.map +1 -1
  47. package/dist/task/ImageEmbeddingTask.d.ts +2 -2
  48. package/dist/task/ImageEmbeddingTask.d.ts.map +1 -1
  49. package/dist/task/ImageSegmentationTask.d.ts +1 -1
  50. package/dist/task/ImageSegmentationTask.d.ts.map +1 -1
  51. package/dist/task/ImageToTextTask.d.ts +1 -1
  52. package/dist/task/ImageToTextTask.d.ts.map +1 -1
  53. package/dist/task/ModelInfoTask.d.ts +1 -1
  54. package/dist/task/ModelInfoTask.d.ts.map +1 -1
  55. package/dist/task/ModelSearchTask.d.ts +5 -2
  56. package/dist/task/ModelSearchTask.d.ts.map +1 -1
  57. package/dist/task/ObjectDetectionTask.d.ts +1 -1
  58. package/dist/task/ObjectDetectionTask.d.ts.map +1 -1
  59. package/dist/task/PoseLandmarkerTask.d.ts +1 -1
  60. package/dist/task/PoseLandmarkerTask.d.ts.map +1 -1
  61. package/dist/task/QueryExpanderTask.d.ts +1 -1
  62. package/dist/task/QueryExpanderTask.d.ts.map +1 -1
  63. package/dist/task/RerankerTask.d.ts +1 -1
  64. package/dist/task/RerankerTask.d.ts.map +1 -1
  65. package/dist/task/StructuralParserTask.d.ts +1 -1
  66. package/dist/task/StructuralParserTask.d.ts.map +1 -1
  67. package/dist/task/StructuredGenerationTask.d.ts +1 -1
  68. package/dist/task/StructuredGenerationTask.d.ts.map +1 -1
  69. package/dist/task/TextChunkerTask.d.ts +1 -1
  70. package/dist/task/TextChunkerTask.d.ts.map +1 -1
  71. package/dist/task/TextClassificationTask.d.ts +1 -1
  72. package/dist/task/TextClassificationTask.d.ts.map +1 -1
  73. package/dist/task/TextEmbeddingTask.d.ts +2 -2
  74. package/dist/task/TextEmbeddingTask.d.ts.map +1 -1
  75. package/dist/task/TextFillMaskTask.d.ts +1 -1
  76. package/dist/task/TextFillMaskTask.d.ts.map +1 -1
  77. package/dist/task/TextGenerationTask.d.ts +1 -1
  78. package/dist/task/TextGenerationTask.d.ts.map +1 -1
  79. package/dist/task/TextLanguageDetectionTask.d.ts +1 -1
  80. package/dist/task/TextLanguageDetectionTask.d.ts.map +1 -1
  81. package/dist/task/TextNamedEntityRecognitionTask.d.ts +1 -1
  82. package/dist/task/TextNamedEntityRecognitionTask.d.ts.map +1 -1
  83. package/dist/task/TextQuestionAnswerTask.d.ts +1 -1
  84. package/dist/task/TextQuestionAnswerTask.d.ts.map +1 -1
  85. package/dist/task/TextRewriterTask.d.ts +1 -1
  86. package/dist/task/TextRewriterTask.d.ts.map +1 -1
  87. package/dist/task/TextSummaryTask.d.ts +1 -1
  88. package/dist/task/TextSummaryTask.d.ts.map +1 -1
  89. package/dist/task/TextTranslationTask.d.ts +1 -1
  90. package/dist/task/TextTranslationTask.d.ts.map +1 -1
  91. package/dist/task/ToolCallingTask.d.ts +2 -1
  92. package/dist/task/ToolCallingTask.d.ts.map +1 -1
  93. package/dist/task/TopicSegmenterTask.d.ts +1 -1
  94. package/dist/task/TopicSegmenterTask.d.ts.map +1 -1
  95. package/dist/task/UnloadModelTask.d.ts +1 -1
  96. package/dist/task/UnloadModelTask.d.ts.map +1 -1
  97. package/dist/task/VectorQuantizeTask.d.ts +1 -1
  98. package/dist/task/VectorQuantizeTask.d.ts.map +1 -1
  99. package/dist/task/VectorSimilarityTask.d.ts +5 -5
  100. package/dist/task/VectorSimilarityTask.d.ts.map +1 -1
  101. package/dist/task/base/AiTask.d.ts +1 -1
  102. package/dist/task/base/AiTask.d.ts.map +1 -1
  103. package/dist/task/base/AiTaskSchemas.d.ts +1 -1
  104. package/dist/task/base/AiTaskSchemas.d.ts.map +1 -1
  105. package/dist/worker.js +10 -1
  106. package/dist/worker.js.map +4 -4
  107. package/package.json +11 -11
package/dist/bun.js CHANGED
@@ -24,6 +24,15 @@ class AiProviderRegistry {
24
24
  getProviders() {
25
25
  return new Map(this.providers);
26
26
  }
27
+ getInstalledProviderIds() {
28
+ return [...this.providers.keys()].sort();
29
+ }
30
+ getProviderIdsForTask(taskType) {
31
+ const taskMap = this.runFnRegistry.get(taskType);
32
+ if (!taskMap)
33
+ return [];
34
+ return [...taskMap.keys()].sort();
35
+ }
27
36
  registerRunFn(modelProvider, taskType, runFn) {
28
37
  if (!this.runFnRegistry.has(taskType)) {
29
38
  this.runFnRegistry.set(taskType, new Map);
@@ -470,7 +479,7 @@ import {
470
479
  import { getLogger as getLogger3 } from "@workglow/util";
471
480
 
472
481
  // src/task/AgentTypes.ts
473
- import { parseDataUri } from "@workglow/util";
482
+ import { parseDataUri } from "@workglow/util/media";
474
483
  function imageBlock(mimeType, data) {
475
484
  return { type: "image", mimeType, data };
476
485
  }
@@ -1463,7 +1472,7 @@ Workflow2.prototype.agent = CreateWorkflow2(AgentTask);
1463
1472
  import { CreateWorkflow as CreateWorkflow3, Workflow as Workflow3 } from "@workglow/task-graph";
1464
1473
 
1465
1474
  // src/task/base/AiVisionTask.ts
1466
- import { convertImageDataToUseableForm } from "@workglow/util";
1475
+ import { convertImageDataToUseableForm } from "@workglow/util/media";
1467
1476
  class AiVisionTask extends AiTask {
1468
1477
  static type = "AiVisionTask";
1469
1478
  async getJobInput(input) {
@@ -1538,13 +1547,13 @@ import {
1538
1547
  import {
1539
1548
  isTypedArray,
1540
1549
  TypedArraySchema as TypedArraySchema2
1541
- } from "@workglow/util";
1550
+ } from "@workglow/util/schema";
1542
1551
 
1543
1552
  // src/task/TextEmbeddingTask.ts
1544
1553
  import { CreateWorkflow as CreateWorkflow4, Workflow as Workflow4 } from "@workglow/task-graph";
1545
1554
  import {
1546
1555
  TypedArraySchema
1547
- } from "@workglow/util";
1556
+ } from "@workglow/util/schema";
1548
1557
  var modelSchema4 = TypeModel("model:TextEmbeddingTask");
1549
1558
  var TextEmbeddingInputSchema = {
1550
1559
  type: "object",
@@ -1789,7 +1798,7 @@ import {
1789
1798
  } from "@workglow/task-graph";
1790
1799
  import {
1791
1800
  TypedArraySchema as TypedArraySchema3
1792
- } from "@workglow/util";
1801
+ } from "@workglow/util/schema";
1793
1802
  var inputSchema2 = {
1794
1803
  type: "object",
1795
1804
  properties: {
@@ -1923,7 +1932,7 @@ import {
1923
1932
  } from "@workglow/task-graph";
1924
1933
  import {
1925
1934
  TypedArraySchema as TypedArraySchema4
1926
- } from "@workglow/util";
1935
+ } from "@workglow/util/schema";
1927
1936
  var inputSchema3 = {
1928
1937
  type: "object",
1929
1938
  properties: {
@@ -2097,7 +2106,7 @@ import {
2097
2106
  } from "@workglow/task-graph";
2098
2107
  import {
2099
2108
  TypedArraySchema as TypedArraySchema5
2100
- } from "@workglow/util";
2109
+ } from "@workglow/util/schema";
2101
2110
  var inputSchema4 = {
2102
2111
  type: "object",
2103
2112
  properties: {
@@ -2220,7 +2229,7 @@ import {
2220
2229
  } from "@workglow/task-graph";
2221
2230
  import {
2222
2231
  TypedArraySchema as TypedArraySchema6
2223
- } from "@workglow/util";
2232
+ } from "@workglow/util/schema";
2224
2233
  var inputSchema5 = {
2225
2234
  type: "object",
2226
2235
  properties: {
@@ -4216,7 +4225,7 @@ Workflow22.prototype.imageClassification = CreateWorkflow22(ImageClassificationT
4216
4225
  import { CreateWorkflow as CreateWorkflow23, Workflow as Workflow23 } from "@workglow/task-graph";
4217
4226
  import {
4218
4227
  TypedArraySchema as TypedArraySchema7
4219
- } from "@workglow/util";
4228
+ } from "@workglow/util/schema";
4220
4229
  var modelSchema16 = TypeModel("model:ImageEmbeddingTask");
4221
4230
  var embeddingSchema = TypedArraySchema7({
4222
4231
  title: "Embedding",
@@ -4482,7 +4491,7 @@ var ModelSearchInputSchema = {
4482
4491
  provider: {
4483
4492
  type: "string",
4484
4493
  title: "Provider",
4485
- description: "The model provider to search (e.g. ANTHROPIC, OPENAI, HF_TRANSFORMERS_ONNX)"
4494
+ description: "Registered AI provider id to use for model search. At runtime the workflow UI lists only providers that support model search."
4486
4495
  },
4487
4496
  query: {
4488
4497
  type: "string",
@@ -4493,6 +4502,30 @@ var ModelSearchInputSchema = {
4493
4502
  required: ["provider", "query"],
4494
4503
  additionalProperties: false
4495
4504
  };
4505
+ function buildModelSearchInputSchemaDynamic() {
4506
+ const registry = getAiProviderRegistry();
4507
+ const ids = registry.getProviderIdsForTask("ModelSearchTask");
4508
+ const enumLabels = {};
4509
+ for (const id of ids) {
4510
+ enumLabels[id] = registry.getProvider(id)?.displayName ?? id;
4511
+ }
4512
+ const providerProp = {
4513
+ ...ModelSearchInputSchema.properties.provider
4514
+ };
4515
+ if (ids.length > 0) {
4516
+ providerProp.enum = ids;
4517
+ providerProp["x-ui-enum-labels"] = enumLabels;
4518
+ }
4519
+ return {
4520
+ type: "object",
4521
+ properties: {
4522
+ provider: providerProp,
4523
+ query: ModelSearchInputSchema.properties.query
4524
+ },
4525
+ required: [...ModelSearchInputSchema.required],
4526
+ additionalProperties: ModelSearchInputSchema.additionalProperties
4527
+ };
4528
+ }
4496
4529
  var ModelSearchOutputSchema = {
4497
4530
  type: "object",
4498
4531
  properties: {
@@ -4522,12 +4555,16 @@ class ModelSearchTask extends Task11 {
4522
4555
  static title = "Model Search";
4523
4556
  static description = "Search for models using provider-specific search functions";
4524
4557
  static cacheable = false;
4558
+ static hasDynamicSchemas = true;
4525
4559
  static inputSchema() {
4526
4560
  return ModelSearchInputSchema;
4527
4561
  }
4528
4562
  static outputSchema() {
4529
4563
  return ModelSearchOutputSchema;
4530
4564
  }
4565
+ inputSchema() {
4566
+ return buildModelSearchInputSchemaDynamic();
4567
+ }
4531
4568
  async execute(input, context) {
4532
4569
  const registry = getAiProviderRegistry();
4533
4570
  const noop = () => {};
@@ -6481,7 +6518,7 @@ import {
6481
6518
  normalizeNumberArray,
6482
6519
  TensorType,
6483
6520
  TypedArraySchema as TypedArraySchema8
6484
- } from "@workglow/util";
6521
+ } from "@workglow/util/schema";
6485
6522
  var inputSchema15 = {
6486
6523
  type: "object",
6487
6524
  properties: {
@@ -6665,7 +6702,7 @@ import {
6665
6702
  hammingSimilarity,
6666
6703
  jaccardSimilarity,
6667
6704
  TypedArraySchema as TypedArraySchema9
6668
- } from "@workglow/util";
6705
+ } from "@workglow/util/schema";
6669
6706
  var SimilarityFn = {
6670
6707
  COSINE: "cosine",
6671
6708
  JACCARD: "jaccard",
@@ -7209,4 +7246,4 @@ export {
7209
7246
  AgentInputSchema
7210
7247
  };
7211
7248
 
7212
- //# debugId=01FBA636739047B364756E2164756E21
7249
+ //# debugId=10C25A453F3375E964756E2164756E21