@promptbook/pdf 0.112.0-13 → 0.112.0-16
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 +35 -35
- package/esm/index.es.js.map +1 -1
- package/esm/src/cli/cli-commands/coder/{find-fresh-emoji-tag.d.ts → find-fresh-emoji-tags.d.ts} +1 -1
- package/esm/src/cli/cli-commands/coder.d.ts +1 -1
- package/esm/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +1 -1
- package/esm/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
- package/esm/src/llm-providers/google/google-models.d.ts +1 -1
- package/esm/src/llm-providers/openai/openai-models.d.ts +1 -1
- package/esm/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +1 -2
- package/esm/src/scrapers/document/DocumentScraper.d.ts +1 -2
- package/esm/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -2
- package/esm/src/scripting/javascript/postprocessing-functions.d.ts +1 -1
- package/esm/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +1 -2
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +93 -94
- package/umd/index.umd.js.map +1 -1
- package/umd/src/cli/cli-commands/coder/{find-fresh-emoji-tag.d.ts → find-fresh-emoji-tags.d.ts} +1 -1
- package/umd/src/cli/cli-commands/coder.d.ts +1 -1
- package/umd/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +1 -1
- package/umd/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/umd/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
- package/umd/src/llm-providers/google/google-models.d.ts +1 -1
- package/umd/src/llm-providers/openai/openai-models.d.ts +1 -1
- package/umd/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +1 -2
- package/umd/src/scrapers/document/DocumentScraper.d.ts +1 -2
- package/umd/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -2
- package/umd/src/scripting/javascript/postprocessing-functions.d.ts +1 -1
- package/umd/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +1 -2
- package/umd/src/version.d.ts +1 -1
package/umd/index.umd.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('fs/promises'), require('spacetrim'), require('crypto-js'), require('crypto-js/enc-hex'), require('path'), require('crypto'), require('rxjs'), require('waitasecond'), require('crypto-js/sha256'), require('mime-types'), require('papaparse')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', 'fs/promises', 'spacetrim', 'crypto-js', 'crypto-js/enc-hex', 'path', 'crypto', 'rxjs', 'waitasecond', 'crypto-js/sha256', 'mime-types', 'papaparse'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-pdf"] = {}, global.promises, global.
|
|
5
|
-
})(this, (function (exports, promises,
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-pdf"] = {}, global.promises, global.spacetrim, global.cryptoJs, global.hexEncoder, global.path, global.crypto, global.rxjs, global.waitasecond, global.sha256, global.mimeTypes, global.papaparse));
|
|
5
|
+
})(this, (function (exports, promises, spacetrim, cryptoJs, hexEncoder, path, crypto, rxjs, waitasecond, sha256, mimeTypes, papaparse) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
9
|
-
var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim$1);
|
|
10
9
|
var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
|
|
11
10
|
var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
|
|
12
11
|
|
|
@@ -24,7 +23,7 @@
|
|
|
24
23
|
* @generated
|
|
25
24
|
* @see https://github.com/webgptorg/promptbook
|
|
26
25
|
*/
|
|
27
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
26
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-16';
|
|
28
27
|
/**
|
|
29
28
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
30
29
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -56,7 +55,7 @@
|
|
|
56
55
|
* @public exported from `@promptbook/utils`
|
|
57
56
|
* @see https://github.com/hejny/spacetrim#usage
|
|
58
57
|
*/
|
|
59
|
-
const spaceTrim =
|
|
58
|
+
const spaceTrim = spacetrim.spaceTrim;
|
|
60
59
|
|
|
61
60
|
/**
|
|
62
61
|
* Just marks a place of place where should be something implemented
|
|
@@ -1216,7 +1215,7 @@
|
|
|
1216
1215
|
function getErrorReportUrl(error) {
|
|
1217
1216
|
const report = {
|
|
1218
1217
|
title: `🐜 Error report from ${NAME}`,
|
|
1219
|
-
body:
|
|
1218
|
+
body: spacetrim.spaceTrim((block) => `
|
|
1220
1219
|
|
|
1221
1220
|
|
|
1222
1221
|
\`${error.name || 'Error'}\` has occurred in the [${NAME}], please look into it @${ADMIN_GITHUB_NAME}.
|
|
@@ -1259,7 +1258,7 @@
|
|
|
1259
1258
|
*/
|
|
1260
1259
|
class UnexpectedError extends Error {
|
|
1261
1260
|
constructor(message) {
|
|
1262
|
-
super(
|
|
1261
|
+
super(spacetrim.spaceTrim((block) => `
|
|
1263
1262
|
${block(message)}
|
|
1264
1263
|
|
|
1265
1264
|
Note: This error should not happen.
|
|
@@ -1889,7 +1888,7 @@
|
|
|
1889
1888
|
constructor(whatWasThrown) {
|
|
1890
1889
|
const tag = `[🤮]`;
|
|
1891
1890
|
console.error(tag, whatWasThrown);
|
|
1892
|
-
super(
|
|
1891
|
+
super(spacetrim.spaceTrim(`
|
|
1893
1892
|
Non-Error object was thrown
|
|
1894
1893
|
|
|
1895
1894
|
Note: Look for ${tag} in the console for more details
|
|
@@ -2115,7 +2114,7 @@
|
|
|
2115
2114
|
pipelineString += '\n\n';
|
|
2116
2115
|
pipelineString += '```' + contentLanguage;
|
|
2117
2116
|
pipelineString += '\n';
|
|
2118
|
-
pipelineString +=
|
|
2117
|
+
pipelineString += spacetrim.spaceTrim(content);
|
|
2119
2118
|
// <- TODO: [main] !!3 Escape
|
|
2120
2119
|
// <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
|
|
2121
2120
|
pipelineString += '\n';
|
|
@@ -2236,7 +2235,7 @@
|
|
|
2236
2235
|
}
|
|
2237
2236
|
else if (typeof value === 'object') {
|
|
2238
2237
|
if (value instanceof Date) {
|
|
2239
|
-
throw new UnexpectedError(
|
|
2238
|
+
throw new UnexpectedError(spacetrim.spaceTrim((block) => `
|
|
2240
2239
|
\`${name}\` is Date
|
|
2241
2240
|
|
|
2242
2241
|
Use \`string_date_iso8601\` instead
|
|
@@ -2255,7 +2254,7 @@
|
|
|
2255
2254
|
throw new UnexpectedError(`${name} is RegExp`);
|
|
2256
2255
|
}
|
|
2257
2256
|
else if (value instanceof Error) {
|
|
2258
|
-
throw new UnexpectedError(
|
|
2257
|
+
throw new UnexpectedError(spacetrim.spaceTrim((block) => `
|
|
2259
2258
|
\`${name}\` is unserialized Error
|
|
2260
2259
|
|
|
2261
2260
|
Use function \`serializeError\`
|
|
@@ -2278,7 +2277,7 @@
|
|
|
2278
2277
|
}
|
|
2279
2278
|
catch (error) {
|
|
2280
2279
|
assertsError(error);
|
|
2281
|
-
throw new UnexpectedError(
|
|
2280
|
+
throw new UnexpectedError(spacetrim.spaceTrim((block) => `
|
|
2282
2281
|
\`${name}\` is not serializable
|
|
2283
2282
|
|
|
2284
2283
|
${block(error.stack || error.message)}
|
|
@@ -2310,7 +2309,7 @@
|
|
|
2310
2309
|
}
|
|
2311
2310
|
}
|
|
2312
2311
|
else {
|
|
2313
|
-
throw new UnexpectedError(
|
|
2312
|
+
throw new UnexpectedError(spacetrim.spaceTrim((block) => `
|
|
2314
2313
|
\`${name}\` is unknown type
|
|
2315
2314
|
|
|
2316
2315
|
Additional message for \`${name}\`:
|
|
@@ -2565,7 +2564,7 @@
|
|
|
2565
2564
|
if (!(error instanceof PipelineLogicError)) {
|
|
2566
2565
|
throw error;
|
|
2567
2566
|
}
|
|
2568
|
-
console.error(
|
|
2567
|
+
console.error(spacetrim.spaceTrim((block) => `
|
|
2569
2568
|
Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
|
|
2570
2569
|
|
|
2571
2570
|
${block(error.message)}
|
|
@@ -2592,7 +2591,7 @@
|
|
|
2592
2591
|
})();
|
|
2593
2592
|
if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
|
|
2594
2593
|
// <- Note: [🚲]
|
|
2595
|
-
throw new PipelineLogicError(
|
|
2594
|
+
throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
|
|
2596
2595
|
Invalid promptbook URL "${pipeline.pipelineUrl}"
|
|
2597
2596
|
|
|
2598
2597
|
${block(pipelineIdentification)}
|
|
@@ -2600,7 +2599,7 @@
|
|
|
2600
2599
|
}
|
|
2601
2600
|
if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
|
|
2602
2601
|
// <- Note: [🚲]
|
|
2603
|
-
throw new PipelineLogicError(
|
|
2602
|
+
throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
|
|
2604
2603
|
Invalid Promptbook Version "${pipeline.bookVersion}"
|
|
2605
2604
|
|
|
2606
2605
|
${block(pipelineIdentification)}
|
|
@@ -2609,7 +2608,7 @@
|
|
|
2609
2608
|
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
2610
2609
|
if (!Array.isArray(pipeline.parameters)) {
|
|
2611
2610
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
2612
|
-
throw new ParseError(
|
|
2611
|
+
throw new ParseError(spacetrim.spaceTrim((block) => `
|
|
2613
2612
|
Pipeline is valid JSON but with wrong structure
|
|
2614
2613
|
|
|
2615
2614
|
\`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
|
|
@@ -2620,7 +2619,7 @@
|
|
|
2620
2619
|
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
2621
2620
|
if (!Array.isArray(pipeline.tasks)) {
|
|
2622
2621
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
2623
|
-
throw new ParseError(
|
|
2622
|
+
throw new ParseError(spacetrim.spaceTrim((block) => `
|
|
2624
2623
|
Pipeline is valid JSON but with wrong structure
|
|
2625
2624
|
|
|
2626
2625
|
\`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
|
|
@@ -2646,7 +2645,7 @@
|
|
|
2646
2645
|
// Note: Check each parameter individually
|
|
2647
2646
|
for (const parameter of pipeline.parameters) {
|
|
2648
2647
|
if (parameter.isInput && parameter.isOutput) {
|
|
2649
|
-
throw new PipelineLogicError(
|
|
2648
|
+
throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
|
|
2650
2649
|
|
|
2651
2650
|
Parameter \`{${parameter.name}}\` can not be both input and output
|
|
2652
2651
|
|
|
@@ -2657,7 +2656,7 @@
|
|
|
2657
2656
|
if (!parameter.isInput &&
|
|
2658
2657
|
!parameter.isOutput &&
|
|
2659
2658
|
!pipeline.tasks.some((task) => task.dependentParameterNames.includes(parameter.name))) {
|
|
2660
|
-
throw new PipelineLogicError(
|
|
2659
|
+
throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
|
|
2661
2660
|
Parameter \`{${parameter.name}}\` is created but not used
|
|
2662
2661
|
|
|
2663
2662
|
You can declare {${parameter.name}} as output parameter by adding in the header:
|
|
@@ -2669,7 +2668,7 @@
|
|
|
2669
2668
|
}
|
|
2670
2669
|
// Note: Testing that parameter is either input or result of some task
|
|
2671
2670
|
if (!parameter.isInput && !pipeline.tasks.some((task) => task.resultingParameterName === parameter.name)) {
|
|
2672
|
-
throw new PipelineLogicError(
|
|
2671
|
+
throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
|
|
2673
2672
|
Parameter \`{${parameter.name}}\` is declared but not defined
|
|
2674
2673
|
|
|
2675
2674
|
You can do one of these:
|
|
@@ -2685,14 +2684,14 @@
|
|
|
2685
2684
|
// Note: Checking each task individually
|
|
2686
2685
|
for (const task of pipeline.tasks) {
|
|
2687
2686
|
if (definedParameters.has(task.resultingParameterName)) {
|
|
2688
|
-
throw new PipelineLogicError(
|
|
2687
|
+
throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
|
|
2689
2688
|
Parameter \`{${task.resultingParameterName}}\` is defined multiple times
|
|
2690
2689
|
|
|
2691
2690
|
${block(pipelineIdentification)}
|
|
2692
2691
|
`));
|
|
2693
2692
|
}
|
|
2694
2693
|
if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
|
|
2695
|
-
throw new PipelineLogicError(
|
|
2694
|
+
throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
|
|
2696
2695
|
Parameter name {${task.resultingParameterName}} is reserved, please use different name
|
|
2697
2696
|
|
|
2698
2697
|
${block(pipelineIdentification)}
|
|
@@ -2702,7 +2701,7 @@
|
|
|
2702
2701
|
if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
|
|
2703
2702
|
if (!task.format &&
|
|
2704
2703
|
!task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
|
|
2705
|
-
throw new PipelineLogicError(
|
|
2704
|
+
throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
|
|
2706
2705
|
Joker parameters are used for {${task.resultingParameterName}} but no expectations are defined
|
|
2707
2706
|
|
|
2708
2707
|
${block(pipelineIdentification)}
|
|
@@ -2710,7 +2709,7 @@
|
|
|
2710
2709
|
}
|
|
2711
2710
|
for (const joker of task.jokerParameterNames) {
|
|
2712
2711
|
if (!task.dependentParameterNames.includes(joker)) {
|
|
2713
|
-
throw new PipelineLogicError(
|
|
2712
|
+
throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
|
|
2714
2713
|
Parameter \`{${joker}}\` is used for {${task.resultingParameterName}} as joker but not in \`dependentParameterNames\`
|
|
2715
2714
|
|
|
2716
2715
|
${block(pipelineIdentification)}
|
|
@@ -2721,21 +2720,21 @@
|
|
|
2721
2720
|
if (task.expectations) {
|
|
2722
2721
|
for (const [unit, { min, max }] of Object.entries(task.expectations)) {
|
|
2723
2722
|
if (min !== undefined && max !== undefined && min > max) {
|
|
2724
|
-
throw new PipelineLogicError(
|
|
2723
|
+
throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
|
|
2725
2724
|
Min expectation (=${min}) of ${unit} is higher than max expectation (=${max})
|
|
2726
2725
|
|
|
2727
2726
|
${block(pipelineIdentification)}
|
|
2728
2727
|
`));
|
|
2729
2728
|
}
|
|
2730
2729
|
if (min !== undefined && min < 0) {
|
|
2731
|
-
throw new PipelineLogicError(
|
|
2730
|
+
throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
|
|
2732
2731
|
Min expectation of ${unit} must be zero or positive
|
|
2733
2732
|
|
|
2734
2733
|
${block(pipelineIdentification)}
|
|
2735
2734
|
`));
|
|
2736
2735
|
}
|
|
2737
2736
|
if (max !== undefined && max <= 0) {
|
|
2738
|
-
throw new PipelineLogicError(
|
|
2737
|
+
throw new PipelineLogicError(spacetrim.spaceTrim((block) => `
|
|
2739
2738
|
Max expectation of ${unit} must be positive
|
|
2740
2739
|
|
|
2741
2740
|
${block(pipelineIdentification)}
|
|
@@ -2757,7 +2756,7 @@
|
|
|
2757
2756
|
while (unresovedTasks.length > 0) {
|
|
2758
2757
|
if (loopLimit-- < 0) {
|
|
2759
2758
|
// Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
|
|
2760
|
-
throw new UnexpectedError(
|
|
2759
|
+
throw new UnexpectedError(spacetrim.spaceTrim((block) => `
|
|
2761
2760
|
Loop limit reached during detection of circular dependencies in \`validatePipeline\`
|
|
2762
2761
|
|
|
2763
2762
|
${block(pipelineIdentification)}
|
|
@@ -2767,7 +2766,7 @@
|
|
|
2767
2766
|
if (currentlyResovedTasks.length === 0) {
|
|
2768
2767
|
throw new PipelineLogicError(
|
|
2769
2768
|
// TODO: [🐎] DRY
|
|
2770
|
-
|
|
2769
|
+
spacetrim.spaceTrim((block) => `
|
|
2771
2770
|
|
|
2772
2771
|
Can not resolve some parameters:
|
|
2773
2772
|
Either you are using a parameter that is not defined, or there are some circular dependencies.
|
|
@@ -2931,7 +2930,7 @@
|
|
|
2931
2930
|
for (const pipeline of pipelines) {
|
|
2932
2931
|
// TODO: [👠] DRY
|
|
2933
2932
|
if (pipeline.pipelineUrl === undefined) {
|
|
2934
|
-
throw new PipelineUrlError(
|
|
2933
|
+
throw new PipelineUrlError(spacetrim.spaceTrim(`
|
|
2935
2934
|
Pipeline with name "${pipeline.title}" does not have defined URL
|
|
2936
2935
|
|
|
2937
2936
|
File:
|
|
@@ -2953,7 +2952,7 @@
|
|
|
2953
2952
|
pipelineJsonToString(unpreparePipeline(pipeline)) !==
|
|
2954
2953
|
pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
|
|
2955
2954
|
const existing = this.collection.get(pipeline.pipelineUrl);
|
|
2956
|
-
throw new PipelineUrlError(
|
|
2955
|
+
throw new PipelineUrlError(spacetrim.spaceTrim(`
|
|
2957
2956
|
Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍎
|
|
2958
2957
|
|
|
2959
2958
|
Conflicting files:
|
|
@@ -2985,13 +2984,13 @@
|
|
|
2985
2984
|
const pipeline = this.collection.get(url);
|
|
2986
2985
|
if (!pipeline) {
|
|
2987
2986
|
if (this.listPipelines().length === 0) {
|
|
2988
|
-
throw new NotFoundError(
|
|
2987
|
+
throw new NotFoundError(spacetrim.spaceTrim(`
|
|
2989
2988
|
Pipeline with url "${url}" not found
|
|
2990
2989
|
|
|
2991
2990
|
No pipelines available
|
|
2992
2991
|
`));
|
|
2993
2992
|
}
|
|
2994
|
-
throw new NotFoundError(
|
|
2993
|
+
throw new NotFoundError(spacetrim.spaceTrim((block) => `
|
|
2995
2994
|
Pipeline with url "${url}" not found
|
|
2996
2995
|
|
|
2997
2996
|
Available pipelines:
|
|
@@ -3032,7 +3031,7 @@
|
|
|
3032
3031
|
*/
|
|
3033
3032
|
class MissingToolsError extends Error {
|
|
3034
3033
|
constructor(message) {
|
|
3035
|
-
super(
|
|
3034
|
+
super(spacetrim.spaceTrim((block) => `
|
|
3036
3035
|
${block(message)}
|
|
3037
3036
|
|
|
3038
3037
|
Note: You have probably forgot to provide some tools for pipeline execution or preparation
|
|
@@ -3253,7 +3252,7 @@
|
|
|
3253
3252
|
*/
|
|
3254
3253
|
class NotYetImplementedError extends Error {
|
|
3255
3254
|
constructor(message) {
|
|
3256
|
-
super(
|
|
3255
|
+
super(spacetrim.spaceTrim((block) => `
|
|
3257
3256
|
${block(message)}
|
|
3258
3257
|
|
|
3259
3258
|
Note: This feature is not implemented yet but it will be soon.
|
|
@@ -3356,7 +3355,7 @@
|
|
|
3356
3355
|
const { name, message, stack } = error;
|
|
3357
3356
|
const { id } = error;
|
|
3358
3357
|
if (!Object.keys(ALL_ERRORS).includes(name)) {
|
|
3359
|
-
console.error(
|
|
3358
|
+
console.error(spacetrim.spaceTrim((block) => `
|
|
3360
3359
|
|
|
3361
3360
|
Cannot serialize error with name "${name}"
|
|
3362
3361
|
|
|
@@ -3389,7 +3388,7 @@
|
|
|
3389
3388
|
}
|
|
3390
3389
|
else if (typeof value !== 'string') {
|
|
3391
3390
|
console.error('Can not parse JSON from non-string value.', { text: value });
|
|
3392
|
-
throw new Error(
|
|
3391
|
+
throw new Error(spacetrim.spaceTrim(`
|
|
3393
3392
|
Can not parse JSON from non-string value.
|
|
3394
3393
|
|
|
3395
3394
|
The value type: ${typeof value}
|
|
@@ -3403,7 +3402,7 @@
|
|
|
3403
3402
|
if (!(error instanceof Error)) {
|
|
3404
3403
|
throw error;
|
|
3405
3404
|
}
|
|
3406
|
-
throw new Error(
|
|
3405
|
+
throw new Error(spacetrim.spaceTrim((block) => `
|
|
3407
3406
|
${block(error.message)}
|
|
3408
3407
|
|
|
3409
3408
|
The expected JSON text:
|
|
@@ -3456,7 +3455,7 @@
|
|
|
3456
3455
|
message = `${name}: ${message}`;
|
|
3457
3456
|
}
|
|
3458
3457
|
if (isStackAddedToMessage && stack !== undefined && stack !== '') {
|
|
3459
|
-
message =
|
|
3458
|
+
message = spacetrim.spaceTrim((block) => `
|
|
3460
3459
|
${block(message)}
|
|
3461
3460
|
|
|
3462
3461
|
Original stack trace:
|
|
@@ -3493,11 +3492,11 @@
|
|
|
3493
3492
|
throw deserializeError(errors[0]);
|
|
3494
3493
|
}
|
|
3495
3494
|
else {
|
|
3496
|
-
throw new PipelineExecutionError(
|
|
3495
|
+
throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
|
|
3497
3496
|
Multiple errors occurred during Promptbook execution
|
|
3498
3497
|
|
|
3499
3498
|
${block(errors
|
|
3500
|
-
.map(({ name, stack, message }, index) =>
|
|
3499
|
+
.map(({ name, stack, message }, index) => spacetrim.spaceTrim((block) => `
|
|
3501
3500
|
${name} ${index + 1}:
|
|
3502
3501
|
${block(stack || message)}
|
|
3503
3502
|
`))
|
|
@@ -4006,14 +4005,14 @@
|
|
|
4006
4005
|
if (description === undefined) {
|
|
4007
4006
|
return headLine;
|
|
4008
4007
|
}
|
|
4009
|
-
return
|
|
4008
|
+
return spacetrim.spaceTrim((block) => `
|
|
4010
4009
|
${headLine}
|
|
4011
4010
|
|
|
4012
4011
|
${ /* <- Note: Indenting the description: */block(description)}
|
|
4013
4012
|
`);
|
|
4014
4013
|
})
|
|
4015
4014
|
.join('\n\n');
|
|
4016
|
-
return
|
|
4015
|
+
return spacetrim.spaceTrim((block) => `
|
|
4017
4016
|
Multiple LLM Providers:
|
|
4018
4017
|
|
|
4019
4018
|
${block(innerModelsTitlesAndDescriptions)}
|
|
@@ -4115,7 +4114,7 @@
|
|
|
4115
4114
|
// 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
4116
4115
|
// 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
4117
4116
|
// 3) ...
|
|
4118
|
-
|
|
4117
|
+
spacetrim.spaceTrim((block) => `
|
|
4119
4118
|
All execution tools of ${this.title} failed:
|
|
4120
4119
|
|
|
4121
4120
|
${block(errors
|
|
@@ -4128,7 +4127,7 @@
|
|
|
4128
4127
|
throw new PipelineExecutionError(`You have not provided any \`LlmExecutionTools\` into ${this.title}`);
|
|
4129
4128
|
}
|
|
4130
4129
|
else {
|
|
4131
|
-
throw new PipelineExecutionError(
|
|
4130
|
+
throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
|
|
4132
4131
|
You have not provided any \`LlmExecutionTools\` that support model variant "${prompt.modelRequirements.modelVariant}" into ${this.title}
|
|
4133
4132
|
|
|
4134
4133
|
Available \`LlmExecutionTools\`:
|
|
@@ -4165,7 +4164,7 @@
|
|
|
4165
4164
|
*/
|
|
4166
4165
|
function joinLlmExecutionTools(title, ...llmExecutionTools) {
|
|
4167
4166
|
if (llmExecutionTools.length === 0) {
|
|
4168
|
-
const warningMessage =
|
|
4167
|
+
const warningMessage = spacetrim.spaceTrim(`
|
|
4169
4168
|
You have not provided any \`LlmExecutionTools\`
|
|
4170
4169
|
This means that you won't be able to execute any prompts that require large language models like GPT-4 or Anthropic's Claude.
|
|
4171
4170
|
|
|
@@ -4482,14 +4481,14 @@
|
|
|
4482
4481
|
return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
|
|
4483
4482
|
});
|
|
4484
4483
|
if (metadata.length === 0) {
|
|
4485
|
-
return
|
|
4484
|
+
return spacetrim.spaceTrim(`
|
|
4486
4485
|
**No scrapers are available**
|
|
4487
4486
|
|
|
4488
4487
|
This is a unexpected behavior, you are probably using some broken version of Promptbook
|
|
4489
4488
|
At least there should be available the metadata of the scrapers
|
|
4490
4489
|
`);
|
|
4491
4490
|
}
|
|
4492
|
-
return
|
|
4491
|
+
return spacetrim.spaceTrim((block) => `
|
|
4493
4492
|
Available scrapers are:
|
|
4494
4493
|
${block(metadata
|
|
4495
4494
|
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
|
|
@@ -4600,7 +4599,7 @@
|
|
|
4600
4599
|
else if (urlOrRequest instanceof Request) {
|
|
4601
4600
|
url = urlOrRequest.url;
|
|
4602
4601
|
}
|
|
4603
|
-
throw new PromptbookFetchError(
|
|
4602
|
+
throw new PromptbookFetchError(spacetrim.spaceTrim((block) => `
|
|
4604
4603
|
Can not fetch "${url}"
|
|
4605
4604
|
|
|
4606
4605
|
Fetch error:
|
|
@@ -4760,7 +4759,7 @@
|
|
|
4760
4759
|
const fileExtension = getFileExtension(filename);
|
|
4761
4760
|
const mimeType = extensionToMimeType(fileExtension || '');
|
|
4762
4761
|
if (!(await isFileExisting(filename, tools.fs))) {
|
|
4763
|
-
throw new NotFoundError(
|
|
4762
|
+
throw new NotFoundError(spacetrim.spaceTrim((block) => `
|
|
4764
4763
|
Can not make source handler for file which does not exist:
|
|
4765
4764
|
|
|
4766
4765
|
File:
|
|
@@ -4853,7 +4852,7 @@
|
|
|
4853
4852
|
// <- TODO: [🪓] Here should be no need for spreading new array, just `partialPieces = partialPiecesUnchecked`
|
|
4854
4853
|
break;
|
|
4855
4854
|
}
|
|
4856
|
-
console.warn(
|
|
4855
|
+
console.warn(spacetrim.spaceTrim((block) => `
|
|
4857
4856
|
Cannot scrape knowledge from source despite the scraper \`${scraper.metadata.className}\` supports the mime type "${sourceHandler.mimeType}".
|
|
4858
4857
|
|
|
4859
4858
|
The source:
|
|
@@ -4869,7 +4868,7 @@
|
|
|
4869
4868
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
4870
4869
|
}
|
|
4871
4870
|
if (partialPieces === null) {
|
|
4872
|
-
throw new KnowledgeScrapeError(
|
|
4871
|
+
throw new KnowledgeScrapeError(spacetrim.spaceTrim((block) => `
|
|
4873
4872
|
Cannot scrape knowledge
|
|
4874
4873
|
|
|
4875
4874
|
The source:
|
|
@@ -4948,7 +4947,7 @@
|
|
|
4948
4947
|
if (task.taskType === 'PROMPT_TASK' &&
|
|
4949
4948
|
knowledgePiecesCount > 0 &&
|
|
4950
4949
|
!dependentParameterNames.includes('knowledge')) {
|
|
4951
|
-
preparedContent =
|
|
4950
|
+
preparedContent = spacetrim.spaceTrim(`
|
|
4952
4951
|
{content}
|
|
4953
4952
|
|
|
4954
4953
|
## Knowledge
|
|
@@ -5261,7 +5260,7 @@
|
|
|
5261
5260
|
}
|
|
5262
5261
|
catch (error) {
|
|
5263
5262
|
assertsError(error);
|
|
5264
|
-
throw new ParseError(
|
|
5263
|
+
throw new ParseError(spacetrim.spaceTrim((block) => `
|
|
5265
5264
|
Can not extract variables from the script
|
|
5266
5265
|
${block(error.stack || error.message)}
|
|
5267
5266
|
|
|
@@ -5444,7 +5443,7 @@
|
|
|
5444
5443
|
const { value, outputParameterName, settings, mapCallback, onProgress } = options;
|
|
5445
5444
|
const csv = csvParse(value, settings);
|
|
5446
5445
|
if (csv.errors.length !== 0) {
|
|
5447
|
-
throw new CsvFormatError(
|
|
5446
|
+
throw new CsvFormatError(spacetrim.spaceTrim((block) => `
|
|
5448
5447
|
CSV parsing error
|
|
5449
5448
|
|
|
5450
5449
|
Error(s) from CSV parsing:
|
|
@@ -5489,7 +5488,7 @@
|
|
|
5489
5488
|
const { value, settings, mapCallback, onProgress } = options;
|
|
5490
5489
|
const csv = csvParse(value, settings);
|
|
5491
5490
|
if (csv.errors.length !== 0) {
|
|
5492
|
-
throw new CsvFormatError(
|
|
5491
|
+
throw new CsvFormatError(spacetrim.spaceTrim((block) => `
|
|
5493
5492
|
CSV parsing error
|
|
5494
5493
|
|
|
5495
5494
|
Error(s) from CSV parsing:
|
|
@@ -5699,7 +5698,7 @@
|
|
|
5699
5698
|
}
|
|
5700
5699
|
// Phase 2️⃣: Non-matching mapping
|
|
5701
5700
|
if (expectedParameterNames.size !== availableParametersNames.size) {
|
|
5702
|
-
throw new PipelineExecutionError(
|
|
5701
|
+
throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
|
|
5703
5702
|
Can not map available parameters to expected parameters
|
|
5704
5703
|
|
|
5705
5704
|
Mapped parameters:
|
|
@@ -6098,7 +6097,7 @@
|
|
|
6098
6097
|
}
|
|
6099
6098
|
catch (error) {
|
|
6100
6099
|
keepUnused(error);
|
|
6101
|
-
throw new ExpectError(
|
|
6100
|
+
throw new ExpectError(spacetrim.spaceTrim((block) => `
|
|
6102
6101
|
Expected valid JSON string
|
|
6103
6102
|
|
|
6104
6103
|
The expected JSON text:
|
|
@@ -6161,7 +6160,7 @@
|
|
|
6161
6160
|
const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
|
|
6162
6161
|
// TODO: [🧠][🍭] JOKERS, EXPECTATIONS, POSTPROCESSING and FOREACH
|
|
6163
6162
|
if (isJokerAttempt && !jokerParameterName) {
|
|
6164
|
-
throw new UnexpectedError(
|
|
6163
|
+
throw new UnexpectedError(spacetrim.spaceTrim((block) => `
|
|
6165
6164
|
Joker not found in attempt ${attemptIndex}
|
|
6166
6165
|
|
|
6167
6166
|
${block(pipelineIdentification)}
|
|
@@ -6172,7 +6171,7 @@
|
|
|
6172
6171
|
$ongoingTaskResult.$expectError = null;
|
|
6173
6172
|
if (isJokerAttempt) {
|
|
6174
6173
|
if (parameters[jokerParameterName] === undefined) {
|
|
6175
|
-
throw new PipelineExecutionError(
|
|
6174
|
+
throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
|
|
6176
6175
|
Joker parameter {${jokerParameterName}} not defined
|
|
6177
6176
|
|
|
6178
6177
|
${block(pipelineIdentification)}
|
|
@@ -6231,7 +6230,7 @@
|
|
|
6231
6230
|
break variant;
|
|
6232
6231
|
case 'EMBEDDING':
|
|
6233
6232
|
case 'IMAGE_GENERATION':
|
|
6234
|
-
throw new PipelineExecutionError(
|
|
6233
|
+
throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
|
|
6235
6234
|
${modelRequirements.modelVariant} model can not be used in pipeline
|
|
6236
6235
|
|
|
6237
6236
|
This should be catched during parsing
|
|
@@ -6242,7 +6241,7 @@
|
|
|
6242
6241
|
break variant;
|
|
6243
6242
|
// <- case [🤖]:
|
|
6244
6243
|
default:
|
|
6245
|
-
throw new PipelineExecutionError(
|
|
6244
|
+
throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
|
|
6246
6245
|
Unknown model variant "${task.modelRequirements.modelVariant}"
|
|
6247
6246
|
|
|
6248
6247
|
${block(pipelineIdentification)}
|
|
@@ -6253,14 +6252,14 @@
|
|
|
6253
6252
|
break;
|
|
6254
6253
|
case 'SCRIPT_TASK':
|
|
6255
6254
|
if (arrayableToArray(tools.script).length === 0) {
|
|
6256
|
-
throw new PipelineExecutionError(
|
|
6255
|
+
throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
|
|
6257
6256
|
No script execution tools are available
|
|
6258
6257
|
|
|
6259
6258
|
${block(pipelineIdentification)}
|
|
6260
6259
|
`));
|
|
6261
6260
|
}
|
|
6262
6261
|
if (!task.contentLanguage) {
|
|
6263
|
-
throw new PipelineExecutionError(
|
|
6262
|
+
throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
|
|
6264
6263
|
Script language is not defined for SCRIPT TASK "${task.name}"
|
|
6265
6264
|
|
|
6266
6265
|
${block(pipelineIdentification)}
|
|
@@ -6291,7 +6290,7 @@
|
|
|
6291
6290
|
throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
|
|
6292
6291
|
}
|
|
6293
6292
|
else {
|
|
6294
|
-
throw new PipelineExecutionError(
|
|
6293
|
+
throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
|
|
6295
6294
|
Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
|
|
6296
6295
|
|
|
6297
6296
|
${block(pipelineIdentification)}
|
|
@@ -6305,7 +6304,7 @@
|
|
|
6305
6304
|
break taskType;
|
|
6306
6305
|
case 'DIALOG_TASK':
|
|
6307
6306
|
if (tools.userInterface === undefined) {
|
|
6308
|
-
throw new PipelineExecutionError(
|
|
6307
|
+
throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
|
|
6309
6308
|
User interface tools are not available
|
|
6310
6309
|
|
|
6311
6310
|
${block(pipelineIdentification)}
|
|
@@ -6323,7 +6322,7 @@
|
|
|
6323
6322
|
break taskType;
|
|
6324
6323
|
// <- case: [🅱]
|
|
6325
6324
|
default:
|
|
6326
|
-
throw new PipelineExecutionError(
|
|
6325
|
+
throw new PipelineExecutionError(spacetrim.spaceTrim((block) => `
|
|
6327
6326
|
Unknown execution type "${task.taskType}"
|
|
6328
6327
|
|
|
6329
6328
|
${block(pipelineIdentification)}
|
|
@@ -6421,7 +6420,7 @@
|
|
|
6421
6420
|
if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
|
|
6422
6421
|
// Note: Create a summary of all failures
|
|
6423
6422
|
const failuresSummary = $ongoingTaskResult.$failedResults
|
|
6424
|
-
.map((failure) =>
|
|
6423
|
+
.map((failure) => spacetrim.spaceTrim((block) => {
|
|
6425
6424
|
var _a, _b;
|
|
6426
6425
|
return `
|
|
6427
6426
|
Attempt ${failure.attemptIndex + 1}:
|
|
@@ -6431,14 +6430,14 @@
|
|
|
6431
6430
|
Result:
|
|
6432
6431
|
${block(failure.result === null
|
|
6433
6432
|
? 'null'
|
|
6434
|
-
:
|
|
6433
|
+
: spacetrim.spaceTrim(failure.result)
|
|
6435
6434
|
.split(/\r?\n/)
|
|
6436
6435
|
.map((line) => `> ${line}`)
|
|
6437
6436
|
.join('\n'))}
|
|
6438
6437
|
`;
|
|
6439
6438
|
}))
|
|
6440
6439
|
.join('\n\n---\n\n');
|
|
6441
|
-
throw new PipelineExecutionError(
|
|
6440
|
+
throw new PipelineExecutionError(spacetrim.spaceTrim((block) => {
|
|
6442
6441
|
var _a;
|
|
6443
6442
|
return `
|
|
6444
6443
|
LLM execution failed ${maxExecutionAttempts}x
|
|
@@ -6458,7 +6457,7 @@
|
|
|
6458
6457
|
}
|
|
6459
6458
|
}
|
|
6460
6459
|
if ($ongoingTaskResult.$resultString === null) {
|
|
6461
|
-
throw new UnexpectedError(
|
|
6460
|
+
throw new UnexpectedError(spacetrim.spaceTrim((block) => `
|
|
6462
6461
|
Something went wrong and prompt result is null
|
|
6463
6462
|
|
|
6464
6463
|
${block(pipelineIdentification)}
|
|
@@ -6485,7 +6484,7 @@
|
|
|
6485
6484
|
return /* not await */ executeAttempts({ ...options, logLlmCall });
|
|
6486
6485
|
}
|
|
6487
6486
|
if (jokerParameterNames.length !== 0) {
|
|
6488
|
-
throw new UnexpectedError(
|
|
6487
|
+
throw new UnexpectedError(spacetrim.spaceTrim((block) => `
|
|
6489
6488
|
JOKER parameters are not supported together with FOREACH command
|
|
6490
6489
|
|
|
6491
6490
|
[🧞♀️] This should be prevented in \`validatePipeline\`
|
|
@@ -6498,7 +6497,7 @@
|
|
|
6498
6497
|
if (formatDefinition === undefined) {
|
|
6499
6498
|
throw new UnexpectedError(
|
|
6500
6499
|
// <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
|
|
6501
|
-
|
|
6500
|
+
spacetrim.spaceTrim((block) => `
|
|
6502
6501
|
Unsupported format "${task.foreach.formatName}"
|
|
6503
6502
|
|
|
6504
6503
|
Available formats:
|
|
@@ -6515,7 +6514,7 @@
|
|
|
6515
6514
|
if (subvalueParser === undefined) {
|
|
6516
6515
|
throw new UnexpectedError(
|
|
6517
6516
|
// <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
|
|
6518
|
-
|
|
6517
|
+
spacetrim.spaceTrim((block) => `
|
|
6519
6518
|
Unsupported subformat name "${task.foreach.subformatName}" for format "${task.foreach.formatName}"
|
|
6520
6519
|
|
|
6521
6520
|
Available subformat names for format "${formatDefinition.formatName}":
|
|
@@ -6555,7 +6554,7 @@
|
|
|
6555
6554
|
if (!(error instanceof PipelineExecutionError)) {
|
|
6556
6555
|
throw error;
|
|
6557
6556
|
}
|
|
6558
|
-
const highLevelError = new PipelineExecutionError(
|
|
6557
|
+
const highLevelError = new PipelineExecutionError(spacetrim.spaceTrim((block) => `
|
|
6559
6558
|
${error.message}
|
|
6560
6559
|
|
|
6561
6560
|
This is error in FOREACH command when mapping ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
|
|
@@ -6579,7 +6578,7 @@
|
|
|
6579
6578
|
...options,
|
|
6580
6579
|
priority: priority + index,
|
|
6581
6580
|
parameters: allSubparameters,
|
|
6582
|
-
pipelineIdentification:
|
|
6581
|
+
pipelineIdentification: spacetrim.spaceTrim((block) => `
|
|
6583
6582
|
${block(pipelineIdentification)}
|
|
6584
6583
|
Subparameter index: ${index}
|
|
6585
6584
|
`),
|
|
@@ -6588,7 +6587,7 @@
|
|
|
6588
6587
|
}
|
|
6589
6588
|
catch (error) {
|
|
6590
6589
|
if (length > BIG_DATASET_TRESHOLD) {
|
|
6591
|
-
console.error(
|
|
6590
|
+
console.error(spacetrim.spaceTrim((block) => `
|
|
6592
6591
|
${error.message}
|
|
6593
6592
|
|
|
6594
6593
|
This is error in FOREACH command when processing ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
|
|
@@ -6764,7 +6763,7 @@
|
|
|
6764
6763
|
// Note: Doublecheck that ALL reserved parameters are defined:
|
|
6765
6764
|
for (const parameterName of RESERVED_PARAMETER_NAMES) {
|
|
6766
6765
|
if (reservedParameters[parameterName] === undefined) {
|
|
6767
|
-
throw new UnexpectedError(
|
|
6766
|
+
throw new UnexpectedError(spacetrim.spaceTrim((block) => `
|
|
6768
6767
|
Reserved parameter {${parameterName}} is not defined
|
|
6769
6768
|
|
|
6770
6769
|
${block(pipelineIdentification)}
|
|
@@ -6790,7 +6789,7 @@
|
|
|
6790
6789
|
const dependentParameterNames = new Set(currentTask.dependentParameterNames);
|
|
6791
6790
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
6792
6791
|
if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
|
|
6793
|
-
throw new UnexpectedError(
|
|
6792
|
+
throw new UnexpectedError(spacetrim.spaceTrim((block) => `
|
|
6794
6793
|
Dependent parameters are not consistent with used parameters:
|
|
6795
6794
|
|
|
6796
6795
|
Dependent parameters:
|
|
@@ -6834,7 +6833,7 @@
|
|
|
6834
6833
|
else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
|
|
6835
6834
|
// Houston, we have a problem
|
|
6836
6835
|
// Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
|
|
6837
|
-
throw new UnexpectedError(
|
|
6836
|
+
throw new UnexpectedError(spacetrim.spaceTrim((block) => `
|
|
6838
6837
|
Parameter \`{${parameterName}}\` is NOT defined
|
|
6839
6838
|
BUT used in task "${currentTask.title || currentTask.name}"
|
|
6840
6839
|
|
|
@@ -6903,7 +6902,7 @@
|
|
|
6903
6902
|
for (const parameter of preparedPipeline.parameters.filter(({ isOutput }) => isOutput)) {
|
|
6904
6903
|
if (parametersToPass[parameter.name] === undefined) {
|
|
6905
6904
|
// [4]
|
|
6906
|
-
$warnings.push(new PipelineExecutionError(
|
|
6905
|
+
$warnings.push(new PipelineExecutionError(spacetrim.spaceTrim((block) => `
|
|
6907
6906
|
Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
|
|
6908
6907
|
|
|
6909
6908
|
Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
|
|
@@ -7011,7 +7010,7 @@
|
|
|
7011
7010
|
for (const parameterName of Object.keys(inputParameters)) {
|
|
7012
7011
|
const parameter = preparedPipeline.parameters.find(({ name }) => name === parameterName);
|
|
7013
7012
|
if (parameter === undefined) {
|
|
7014
|
-
warnings.push(new PipelineExecutionError(
|
|
7013
|
+
warnings.push(new PipelineExecutionError(spacetrim.spaceTrim((block) => `
|
|
7015
7014
|
Extra parameter {${parameterName}} is being passed which is not part of the pipeline.
|
|
7016
7015
|
|
|
7017
7016
|
${block(pipelineIdentification)}
|
|
@@ -7026,7 +7025,7 @@
|
|
|
7026
7025
|
// TODO: [🧠] This should be also non-critical error
|
|
7027
7026
|
return exportJson({
|
|
7028
7027
|
name: 'pipelineExecutorResult',
|
|
7029
|
-
message:
|
|
7028
|
+
message: spacetrim.spaceTrim((block) => `
|
|
7030
7029
|
Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
|
|
7031
7030
|
|
|
7032
7031
|
${block(pipelineIdentification)}
|
|
@@ -7035,7 +7034,7 @@
|
|
|
7035
7034
|
value: {
|
|
7036
7035
|
isSuccessful: false,
|
|
7037
7036
|
errors: [
|
|
7038
|
-
new PipelineExecutionError(
|
|
7037
|
+
new PipelineExecutionError(spacetrim.spaceTrim((block) => `
|
|
7039
7038
|
Parameter \`{${parameter.name}}\` is passed as input parameter but it is not input
|
|
7040
7039
|
|
|
7041
7040
|
${block(pipelineIdentification)}
|
|
@@ -7062,7 +7061,7 @@
|
|
|
7062
7061
|
while (unresovedTasks.length > 0) {
|
|
7063
7062
|
if (loopLimit-- < 0) {
|
|
7064
7063
|
// Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
|
|
7065
|
-
throw new UnexpectedError(
|
|
7064
|
+
throw new UnexpectedError(spacetrim.spaceTrim((block) => `
|
|
7066
7065
|
Loop limit reached during resolving parameters pipeline execution
|
|
7067
7066
|
|
|
7068
7067
|
${block(pipelineIdentification)}
|
|
@@ -7072,7 +7071,7 @@
|
|
|
7072
7071
|
if (!currentTask && resolving.length === 0) {
|
|
7073
7072
|
throw new UnexpectedError(
|
|
7074
7073
|
// TODO: [🐎] DRY
|
|
7075
|
-
|
|
7074
|
+
spacetrim.spaceTrim((block) => `
|
|
7076
7075
|
Can not resolve some parameters:
|
|
7077
7076
|
|
|
7078
7077
|
${block(pipelineIdentification)}
|
|
@@ -7112,7 +7111,7 @@
|
|
|
7112
7111
|
tools,
|
|
7113
7112
|
onProgress(newOngoingResult) {
|
|
7114
7113
|
if (isReturned) {
|
|
7115
|
-
throw new UnexpectedError(
|
|
7114
|
+
throw new UnexpectedError(spacetrim.spaceTrim((block) => `
|
|
7116
7115
|
Can not call \`onProgress\` after pipeline execution is finished
|
|
7117
7116
|
|
|
7118
7117
|
${block(pipelineIdentification)}
|
|
@@ -7129,7 +7128,7 @@
|
|
|
7129
7128
|
},
|
|
7130
7129
|
logLlmCall,
|
|
7131
7130
|
$executionReport: executionReport,
|
|
7132
|
-
pipelineIdentification:
|
|
7131
|
+
pipelineIdentification: spacetrim.spaceTrim((block) => `
|
|
7133
7132
|
${block(pipelineIdentification)}
|
|
7134
7133
|
Task name: ${currentTask.name}
|
|
7135
7134
|
Task title: ${currentTask.title}
|
|
@@ -7238,7 +7237,7 @@
|
|
|
7238
7237
|
preparedPipeline = pipeline;
|
|
7239
7238
|
}
|
|
7240
7239
|
else if (isNotPreparedWarningSuppressed !== true) {
|
|
7241
|
-
console.warn(
|
|
7240
|
+
console.warn(spacetrim.spaceTrim((block) => `
|
|
7242
7241
|
Pipeline is not prepared
|
|
7243
7242
|
|
|
7244
7243
|
${block(pipelineIdentification)}
|
|
@@ -7263,7 +7262,7 @@
|
|
|
7263
7262
|
tools,
|
|
7264
7263
|
onProgress,
|
|
7265
7264
|
logLlmCall,
|
|
7266
|
-
pipelineIdentification:
|
|
7265
|
+
pipelineIdentification: spacetrim.spaceTrim((block) => `
|
|
7267
7266
|
${block(pipelineIdentification)}
|
|
7268
7267
|
${runCount === 1 ? '' : `Run #${runCount}`}
|
|
7269
7268
|
`),
|
|
@@ -7460,8 +7459,8 @@
|
|
|
7460
7459
|
knowledgeTextPieces.map(async (knowledgeTextPiece, i) => {
|
|
7461
7460
|
// Note: These are just default values, they will be overwritten by the actual values:
|
|
7462
7461
|
let name = `piece-${i}`;
|
|
7463
|
-
let title =
|
|
7464
|
-
const knowledgePieceContent =
|
|
7462
|
+
let title = spacetrim.spaceTrim(knowledgeTextPiece.substring(0, 100));
|
|
7463
|
+
const knowledgePieceContent = spacetrim.spaceTrim(knowledgeTextPiece);
|
|
7465
7464
|
let keywords = [];
|
|
7466
7465
|
const index = [];
|
|
7467
7466
|
/*
|
|
@@ -7474,7 +7473,7 @@
|
|
|
7474
7473
|
isCrashedOnError: true,
|
|
7475
7474
|
});
|
|
7476
7475
|
const { title: titleRaw = 'Untitled' } = titleResult.outputParameters;
|
|
7477
|
-
title =
|
|
7476
|
+
title = spacetrim.spaceTrim(titleRaw) /* <- TODO: Maybe do in pipeline */;
|
|
7478
7477
|
name = titleToName(title);
|
|
7479
7478
|
// --- Keywords
|
|
7480
7479
|
const keywordsResult = await prepareKeywordsExecutor({ knowledgePieceContent }).asPromise({
|