@promptbook/markitdown 0.103.0-55 → 0.103.0-66
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 +91 -39
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +2 -2
- package/esm/typings/src/_packages/core.index.d.ts +6 -8
- package/esm/typings/src/_packages/types.index.d.ts +7 -1
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -1
- package/esm/typings/src/book-2.0/agent-source/createCommitmentRegex.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/AgentChat/AgentChat.d.ts +3 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +6 -0
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +5 -0
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentIntegration.d.ts +52 -0
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentSeamlessIntegration.d.ts +14 -0
- package/esm/typings/src/book-components/icons/SendIcon.d.ts +3 -0
- package/esm/typings/src/commitments/CLOSED/CLOSED.d.ts +4 -0
- package/esm/typings/src/commitments/CLOSED/CLOSED.test.d.ts +4 -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/USE/USE.d.ts +53 -0
- package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +42 -0
- package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.test.d.ts +1 -0
- package/esm/typings/src/commitments/{IMPORTANT/IMPORTANT.d.ts → USE_MCP/USE_MCP.d.ts} +16 -5
- package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +38 -0
- package/esm/typings/src/commitments/_base/BaseCommitmentDefinition.d.ts +6 -0
- package/esm/typings/src/commitments/index.d.ts +93 -1
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +3 -1
- package/esm/typings/src/other/templates/getTemplatesPipelineCollection.d.ts +1 -1
- package/esm/typings/src/playground/playground.d.ts +3 -0
- package/esm/typings/src/types/typeAliases.d.ts +6 -0
- package/esm/typings/src/utils/color/Color.d.ts +9 -1
- package/esm/typings/src/utils/color/css-colors.d.ts +1 -0
- package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +6 -0
- package/esm/typings/src/utils/random/CzechNamePool.d.ts +7 -0
- package/esm/typings/src/utils/random/EnglishNamePool.d.ts +7 -0
- package/esm/typings/src/utils/random/NamePool.d.ts +17 -0
- package/esm/typings/src/utils/random/getNamePool.d.ts +10 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +3 -3
- package/umd/index.umd.js +116 -64
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgent.d.ts +0 -29
- package/esm/typings/src/commitments/registry.d.ts +0 -68
- 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-66';
|
|
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',
|
|
@@ -295,21 +307,61 @@
|
|
|
295
307
|
* @param color
|
|
296
308
|
* @returns Color object
|
|
297
309
|
*/
|
|
298
|
-
static from(color) {
|
|
299
|
-
if (color
|
|
310
|
+
static from(color, _isSingleValue = false) {
|
|
311
|
+
if (color === '') {
|
|
312
|
+
throw new Error(`Can not create color from empty string`);
|
|
313
|
+
}
|
|
314
|
+
else if (color instanceof Color) {
|
|
300
315
|
return take(color);
|
|
301
316
|
}
|
|
302
317
|
else if (Color.isColor(color)) {
|
|
303
318
|
return take(color);
|
|
304
319
|
}
|
|
305
320
|
else if (typeof color === 'string') {
|
|
306
|
-
|
|
321
|
+
try {
|
|
322
|
+
return Color.fromString(color);
|
|
323
|
+
}
|
|
324
|
+
catch (error) {
|
|
325
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
326
|
+
if (_isSingleValue) {
|
|
327
|
+
throw error;
|
|
328
|
+
}
|
|
329
|
+
const parts = color.split(/[\s+,;|]/);
|
|
330
|
+
if (parts.length > 0) {
|
|
331
|
+
return Color.from(parts[0].trim(), true);
|
|
332
|
+
}
|
|
333
|
+
else {
|
|
334
|
+
throw new Error(`Can not create color from given string "${color}"`);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
307
337
|
}
|
|
308
338
|
else {
|
|
309
339
|
console.error({ color });
|
|
310
340
|
throw new Error(`Can not create color from given object`);
|
|
311
341
|
}
|
|
312
342
|
}
|
|
343
|
+
/**
|
|
344
|
+
* Creates a new Color instance from miscellaneous formats
|
|
345
|
+
* It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
|
|
346
|
+
*
|
|
347
|
+
* @param color
|
|
348
|
+
* @returns Color object
|
|
349
|
+
*/
|
|
350
|
+
static fromSafe(color) {
|
|
351
|
+
try {
|
|
352
|
+
return Color.from(color);
|
|
353
|
+
}
|
|
354
|
+
catch (error) {
|
|
355
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
356
|
+
console.warn(spaceTrim((block) => `
|
|
357
|
+
Color.fromSafe error:
|
|
358
|
+
${block(error.message)}
|
|
359
|
+
|
|
360
|
+
Returning default PROMPTBOOK_COLOR.
|
|
361
|
+
`));
|
|
362
|
+
return Color.fromString('promptbook');
|
|
363
|
+
}
|
|
364
|
+
}
|
|
313
365
|
/**
|
|
314
366
|
* Creates a new Color instance from miscellaneous string formats
|
|
315
367
|
*
|
|
@@ -919,7 +971,7 @@
|
|
|
919
971
|
*
|
|
920
972
|
* @public exported from `@promptbook/core`
|
|
921
973
|
*/
|
|
922
|
-
const PROMPTBOOK_COLOR = Color.
|
|
974
|
+
const PROMPTBOOK_COLOR = Color.fromString('promptbook');
|
|
923
975
|
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
924
976
|
/**
|
|
925
977
|
* Colors for syntax highlighting in the `<BookEditor/>`
|
|
@@ -1186,7 +1238,7 @@
|
|
|
1186
1238
|
*/
|
|
1187
1239
|
class UnexpectedError extends Error {
|
|
1188
1240
|
constructor(message) {
|
|
1189
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
1241
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
1190
1242
|
${block(message)}
|
|
1191
1243
|
|
|
1192
1244
|
Note: This error should not happen.
|
|
@@ -1814,7 +1866,7 @@
|
|
|
1814
1866
|
constructor(whatWasThrown) {
|
|
1815
1867
|
const tag = `[🤮]`;
|
|
1816
1868
|
console.error(tag, whatWasThrown);
|
|
1817
|
-
super(spaceTrim.spaceTrim(`
|
|
1869
|
+
super(spaceTrim$1.spaceTrim(`
|
|
1818
1870
|
Non-Error object was thrown
|
|
1819
1871
|
|
|
1820
1872
|
Note: Look for ${tag} in the console for more details
|
|
@@ -2489,7 +2541,7 @@
|
|
|
2489
2541
|
if (!(error instanceof PipelineLogicError)) {
|
|
2490
2542
|
throw error;
|
|
2491
2543
|
}
|
|
2492
|
-
console.error(spaceTrim.spaceTrim((block) => `
|
|
2544
|
+
console.error(spaceTrim$1.spaceTrim((block) => `
|
|
2493
2545
|
Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
|
|
2494
2546
|
|
|
2495
2547
|
${block(error.message)}
|
|
@@ -2516,7 +2568,7 @@
|
|
|
2516
2568
|
})();
|
|
2517
2569
|
if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
|
|
2518
2570
|
// <- Note: [🚲]
|
|
2519
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2571
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2520
2572
|
Invalid promptbook URL "${pipeline.pipelineUrl}"
|
|
2521
2573
|
|
|
2522
2574
|
${block(pipelineIdentification)}
|
|
@@ -2524,7 +2576,7 @@
|
|
|
2524
2576
|
}
|
|
2525
2577
|
if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
|
|
2526
2578
|
// <- Note: [🚲]
|
|
2527
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2579
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2528
2580
|
Invalid Promptbook Version "${pipeline.bookVersion}"
|
|
2529
2581
|
|
|
2530
2582
|
${block(pipelineIdentification)}
|
|
@@ -2533,7 +2585,7 @@
|
|
|
2533
2585
|
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
2534
2586
|
if (!Array.isArray(pipeline.parameters)) {
|
|
2535
2587
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
2536
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
2588
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
2537
2589
|
Pipeline is valid JSON but with wrong structure
|
|
2538
2590
|
|
|
2539
2591
|
\`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
|
|
@@ -2544,7 +2596,7 @@
|
|
|
2544
2596
|
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
2545
2597
|
if (!Array.isArray(pipeline.tasks)) {
|
|
2546
2598
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
2547
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
2599
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
2548
2600
|
Pipeline is valid JSON but with wrong structure
|
|
2549
2601
|
|
|
2550
2602
|
\`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
|
|
@@ -2570,7 +2622,7 @@
|
|
|
2570
2622
|
// Note: Check each parameter individually
|
|
2571
2623
|
for (const parameter of pipeline.parameters) {
|
|
2572
2624
|
if (parameter.isInput && parameter.isOutput) {
|
|
2573
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2625
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2574
2626
|
|
|
2575
2627
|
Parameter \`{${parameter.name}}\` can not be both input and output
|
|
2576
2628
|
|
|
@@ -2581,7 +2633,7 @@
|
|
|
2581
2633
|
if (!parameter.isInput &&
|
|
2582
2634
|
!parameter.isOutput &&
|
|
2583
2635
|
!pipeline.tasks.some((task) => task.dependentParameterNames.includes(parameter.name))) {
|
|
2584
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2636
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2585
2637
|
Parameter \`{${parameter.name}}\` is created but not used
|
|
2586
2638
|
|
|
2587
2639
|
You can declare {${parameter.name}} as output parameter by adding in the header:
|
|
@@ -2593,7 +2645,7 @@
|
|
|
2593
2645
|
}
|
|
2594
2646
|
// Note: Testing that parameter is either input or result of some task
|
|
2595
2647
|
if (!parameter.isInput && !pipeline.tasks.some((task) => task.resultingParameterName === parameter.name)) {
|
|
2596
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2648
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2597
2649
|
Parameter \`{${parameter.name}}\` is declared but not defined
|
|
2598
2650
|
|
|
2599
2651
|
You can do one of these:
|
|
@@ -2609,14 +2661,14 @@
|
|
|
2609
2661
|
// Note: Checking each task individually
|
|
2610
2662
|
for (const task of pipeline.tasks) {
|
|
2611
2663
|
if (definedParameters.has(task.resultingParameterName)) {
|
|
2612
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2664
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2613
2665
|
Parameter \`{${task.resultingParameterName}}\` is defined multiple times
|
|
2614
2666
|
|
|
2615
2667
|
${block(pipelineIdentification)}
|
|
2616
2668
|
`));
|
|
2617
2669
|
}
|
|
2618
2670
|
if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
|
|
2619
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2671
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2620
2672
|
Parameter name {${task.resultingParameterName}} is reserved, please use different name
|
|
2621
2673
|
|
|
2622
2674
|
${block(pipelineIdentification)}
|
|
@@ -2626,7 +2678,7 @@
|
|
|
2626
2678
|
if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
|
|
2627
2679
|
if (!task.format &&
|
|
2628
2680
|
!task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
|
|
2629
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2681
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2630
2682
|
Joker parameters are used for {${task.resultingParameterName}} but no expectations are defined
|
|
2631
2683
|
|
|
2632
2684
|
${block(pipelineIdentification)}
|
|
@@ -2634,7 +2686,7 @@
|
|
|
2634
2686
|
}
|
|
2635
2687
|
for (const joker of task.jokerParameterNames) {
|
|
2636
2688
|
if (!task.dependentParameterNames.includes(joker)) {
|
|
2637
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2689
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2638
2690
|
Parameter \`{${joker}}\` is used for {${task.resultingParameterName}} as joker but not in \`dependentParameterNames\`
|
|
2639
2691
|
|
|
2640
2692
|
${block(pipelineIdentification)}
|
|
@@ -2645,21 +2697,21 @@
|
|
|
2645
2697
|
if (task.expectations) {
|
|
2646
2698
|
for (const [unit, { min, max }] of Object.entries(task.expectations)) {
|
|
2647
2699
|
if (min !== undefined && max !== undefined && min > max) {
|
|
2648
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2700
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2649
2701
|
Min expectation (=${min}) of ${unit} is higher than max expectation (=${max})
|
|
2650
2702
|
|
|
2651
2703
|
${block(pipelineIdentification)}
|
|
2652
2704
|
`));
|
|
2653
2705
|
}
|
|
2654
2706
|
if (min !== undefined && min < 0) {
|
|
2655
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2707
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2656
2708
|
Min expectation of ${unit} must be zero or positive
|
|
2657
2709
|
|
|
2658
2710
|
${block(pipelineIdentification)}
|
|
2659
2711
|
`));
|
|
2660
2712
|
}
|
|
2661
2713
|
if (max !== undefined && max <= 0) {
|
|
2662
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
|
|
2714
|
+
throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
|
|
2663
2715
|
Max expectation of ${unit} must be positive
|
|
2664
2716
|
|
|
2665
2717
|
${block(pipelineIdentification)}
|
|
@@ -2681,7 +2733,7 @@
|
|
|
2681
2733
|
while (unresovedTasks.length > 0) {
|
|
2682
2734
|
if (loopLimit-- < 0) {
|
|
2683
2735
|
// Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
|
|
2684
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
2736
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
2685
2737
|
Loop limit reached during detection of circular dependencies in \`validatePipeline\`
|
|
2686
2738
|
|
|
2687
2739
|
${block(pipelineIdentification)}
|
|
@@ -2691,7 +2743,7 @@
|
|
|
2691
2743
|
if (currentlyResovedTasks.length === 0) {
|
|
2692
2744
|
throw new PipelineLogicError(
|
|
2693
2745
|
// TODO: [🐎] DRY
|
|
2694
|
-
spaceTrim.spaceTrim((block) => `
|
|
2746
|
+
spaceTrim$1.spaceTrim((block) => `
|
|
2695
2747
|
|
|
2696
2748
|
Can not resolve some parameters:
|
|
2697
2749
|
Either you are using a parameter that is not defined, or there are some circular dependencies.
|
|
@@ -2855,7 +2907,7 @@
|
|
|
2855
2907
|
for (const pipeline of pipelines) {
|
|
2856
2908
|
// TODO: [👠] DRY
|
|
2857
2909
|
if (pipeline.pipelineUrl === undefined) {
|
|
2858
|
-
throw new PipelineUrlError(spaceTrim.spaceTrim(`
|
|
2910
|
+
throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
|
|
2859
2911
|
Pipeline with name "${pipeline.title}" does not have defined URL
|
|
2860
2912
|
|
|
2861
2913
|
File:
|
|
@@ -2877,7 +2929,7 @@
|
|
|
2877
2929
|
pipelineJsonToString(unpreparePipeline(pipeline)) !==
|
|
2878
2930
|
pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
|
|
2879
2931
|
const existing = this.collection.get(pipeline.pipelineUrl);
|
|
2880
|
-
throw new PipelineUrlError(spaceTrim.spaceTrim(`
|
|
2932
|
+
throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
|
|
2881
2933
|
Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍎
|
|
2882
2934
|
|
|
2883
2935
|
Conflicting files:
|
|
@@ -2909,13 +2961,13 @@
|
|
|
2909
2961
|
const pipeline = this.collection.get(url);
|
|
2910
2962
|
if (!pipeline) {
|
|
2911
2963
|
if (this.listPipelines().length === 0) {
|
|
2912
|
-
throw new NotFoundError(spaceTrim.spaceTrim(`
|
|
2964
|
+
throw new NotFoundError(spaceTrim$1.spaceTrim(`
|
|
2913
2965
|
Pipeline with url "${url}" not found
|
|
2914
2966
|
|
|
2915
2967
|
No pipelines available
|
|
2916
2968
|
`));
|
|
2917
2969
|
}
|
|
2918
|
-
throw new NotFoundError(spaceTrim.spaceTrim((block) => `
|
|
2970
|
+
throw new NotFoundError(spaceTrim$1.spaceTrim((block) => `
|
|
2919
2971
|
Pipeline with url "${url}" not found
|
|
2920
2972
|
|
|
2921
2973
|
Available pipelines:
|
|
@@ -2956,7 +3008,7 @@
|
|
|
2956
3008
|
*/
|
|
2957
3009
|
class MissingToolsError extends Error {
|
|
2958
3010
|
constructor(message) {
|
|
2959
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
3011
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
2960
3012
|
${block(message)}
|
|
2961
3013
|
|
|
2962
3014
|
Note: You have probably forgot to provide some tools for pipeline execution or preparation
|
|
@@ -3164,7 +3216,7 @@
|
|
|
3164
3216
|
*/
|
|
3165
3217
|
class NotYetImplementedError extends Error {
|
|
3166
3218
|
constructor(message) {
|
|
3167
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
3219
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
3168
3220
|
${block(message)}
|
|
3169
3221
|
|
|
3170
3222
|
Note: This feature is not implemented yet but it will be soon.
|
|
@@ -3403,11 +3455,11 @@
|
|
|
3403
3455
|
throw deserializeError(errors[0]);
|
|
3404
3456
|
}
|
|
3405
3457
|
else {
|
|
3406
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
3458
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
3407
3459
|
Multiple errors occurred during Promptbook execution
|
|
3408
3460
|
|
|
3409
3461
|
${block(errors
|
|
3410
|
-
.map(({ name, stack, message }, index) => spaceTrim.spaceTrim((block) => `
|
|
3462
|
+
.map(({ name, stack, message }, index) => spaceTrim$1.spaceTrim((block) => `
|
|
3411
3463
|
${name} ${index + 1}:
|
|
3412
3464
|
${block(stack || message)}
|
|
3413
3465
|
`))
|
|
@@ -4806,7 +4858,7 @@
|
|
|
4806
4858
|
if (task.taskType === 'PROMPT_TASK' &&
|
|
4807
4859
|
knowledgePiecesCount > 0 &&
|
|
4808
4860
|
!dependentParameterNames.includes('knowledge')) {
|
|
4809
|
-
preparedContent = spaceTrim.spaceTrim(`
|
|
4861
|
+
preparedContent = spaceTrim$1.spaceTrim(`
|
|
4810
4862
|
{content}
|
|
4811
4863
|
|
|
4812
4864
|
## Knowledge
|
|
@@ -5119,7 +5171,7 @@
|
|
|
5119
5171
|
}
|
|
5120
5172
|
catch (error) {
|
|
5121
5173
|
assertsError(error);
|
|
5122
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
5174
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
5123
5175
|
Can not extract variables from the script
|
|
5124
5176
|
${block(error.stack || error.message)}
|
|
5125
5177
|
|
|
@@ -5956,7 +6008,7 @@
|
|
|
5956
6008
|
}
|
|
5957
6009
|
catch (error) {
|
|
5958
6010
|
keepUnused(error);
|
|
5959
|
-
throw new ExpectError(spaceTrim.spaceTrim((block) => `
|
|
6011
|
+
throw new ExpectError(spaceTrim$1.spaceTrim((block) => `
|
|
5960
6012
|
Expected valid JSON string
|
|
5961
6013
|
|
|
5962
6014
|
The expected JSON text:
|
|
@@ -6019,7 +6071,7 @@
|
|
|
6019
6071
|
const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
|
|
6020
6072
|
// TODO: [🧠][🍭] JOKERS, EXPECTATIONS, POSTPROCESSING and FOREACH
|
|
6021
6073
|
if (isJokerAttempt && !jokerParameterName) {
|
|
6022
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6074
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6023
6075
|
Joker not found in attempt ${attemptIndex}
|
|
6024
6076
|
|
|
6025
6077
|
${block(pipelineIdentification)}
|
|
@@ -6030,7 +6082,7 @@
|
|
|
6030
6082
|
$ongoingTaskResult.$expectError = null;
|
|
6031
6083
|
if (isJokerAttempt) {
|
|
6032
6084
|
if (parameters[jokerParameterName] === undefined) {
|
|
6033
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6085
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6034
6086
|
Joker parameter {${jokerParameterName}} not defined
|
|
6035
6087
|
|
|
6036
6088
|
${block(pipelineIdentification)}
|
|
@@ -6088,7 +6140,7 @@
|
|
|
6088
6140
|
$ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
|
|
6089
6141
|
break variant;
|
|
6090
6142
|
case 'EMBEDDING':
|
|
6091
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6143
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6092
6144
|
Embedding model can not be used in pipeline
|
|
6093
6145
|
|
|
6094
6146
|
This should be catched during parsing
|
|
@@ -6099,7 +6151,7 @@
|
|
|
6099
6151
|
break variant;
|
|
6100
6152
|
// <- case [🤖]:
|
|
6101
6153
|
default:
|
|
6102
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6154
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6103
6155
|
Unknown model variant "${task.modelRequirements.modelVariant}"
|
|
6104
6156
|
|
|
6105
6157
|
${block(pipelineIdentification)}
|
|
@@ -6110,14 +6162,14 @@
|
|
|
6110
6162
|
break;
|
|
6111
6163
|
case 'SCRIPT_TASK':
|
|
6112
6164
|
if (arrayableToArray(tools.script).length === 0) {
|
|
6113
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6165
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6114
6166
|
No script execution tools are available
|
|
6115
6167
|
|
|
6116
6168
|
${block(pipelineIdentification)}
|
|
6117
6169
|
`));
|
|
6118
6170
|
}
|
|
6119
6171
|
if (!task.contentLanguage) {
|
|
6120
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6172
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6121
6173
|
Script language is not defined for SCRIPT TASK "${task.name}"
|
|
6122
6174
|
|
|
6123
6175
|
${block(pipelineIdentification)}
|
|
@@ -6148,7 +6200,7 @@
|
|
|
6148
6200
|
throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
|
|
6149
6201
|
}
|
|
6150
6202
|
else {
|
|
6151
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6203
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6152
6204
|
Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
|
|
6153
6205
|
|
|
6154
6206
|
${block(pipelineIdentification)}
|
|
@@ -6162,7 +6214,7 @@
|
|
|
6162
6214
|
break taskType;
|
|
6163
6215
|
case 'DIALOG_TASK':
|
|
6164
6216
|
if (tools.userInterface === undefined) {
|
|
6165
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6217
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6166
6218
|
User interface tools are not available
|
|
6167
6219
|
|
|
6168
6220
|
${block(pipelineIdentification)}
|
|
@@ -6180,7 +6232,7 @@
|
|
|
6180
6232
|
break taskType;
|
|
6181
6233
|
// <- case: [🅱]
|
|
6182
6234
|
default:
|
|
6183
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6235
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6184
6236
|
Unknown execution type "${task.taskType}"
|
|
6185
6237
|
|
|
6186
6238
|
${block(pipelineIdentification)}
|
|
@@ -6278,7 +6330,7 @@
|
|
|
6278
6330
|
if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
|
|
6279
6331
|
// Note: Create a summary of all failures
|
|
6280
6332
|
const failuresSummary = $ongoingTaskResult.$failedResults
|
|
6281
|
-
.map((failure) => spaceTrim.spaceTrim((block) => {
|
|
6333
|
+
.map((failure) => spaceTrim$1.spaceTrim((block) => {
|
|
6282
6334
|
var _a, _b;
|
|
6283
6335
|
return `
|
|
6284
6336
|
Attempt ${failure.attemptIndex + 1}:
|
|
@@ -6288,14 +6340,14 @@
|
|
|
6288
6340
|
Result:
|
|
6289
6341
|
${block(failure.result === null
|
|
6290
6342
|
? 'null'
|
|
6291
|
-
: spaceTrim.spaceTrim(failure.result)
|
|
6343
|
+
: spaceTrim$1.spaceTrim(failure.result)
|
|
6292
6344
|
.split('\n')
|
|
6293
6345
|
.map((line) => `> ${line}`)
|
|
6294
6346
|
.join('\n'))}
|
|
6295
6347
|
`;
|
|
6296
6348
|
}))
|
|
6297
6349
|
.join('\n\n---\n\n');
|
|
6298
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => {
|
|
6350
|
+
throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => {
|
|
6299
6351
|
var _a;
|
|
6300
6352
|
return `
|
|
6301
6353
|
LLM execution failed ${maxExecutionAttempts}x
|
|
@@ -6315,7 +6367,7 @@
|
|
|
6315
6367
|
}
|
|
6316
6368
|
}
|
|
6317
6369
|
if ($ongoingTaskResult.$resultString === null) {
|
|
6318
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6370
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6319
6371
|
Something went wrong and prompt result is null
|
|
6320
6372
|
|
|
6321
6373
|
${block(pipelineIdentification)}
|
|
@@ -6621,7 +6673,7 @@
|
|
|
6621
6673
|
// Note: Doublecheck that ALL reserved parameters are defined:
|
|
6622
6674
|
for (const parameterName of RESERVED_PARAMETER_NAMES) {
|
|
6623
6675
|
if (reservedParameters[parameterName] === undefined) {
|
|
6624
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6676
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6625
6677
|
Reserved parameter {${parameterName}} is not defined
|
|
6626
6678
|
|
|
6627
6679
|
${block(pipelineIdentification)}
|
|
@@ -6647,7 +6699,7 @@
|
|
|
6647
6699
|
const dependentParameterNames = new Set(currentTask.dependentParameterNames);
|
|
6648
6700
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
6649
6701
|
if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
|
|
6650
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6702
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6651
6703
|
Dependent parameters are not consistent with used parameters:
|
|
6652
6704
|
|
|
6653
6705
|
Dependent parameters:
|
|
@@ -6691,7 +6743,7 @@
|
|
|
6691
6743
|
else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
|
|
6692
6744
|
// Houston, we have a problem
|
|
6693
6745
|
// Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
|
|
6694
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6746
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6695
6747
|
Parameter \`{${parameterName}}\` is NOT defined
|
|
6696
6748
|
BUT used in task "${currentTask.title || currentTask.name}"
|
|
6697
6749
|
|
|
@@ -6760,7 +6812,7 @@
|
|
|
6760
6812
|
for (const parameter of preparedPipeline.parameters.filter(({ isOutput }) => isOutput)) {
|
|
6761
6813
|
if (parametersToPass[parameter.name] === undefined) {
|
|
6762
6814
|
// [4]
|
|
6763
|
-
$warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6815
|
+
$warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6764
6816
|
Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
|
|
6765
6817
|
|
|
6766
6818
|
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 +6920,7 @@
|
|
|
6868
6920
|
for (const parameterName of Object.keys(inputParameters)) {
|
|
6869
6921
|
const parameter = preparedPipeline.parameters.find(({ name }) => name === parameterName);
|
|
6870
6922
|
if (parameter === undefined) {
|
|
6871
|
-
warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6923
|
+
warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6872
6924
|
Extra parameter {${parameterName}} is being passed which is not part of the pipeline.
|
|
6873
6925
|
|
|
6874
6926
|
${block(pipelineIdentification)}
|
|
@@ -6883,7 +6935,7 @@
|
|
|
6883
6935
|
// TODO: [🧠] This should be also non-critical error
|
|
6884
6936
|
return exportJson({
|
|
6885
6937
|
name: 'pipelineExecutorResult',
|
|
6886
|
-
message: spaceTrim.spaceTrim((block) => `
|
|
6938
|
+
message: spaceTrim$1.spaceTrim((block) => `
|
|
6887
6939
|
Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
|
|
6888
6940
|
|
|
6889
6941
|
${block(pipelineIdentification)}
|
|
@@ -6892,7 +6944,7 @@
|
|
|
6892
6944
|
value: {
|
|
6893
6945
|
isSuccessful: false,
|
|
6894
6946
|
errors: [
|
|
6895
|
-
new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
|
|
6947
|
+
new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
|
|
6896
6948
|
Parameter \`{${parameter.name}}\` is passed as input parameter but it is not input
|
|
6897
6949
|
|
|
6898
6950
|
${block(pipelineIdentification)}
|
|
@@ -6919,7 +6971,7 @@
|
|
|
6919
6971
|
while (unresovedTasks.length > 0) {
|
|
6920
6972
|
if (loopLimit-- < 0) {
|
|
6921
6973
|
// Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
|
|
6922
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6974
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6923
6975
|
Loop limit reached during resolving parameters pipeline execution
|
|
6924
6976
|
|
|
6925
6977
|
${block(pipelineIdentification)}
|
|
@@ -6929,7 +6981,7 @@
|
|
|
6929
6981
|
if (!currentTask && resolving.length === 0) {
|
|
6930
6982
|
throw new UnexpectedError(
|
|
6931
6983
|
// TODO: [🐎] DRY
|
|
6932
|
-
spaceTrim.spaceTrim((block) => `
|
|
6984
|
+
spaceTrim$1.spaceTrim((block) => `
|
|
6933
6985
|
Can not resolve some parameters:
|
|
6934
6986
|
|
|
6935
6987
|
${block(pipelineIdentification)}
|
|
@@ -6969,7 +7021,7 @@
|
|
|
6969
7021
|
tools,
|
|
6970
7022
|
onProgress(newOngoingResult) {
|
|
6971
7023
|
if (isReturned) {
|
|
6972
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
7024
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6973
7025
|
Can not call \`onProgress\` after pipeline execution is finished
|
|
6974
7026
|
|
|
6975
7027
|
${block(pipelineIdentification)}
|
|
@@ -6986,7 +7038,7 @@
|
|
|
6986
7038
|
},
|
|
6987
7039
|
logLlmCall,
|
|
6988
7040
|
$executionReport: executionReport,
|
|
6989
|
-
pipelineIdentification: spaceTrim.spaceTrim((block) => `
|
|
7041
|
+
pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
|
|
6990
7042
|
${block(pipelineIdentification)}
|
|
6991
7043
|
Task name: ${currentTask.name}
|
|
6992
7044
|
Task title: ${currentTask.title}
|
|
@@ -7095,7 +7147,7 @@
|
|
|
7095
7147
|
preparedPipeline = pipeline;
|
|
7096
7148
|
}
|
|
7097
7149
|
else if (isNotPreparedWarningSuppressed !== true) {
|
|
7098
|
-
console.warn(spaceTrim.spaceTrim((block) => `
|
|
7150
|
+
console.warn(spaceTrim$1.spaceTrim((block) => `
|
|
7099
7151
|
Pipeline is not prepared
|
|
7100
7152
|
|
|
7101
7153
|
${block(pipelineIdentification)}
|
|
@@ -7120,7 +7172,7 @@
|
|
|
7120
7172
|
tools,
|
|
7121
7173
|
onProgress,
|
|
7122
7174
|
logLlmCall,
|
|
7123
|
-
pipelineIdentification: spaceTrim.spaceTrim((block) => `
|
|
7175
|
+
pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
|
|
7124
7176
|
${block(pipelineIdentification)}
|
|
7125
7177
|
${runCount === 1 ? '' : `Run #${runCount}`}
|
|
7126
7178
|
`),
|