@promptbook/core 0.92.0-21 β†’ 0.92.0-23

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 (27) hide show
  1. package/esm/index.es.js +168 -91
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/core.index.d.ts +6 -0
  4. package/esm/typings/src/_packages/types.index.d.ts +2 -0
  5. package/esm/typings/src/commands/FOREACH/ForeachJson.d.ts +6 -6
  6. package/esm/typings/src/config.d.ts +29 -11
  7. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +12 -9
  8. package/esm/typings/src/execution/createPipelineExecutor/20-executeTask.d.ts +11 -8
  9. package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +15 -3
  10. package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTask.d.ts +10 -8
  11. package/esm/typings/src/formats/_common/FormatParser.d.ts +5 -3
  12. package/esm/typings/src/formats/_common/FormatSubvalueParser.d.ts +40 -5
  13. package/esm/typings/src/formats/csv/utils/isValidCsvString.d.ts +1 -1
  14. package/esm/typings/src/formats/json/utils/isValidJsonString.d.ts +1 -1
  15. package/esm/typings/src/formats/xml/utils/isValidXmlString.d.ts +1 -1
  16. package/esm/typings/src/llm-providers/_common/register/LlmToolsOptions.d.ts +4 -1
  17. package/esm/typings/src/scrapers/_common/register/$scrapersMetadataRegister.d.ts +3 -3
  18. package/esm/typings/src/types/typeAliases.d.ts +9 -7
  19. package/esm/typings/src/utils/$Register.d.ts +8 -7
  20. package/esm/typings/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +7 -7
  21. package/esm/typings/src/utils/serialization/clonePipeline.d.ts +4 -3
  22. package/esm/typings/src/utils/serialization/deepClone.d.ts +5 -1
  23. package/esm/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +3 -3
  24. package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +5 -4
  25. package/package.json +1 -1
  26. package/umd/index.umd.js +170 -90
  27. package/umd/index.umd.js.map +1 -1
package/esm/index.es.js CHANGED
@@ -27,7 +27,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
27
27
  * @generated
28
28
  * @see https://github.com/webgptorg/promptbook
29
29
  */
30
- const PROMPTBOOK_ENGINE_VERSION = '0.92.0-21';
30
+ const PROMPTBOOK_ENGINE_VERSION = '0.92.0-23';
31
31
  /**
32
32
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
33
33
  * Note: [πŸ’ž] Ignore a discrepancy between file name and entity name
@@ -274,6 +274,25 @@ const DEFAULT_BOOK_OUTPUT_PARAMETER_NAME = 'result';
274
274
  * @public exported from `@promptbook/core`
275
275
  */
276
276
  const DEFAULT_MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB
277
+ /**
278
+ * @@@
279
+ *
280
+ * @public exported from `@promptbook/core`
281
+ */
282
+ const BIG_DATASET_TRESHOLD = 50;
283
+ /**
284
+ * @@@
285
+ *
286
+ * @public exported from `@promptbook/core`
287
+ */
288
+ const FAILED_VALUE_PLACEHOLDER = '!';
289
+ // <- TODO: !!!! Use
290
+ /**
291
+ * @@@
292
+ *
293
+ * @public exported from `@promptbook/core`
294
+ */
295
+ const PENDING_VALUE_PLACEHOLDER = '…';
277
296
  // <- TODO: [🧠] Better system for generator warnings - not always "code" and "by `@promptbook/cli`"
278
297
  /**
279
298
  * The maximum number of iterations for a loops
@@ -334,19 +353,21 @@ const DEFAULT_MAX_PARALLEL_COUNT = 5; // <- TODO: [πŸ€Ήβ€β™‚οΈ]
334
353
  */
335
354
  const DEFAULT_MAX_EXECUTION_ATTEMPTS = 10; // <- TODO: [πŸ€Ήβ€β™‚οΈ]
336
355
  /**
337
- * @@@
338
- * TODO: [🐝][main] !!3 Use
356
+ * The maximum depth to which knowledge sources will be scraped when building a knowledge base.
357
+ * This prevents infinite recursion and limits resource usage.
339
358
  *
340
359
  * @public exported from `@promptbook/core`
341
360
  */
