@promptbook/documents 0.103.0-54 → 0.103.0-56
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 +130 -96
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +4 -0
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +5 -0
- package/esm/typings/src/commitments/CLOSED/CLOSED.d.ts +35 -0
- package/esm/typings/src/commitments/COMPONENT/COMPONENT.d.ts +28 -0
- package/esm/typings/src/commitments/FROM/FROM.d.ts +34 -0
- package/esm/typings/src/commitments/LANGUAGE/LANGUAGE.d.ts +35 -0
- package/esm/typings/src/commitments/META_COLOR/META_COLOR.d.ts +6 -0
- package/esm/typings/src/commitments/META_FONT/META_FONT.d.ts +42 -0
- package/esm/typings/src/commitments/OPEN/OPEN.d.ts +35 -0
- package/esm/typings/src/commitments/USE/USE.d.ts +53 -0
- package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +38 -0
- package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.test.d.ts +1 -0
- package/esm/typings/src/commitments/USE_MCP/USE_MCP.d.ts +37 -0
- package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +38 -0
- package/esm/typings/src/commitments/index.d.ts +12 -1
- package/esm/typings/src/playground/playground.d.ts +3 -0
- package/esm/typings/src/utils/color/Color.d.ts +8 -0
- package/esm/typings/src/utils/color/css-colors.d.ts +1 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +3 -3
- package/umd/index.umd.js +98 -64
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/playground/playground1.d.ts +0 -2
package/umd/index.umd.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('fs/promises'), require('spacetrim'), require('child_process'), require('colors'), require('waitasecond'), require('crypto-js'), require('crypto-js/enc-hex'), require('path'), require('crypto'), require('rxjs'), require('crypto-js/sha256'), require('mime-types'), require('papaparse')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', 'fs/promises', 'spacetrim', 'child_process', 'colors', 'waitasecond', 'crypto-js', 'crypto-js/enc-hex', 'path', 'crypto', 'rxjs', 'crypto-js/sha256', 'mime-types', 'papaparse'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-documents"] = {}, global.promises, global.spaceTrim, global.child_process, global.colors, global.waitasecond, global.cryptoJs, global.hexEncoder, global.path, global.crypto, global.rxjs, global.sha256, global.mimeTypes, global.papaparse));
|
|
5
|
-
})(this, (function (exports, promises, spaceTrim, child_process, colors, waitasecond, cryptoJs, hexEncoder, path, crypto, rxjs, sha256, mimeTypes, papaparse) { 'use strict';
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-documents"] = {}, global.promises, global.spaceTrim$1, global.child_process, global.colors, global.waitasecond, global.cryptoJs, global.hexEncoder, global.path, global.crypto, global.rxjs, global.sha256, global.mimeTypes, global.papaparse));
|
|
5
|
+
})(this, (function (exports, promises, spaceTrim$1, child_process, colors, waitasecond, cryptoJs, hexEncoder, path, crypto, rxjs, 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);
|
|
9
|
+
var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim$1);
|
|
10
10
|
var colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
|
|
11
11
|
var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
|
|
12
12
|
var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* @generated
|
|
26
26
|
* @see https://github.com/webgptorg/promptbook
|
|
27
27
|
*/
|
|
28
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-
|
|
28
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-56';
|
|
29
29
|
/**
|
|
30
30
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
31
31
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -48,6 +48,17 @@
|
|
|
48
48
|
function keepUnused(...valuesToKeep) {
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Trims string from all 4 sides
|
|
53
|
+
*
|
|
54
|
+
* Note: This is a re-exported function from the `spacetrim` package which is
|
|
55
|
+
* Developed by same author @hejny as this package
|
|
56
|
+
*
|
|
57
|
+
* @public exported from `@promptbook/utils`
|
|
58
|
+
* @see https://github.com/hejny/spacetrim#usage
|
|
59
|
+
*/
|
|
60
|
+
const spaceTrim = spaceTrim$1.spaceTrim;
|
|
61
|
+
|
|
51
62
|
/**
|
|
52
63
|
* @private util of `@promptbook/color`
|
|
53
64
|
* @de
|
|
@@ -96,6 +107,7 @@
|
|
|
96
107
|
* @public exported from `@promptbook/color`
|
|
97
108
|
*/
|
|
98
109
|
const CSS_COLORS = {
|
|
110
|
+
promptbook: '#79EAFD',
|
|
99
111
|
transparent: 'rgba(0,0,0,0)',
|
|
100
112
|
aliceblue: '#f0f8ff',
|
|
101
113
|
antiquewhite: '#faebd7',
|
|
@@ -311,6 +323,28 @@
|
|
|
311
323
|
throw new Error(`Can not create color from given object`);
|
|
312
324
|
}
|
|
313
325
|
}
|
|
326
|
+
/**
|
|
327
|
+
* Creates a new Color instance from miscellaneous formats
|
|
328
|
+
* It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
|
|
329
|
+
*
|
|
330
|
+
* @param color
|
|
331
|
+
* @returns Color object
|
|
332
|
+
*/
|
|
333
|
+
static fromSafe(color) {
|
|
334
|
+
try {
|
|
335
|
+
return Color.from(color);
|
|
336
|
+
}
|
|
337
|
+
catch (error) {
|
|
338
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
339
|
+
console.warn(spaceTrim((block) => `
|
|
340
|
+
Color.fromSafe error:
|
|
341
|
+
${block(error.message)}
|
|
342
|
+
|
|
343
|
+
Returning default PROMPTBOOK_COLOR.
|
|
344
|
+
`));
|
|
345
|
+
return Color.fromString('promptbook');
|
|
346
|
+
}
|
|
347
|
+
}
|
|
314
348
|
/**
|
|
315
349
|
* Creates a new Color instance from miscellaneous string formats
|
|
316
350
|
*
|
|
@@ -920,7 +954,7 @@
|
|
|
920
954
|
*
|
|
921
955
|
* @public exported from `@promptbook/core`
|
|
922
956
|
*/
|
|
923
|
-
const PROMPTBOOK_COLOR = Color.
|
|
957
|
+
const PROMPTBOOK_COLOR = Color.fromString('promptbook');
|
|
924
958
|
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
925
959
|
/**
|
|
926
960
|
* Colors for syntax highlighting in the `<BookEditor/>`
|
|
@@ -1143,7 +1177,7 @@
|
|
|
1143
1177
|
*/
|
|
1144
1178
|
class MissingToolsError extends Error {
|
|
1145
1179
|
constructor(message) {
|
|
1146
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
1180
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
1147
1181
|
${block(message)}
|
|
1148
1182
|
|
|
1149
1183
|
Note: You have probably forgot to provide some tools for pipeline execution or preparation
|
|
@@ -1205,7 +1239,7 @@
|
|
|
1205
1239
|
*/
|
|
1206
1240
|
class UnexpectedError extends Error {
|
|
1207
1241
|
constructor(message) {
|
|
1208
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
1242
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
1209
1243
|
${block(message)}
|
|
1210
1244
|
|
|
1211
1245
|
Note: This error should not happen.
|
|
@@ -1366,11 +1400,11 @@
|
|
|
1366
1400
|
console.warn(`Command "${humanReadableCommand}" exited with code ${code}`);
|
|
1367
1401
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
1368
1402
|
}
|
|
1369
|
-
resolve(spaceTrim.spaceTrim(output.join('\n')));
|
|
1403
|
+
resolve(spaceTrim$1.spaceTrim(output.join('\n')));
|
|
1370
1404
|
}
|
|
1371
1405
|
}
|
|
1372
1406
|
else {
|
|
1373
|
-
resolve(spaceTrim.spaceTrim(output.join('\n')));
|
|
1407
|
+
resolve(spaceTrim$1.spaceTrim(output.join('\n')));
|
|
1374
1408
|
}
|
|
1375
1409
|
};
|
|
1376
1410
|
commandProcess.on('close', finishWithCode);
|
|
@@ -1388,7 +1422,7 @@
|
|
|
1388
1422
|
console.warn(error);
|
|
1389
1423
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
1390
1424
|
}
|
|
1391
|
-
resolve(spaceTrim.spaceTrim(output.join('\n')));
|
|
1425
|
+
resolve(spaceTrim$1.spaceTrim(output.join('\n')));
|
|
1392
1426
|
}
|
|
1393
1427
|
});
|
|
1394
1428
|
}
|
|
@@ -2005,7 +2039,7 @@
|
|
|
2005
2039
|
constructor(whatWasThrown) {
|
|
2006
2040
|
const tag = `[🤮]`;
|
|
2007
2041
|
console.error(tag, whatWasThrown);
|
|
2008
|
-
super(spaceTrim.spaceTrim(`
|
|
2042
|
+
super(spaceTrim$1.spaceTrim(`
|
|
2009
2043
|
Non-Error object was thrown
|
|
2010
2044
|
|
|
2011
2045
|
Note: Look for ${tag} in the console for more details
|
|
@@ -2680,7 +2714,7 @@
|
|
|
2680
2714
|
if (!(error instanceof PipelineLogicError)) {
|
|
2681
2715
|
throw error;
|
|
2682
2716
|
}
|
|
2683
|
-
console.error(spaceTrim.spaceTrim((block) => `
|
|
2717
|
+
console.error(spaceTrim$1.spaceTrim((block) => `
|
|
2684
2718
|
Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
|
|
2685
2719
|
|
|
2686
2720
|
${block(error.message)}
|
|
@@ -2707,7 +2741,7 @@
|
|
|
2707
2741
|
})();
|
|
2708
2742
|
if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
|
|
2709
2743
|
// <- Note: [🚲]
|
|
2710
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2744
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2711
2745
|
Invalid promptbook URL "${pipeline.pipelineUrl}"
|
|
2712
2746
|
|
|
2713
2747
|
${block(pipelineIdentification)}
|
|
@@ -2715,7 +2749,7 @@
|
|
|
2715
2749
|
}
|
|
2716
2750
|
if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
|
|
2717
2751
|
// <- Note: [🚲]
|
|
2718
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2752
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2719
2753
|
Invalid Promptbook Version "${pipeline.bookVersion}"
|
|
2720
2754
|
|
|
2721
2755
|
${block(pipelineIdentification)}
|
|
@@ -2724,7 +2758,7 @@
|
|
|
2724
2758
|
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
2725
2759
|
if (!Array.isArray(pipeline.parameters)) {
|
|
2726
2760
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
2727
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
2761
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
2728
2762
|
Pipeline is valid JSON but with wrong structure
|
|
2729
2763
|
|
|
2730
2764
|
\`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
|
|
@@ -2735,7 +2769,7 @@
|
|
|
2735
2769
|
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
2736
2770
|
if (!Array.isArray(pipeline.tasks)) {
|
|
2737
2771
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
2738
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
2772
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
2739
2773
|
Pipeline is valid JSON but with wrong structure
|
|
2740
2774
|
|
|
2741
2775
|
\`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
|
|
@@ -2761,7 +2795,7 @@
|
|
|
2761
2795
|
// Note: Check each parameter individually
|
|
2762
2796
|
for (const parameter of pipeline.parameters) {
|
|
2763
2797
|
if (parameter.isInput && parameter.isOutput) {
|
|
2764
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2798
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2765
2799
|
|
|
2766
2800
|
Parameter \`{${parameter.name}}\` can not be both input and output
|
|
2767
2801
|
|
|
@@ -2772,7 +2806,7 @@
|
|
|
2772
2806
|
if (!parameter.isInput &&
|
|
2773
2807
|
!parameter.isOutput &&
|
|
2774
2808
|
!pipeline.tasks.some((task) => task.dependentParameterNames.includes(parameter.name))) {
|
|
2775
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2809
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2776
2810
|
Parameter \`{${parameter.name}}\` is created but not used
|
|
2777
2811
|
|
|
2778
2812
|
You can declare {${parameter.name}} as output parameter by adding in the header:
|
|
@@ -2784,7 +2818,7 @@
|
|
|
2784
2818
|
}
|
|
2785
2819
|
// Note: Testing that parameter is either input or result of some task
|
|
2786
2820
|
if (!parameter.isInput && !pipeline.tasks.some((task) => task.resultingParameterName === parameter.name)) {
|
|
2787
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2821
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2788
2822
|
Parameter \`{${parameter.name}}\` is declared but not defined
|
|
2789
2823
|
|
|
2790
2824
|
You can do one of these:
|
|
@@ -2800,14 +2834,14 @@
|
|
|
2800
2834
|
// Note: Checking each task individually
|
|
2801
2835
|
for (const task of pipeline.tasks) {
|
|
2802
2836
|
if (definedParameters.has(task.resultingParameterName)) {
|
|
2803
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2837
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2804
2838
|
Parameter \`{${task.resultingParameterName}}\` is defined multiple times
|
|
2805
2839
|
|
|
2806
2840
|
${block(pipelineIdentification)}
|
|
2807
2841
|
`));
|
|
2808
2842
|
}
|
|
2809
2843
|
if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
|
|
2810
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2844
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2811
2845
|
Parameter name {${task.resultingParameterName}} is reserved, please use different name
|
|
2812
2846
|
|
|
2813
2847
|
${block(pipelineIdentification)}
|
|
@@ -2817,7 +2851,7 @@
|
|
|
2817
2851
|
if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
|
|
2818
2852
|
if (!task.format &&
|
|
2819
2853
|
!task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
|
|
2820
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2854
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2821
2855
|
Joker parameters are used for {${task.resultingParameterName}} but no expectations are defined
|
|
2822
2856
|
|
|
2823
2857
|
${block(pipelineIdentification)}
|
|
@@ -2825,7 +2859,7 @@
|
|
|
2825
2859
|
}
|
|
2826
2860
|
for (const joker of task.jokerParameterNames) {
|
|
2827
2861
|
if (!task.dependentParameterNames.includes(joker)) {
|
|
2828
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2862
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2829
2863
|
Parameter \`{${joker}}\` is used for {${task.resultingParameterName}} as joker but not in \`dependentParameterNames\`
|
|
2830
2864
|
|
|
2831
2865
|
${block(pipelineIdentification)}
|
|
@@ -2836,21 +2870,21 @@
|
|
|
2836
2870
|
if (task.expectations) {
|
|
2837
2871
|
for (const [unit, { min, max }] of Object.entries(task.expectations)) {
|
|
2838
2872
|
if (min !== undefined && max !== undefined && min > max) {
|
|
2839
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2873
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2840
2874
|
Min expectation (=${min}) of ${unit} is higher than max expectation (=${max})
|
|
2841
2875
|
|
|
2842
2876
|
${block(pipelineIdentification)}
|
|
2843
2877
|
`));
|
|
2844
2878
|
}
|
|
2845
2879
|
if (min !== undefined && min < 0) {
|
|
2846
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2880
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2847
2881
|
Min expectation of ${unit} must be zero or positive
|
|
2848
2882
|
|
|
2849
2883
|
${block(pipelineIdentification)}
|
|
2850
2884
|
`));
|
|
2851
2885
|
}
|
|
2852
2886
|
if (max !== undefined && max <= 0) {
|
|
2853
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2887
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2854
2888
|
Max expectation of ${unit} must be positive
|
|
2855
2889
|
|
|
2856
2890
|
${block(pipelineIdentification)}
|
|
@@ -2872,7 +2906,7 @@
|
|
|
2872
2906
|
while (unresovedTasks.length > 0) {
|
|
2873
2907
|
if (loopLimit-- < 0) {
|
|
2874
2908
|
// Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
|
|
2875
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
2909
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
2876
2910
|
Loop limit reached during detection of circular dependencies in \`validatePipeline\`
|
|
2877
2911
|
|
|
2878
2912
|
${block(pipelineIdentification)}
|
|
@@ -2882,7 +2916,7 @@
|
|
|
2882
2916
|
if (currentlyResovedTasks.length === 0) {
|
|
2883
2917
|
throw new PipelineLogicError(
|
|
2884
2918
|
// TODO: [🐎] DRY
|
|
2885
|
-
spaceTrim.spaceTrim((block) => `
|
|
2919
|
+
spaceTrim$1.spaceTrim((block) => `
|
|
2886
2920
|
|
|
2887
2921
|
Can not resolve some parameters:
|
|
2888
2922
|
Either you are using a parameter that is not defined, or there are some circular dependencies.
|
|
@@ -3046,7 +3080,7 @@
|
|
|
3046
3080
|
for (const pipeline of pipelines) {
|
|
3047
3081
|
// TODO: [👠] DRY
|
|
3048
3082
|
if (pipeline.pipelineUrl === undefined) {
|
|
3049
|
-
throw new PipelineUrlError(spaceTrim.spaceTrim(`
|
|
3083
|
+
throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
|
|
3050
3084
|
Pipeline with name "${pipeline.title}" does not have defined URL
|
|
3051
3085
|
|
|
3052
3086
|
File:
|
|
@@ -3068,7 +3102,7 @@
|
|
|
3068
3102
|
pipelineJsonToString(unpreparePipeline(pipeline)) !==
|
|
3069
3103
|
pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
|
|
3070
3104
|
const existing = this.collection.get(pipeline.pipelineUrl);
|
|
3071
|
-
throw new PipelineUrlError(spaceTrim.spaceTrim(`
|
|
3105
|
+
throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
|
|
3072
3106
|
Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍎
|
|
3073
3107
|
|
|
3074
3108
|
Conflicting files:
|
|
@@ -3100,13 +3134,13 @@
|
|
|
3100
3134
|
const pipeline = this.collection.get(url);
|
|
3101
3135
|
if (!pipeline) {
|
|
3102
3136
|
if (this.listPipelines().length === 0) {
|
|
3103
|
-
throw new NotFoundError(spaceTrim.spaceTrim(`
|
|
3137
|
+
throw new NotFoundError(spaceTrim$1.spaceTrim(`
|
|
3104
3138
|
Pipeline with url "${url}" not found
|
|
3105
3139
|
|
|
3106
3140
|
No pipelines available
|
|
3107
3141
|
`));
|
|
3108
3142
|
}
|
|
3109
|
-
throw new NotFoundError(spaceTrim.spaceTrim((block) => `
|
|
3143
|
+
throw new NotFoundError(spaceTrim$1.spaceTrim((block) => `
|
|
3110
3144
|
Pipeline with url "${url}" not found
|
|
3111
3145
|
|
|
3112
3146
|
Available pipelines:
|
|
@@ -3337,7 +3371,7 @@
|
|
|
3337
3371
|
*/
|
|
3338
3372
|
class NotYetImplementedError extends Error {
|
|
3339
3373
|
constructor(message) {
|
|
3340
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
3374
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
3341
3375
|
${block(message)}
|
|
3342
3376
|
|
|
3343
3377
|
Note: This feature is not implemented yet but it will be soon.
|
|
@@ -3576,11 +3610,11 @@
|
|
|
3576
3610
|
throw deserializeError(errors[0]);
|
|
3577
3611
|
}
|
|
3578
3612
|
else {
|
|
3579
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
3613
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
3580
3614
|
Multiple errors occurred during Promptbook execution
|
|
3581
3615
|
|
|
3582
3616
|
${block(errors
|
|
3583
|
-
.map(({ name, stack, message }, index) => spaceTrim.spaceTrim((block) => `
|
|
3617
|
+
.map(({ name, stack, message }, index) => spaceTrim$1.spaceTrim((block) => `
|
|
3584
3618
|
${name} ${index + 1}:
|
|
3585
3619
|
${block(stack || message)}
|
|
3586
3620
|
`))
|
|
@@ -4969,7 +5003,7 @@
|
|
|
4969
5003
|
if (task.taskType === 'PROMPT_TASK' &&
|
|
4970
5004
|
knowledgePiecesCount > 0 &&
|
|
4971
5005
|
!dependentParameterNames.includes('knowledge')) {
|
|
4972
|
-
preparedContent = spaceTrim.spaceTrim(`
|
|
5006
|
+
preparedContent = spaceTrim$1.spaceTrim(`
|
|
4973
5007
|
{content}
|
|
4974
5008
|
|
|
4975
5009
|
## Knowledge
|
|
@@ -5282,7 +5316,7 @@
|
|
|
5282
5316
|
}
|
|
5283
5317
|
catch (error) {
|
|
5284
5318
|
assertsError(error);
|
|
5285
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
5319
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
5286
5320
|
Can not extract variables from the script
|
|
5287
5321
|
${block(error.stack || error.message)}
|
|
5288
5322
|
|
|
@@ -6119,7 +6153,7 @@
|
|
|
6119
6153
|
}
|
|
6120
6154
|
catch (error) {
|
|
6121
6155
|
keepUnused(error);
|
|
6122
|
-
throw new ExpectError(spaceTrim.spaceTrim((block) => `
|
|
6156
|
+
throw new ExpectError(spaceTrim$1.spaceTrim((block) => `
|
|
6123
6157
|
Expected valid JSON string
|
|
6124
6158
|
|
|
6125
6159
|
The expected JSON text:
|
|
@@ -6182,7 +6216,7 @@
|
|
|
6182
6216
|
const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
|
|
6183
6217
|
// TODO: [🧠][🍭] JOKERS, EXPECTATIONS, POSTPROCESSING and FOREACH
|
|
6184
6218
|
if (isJokerAttempt && !jokerParameterName) {
|
|
6185
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6219
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6186
6220
|
Joker not found in attempt ${attemptIndex}
|
|
6187
6221
|
|
|
6188
6222
|
${block(pipelineIdentification)}
|
|
@@ -6193,7 +6227,7 @@
|
|
|
6193
6227
|
$ongoingTaskResult.$expectError = null;
|
|
6194
6228
|
if (isJokerAttempt) {
|
|
6195
6229
|
if (parameters[jokerParameterName] === undefined) {
|
|
6196
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6230
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6197
6231
|
Joker parameter {${jokerParameterName}} not defined
|
|
6198
6232
|
|
|
6199
6233
|
${block(pipelineIdentification)}
|
|
@@ -6251,7 +6285,7 @@
|
|
|
6251
6285
|
$ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
|
|
6252
6286
|
break variant;
|
|
6253
6287
|
case 'EMBEDDING':
|
|
6254
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6288
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6255
6289
|
Embedding model can not be used in pipeline
|
|
6256
6290
|
|
|
6257
6291
|
This should be catched during parsing
|
|
@@ -6262,7 +6296,7 @@
|
|
|
6262
6296
|
break variant;
|
|
6263
6297
|
// <- case [🤖]:
|
|
6264
6298
|
default:
|
|
6265
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6299
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6266
6300
|
Unknown model variant "${task.modelRequirements.modelVariant}"
|
|
6267
6301
|
|
|
6268
6302
|
${block(pipelineIdentification)}
|
|
@@ -6273,14 +6307,14 @@
|
|
|
6273
6307
|
break;
|
|
6274
6308
|
case 'SCRIPT_TASK':
|
|
6275
6309
|
if (arrayableToArray(tools.script).length === 0) {
|
|
6276
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6310
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6277
6311
|
No script execution tools are available
|
|
6278
6312
|
|
|
6279
6313
|
${block(pipelineIdentification)}
|
|
6280
6314
|
`));
|
|
6281
6315
|
}
|
|
6282
6316
|
if (!task.contentLanguage) {
|
|
6283
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6317
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6284
6318
|
Script language is not defined for SCRIPT TASK "${task.name}"
|
|
6285
6319
|
|
|
6286
6320
|
${block(pipelineIdentification)}
|
|
@@ -6311,7 +6345,7 @@
|
|
|
6311
6345
|
throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
|
|
6312
6346
|
}
|
|
6313
6347
|
else {
|
|
6314
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6348
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6315
6349
|
Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
|
|
6316
6350
|
|
|
6317
6351
|
${block(pipelineIdentification)}
|
|
@@ -6325,7 +6359,7 @@
|
|
|
6325
6359
|
break taskType;
|
|
6326
6360
|
case 'DIALOG_TASK':
|
|
6327
6361
|
if (tools.userInterface === undefined) {
|
|
6328
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6362
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6329
6363
|
User interface tools are not available
|
|
6330
6364
|
|
|
6331
6365
|
${block(pipelineIdentification)}
|
|
@@ -6343,7 +6377,7 @@
|
|
|
6343
6377
|
break taskType;
|
|
6344
6378
|
// <- case: [🅱]
|
|
6345
6379
|
default:
|
|
6346
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6380
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6347
6381
|
Unknown execution type "${task.taskType}"
|
|
6348
6382
|
|
|
6349
6383
|
${block(pipelineIdentification)}
|
|
@@ -6441,7 +6475,7 @@
|
|
|
6441
6475
|
if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
|
|
6442
6476
|
// Note: Create a summary of all failures
|
|
6443
6477
|
const failuresSummary = $ongoingTaskResult.$failedResults
|
|
6444
|
-
.map((failure) => spaceTrim.spaceTrim((block) => {
|
|
6478
|
+
.map((failure) => spaceTrim$1.spaceTrim((block) => {
|
|
6445
6479
|
var _a, _b;
|
|
6446
6480
|
return `
|
|
6447
6481
|
Attempt ${failure.attemptIndex + 1}:
|
|
@@ -6451,14 +6485,14 @@
|
|
|
6451
6485
|
Result:
|
|
6452
6486
|
${block(failure.result === null
|
|
6453
6487
|
? 'null'
|
|
6454
|
-
: spaceTrim.spaceTrim(failure.result)
|
|
6488
|
+
: spaceTrim$1.spaceTrim(failure.result)
|
|
6455
6489
|
.split('\n')
|
|
6456
6490
|
.map((line) => `> ${line}`)
|
|
6457
6491
|
.join('\n'))}
|
|
6458
6492
|
`;
|
|
6459
6493
|
}))
|
|
6460
6494
|
.join('\n\n---\n\n');
|
|
6461
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => {
|
|
6495
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => {
|
|
6462
6496
|
var _a;
|
|
6463
6497
|
return `
|
|
6464
6498
|
LLM execution failed ${maxExecutionAttempts}x
|
|
@@ -6478,7 +6512,7 @@
|
|
|
6478
6512
|
}
|
|
6479
6513
|
}
|
|
6480
6514
|
if ($ongoingTaskResult.$resultString === null) {
|
|
6481
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6515
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6482
6516
|
Something went wrong and prompt result is null
|
|
6483
6517
|
|
|
6484
6518
|
${block(pipelineIdentification)}
|
|
@@ -6784,7 +6818,7 @@
|
|
|
6784
6818
|
// Note: Doublecheck that ALL reserved parameters are defined:
|
|
6785
6819
|
for (const parameterName of RESERVED_PARAMETER_NAMES) {
|
|
6786
6820
|
if (reservedParameters[parameterName] === undefined) {
|
|
6787
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6821
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6788
6822
|
Reserved parameter {${parameterName}} is not defined
|
|
6789
6823
|
|
|
6790
6824
|
${block(pipelineIdentification)}
|
|
@@ -6810,7 +6844,7 @@
|
|
|
6810
6844
|
const dependentParameterNames = new Set(currentTask.dependentParameterNames);
|
|
6811
6845
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
6812
6846
|
if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
|
|
6813
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6847
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6814
6848
|
Dependent parameters are not consistent with used parameters:
|
|
6815
6849
|
|
|
6816
6850
|
Dependent parameters:
|
|
@@ -6854,7 +6888,7 @@
|
|
|
6854
6888
|
else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
|
|
6855
6889
|
// Houston, we have a problem
|
|
6856
6890
|
// Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
|
|
6857
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6891
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6858
6892
|
Parameter \`{${parameterName}}\` is NOT defined
|
|
6859
6893
|
BUT used in task "${currentTask.title || currentTask.name}"
|
|
6860
6894
|
|
|
@@ -6923,7 +6957,7 @@
|
|
|
6923
6957
|
for (const parameter of preparedPipeline.parameters.filter(({ isOutput }) => isOutput)) {
|
|
6924
6958
|
if (parametersToPass[parameter.name] === undefined) {
|
|
6925
6959
|
// [4]
|
|
6926
|
-
$warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6960
|
+
$warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6927
6961
|
Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
|
|
6928
6962
|
|
|
6929
6963
|
Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
|
|
@@ -7031,7 +7065,7 @@
|
|
|
7031
7065
|
for (const parameterName of Object.keys(inputParameters)) {
|
|
7032
7066
|
const parameter = preparedPipeline.parameters.find(({ name }) => name === parameterName);
|
|
7033
7067
|
if (parameter === undefined) {
|
|
7034
|
-
warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
7068
|
+
warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
7035
7069
|
Extra parameter {${parameterName}} is being passed which is not part of the pipeline.
|
|
7036
7070
|
|
|
7037
7071
|
${block(pipelineIdentification)}
|
|
@@ -7046,7 +7080,7 @@
|
|
|
7046
7080
|
// TODO: [🧠] This should be also non-critical error
|
|
7047
7081
|
return exportJson({
|
|
7048
7082
|
name: 'pipelineExecutorResult',
|
|
7049
|
-
message: spaceTrim.spaceTrim((block) => `
|
|
7083
|
+
message: spaceTrim$1.spaceTrim((block) => `
|
|
7050
7084
|
Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
|
|
7051
7085
|
|
|
7052
7086
|
${block(pipelineIdentification)}
|
|
@@ -7055,7 +7089,7 @@
|
|
|
7055
7089
|
value: {
|
|
7056
7090
|
isSuccessful: false,
|
|
7057
7091
|
errors: [
|
|
7058
|
-
new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
7092
|
+
new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
7059
7093
|
Parameter \`{${parameter.name}}\` is passed as input parameter but it is not input
|
|
7060
7094
|
|
|
7061
7095
|
${block(pipelineIdentification)}
|
|
@@ -7082,7 +7116,7 @@
|
|
|
7082
7116
|
while (unresovedTasks.length > 0) {
|
|
7083
7117
|
if (loopLimit-- < 0) {
|
|
7084
7118
|
// Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
|
|
7085
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
7119
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
7086
7120
|
Loop limit reached during resolving parameters pipeline execution
|
|
7087
7121
|
|
|
7088
7122
|
${block(pipelineIdentification)}
|
|
@@ -7092,7 +7126,7 @@
|
|
|
7092
7126
|
if (!currentTask && resolving.length === 0) {
|
|
7093
7127
|
throw new UnexpectedError(
|
|
7094
7128
|
// TODO: [🐎] DRY
|
|
7095
|
-
spaceTrim.spaceTrim((block) => `
|
|
7129
|
+
spaceTrim$1.spaceTrim((block) => `
|
|
7096
7130
|
Can not resolve some parameters:
|
|
7097
7131
|
|
|
7098
7132
|
${block(pipelineIdentification)}
|
|
@@ -7132,7 +7166,7 @@
|
|
|
7132
7166
|
tools,
|
|
7133
7167
|
onProgress(newOngoingResult) {
|
|
7134
7168
|
if (isReturned) {
|
|
7135
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
7169
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
7136
7170
|
Can not call \`onProgress\` after pipeline execution is finished
|
|
7137
7171
|
|
|
7138
7172
|
${block(pipelineIdentification)}
|
|
@@ -7149,7 +7183,7 @@
|
|
|
7149
7183
|
},
|
|
7150
7184
|
logLlmCall,
|
|
7151
7185
|
$executionReport: executionReport,
|
|
7152
|
-
pipelineIdentification: spaceTrim.spaceTrim((block) => `
|
|
7186
|
+
pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
|
|
7153
7187
|
${block(pipelineIdentification)}
|
|
7154
7188
|
Task name: ${currentTask.name}
|
|
7155
7189
|
Task title: ${currentTask.title}
|
|
@@ -7258,7 +7292,7 @@
|
|
|
7258
7292
|
preparedPipeline = pipeline;
|
|
7259
7293
|
}
|
|
7260
7294
|
else if (isNotPreparedWarningSuppressed !== true) {
|
|
7261
|
-
console.warn(spaceTrim.spaceTrim((block) => `
|
|
7295
|
+
console.warn(spaceTrim$1.spaceTrim((block) => `
|
|
7262
7296
|
Pipeline is not prepared
|
|
7263
7297
|
|
|
7264
7298
|
${block(pipelineIdentification)}
|
|
@@ -7283,7 +7317,7 @@
|
|
|
7283
7317
|
tools,
|
|
7284
7318
|
onProgress,
|
|
7285
7319
|
logLlmCall,
|
|
7286
|
-
pipelineIdentification: spaceTrim.spaceTrim((block) => `
|
|
7320
|
+
pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
|
|
7287
7321
|
${block(pipelineIdentification)}
|
|
7288
7322
|
${runCount === 1 ? '' : `Run #${runCount}`}
|
|
7289
7323
|
`),
|