@workglow/ai 0.0.123 → 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.
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);
@@ -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 = () => {};
@@ -7209,4 +7246,4 @@ export {
7209
7246
  AgentInputSchema
7210
7247
  };
7211
7248
 
7212
- //# debugId=D89F77C8F1A116D164756E2164756E21
7249
+ //# debugId=10C25A453F3375E964756E2164756E21