342
361
  const DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH = 3;
362
+ // <- TODO: [🐝]
343
363
  /**
344
- * @@@
345
- * TODO: [🐝][main] !!3 Use
364
+ * The maximum total number of knowledge sources that will be scraped in a single operation.
365
+ * This acts as a global limit to avoid excessive resource consumption.
346
366
  *
347
367
  * @public exported from `@promptbook/core`
348
368
  */
349
369
  const DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL = 200;
370
+ // <- TODO: [🐝]
350
371
  /**
351
372
  * Where to store your books
352
373
  * This is kind of a "src" for your books
@@ -424,7 +445,7 @@ const MOMENT_ARG_THRESHOLDS = {
424
445
  const DEFAULT_REMOTE_SERVER_URL = REMOTE_SERVER_URLS[0].urls[0];
425
446
  // <- TODO: [πŸ§œβ€β™‚οΈ]
426
447
  /**
427
- * @@@
448
+ * Default settings for parsing and generating CSV files in Promptbook.
428
449
  *
429
450
  * @public exported from `@promptbook/core`
430
451
  */
@@ -435,15 +456,15 @@ const DEFAULT_CSV_SETTINGS = Object.freeze({
435
456
  skipEmptyLines: true,
436
457
  });
437
458
  /**
438
- * @@@
459
+ * Controls whether verbose logging is enabled by default throughout the application.
439
460
  *
440
461
  * @public exported from `@promptbook/core`
441
462
  */
442
463
  let DEFAULT_IS_VERBOSE = false;
443
464
  /**
444
- * @@@
465
+ * Enables or disables verbose logging globally at runtime.
445
466
  *
446
- * Note: This is experimental feature
467
+ * Note: This is an experimental feature.
447
468
  *
448
469
  * @public exported from `@promptbook/core`
449
470
  */
@@ -451,7 +472,7 @@ function SET_IS_VERBOSE(isVerbose) {
451
472
  DEFAULT_IS_VERBOSE = isVerbose;
452
473
  }
453
474
  /**
454
- * @@@
475
+ * Controls whether auto-installation of dependencies is enabled by default.
455
476
  *
456
477
  * @public exported from `@promptbook/core`
457
478
  */
@@ -471,7 +492,7 @@ const DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME = `getPipelineCollection`;
471
492
  */
472
493
  const DEFAULT_RPM = 60;
473
494
  /**
474
- * @@@
495
+ * Indicates whether pipeline logic validation is enabled. When true, the pipeline logic is checked for consistency.
475
496
  *
476
497
  * @private within the repository
477
498
  */
