@promptbook/markitdown 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 +70 -36
- 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 +95 -61
- 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('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-markitdown"] = {}, 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';
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-markitdown"] = {}, global.promises, global.spaceTrim$1, global.cryptoJs, global.hexEncoder, global.path, global.crypto, global.rxjs, global.waitasecond, global.sha256, global.mimeTypes, global.papaparse));
|
|
5
|
+
})(this, (function (exports, promises, spaceTrim$1, 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);
|
|
9
|
+
var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim$1);
|
|
10
10
|
var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
|
|
11
11
|
var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
|
|
12
12
|
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* @generated
|
|
25
25
|
* @see https://github.com/webgptorg/promptbook
|
|
26
26
|
*/
|
|
27
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-
|
|
27
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-56';
|
|
28
28
|
/**
|
|
29
29
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
30
30
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -47,6 +47,17 @@
|
|
|
47
47
|
function keepUnused(...valuesToKeep) {
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Trims string from all 4 sides
|
|
52
|
+
*
|
|
53
|
+
* Note: This is a re-exported function from the `spacetrim` package which is
|
|
54
|
+
* Developed by same author @hejny as this package
|
|
55
|
+
*
|
|
56
|
+
* @public exported from `@promptbook/utils`
|
|
57
|
+
* @see https://github.com/hejny/spacetrim#usage
|
|
58
|
+
*/
|
|
59
|
+
const spaceTrim = spaceTrim$1.spaceTrim;
|
|
60
|
+
|
|
50
61
|
/**
|
|
51
62
|
* @private util of `@promptbook/color`
|
|
52
63
|
* @de
|
|
@@ -95,6 +106,7 @@
|
|
|
95
106
|
* @public exported from `@promptbook/color`
|
|
96
107
|
*/
|
|
97
108
|
const CSS_COLORS = {
|
|
109
|
+
promptbook: '#79EAFD',
|
|
98
110
|
transparent: 'rgba(0,0,0,0)',
|
|
99
111
|
aliceblue: '#f0f8ff',
|
|
100
112
|
antiquewhite: '#faebd7',
|
|
@@ -310,6 +322,28 @@
|
|
|
310
322
|
throw new Error(`Can not create color from given object`);
|
|
311
323
|
}
|
|
312
324
|
}
|
|
325
|
+
/**
|
|
326
|
+
* Creates a new Color instance from miscellaneous formats
|
|
327
|
+
* It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
|
|
328
|
+
*
|
|
329
|
+
* @param color
|
|
330
|
+
* @returns Color object
|
|
331
|
+
*/
|
|
332
|
+
static fromSafe(color) {
|
|
333
|
+
try {
|
|
334
|
+
return Color.from(color);
|
|
335
|
+
}
|
|
336
|
+
catch (error) {
|
|
337
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
338
|
+
console.warn(spaceTrim((block) => `
|
|
339
|
+
Color.fromSafe error:
|
|
340
|
+
${block(error.message)}
|
|
341
|
+
|
|
342
|
+
Returning default PROMPTBOOK_COLOR.
|
|
343
|
+
`));
|
|
344
|
+
return Color.fromString('promptbook');
|
|
345
|
+
}
|
|
346
|
+
}
|
|
313
347
|
/**
|
|
314
348
|
* Creates a new Color instance from miscellaneous string formats
|
|
315
349
|
*
|
|
@@ -919,7 +953,7 @@
|
|
|
919
953
|
*
|
|
920
954
|
* @public exported from `@promptbook/core`
|
|
921
955
|
*/
|
|
922
|
-
const PROMPTBOOK_COLOR = Color.
|
|
956
|
+
const PROMPTBOOK_COLOR = Color.fromString('promptbook');
|
|
923
957
|
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
924
958
|
/**
|
|
925
959
|
* Colors for syntax highlighting in the `<BookEditor/>`
|
|
@@ -1186,7 +1220,7 @@
|
|
|
1186
1220
|
*/
|
|
1187
1221
|
class UnexpectedError extends Error {
|
|
1188
1222
|
constructor(message) {
|
|
1189
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
1223
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
1190
1224
|
${block(message)}
|
|
1191
1225
|
|
|
1192
1226
|
Note: This error should not happen.
|
|
@@ -1814,7 +1848,7 @@
|
|
|
1814
1848
|
constructor(whatWasThrown) {
|
|
1815
1849
|
const tag = `[🤮]`;
|
|
1816
1850
|
console.error(tag, whatWasThrown);
|
|
1817
|
-
super(spaceTrim.spaceTrim(`
|
|
1851
|
+
super(spaceTrim$1.spaceTrim(`
|
|
1818
1852
|
Non-Error object was thrown
|
|
1819
1853
|
|
|
1820
1854
|
Note: Look for ${tag} in the console for more details
|
|
@@ -2489,7 +2523,7 @@
|
|
|
2489
2523
|
if (!(error instanceof PipelineLogicError)) {
|
|
2490
2524
|
throw error;
|
|
2491
2525
|
}
|
|
2492
|
-
console.error(spaceTrim.spaceTrim((block) => `
|
|
2526
|
+
console.error(spaceTrim$1.spaceTrim((block) => `
|
|
2493
2527
|
Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
|
|
2494
2528
|
|
|
2495
2529
|
${block(error.message)}
|
|
@@ -2516,7 +2550,7 @@
|
|
|
2516
2550
|
})();
|
|
2517
2551
|
if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
|
|
2518
2552
|
// <- Note: [🚲]
|
|
2519
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2553
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2520
2554
|
Invalid promptbook URL "${pipeline.pipelineUrl}"
|
|
2521
2555
|
|
|
2522
2556
|
${block(pipelineIdentification)}
|
|
@@ -2524,7 +2558,7 @@
|
|
|
2524
2558
|
}
|
|
2525
2559
|
if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
|
|
2526
2560
|
// <- Note: [🚲]
|
|
2527
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2561
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2528
2562
|
Invalid Promptbook Version "${pipeline.bookVersion}"
|
|
2529
2563
|
|
|
2530
2564
|
${block(pipelineIdentification)}
|
|
@@ -2533,7 +2567,7 @@
|
|
|
2533
2567
|
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
2534
2568
|
if (!Array.isArray(pipeline.parameters)) {
|
|
2535
2569
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
2536
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
2570
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
2537
2571
|
Pipeline is valid JSON but with wrong structure
|
|
2538
2572
|
|
|
2539
2573
|
\`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
|
|
@@ -2544,7 +2578,7 @@
|
|
|
2544
2578
|
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
2545
2579
|
if (!Array.isArray(pipeline.tasks)) {
|
|
2546
2580
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
2547
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
2581
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
2548
2582
|
Pipeline is valid JSON but with wrong structure
|
|
2549
2583
|
|
|
2550
2584
|
\`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
|
|
@@ -2570,7 +2604,7 @@
|
|
|
2570
2604
|
// Note: Check each parameter individually
|
|
2571
2605
|
for (const parameter of pipeline.parameters) {
|
|
2572
2606
|
if (parameter.isInput && parameter.isOutput) {
|
|
2573
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2607
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2574
2608
|
|
|
2575
2609
|
Parameter \`{${parameter.name}}\` can not be both input and output
|
|
2576
2610
|
|
|
@@ -2581,7 +2615,7 @@
|
|
|
2581
2615
|
if (!parameter.isInput &&
|
|
2582
2616
|
!parameter.isOutput &&
|
|
2583
2617
|
!pipeline.tasks.some((task) => task.dependentParameterNames.includes(parameter.name))) {
|
|
2584
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2618
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2585
2619
|
Parameter \`{${parameter.name}}\` is created but not used
|
|
2586
2620
|
|
|
2587
2621
|
You can declare {${parameter.name}} as output parameter by adding in the header:
|
|
@@ -2593,7 +2627,7 @@
|
|
|
2593
2627
|
}
|
|
2594
2628
|
// Note: Testing that parameter is either input or result of some task
|
|
2595
2629
|
if (!parameter.isInput && !pipeline.tasks.some((task) => task.resultingParameterName === parameter.name)) {
|
|
2596
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2630
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2597
2631
|
Parameter \`{${parameter.name}}\` is declared but not defined
|
|
2598
2632
|
|
|
2599
2633
|
You can do one of these:
|
|
@@ -2609,14 +2643,14 @@
|
|
|
2609
2643
|
// Note: Checking each task individually
|
|
2610
2644
|
for (const task of pipeline.tasks) {
|
|
2611
2645
|
if (definedParameters.has(task.resultingParameterName)) {
|
|
2612
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2646
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2613
2647
|
Parameter \`{${task.resultingParameterName}}\` is defined multiple times
|
|
2614
2648
|
|
|
2615
2649
|
${block(pipelineIdentification)}
|
|
2616
2650
|
`));
|
|
2617
2651
|
}
|
|
2618
2652
|
if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
|
|
2619
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2653
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2620
2654
|
Parameter name {${task.resultingParameterName}} is reserved, please use different name
|
|
2621
2655
|
|
|
2622
2656
|
${block(pipelineIdentification)}
|
|
@@ -2626,7 +2660,7 @@
|
|
|
2626
2660
|
if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
|
|
2627
2661
|
if (!task.format &&
|
|
2628
2662
|
!task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
|
|
2629
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2663
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2630
2664
|
Joker parameters are used for {${task.resultingParameterName}} but no expectations are defined
|
|
2631
2665
|
|
|
2632
2666
|
${block(pipelineIdentification)}
|
|
@@ -2634,7 +2668,7 @@
|
|
|
2634
2668
|
}
|
|
2635
2669
|
for (const joker of task.jokerParameterNames) {
|
|
2636
2670
|
if (!task.dependentParameterNames.includes(joker)) {
|
|
2637
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2671
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2638
2672
|
Parameter \`{${joker}}\` is used for {${task.resultingParameterName}} as joker but not in \`dependentParameterNames\`
|
|
2639
2673
|
|
|
2640
2674
|
${block(pipelineIdentification)}
|
|
@@ -2645,21 +2679,21 @@
|
|
|
2645
2679
|
if (task.expectations) {
|
|
2646
2680
|
for (const [unit, { min, max }] of Object.entries(task.expectations)) {
|
|
2647
2681
|
if (min !== undefined && max !== undefined && min > max) {
|
|
2648
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2682
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2649
2683
|
Min expectation (=${min}) of ${unit} is higher than max expectation (=${max})
|
|
2650
2684
|
|
|
2651
2685
|
${block(pipelineIdentification)}
|
|
2652
2686
|
`));
|
|
2653
2687
|
}
|
|
2654
2688
|
if (min !== undefined && min < 0) {
|
|
2655
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2689
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2656
2690
|
Min expectation of ${unit} must be zero or positive
|
|
2657
2691
|
|
|
2658
2692
|
${block(pipelineIdentification)}
|
|
2659
2693
|
`));
|
|
2660
2694
|
}
|
|
2661
2695
|
if (max !== undefined && max <= 0) {
|
|
2662
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2696
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2663
2697
|
Max expectation of ${unit} must be positive
|
|
2664
2698
|
|
|
2665
2699
|
${block(pipelineIdentification)}
|
|
@@ -2681,7 +2715,7 @@
|
|
|
2681
2715
|
while (unresovedTasks.length > 0) {
|
|
2682
2716
|
if (loopLimit-- < 0) {
|
|
2683
2717
|
// Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
|
|
2684
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
2718
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
2685
2719
|
Loop limit reached during detection of circular dependencies in \`validatePipeline\`
|
|
2686
2720
|
|
|
2687
2721
|
${block(pipelineIdentification)}
|
|
@@ -2691,7 +2725,7 @@
|
|
|
2691
2725
|
if (currentlyResovedTasks.length === 0) {
|
|
2692
2726
|
throw new PipelineLogicError(
|
|
2693
2727
|
// TODO: [🐎] DRY
|
|
2694
|
-
spaceTrim.spaceTrim((block) => `
|
|
2728
|
+
spaceTrim$1.spaceTrim((block) => `
|
|
2695
2729
|
|
|
2696
2730
|
Can not resolve some parameters:
|
|
2697
2731
|
Either you are using a parameter that is not defined, or there are some circular dependencies.
|
|
@@ -2855,7 +2889,7 @@
|
|
|
2855
2889
|
for (const pipeline of pipelines) {
|
|
2856
2890
|
// TODO: [👠] DRY
|
|
2857
2891
|
if (pipeline.pipelineUrl === undefined) {
|
|
2858
|
-
throw new PipelineUrlError(spaceTrim.spaceTrim(`
|
|
2892
|
+
throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
|
|
2859
2893
|
Pipeline with name "${pipeline.title}" does not have defined URL
|
|
2860
2894
|
|
|
2861
2895
|
File:
|
|
@@ -2877,7 +2911,7 @@
|
|
|
2877
2911
|
pipelineJsonToString(unpreparePipeline(pipeline)) !==
|
|
2878
2912
|
pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
|
|
2879
2913
|
const existing = this.collection.get(pipeline.pipelineUrl);
|
|
2880
|
-
throw new PipelineUrlError(spaceTrim.spaceTrim(`
|
|
2914
|
+
throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
|
|
2881
2915
|
Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍎
|
|
2882
2916
|
|
|
2883
2917
|
Conflicting files:
|
|
@@ -2909,13 +2943,13 @@
|
|
|
2909
2943
|
const pipeline = this.collection.get(url);
|
|
2910
2944
|
if (!pipeline) {
|
|
2911
2945
|
if (this.listPipelines().length === 0) {
|
|
2912
|
-
throw new NotFoundError(spaceTrim.spaceTrim(`
|
|
2946
|
+
throw new NotFoundError(spaceTrim$1.spaceTrim(`
|
|
2913
2947
|
Pipeline with url "${url}" not found
|
|
2914
2948
|
|
|
2915
2949
|
No pipelines available
|
|
2916
2950
|
`));
|
|
2917
2951
|
}
|
|
2918
|
-
throw new NotFoundError(spaceTrim.spaceTrim((block) => `
|
|
2952
|
+
throw new NotFoundError(spaceTrim$1.spaceTrim((block) => `
|
|
2919
2953
|
Pipeline with url "${url}" not found
|
|
2920
2954
|
|
|
2921
2955
|
Available pipelines:
|
|
@@ -2956,7 +2990,7 @@
|
|
|
2956
2990
|
*/
|
|
2957
2991
|
class MissingToolsError extends Error {
|
|
2958
2992
|
constructor(message) {
|
|
2959
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
2993
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
2960
2994
|
${block(message)}
|
|
2961
2995
|
|
|
2962
2996
|
Note: You have probably forgot to provide some tools for pipeline execution or preparation
|
|
@@ -3164,7 +3198,7 @@
|
|
|
3164
3198
|
*/
|
|
3165
3199
|
class NotYetImplementedError extends Error {
|
|
3166
3200
|
constructor(message) {
|
|
3167
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
3201
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
3168
3202
|
${block(message)}
|
|
3169
3203
|
|
|
3170
3204
|
Note: This feature is not implemented yet but it will be soon.
|
|
@@ -3403,11 +3437,11 @@
|
|
|
3403
3437
|
throw deserializeError(errors[0]);
|
|
3404
3438
|
}
|
|
3405
3439
|
else {
|
|
3406
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
3440
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
3407
3441
|
Multiple errors occurred during Promptbook execution
|
|
3408
3442
|
|
|
3409
3443
|
${block(errors
|
|
3410
|
-
.map(({ name, stack, message }, index) => spaceTrim.spaceTrim((block) => `
|
|
3444
|
+
.map(({ name, stack, message }, index) => spaceTrim$1.spaceTrim((block) => `
|
|
3411
3445
|
${name} ${index + 1}:
|
|
3412
3446
|
${block(stack || message)}
|
|
3413
3447
|
`))
|
|
@@ -4806,7 +4840,7 @@
|
|
|
4806
4840
|
if (task.taskType === 'PROMPT_TASK' &&
|
|
4807
4841
|
knowledgePiecesCount > 0 &&
|
|
4808
4842
|
!dependentParameterNames.includes('knowledge')) {
|
|
4809
|
-
preparedContent = spaceTrim.spaceTrim(`
|
|
4843
|
+
preparedContent = spaceTrim$1.spaceTrim(`
|
|
4810
4844
|
{content}
|
|
4811
4845
|
|
|
4812
4846
|
## Knowledge
|
|
@@ -5119,7 +5153,7 @@
|
|
|
5119
5153
|
}
|
|
5120
5154
|
catch (error) {
|
|
5121
5155
|
assertsError(error);
|
|
5122
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
5156
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
5123
5157
|
Can not extract variables from the script
|
|
5124
5158
|
${block(error.stack || error.message)}
|
|
5125
5159
|
|
|
@@ -5956,7 +5990,7 @@
|
|
|
5956
5990
|
}
|
|
5957
5991
|
catch (error) {
|
|
5958
5992
|
keepUnused(error);
|
|
5959
|
-
throw new ExpectError(spaceTrim.spaceTrim((block) => `
|
|
5993
|
+
throw new ExpectError(spaceTrim$1.spaceTrim((block) => `
|
|
5960
5994
|
Expected valid JSON string
|
|
5961
5995
|
|
|
5962
5996
|
The expected JSON text:
|
|
@@ -6019,7 +6053,7 @@
|
|
|
6019
6053
|
const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
|
|
6020
6054
|
// TODO: [🧠][🍭] JOKERS, EXPECTATIONS, POSTPROCESSING and FOREACH
|
|
6021
6055
|
if (isJokerAttempt && !jokerParameterName) {
|
|
6022
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6056
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6023
6057
|
Joker not found in attempt ${attemptIndex}
|
|
6024
6058
|
|
|
6025
6059
|
${block(pipelineIdentification)}
|
|
@@ -6030,7 +6064,7 @@
|
|
|
6030
6064
|
$ongoingTaskResult.$expectError = null;
|
|
6031
6065
|
if (isJokerAttempt) {
|
|
6032
6066
|
if (parameters[jokerParameterName] === undefined) {
|
|
6033
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6067
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6034
6068
|
Joker parameter {${jokerParameterName}} not defined
|
|
6035
6069
|
|
|
6036
6070
|
${block(pipelineIdentification)}
|
|
@@ -6088,7 +6122,7 @@
|
|
|
6088
6122
|
$ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
|
|
6089
6123
|
break variant;
|
|
6090
6124
|
case 'EMBEDDING':
|
|
6091
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6125
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6092
6126
|
Embedding model can not be used in pipeline
|
|
6093
6127
|
|
|
6094
6128
|
This should be catched during parsing
|
|
@@ -6099,7 +6133,7 @@
|
|
|
6099
6133
|
break variant;
|
|
6100
6134
|
// <- case [🤖]:
|
|
6101
6135
|
default:
|
|
6102
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6136
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6103
6137
|
Unknown model variant "${task.modelRequirements.modelVariant}"
|
|
6104
6138
|
|
|
6105
6139
|
${block(pipelineIdentification)}
|
|
@@ -6110,14 +6144,14 @@
|
|
|
6110
6144
|
break;
|
|
6111
6145
|
case 'SCRIPT_TASK':
|
|
6112
6146
|
if (arrayableToArray(tools.script).length === 0) {
|
|
6113
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6147
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6114
6148
|
No script execution tools are available
|
|
6115
6149
|
|
|
6116
6150
|
${block(pipelineIdentification)}
|
|
6117
6151
|
`));
|
|
6118
6152
|
}
|
|
6119
6153
|
if (!task.contentLanguage) {
|
|
6120
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6154
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6121
6155
|
Script language is not defined for SCRIPT TASK "${task.name}"
|
|
6122
6156
|
|
|
6123
6157
|
${block(pipelineIdentification)}
|
|
@@ -6148,7 +6182,7 @@
|
|
|
6148
6182
|
throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
|
|
6149
6183
|
}
|
|
6150
6184
|
else {
|
|
6151
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6185
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6152
6186
|
Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
|
|
6153
6187
|
|
|
6154
6188
|
${block(pipelineIdentification)}
|
|
@@ -6162,7 +6196,7 @@
|
|
|
6162
6196
|
break taskType;
|
|
6163
6197
|
case 'DIALOG_TASK':
|
|
6164
6198
|
if (tools.userInterface === undefined) {
|
|
6165
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6199
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6166
6200
|
User interface tools are not available
|
|
6167
6201
|
|
|
6168
6202
|
${block(pipelineIdentification)}
|
|
@@ -6180,7 +6214,7 @@
|
|
|
6180
6214
|
break taskType;
|
|
6181
6215
|
// <- case: [🅱]
|
|
6182
6216
|
default:
|
|
6183
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6217
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6184
6218
|
Unknown execution type "${task.taskType}"
|
|
6185
6219
|
|
|
6186
6220
|
${block(pipelineIdentification)}
|
|
@@ -6278,7 +6312,7 @@
|
|
|
6278
6312
|
if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
|
|
6279
6313
|
// Note: Create a summary of all failures
|
|
6280
6314
|
const failuresSummary = $ongoingTaskResult.$failedResults
|
|
6281
|
-
.map((failure) => spaceTrim.spaceTrim((block) => {
|
|
6315
|
+
.map((failure) => spaceTrim$1.spaceTrim((block) => {
|
|
6282
6316
|
var _a, _b;
|
|
6283
6317
|
return `
|
|
6284
6318
|
Attempt ${failure.attemptIndex + 1}:
|
|
@@ -6288,14 +6322,14 @@
|
|
|
6288
6322
|
Result:
|
|
6289
6323
|
${block(failure.result === null
|
|
6290
6324
|
? 'null'
|
|
6291
|
-
: spaceTrim.spaceTrim(failure.result)
|
|
6325
|
+
: spaceTrim$1.spaceTrim(failure.result)
|
|
6292
6326
|
.split('\n')
|
|
6293
6327
|
.map((line) => `> ${line}`)
|
|
6294
6328
|
.join('\n'))}
|
|
6295
6329
|
`;
|
|
6296
6330
|
}))
|
|
6297
6331
|
.join('\n\n---\n\n');
|
|
6298
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => {
|
|
6332
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => {
|
|
6299
6333
|
var _a;
|
|
6300
6334
|
return `
|
|
6301
6335
|
LLM execution failed ${maxExecutionAttempts}x
|
|
@@ -6315,7 +6349,7 @@
|
|
|
6315
6349
|
}
|
|
6316
6350
|
}
|
|
6317
6351
|
if ($ongoingTaskResult.$resultString === null) {
|
|
6318
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6352
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6319
6353
|
Something went wrong and prompt result is null
|
|
6320
6354
|
|
|
6321
6355
|
${block(pipelineIdentification)}
|
|
@@ -6621,7 +6655,7 @@
|
|
|
6621
6655
|
// Note: Doublecheck that ALL reserved parameters are defined:
|
|
6622
6656
|
for (const parameterName of RESERVED_PARAMETER_NAMES) {
|
|
6623
6657
|
if (reservedParameters[parameterName] === undefined) {
|
|
6624
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6658
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6625
6659
|
Reserved parameter {${parameterName}} is not defined
|
|
6626
6660
|
|
|
6627
6661
|
${block(pipelineIdentification)}
|
|
@@ -6647,7 +6681,7 @@
|
|
|
6647
6681
|
const dependentParameterNames = new Set(currentTask.dependentParameterNames);
|
|
6648
6682
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
6649
6683
|
if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
|
|
6650
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6684
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6651
6685
|
Dependent parameters are not consistent with used parameters:
|
|
6652
6686
|
|
|
6653
6687
|
Dependent parameters:
|
|
@@ -6691,7 +6725,7 @@
|
|
|
6691
6725
|
else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
|
|
6692
6726
|
// Houston, we have a problem
|
|
6693
6727
|
// Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
|
|
6694
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6728
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6695
6729
|
Parameter \`{${parameterName}}\` is NOT defined
|
|
6696
6730
|
BUT used in task "${currentTask.title || currentTask.name}"
|
|
6697
6731
|
|
|
@@ -6760,7 +6794,7 @@
|
|
|
6760
6794
|
for (const parameter of preparedPipeline.parameters.filter(({ isOutput }) => isOutput)) {
|
|
6761
6795
|
if (parametersToPass[parameter.name] === undefined) {
|
|
6762
6796
|
// [4]
|
|
6763
|
-
$warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6797
|
+
$warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6764
6798
|
Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
|
|
6765
6799
|
|
|
6766
6800
|
Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
|
|
@@ -6868,7 +6902,7 @@
|
|
|
6868
6902
|
for (const parameterName of Object.keys(inputParameters)) {
|
|
6869
6903
|
const parameter = preparedPipeline.parameters.find(({ name }) => name === parameterName);
|
|
6870
6904
|
if (parameter === undefined) {
|
|
6871
|
-
warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6905
|
+
warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6872
6906
|
Extra parameter {${parameterName}} is being passed which is not part of the pipeline.
|
|
6873
6907
|
|
|
6874
6908
|
${block(pipelineIdentification)}
|
|
@@ -6883,7 +6917,7 @@
|
|
|
6883
6917
|
// TODO: [🧠] This should be also non-critical error
|
|
6884
6918
|
return exportJson({
|
|
6885
6919
|
name: 'pipelineExecutorResult',
|
|
6886
|
-
message: spaceTrim.spaceTrim((block) => `
|
|
6920
|
+
message: spaceTrim$1.spaceTrim((block) => `
|
|
6887
6921
|
Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
|
|
6888
6922
|
|
|
6889
6923
|
${block(pipelineIdentification)}
|
|
@@ -6892,7 +6926,7 @@
|
|
|
6892
6926
|
value: {
|
|
6893
6927
|
isSuccessful: false,
|
|
6894
6928
|
errors: [
|
|
6895
|
-
new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6929
|
+
new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6896
6930
|
Parameter \`{${parameter.name}}\` is passed as input parameter but it is not input
|
|
6897
6931
|
|
|
6898
6932
|
${block(pipelineIdentification)}
|
|
@@ -6919,7 +6953,7 @@
|
|
|
6919
6953
|
while (unresovedTasks.length > 0) {
|
|
6920
6954
|
if (loopLimit-- < 0) {
|
|
6921
6955
|
// Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
|
|
6922
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6956
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6923
6957
|
Loop limit reached during resolving parameters pipeline execution
|
|
6924
6958
|
|
|
6925
6959
|
${block(pipelineIdentification)}
|
|
@@ -6929,7 +6963,7 @@
|
|
|
6929
6963
|
if (!currentTask && resolving.length === 0) {
|
|
6930
6964
|
throw new UnexpectedError(
|
|
6931
6965
|
// TODO: [🐎] DRY
|
|
6932
|
-
spaceTrim.spaceTrim((block) => `
|
|
6966
|
+
spaceTrim$1.spaceTrim((block) => `
|
|
6933
6967
|
Can not resolve some parameters:
|
|
6934
6968
|
|
|
6935
6969
|
${block(pipelineIdentification)}
|
|
@@ -6969,7 +7003,7 @@
|
|
|
6969
7003
|
tools,
|
|
6970
7004
|
onProgress(newOngoingResult) {
|
|
6971
7005
|
if (isReturned) {
|
|
6972
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
7006
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6973
7007
|
Can not call \`onProgress\` after pipeline execution is finished
|
|
6974
7008
|
|
|
6975
7009
|
${block(pipelineIdentification)}
|
|
@@ -6986,7 +7020,7 @@
|
|
|
6986
7020
|
},
|
|
6987
7021
|
logLlmCall,
|
|
6988
7022
|
$executionReport: executionReport,
|
|
6989
|
-
pipelineIdentification: spaceTrim.spaceTrim((block) => `
|
|
7023
|
+
pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
|
|
6990
7024
|
${block(pipelineIdentification)}
|
|
6991
7025
|
Task name: ${currentTask.name}
|
|
6992
7026
|
Task title: ${currentTask.title}
|
|
@@ -7095,7 +7129,7 @@
|
|
|
7095
7129
|
preparedPipeline = pipeline;
|
|
7096
7130
|
}
|
|
7097
7131
|
else if (isNotPreparedWarningSuppressed !== true) {
|
|
7098
|
-
console.warn(spaceTrim.spaceTrim((block) => `
|
|
7132
|
+
console.warn(spaceTrim$1.spaceTrim((block) => `
|
|
7099
7133
|
Pipeline is not prepared
|
|
7100
7134
|
|
|
7101
7135
|
${block(pipelineIdentification)}
|
|
@@ -7120,7 +7154,7 @@
|
|
|
7120
7154
|
tools,
|
|
7121
7155
|
onProgress,
|
|
7122
7156
|
logLlmCall,
|
|
7123
|
-
pipelineIdentification: spaceTrim.spaceTrim((block) => `
|
|
7157
|
+
pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
|
|
7124
7158
|
${block(pipelineIdentification)}
|
|
7125
7159
|
${runCount === 1 ? '' : `Run #${runCount}`}
|
|
7126
7160
|
`),
|