@promptbook/components 0.104.0-3 → 0.104.0-4

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/esm/index.es.js CHANGED
@@ -35,7 +35,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
35
35
  * @generated
36
36
  * @see https://github.com/webgptorg/promptbook
37
37
  */
38
- const PROMPTBOOK_ENGINE_VERSION = '0.104.0-3';
38
+ const PROMPTBOOK_ENGINE_VERSION = '0.104.0-4';
39
39
  /**
40
40
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
41
41
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -11237,6 +11237,12 @@ class MultipleLlmExecutionTools {
11237
11237
  callEmbeddingModel(prompt) {
11238
11238
  return this.callCommonModel(prompt);
11239
11239
  }
11240
+ /**
11241
+ * Calls the best available embedding model
11242
+ */
11243
+ callImageGenerationModel(prompt) {
11244
+ return this.callCommonModel(prompt);
11245
+ }
11240
11246
  // <- Note: [🤖]
11241
11247
  /**
11242
11248
  * Calls the best available model
@@ -11263,6 +11269,11 @@ class MultipleLlmExecutionTools {
11263
11269
  continue llm;
11264
11270
  }
11265
11271
  return await llmExecutionTools.callEmbeddingModel(prompt);
11272
+ case 'IMAGE_GENERATION':
11273
+ if (llmExecutionTools.callImageGenerationModel === undefined) {
11274
+ continue llm;
11275
+ }
11276
+ return await llmExecutionTools.callImageGenerationModel(prompt);
11266
11277
  // <- case [🤖]:
11267
11278
  default:
11268
11279
  throw new UnexpectedError(`Unknown model variant "${prompt.modelRequirements.modelVariant}" in ${llmExecutionTools.title}`);
@@ -12437,6 +12448,15 @@ function countUsage(llmTools) {
12437
12448
  return promptResult;
12438
12449
  };
12439
12450
  }
12451
+ if (llmTools.callImageGenerationModel !== undefined) {
12452
+ proxyTools.callImageGenerationModel = async (prompt) => {
12453
+ // console.info('[🚕] callImageGenerationModel through countTotalUsage');
12454
+ const promptResult = await llmTools.callImageGenerationModel(prompt);
12455
+ totalUsage = addUsage(totalUsage, promptResult.usage);
12456
+ spending.next(promptResult.usage);
12457
+ return promptResult;
12458
+ };
12459
+ }
12440
12460
  // <- Note: [🤖]
12441
12461
  return proxyTools;
12442
12462
  }
@@ -13980,8 +14000,9 @@ async function executeAttempts(options) {
13980
14000
  $ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
13981
14001
  break variant;
13982
14002
  case 'EMBEDDING':
14003
+ case 'IMAGE_GENERATION':
13983
14004
  throw new PipelineExecutionError(spaceTrim$1((block) => `
13984
- Embedding model can not be used in pipeline
14005
+ ${modelRequirements.modelVariant} model can not be used in pipeline
13985
14006
 
13986
14007
  This should be catched during parsing
13987
14008