@@ -604,7 +625,7 @@ function assertsError(whatWasThrown) {
604
625
  * Function isValidJsonString will tell you if the string is valid JSON or not
605
626
  *
606
627
  * @param value The string to check
607
- * @returns True if the string is a valid JSON string, false otherwise
628
+ * @returns `true` if the string is a valid JSON string, false otherwise
608
629
  *
609
630
  * @public exported from `@promptbook/utils`
610
631
  */
@@ -1015,8 +1036,12 @@ function checkSerializableAsJson(options) {
1015
1036
  */
1016
1037
 
1017
1038
  /**
1018
- * @@@
1039
+ * Creates a deep clone of the given object
1040
+ *
1041
+ * Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
1019
1042
  *
1043
+ * @param objectValue The object to clone.
1044
+ * @returns A deep, writable clone of the input object.
1020
1045
  * @public exported from `@promptbook/utils`
1021
1046
  */
1022
1047
  function deepClone(objectValue) {
@@ -2783,7 +2808,7 @@ function csvParse(value /* <- TODO: string_csv */, settings, schema /* <- TODO:
2783
2808
  * Function to check if a string is valid CSV
2784
2809
  *
2785
2810
  * @param value The string to check
2786
- * @returns True if the string is a valid CSV string, false otherwise
2811
+ * @returns `true` if the string is a valid CSV string, false otherwise
2787
2812
  *
2788
2813
  * @public exported from `@promptbook/utils`
2789
2814
  */
@@ -2822,7 +2847,8 @@ const CsvFormatParser = {
2822
2847
  subvalueParsers: [
2823
2848
  {
2824
2849
  subvalueName: 'ROW',
2825
- async mapValues(value, outputParameterName, settings, mapCallback) {
2850
+ async mapValues(options) {
2851
+ const { value, outputParameterName, settings, mapCallback, onProgress } = options;
2826
2852
  const csv = csvParse(value, settings);
2827
2853
  if (csv.errors.length !== 0) {
2828
2854
  throw new CsvFormatError(spaceTrim((block) => `
@@ -2838,21 +2864,30 @@ const CsvFormatParser = {
2838
2864
  ${block(value)}
2839
2865
  `));
2840
2866
  }
2841
- const mappedData = await Promise.all(csv.data.map(async (row, index) => {
2867
+ const mappedData = [];
2868
+ const length = csv.data.length;
2869
+ for (let index = 0; index < length; index++) {
2870
+ const row = csv.data[index];
2842
2871
  if (row[outputParameterName]) {
2843
2872
  throw new CsvFormatError(`Can not overwrite existing column "${outputParameterName}" in CSV row`);
2844
2873
  }
2845
- return {
2874
+ const mappedRow = {
2846
2875
  ...row,
2847
- [outputParameterName]: await mapCallback(row, index),
2876
+ [outputParameterName]: await mapCallback(row, index, length),
2848
2877
  };
2849
- }));
2878
+ mappedData.push(mappedRow);
2879
+ if (onProgress) {
2880
+ // Note: Report the CSV with all rows mapped so far
2881
+ await onProgress(unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
2882
+ }
2883
+ }
2850
2884
  return unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
2851
2885
  },
2852
2886
  },
2853
2887
  {
2854
2888
  subvalueName: 'CELL',
2855
- async mapValues(value, outputParameterName, settings, mapCallback) {
2889
+ async mapValues(options) {
2890
+ const { value, settings, mapCallback, onProgress } = options;
2856
2891
  const csv = csvParse(value, settings);
2857
2892
  if (csv.errors.length !== 0) {
2858
2893
  throw new CsvFormatError(spaceTrim((block) => `
@@ -2869,9 +2904,9 @@ const CsvFormatParser = {
2869
2904
  `));
2870
2905
  }
2871
2906
  const mappedData = await Promise.all(csv.data.map(async (row, rowIndex) => {
2872
- return /* not await */ Promise.all(Object.entries(row).map(async ([key, value], columnIndex) => {
2907
+ return /* not await */ Promise.all(Object.entries(row).map(async ([key, value], columnIndex, array) => {
2873
2908
  const index = rowIndex * Object.keys(row).length + columnIndex;
2874
- return /* not await */ mapCallback({ [key]: value }, index);
2909
+ return /* not await */ mapCallback({ [key]: value }, index, array.length);
2875
2910
  }));
2876
2911
  }));
2877
2912
  return unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
@@ -2939,14 +2974,15 @@ const TextFormatParser = {
2939
2974
  subvalueParsers: [
2940
2975
  {
2941
2976
  subvalueName: 'LINE',
2942
- async mapValues(value, outputParameterName, settings, mapCallback) {
2977
+ async mapValues(options) {
2978
+ const { value, mapCallback, onProgress } = options;
2943
2979
  const lines = value.split('\n');
2944
- const mappedLines = await Promise.all(lines.map((lineContent, lineNumber) =>
2980
+ const mappedLines = await Promise.all(lines.map((lineContent, lineNumber, array) =>
2945
2981
  // TODO: [🧠] Maybe option to skip empty line
2946
2982
  /* not await */ mapCallback({
2947
2983
  lineContent,
2948
2984
  // TODO: [🧠] Maybe also put here `lineNumber`
2949
- }, lineNumber)));
2985
+ }, lineNumber, array.length)));
2950
2986
  return mappedLines.join('\n');
2951
2987
  },
2952
2988
  },
@@ -2967,7 +3003,7 @@ const TextFormatParser = {
2967
3003
  * Function to check if a string is valid XML
2968
3004
  *
2969
3005
  * @param value
2970
- * @returns True if the string is a valid XML string, false otherwise
3006
+ * @returns `true` if the string is a valid XML string, false otherwise
2971
3007
  *
2972
3008
  * @public exported from `@promptbook/utils`
2973
3009
  */
@@ -3029,13 +3065,13 @@ const FORMAT_DEFINITIONS = [JsonFormatParser, XmlFormatParser, TextFormatParser,
3029
3065
  */
3030
3066
 
3031
3067
  /**
3032
- * Maps available parameters to expected parameters
3068
+ * Maps available parameters to expected parameters for a pipeline task.
3033
3069
  *
3034
3070
  * The strategy is:
3035
- * 1) @@@
3036
- * 2) @@@
3071
+ * 1) First, match parameters by name where both available and expected.
3072
+ * 2) Then, if there are unmatched expected and available parameters, map them by order.
3037
3073
  *
3038
- * @throws {PipelineExecutionError} @@@
3074
+ * @throws {PipelineExecutionError} If the number of unmatched expected and available parameters does not match, or mapping is ambiguous.
3039
3075
  * @private within the repository used in `createPipelineExecutor`
3040
3076
  */
3041
3077
  function mapAvailableToExpectedParameters(options) {
@@ -4266,12 +4302,16 @@ async function executeAttempts(options) {
4266
4302
  */
4267
4303
 
4268
4304
  /**
4269
- * @@@
4305
+ * Executes a pipeline task that requires mapping or iterating over subvalues of a parameter (such as rows in a CSV).
4306
+ * Handles format and subformat resolution, error handling, and progress reporting.
4307
+ *
4308
+ * @param options - Options for execution, including task details and progress callback.
4309
+ * @returns The result of the subvalue mapping or execution attempts.
4270
4310
  *
4271
4311
  * @private internal utility of `createPipelineExecutor`
4272
4312
  */
4273
4313
  async function executeFormatSubvalues(options) {
4274
- const { task, jokerParameterNames, parameters, priority, csvSettings, pipelineIdentification } = options;
4314
+ const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, pipelineIdentification } = options;
4275
4315
  if (task.foreach === undefined) {
4276
4316
  return /* not await */ executeAttempts(options);
4277
4317
  }
@@ -4325,46 +4365,74 @@ async function executeFormatSubvalues(options) {
4325
4365
  formatSettings = csvSettings;
4326
4366
  // <- TODO: [πŸ€Ήβ€β™‚οΈ] More universal, make simmilar pattern for other formats for example \n vs \r\n in text
4327
4367
  }
4328
- const resultString = await subvalueParser.mapValues(parameterValue, task.foreach.outputSubparameterName, formatSettings, async (subparameters, index) => {
4329
- let mappedParameters;
4330
- // TODO: [πŸ€Ήβ€β™‚οΈ][πŸͺ‚] Limit to N concurrent executions
4331
- // TODO: When done [🐚] Report progress also for each subvalue here
4332
- try {
4333
- mappedParameters = mapAvailableToExpectedParameters({
4334
- expectedParameters: Object.fromEntries(task.foreach.inputSubparameterNames.map((subparameterName) => [subparameterName, null])),
4335
- availableParameters: subparameters,
4336
- });
4337
- }
4338
- catch (error) {
4339
- if (!(error instanceof PipelineExecutionError)) {
4340
- throw error;
4368
+ const resultString = await subvalueParser.mapValues({
4369
+ value: parameterValue,
4370
+ outputParameterName: task.foreach.outputSubparameterName,
4371
+ settings: formatSettings,
4372
+ onProgress(partialResultString) {
4373
+ return onProgress(Object.freeze({
4374
+ [task.resultingParameterName]: partialResultString,
4375
+ }));
4376
+ },
4377
+ async mapCallback(subparameters, index, length) {
4378
+ let mappedParameters;
4379
+ try {
4380
+ mappedParameters = mapAvailableToExpectedParameters({
4381
+ expectedParameters: Object.fromEntries(task.foreach.inputSubparameterNames.map((subparameterName) => [subparameterName, null])),
4382
+ availableParameters: subparameters,
4383
+ });
4341
4384
  }
4342
- throw new PipelineExecutionError(spaceTrim((block) => `
4343
- ${error.message}
4385
+ catch (error) {
4386
+ if (!(error instanceof PipelineExecutionError)) {
4387
+ throw error;
4388
+ }
4389
+ const highLevelError = new PipelineExecutionError(spaceTrim((block) => `
4390
+ ${error.message}
4344
4391
 
4345
- This is error in FOREACH command
4346
- You have probbably passed wrong data to pipeline or wrong data was generated which are processed by FOREACH command
4392
+ This is error in FOREACH command when mapping data
4393
+ You have probbably passed wrong data to pipeline or wrong data was generated which are processed by FOREACH command
4347
4394
 
4348
- ${block(pipelineIdentification)}
4349
- Subparameter index: ${index}
4350
- `));
4351
- }
4352
- const allSubparameters = {
4353
- ...parameters,
4354
- ...mappedParameters,
4355
- };
4356
- // Note: [πŸ‘¨β€πŸ‘¨β€πŸ‘§] Now we can freeze `subparameters` because we are sure that all and only used parameters are defined and are not going to be changed
4357
- Object.freeze(allSubparameters);
4358
- const subresultString = await executeAttempts({
4359
- ...options,
4360
- priority: priority + index,
4361
- parameters: allSubparameters,
4362
- pipelineIdentification: spaceTrim((block) => `
4363
- ${block(pipelineIdentification)}
4364
- Subparameter index: ${index}
4365
- `),
4366
- });
4367
- return subresultString;
4395
+ ${block(pipelineIdentification)}
4396
+ Subparameter index: ${index}
4397
+ `));
4398
+ if (length > BIG_DATASET_TRESHOLD) {
4399
+ console.error(highLevelError);
4400
+ return '~';
4401
+ }
4402
+ throw highLevelError;
4403
+ }
4404
+ const allSubparameters = {
4405
+ ...parameters,
4406
+ ...mappedParameters,
4407
+ };
4408
+ Object.freeze(allSubparameters);
4409
+ try {
4410
+ const subresultString = await executeAttempts({
4411
+ ...options,
4412
+ priority: priority + index,
4413
+ parameters: allSubparameters,
4414
+ pipelineIdentification: spaceTrim((block) => `
4415
+ ${block(pipelineIdentification)}
4416
+ Subparameter index: ${index}
4417
+ `),
4418
+ });
4419
+ return subresultString;
4420
+ }
4421
+ catch (error) {
4422
+ if (length > BIG_DATASET_TRESHOLD) {
4423
+ console.error(spaceTrim((block) => `
4424
+ Error in FOREACH command:
4425
+
4426
+ ${block(pipelineIdentification)}
4427
+
4428
+ ${block(pipelineIdentification)}
4429
+ Subparameter index: ${index}
4430
+ `));
4431
+ return '~';
4432
+ }
4433
+ throw error;
4434
+ }
4435
+ },
4368
4436
  });
4369
4437
  return resultString;
4370
4438
  }
@@ -4498,7 +4566,11 @@ async function getKnowledgeForTask(options) {
4498
4566
  */
4499
4567
 
4500
4568
  /**
4501
- * @@@
4569
+ * Retrieves all reserved parameters for a given pipeline task, including context, knowledge, examples, and metadata.
4570
+ * Ensures all reserved parameters are defined and throws if any are missing.
4571
+ *
4572
+ * @param options - Options including tools, pipeline, task, and context.
4573
+ * @returns An object containing all reserved parameters for the task.
4502
4574
  *
4503
4575
  * @private internal utility of `createPipelineExecutor`
4504
4576
  */
@@ -4531,18 +4603,16 @@ async function getReservedParametersForTask(options) {
4531
4603
  }
4532
4604
 
4533
4605
  /**
4534
- * @@@
4606
+ * Executes a single task within a pipeline, handling parameter validation, error checking, and progress reporting.
4607
+ *
4608
+ * @param options - Options for execution, including the task, pipeline, parameters, and callbacks.
4609
+ * @returns The output parameters produced by the task.
4535
4610
  *
4536
4611
  * @private internal utility of `createPipelineExecutor`
4537
4612
  */
4538
4613
  async function executeTask(options) {
4539
4614
  const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSupressed, } = options;
4540
4615
  const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
4541
- await onProgress({
4542
- outputParameters: {
4543
- [currentTask.resultingParameterName]: '', // <- TODO: [🧠] What is the best value here?
4544
- },
4545
- });
4546
4616
  // Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but it’s good to doublecheck
4547
4617
  const usedParameterNames = extractParameterNamesFromTask(currentTask);
4548
4618
  const dependentParameterNames = new Set(currentTask.dependentParameterNames);
@@ -4617,6 +4687,7 @@ async function executeTask(options) {
4617
4687
  preparedPipeline,
4618
4688
  tools,
4619
4689
  $executionReport,
4690
+ onProgress,
4620
4691
  pipelineIdentification,
4621
4692
  maxExecutionAttempts,
4622
4693
  maxParallelCount,
@@ -4669,9 +4740,12 @@ function filterJustOutputParameters(options) {
4669
4740
  }
4670
4741
 
4671
4742
  /**
4672
- * @@@
4743
+ * Executes an entire pipeline, resolving tasks in dependency order, handling errors, and reporting progress.
4673
4744
  *
4674
- * Note: This is not a `PipelineExecutor` (which is binded with one exact pipeline), but a utility function of `createPipelineExecutor` which creates `PipelineExecutor`
4745
+ * Note: This is not a `PipelineExecutor` (which is bound to a single pipeline), but a utility function used by `createPipelineExecutor` to create a `PipelineExecutor`.
4746
+ *
4747
+ * @param options - Options for execution, including input parameters, pipeline, and callbacks.
4748
+ * @returns The result of the pipeline execution, including output parameters, errors, and usage statistics.
4675
4749
  *
4676
4750
  * @private internal utility of `createPipelineExecutor`
4677
4751
  */
@@ -5272,11 +5346,11 @@ function normalizeTo_snake_case(text) {
5272
5346
  }
5273
5347
 
5274
5348
  /**
5275
- * Register is @@@
5349
+ * Global registry for storing and managing registered entities of a given type.
5276
5350
  *
5277
5351
  * Note: `$` is used to indicate that this function is not a pure function - it accesses and adds variables in global scope.
5278
5352
  *
5279
- * @private internal utility, exported are only signleton instances of this class
5353
+ * @private internal utility, exported are only singleton instances of this class
5280
5354
  */
5281
5355
  class $Register {
5282
5356
  constructor(registerName) {
@@ -5326,10 +5400,10 @@ class $Register {
5326
5400
  }
5327
5401
 
5328
5402
  /**
5329
- * @@@
5403
+ * Global registry for storing metadata about all available scrapers and converters.
5330
5404
  *
5331
- * Note: `$` is used to indicate that this interacts with the global scope
5332
- * @singleton Only one instance of each register is created per build, but thare can be more @@@
5405
+ * Note: `$` is used to indicate that this interacts with the global scope.
5406
+ * @singleton Only one instance of each register is created per build, but there can be more in different contexts (e.g., tests).
5333
5407
  * @public exported from `@promptbook/core`
5334
5408
  */
5335
5409
  const $scrapersMetadataRegister = new $Register('scrapers_metadata');
@@ -6868,11 +6942,12 @@ function removeQuotes(text) {
6868
6942
  }
6869
6943
 
6870
6944
  /**
6871
- * Function `validateParameterName` will @@@
6945
+ * Function `validateParameterName` will normalize and validate a parameter name for use in pipelines.
6946
+ * It removes diacritics, emojis, and quotes, normalizes to camelCase, and checks for reserved names and invalid characters.
6872
6947
  *
6873
- * @param parameterName @@@
6874
- * @returns @@@
6875
- * @throws {ParseError} @@@
6948
+ * @param parameterName The parameter name to validate and normalize.
6949
+ * @returns The validated and normalized parameter name.
6950
+ * @throws {ParseError} If the parameter name is empty, reserved, or contains invalid characters.
6876
6951
  * @private within the repository
6877
6952
  */
6878
6953
  function validateParameterName(parameterName) {
@@ -8046,10 +8121,10 @@ function $applyToTaskJson(command, $taskJson, $pipelineJson) {
8046
8121
  }
8047
8122
 
8048
8123
  /**
8049
- * @@@
8124
+ * Checks if the given value is a valid JavaScript identifier name.
8050
8125
  *
8051
- * @param javascriptName @@@
8052
- * @returns @@@
8126
+ * @param javascriptName The value to check for JavaScript identifier validity.
8127
+ * @returns `true` if the value is a valid JavaScript name, false otherwise.
8053
8128
  * @public exported from `@promptbook/utils`
8054
8129
  */
8055
8130
  function isValidJavascriptName(javascriptName) {
@@ -10581,8 +10656,10 @@ function cacheLlmTools(llmTools, options = {}) {
10581
10656
  sha256(hexEncoder.parse(JSON.stringify({ parameters, content, modelRequirements }))).toString( /* hex */));
10582
10657
  const cacheItem = !isCacheReloaded ? await storage.getItem(key) : null;
10583
10658
  if (cacheItem) {
10659
+ console.log('!!! Cache hit for key:', key);
10584
10660
  return cacheItem.promptResult;
10585
10661
  }
10662
+ console.log('!!! Cache miss for key:', key);
10586
10663
  let promptResult;
10587
10664
  variant: switch (prompt.modelRequirements.modelVariant) {
10588
10665
  case 'CHAT':
@@ -11480,5 +11557,5 @@ class PrefixStorage {
11480
11557
  }
11481
11558
  }
11482
11559
 
11483
- export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, ADMIN_EMAIL, ADMIN_GITHUB_NAME, AbstractFormatError, AuthenticationError, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateError, BoilerplateFormfactorDefinition, CLAIM, CLI_APP_ID, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CompletionFormfactorDefinition, CsvFormatError, CsvFormatParser, DEFAULT_BOOKS_DIRNAME, DEFAULT_BOOK_OUTPUT_PARAMETER_NAME, DEFAULT_BOOK_TITLE, DEFAULT_CSV_SETTINGS, DEFAULT_DOWNLOAD_CACHE_DIRNAME, DEFAULT_EXECUTION_CACHE_DIRNAME, DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_FILE_SIZE, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_PROMPT_TASK_TITLE, DEFAULT_REMOTE_SERVER_URL, DEFAULT_RPM, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TASK_TITLE, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FORMFACTOR_DEFINITIONS, GENERIC_PIPELINE_INTERFACE, GeneratorFormfactorDefinition, GenericFormfactorDefinition, ImageGeneratorFormfactorDefinition, KnowledgeScrapeError, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_ORDER, MODEL_TRUST_LEVEL, MODEL_VARIANTS, MatcherFormfactorDefinition, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NAME, NonTaskSectionTypes, NotFoundError, NotYetImplementedError, ORDER_OF_PIPELINE_JSON, PLAYGROUND_APP_ID, PROMPTBOOK_ENGINE_VERSION, PROMPTBOOK_ERRORS, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, PromptbookFetchError, REMOTE_SERVER_URLS, RESERVED_PARAMETER_NAMES, SET_IS_VERBOSE, SectionTypes, SheetsFormfactorDefinition, TaskTypes, TextFormatParser, TranslatorFormfactorDefinition, UNCERTAIN_USAGE, UNCERTAIN_ZERO_VALUE, UnexpectedError, WrappedError, ZERO_USAGE, ZERO_VALUE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _BoilerplateScraperMetadataRegistration, _DeepseekMetadataRegistration, _DocumentScraperMetadataRegistration, _GoogleMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _MarkitdownScraperMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, addUsage, book, cacheLlmTools, collectionToJson, compilePipeline, computeCosineSimilarity, countUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, extractParameterNamesFromTask, filterModels, getPipelineInterface, identificationToPromptbookToken, isPassingExpectations, isPipelineImplementingInterface, isPipelineInterfacesEqual, isPipelinePrepared, isValidPipelineString, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, migratePipeline, parsePipeline, pipelineJsonToString, prepareKnowledgePieces, preparePersona, preparePipeline, prepareTasks, prettifyPipelineString, promptbookFetch, promptbookTokenToIdentification, unpreparePipeline, usageToHuman, usageToWorktime, validatePipeline, validatePipelineString };
11560
+ export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, ADMIN_EMAIL, ADMIN_GITHUB_NAME, AbstractFormatError, AuthenticationError, BIG_DATASET_TRESHOLD, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateError, BoilerplateFormfactorDefinition, CLAIM, CLI_APP_ID, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CompletionFormfactorDefinition, CsvFormatError, CsvFormatParser, DEFAULT_BOOKS_DIRNAME, DEFAULT_BOOK_OUTPUT_PARAMETER_NAME, DEFAULT_BOOK_TITLE, DEFAULT_CSV_SETTINGS, DEFAULT_DOWNLOAD_CACHE_DIRNAME, DEFAULT_EXECUTION_CACHE_DIRNAME, DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_FILE_SIZE, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_PROMPT_TASK_TITLE, DEFAULT_REMOTE_SERVER_URL, DEFAULT_RPM, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TASK_TITLE, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FAILED_VALUE_PLACEHOLDER, FORMFACTOR_DEFINITIONS, GENERIC_PIPELINE_INTERFACE, GeneratorFormfactorDefinition, GenericFormfactorDefinition, ImageGeneratorFormfactorDefinition, KnowledgeScrapeError, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_ORDER, MODEL_TRUST_LEVEL, MODEL_VARIANTS, MatcherFormfactorDefinition, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NAME, NonTaskSectionTypes, NotFoundError, NotYetImplementedError, ORDER_OF_PIPELINE_JSON, PENDING_VALUE_PLACEHOLDER, PLAYGROUND_APP_ID, PROMPTBOOK_ENGINE_VERSION, PROMPTBOOK_ERRORS, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, PromptbookFetchError, REMOTE_SERVER_URLS, RESERVED_PARAMETER_NAMES, SET_IS_VERBOSE, SectionTypes, SheetsFormfactorDefinition, TaskTypes, TextFormatParser, TranslatorFormfactorDefinition, UNCERTAIN_USAGE, UNCERTAIN_ZERO_VALUE, UnexpectedError, WrappedError, ZERO_USAGE, ZERO_VALUE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _BoilerplateScraperMetadataRegistration, _DeepseekMetadataRegistration, _DocumentScraperMetadataRegistration, _GoogleMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _MarkitdownScraperMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, addUsage, book, cacheLlmTools, collectionToJson, compilePipeline, computeCosineSimilarity, countUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, extractParameterNamesFromTask, filterModels, getPipelineInterface, identificationToPromptbookToken, isPassingExpectations, isPipelineImplementingInterface, isPipelineInterfacesEqual, isPipelinePrepared, isValidPipelineString, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, migratePipeline, parsePipeline, pipelineJsonToString, prepareKnowledgePieces, preparePersona, preparePipeline, prepareTasks, prettifyPipelineString, promptbookFetch, promptbookTokenToIdentification, unpreparePipeline, usageToHuman, usageToWorktime, validatePipeline, validatePipelineString };
11484
11561
  //# sourceMappingURL=index.es.js.map