@promptbook/core 0.66.0-9 → 0.67.0-0
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 +377 -237
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +6 -4
- package/esm/typings/src/_packages/types.index.d.ts +7 -1
- package/esm/typings/src/_packages/utils.index.d.ts +14 -8
- package/esm/typings/src/commands/EXPECT/ExpectFormatCommand.d.ts +2 -0
- package/esm/typings/src/config.d.ts +6 -0
- package/esm/typings/src/errors/{ReferenceError.d.ts → PipelineUrlError.d.ts} +2 -2
- package/esm/typings/src/errors/index.d.ts +27 -0
- package/esm/typings/src/errors/utils/ErrorJson.d.ts +20 -0
- package/esm/typings/src/errors/utils/deserializeError.d.ts +7 -0
- package/esm/typings/src/errors/utils/deserializeError.test.d.ts +1 -0
- package/esm/typings/src/errors/utils/serializeError.d.ts +7 -0
- package/esm/typings/src/errors/utils/serializeError.test.d.ts +1 -0
- package/esm/typings/src/execution/ExecutionTools.d.ts +4 -1
- package/esm/typings/src/execution/PipelineExecutor.d.ts +1 -47
- package/esm/typings/src/execution/PipelineExecutorResult.d.ts +49 -0
- package/esm/typings/src/execution/PromptResult.d.ts +5 -4
- package/esm/typings/src/execution/PromptResultUsage.d.ts +4 -0
- package/esm/typings/src/execution/UncertainNumber.d.ts +1 -0
- package/esm/typings/src/execution/assertsExecutionSuccessful.d.ts +2 -2
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +0 -1
- package/esm/typings/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +2 -2
- package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_Error.d.ts +2 -6
- package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -0
- package/esm/typings/src/scripting/javascript/JavascriptExecutionToolsOptions.d.ts +2 -2
- package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +1 -1
- package/esm/typings/src/types/ModelRequirements.d.ts +5 -5
- package/esm/typings/src/types/PipelineJson/Expectations.d.ts +3 -1
- package/esm/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +2 -0
- package/esm/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +4 -0
- package/esm/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +2 -0
- package/esm/typings/src/types/PipelineJson/PersonaJson.d.ts +4 -0
- package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +2 -0
- package/esm/typings/src/types/PipelineJson/PromptDialogJson.d.ts +1 -0
- package/esm/typings/src/types/PipelineJson/PromptTemplateJson.d.ts +2 -0
- package/esm/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +2 -2
- package/esm/typings/src/types/PipelineJson/PromptTemplateParameterJson.d.ts +2 -0
- package/esm/typings/src/types/PipelineJson/ScriptJson.d.ts +1 -0
- package/esm/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +1 -0
- package/esm/typings/src/types/Prompt.d.ts +7 -7
- package/esm/typings/src/types/ScriptLanguage.d.ts +2 -0
- package/esm/typings/src/types/execution-report/ExecutionPromptReportJson.d.ts +24 -0
- package/esm/typings/src/types/execution-report/ExecutionReportJson.d.ts +3 -20
- package/esm/typings/src/types/typeAliases.d.ts +7 -0
- package/esm/typings/src/utils/environment/$getGlobalScope.d.ts +1 -4
- package/esm/typings/src/utils/serialization/$asDeeplyFrozenSerializableJson.d.ts +17 -0
- package/esm/typings/src/utils/{deepFreeze.d.ts → serialization/$deepFreeze.d.ts} +0 -10
- package/esm/typings/src/utils/serialization/checkSerializableAsJson.d.ts +27 -0
- package/esm/typings/src/utils/{clonePipeline.d.ts → serialization/clonePipeline.d.ts} +1 -1
- package/esm/typings/src/utils/serialization/isSerializableAsJson.d.ts +24 -0
- package/esm/typings/src/utils/serialization/isSerializableAsJson.test.d.ts +1 -0
- package/package.json +1 -1
- package/umd/index.umd.js +379 -238
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/errors/VersionMismatchError.d.ts +0 -10
- /package/esm/typings/src/utils/{deepClone.d.ts → serialization/deepClone.d.ts} +0 -0
package/umd/index.umd.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
/**
|
|
17
17
|
* The version of the Promptbook library
|
|
18
18
|
*/
|
|
19
|
-
var PROMPTBOOK_VERSION = '0.66.0
|
|
19
|
+
var PROMPTBOOK_VERSION = '0.66.0';
|
|
20
20
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
21
21
|
|
|
22
22
|
/*! *****************************************************************************
|
|
@@ -412,6 +412,26 @@
|
|
|
412
412
|
* TODO: [🧠] Should be in generated .ptbk.md file GENERATOR_WARNING
|
|
413
413
|
*/
|
|
414
414
|
|
|
415
|
+
/**
|
|
416
|
+
* Returns the same value that is passed as argument.
|
|
417
|
+
* No side effects.
|
|
418
|
+
*
|
|
419
|
+
* Note: It can be usefull for:
|
|
420
|
+
*
|
|
421
|
+
* 1) Leveling indentation
|
|
422
|
+
* 2) Putting always-true or always-false conditions without getting eslint errors
|
|
423
|
+
*
|
|
424
|
+
* @param value any values
|
|
425
|
+
* @returns the same values
|
|
426
|
+
* @private within the repository
|
|
427
|
+
*/
|
|
428
|
+
function just(value) {
|
|
429
|
+
if (value === undefined) {
|
|
430
|
+
return undefined;
|
|
431
|
+
}
|
|
432
|
+
return value;
|
|
433
|
+
}
|
|
434
|
+
|
|
415
435
|
/**
|
|
416
436
|
* @@@
|
|
417
437
|
*
|
|
@@ -442,42 +462,169 @@
|
|
|
442
462
|
}
|
|
443
463
|
return Object.freeze(objectValue);
|
|
444
464
|
}
|
|
465
|
+
/**
|
|
466
|
+
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
467
|
+
*/
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* This error type indicates that the error should not happen and its last check before crashing with some other error
|
|
471
|
+
*
|
|
472
|
+
* @public exported from `@promptbook/core`
|
|
473
|
+
*/
|
|
474
|
+
var UnexpectedError = /** @class */ (function (_super) {
|
|
475
|
+
__extends(UnexpectedError, _super);
|
|
476
|
+
function UnexpectedError(message) {
|
|
477
|
+
var _this = _super.call(this, spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(message), "\n\n Note: This error should not happen.\n It's probbably a bug in the pipeline collection\n\n Please report issue:\n https://github.com/webgptorg/promptbook/issues\n\n Or contact us on me@pavolhejny.com\n\n "); })) || this;
|
|
478
|
+
_this.name = 'UnexpectedError';
|
|
479
|
+
Object.setPrototypeOf(_this, UnexpectedError.prototype);
|
|
480
|
+
return _this;
|
|
481
|
+
}
|
|
482
|
+
return UnexpectedError;
|
|
483
|
+
}(Error));
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* Checks if the value is [🚉] serializable as JSON
|
|
487
|
+
* If not, throws an UnexpectedError with a rich error message and tracking
|
|
488
|
+
*
|
|
489
|
+
* - Almost all primitives are serializable BUT:
|
|
490
|
+
* - `undefined` is not serializable
|
|
491
|
+
* - `NaN` is not serializable
|
|
492
|
+
* - Objects and arrays are serializable if all their properties are serializable
|
|
493
|
+
* - Functions are not serializable
|
|
494
|
+
* - Circular references are not serializable
|
|
495
|
+
* - `Date` objects are not serializable
|
|
496
|
+
* - `Map` and `Set` objects are not serializable
|
|
497
|
+
* - `RegExp` objects are not serializable
|
|
498
|
+
* - `Error` objects are not serializable
|
|
499
|
+
* - `Symbol` objects are not serializable
|
|
500
|
+
* - And much more...
|
|
501
|
+
*
|
|
502
|
+
* @throws UnexpectedError if the value is not serializable as JSON
|
|
503
|
+
* @public exported from `@promptbook/utils`
|
|
504
|
+
*/
|
|
505
|
+
function checkSerializableAsJson(name, value) {
|
|
506
|
+
var e_1, _a;
|
|
507
|
+
if (value === undefined) {
|
|
508
|
+
throw new UnexpectedError("".concat(name, " is undefined"));
|
|
509
|
+
}
|
|
510
|
+
else if (value === null) {
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
else if (typeof value === 'boolean') {
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
else if (typeof value === 'number' && !isNaN(value)) {
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
else if (typeof value === 'string') {
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
else if (typeof value === 'symbol') {
|
|
523
|
+
throw new UnexpectedError("".concat(name, " is symbol"));
|
|
524
|
+
}
|
|
525
|
+
else if (typeof value === 'function') {
|
|
526
|
+
throw new UnexpectedError("".concat(name, " is function"));
|
|
527
|
+
}
|
|
528
|
+
else if (typeof value === 'object' && Array.isArray(value)) {
|
|
529
|
+
for (var i = 0; i < value.length; i++) {
|
|
530
|
+
checkSerializableAsJson("".concat(name, "[").concat(i, "]"), value[i]);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
else if (typeof value === 'object') {
|
|
534
|
+
if (value instanceof Date) {
|
|
535
|
+
throw new UnexpectedError(spaceTrim__default["default"]("\n ".concat(name, " is Date\n\n Use `string_date_iso8601` instead\n ")));
|
|
536
|
+
}
|
|
537
|
+
else if (value instanceof Map) {
|
|
538
|
+
throw new UnexpectedError("".concat(name, " is Map"));
|
|
539
|
+
}
|
|
540
|
+
else if (value instanceof Set) {
|
|
541
|
+
throw new UnexpectedError("".concat(name, " is Set"));
|
|
542
|
+
}
|
|
543
|
+
else if (value instanceof RegExp) {
|
|
544
|
+
throw new UnexpectedError("".concat(name, " is RegExp"));
|
|
545
|
+
}
|
|
546
|
+
else if (value instanceof Error) {
|
|
547
|
+
throw new UnexpectedError(spaceTrim__default["default"]("\n ".concat(name, " is unserialized Error\n\n Use function `serializeError`\n ")));
|
|
548
|
+
}
|
|
549
|
+
else {
|
|
550
|
+
try {
|
|
551
|
+
for (var _b = __values(Object.entries(value)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
552
|
+
var _d = __read(_c.value, 2), subName = _d[0], subValue = _d[1];
|
|
553
|
+
if (subValue === undefined) {
|
|
554
|
+
// Note: undefined in object is serializable - it is just omited
|
|
555
|
+
continue;
|
|
556
|
+
}
|
|
557
|
+
checkSerializableAsJson("".concat(name, ".").concat(subName), subValue);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
561
|
+
finally {
|
|
562
|
+
try {
|
|
563
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
564
|
+
}
|
|
565
|
+
finally { if (e_1) throw e_1.error; }
|
|
566
|
+
}
|
|
567
|
+
try {
|
|
568
|
+
JSON.stringify(value); // <- TODO: [0]
|
|
569
|
+
}
|
|
570
|
+
catch (error) {
|
|
571
|
+
if (!(error instanceof Error)) {
|
|
572
|
+
throw error;
|
|
573
|
+
}
|
|
574
|
+
throw new UnexpectedError(spaceTrim__default["default"](function (block) { return "\n ".concat(name, " is not serializable\n\n ").concat(block(error.toString()), "\n "); }));
|
|
575
|
+
}
|
|
576
|
+
/*
|
|
577
|
+
TODO: [0] Is there some more elegant way to check circular references?
|
|
578
|
+
const seen = new Set();
|
|
579
|
+
const stack = [{ value }];
|
|
580
|
+
while (stack.length > 0) {
|
|
581
|
+
const { value } = stack.pop()!;
|
|
582
|
+
if (typeof value === 'object' && value !== null) {
|
|
583
|
+
if (seen.has(value)) {
|
|
584
|
+
throw new UnexpectedError(`${name} has circular reference`);
|
|
585
|
+
}
|
|
586
|
+
seen.add(value);
|
|
587
|
+
if (Array.isArray(value)) {
|
|
588
|
+
stack.push(...value.map((value) => ({ value })));
|
|
589
|
+
} else {
|
|
590
|
+
stack.push(...Object.values(value).map((value) => ({ value })));
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
*/
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
else {
|
|
599
|
+
throw new UnexpectedError("".concat(name, " is unknown"));
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* TODO: [🧠][🛣] More elegant way to tracking than passing `name`
|
|
604
|
+
* TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
|
|
605
|
+
* Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
|
|
606
|
+
*/
|
|
607
|
+
|
|
445
608
|
/**
|
|
446
609
|
* @@@
|
|
447
610
|
* @@@
|
|
448
611
|
*
|
|
449
612
|
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
|
|
450
613
|
*
|
|
614
|
+
* @param name - Name of the object for debugging purposes
|
|
615
|
+
* @param objectValue - Object to be deeply frozen
|
|
451
616
|
* @returns The same object as the input, but deeply frozen
|
|
452
617
|
* @private this is in comparison to `deepFreeze` a more specific utility and maybe not very good practice to use without specific reason and considerations
|
|
453
618
|
*/
|
|
454
|
-
function
|
|
619
|
+
function $asDeeplyFrozenSerializableJson(name, objectValue) {
|
|
620
|
+
checkSerializableAsJson(name, objectValue);
|
|
455
621
|
return $deepFreeze(objectValue);
|
|
456
622
|
}
|
|
457
623
|
/**
|
|
624
|
+
* TODO: [🧠][🛣] More elegant way to tracking than passing `name`
|
|
458
625
|
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
459
626
|
*/
|
|
460
627
|
|
|
461
|
-
/**
|
|
462
|
-
* Returns the same value that is passed as argument.
|
|
463
|
-
* No side effects.
|
|
464
|
-
*
|
|
465
|
-
* Note: It can be usefull for:
|
|
466
|
-
*
|
|
467
|
-
* 1) Leveling indentation
|
|
468
|
-
* 2) Putting always-true or always-false conditions without getting eslint errors
|
|
469
|
-
*
|
|
470
|
-
* @param value any values
|
|
471
|
-
* @returns the same values
|
|
472
|
-
* @private within the repository
|
|
473
|
-
*/
|
|
474
|
-
function just(value) {
|
|
475
|
-
if (value === undefined) {
|
|
476
|
-
return undefined;
|
|
477
|
-
}
|
|
478
|
-
return value;
|
|
479
|
-
}
|
|
480
|
-
|
|
481
628
|
/**
|
|
482
629
|
* Warning message for the generated sections and files files
|
|
483
630
|
*
|
|
@@ -554,7 +701,7 @@
|
|
|
554
701
|
*
|
|
555
702
|
* @public exported from `@promptbook/core`
|
|
556
703
|
*/
|
|
557
|
-
var RESERVED_PARAMETER_NAMES = $
|
|
704
|
+
var RESERVED_PARAMETER_NAMES = $asDeeplyFrozenSerializableJson('RESERVED_PARAMETER_NAMES', [
|
|
558
705
|
'content',
|
|
559
706
|
'context',
|
|
560
707
|
'knowledge',
|
|
@@ -597,6 +744,13 @@
|
|
|
597
744
|
* @public exported from `@promptbook/core`
|
|
598
745
|
*/
|
|
599
746
|
var DEFAULT_REMOTE_URL_PATH = '/promptbook/socket.io';
|
|
747
|
+
// <- TODO: [🧜♂️]
|
|
748
|
+
/**
|
|
749
|
+
* @@@
|
|
750
|
+
*
|
|
751
|
+
* @public exported from `@promptbook/core`
|
|
752
|
+
*/
|
|
753
|
+
var IS_VERBOSE = false;
|
|
600
754
|
/**
|
|
601
755
|
* TODO: [🧠][🧜♂️] Maybe join remoteUrl and path into single value
|
|
602
756
|
*/
|
|
@@ -633,22 +787,6 @@
|
|
|
633
787
|
return PipelineLogicError;
|
|
634
788
|
}(Error));
|
|
635
789
|
|
|
636
|
-
/**
|
|
637
|
-
* This error type indicates that the error should not happen and its last check before crashing with some other error
|
|
638
|
-
*
|
|
639
|
-
* @public exported from `@promptbook/core`
|
|
640
|
-
*/
|
|
641
|
-
var UnexpectedError = /** @class */ (function (_super) {
|
|
642
|
-
__extends(UnexpectedError, _super);
|
|
643
|
-
function UnexpectedError(message) {
|
|
644
|
-
var _this = _super.call(this, spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(message), "\n\n Note: This error should not happen.\n It's probbably a bug in the pipeline collection\n\n Please report issue:\n https://github.com/webgptorg/promptbook/issues\n\n Or contact us on me@pavolhejny.com\n\n "); })) || this;
|
|
645
|
-
_this.name = 'UnexpectedError';
|
|
646
|
-
Object.setPrototypeOf(_this, UnexpectedError.prototype);
|
|
647
|
-
return _this;
|
|
648
|
-
}
|
|
649
|
-
return UnexpectedError;
|
|
650
|
-
}(Error));
|
|
651
|
-
|
|
652
790
|
/**
|
|
653
791
|
* Tests if given string is valid semantic version
|
|
654
792
|
*
|
|
@@ -1062,15 +1200,15 @@
|
|
|
1062
1200
|
*
|
|
1063
1201
|
* @public exported from `@promptbook/core`
|
|
1064
1202
|
*/
|
|
1065
|
-
var
|
|
1066
|
-
__extends(
|
|
1067
|
-
function
|
|
1203
|
+
var PipelineUrlError = /** @class */ (function (_super) {
|
|
1204
|
+
__extends(PipelineUrlError, _super);
|
|
1205
|
+
function PipelineUrlError(message) {
|
|
1068
1206
|
var _this = _super.call(this, message) || this;
|
|
1069
|
-
_this.name = '
|
|
1070
|
-
Object.setPrototypeOf(_this,
|
|
1207
|
+
_this.name = 'PipelineUrlError';
|
|
1208
|
+
Object.setPrototypeOf(_this, PipelineUrlError.prototype);
|
|
1071
1209
|
return _this;
|
|
1072
1210
|
}
|
|
1073
|
-
return
|
|
1211
|
+
return PipelineUrlError;
|
|
1074
1212
|
}(Error));
|
|
1075
1213
|
|
|
1076
1214
|
/**
|
|
@@ -1118,7 +1256,7 @@
|
|
|
1118
1256
|
delete promptTemplateUnprepared.preparedContent;
|
|
1119
1257
|
return promptTemplateUnprepared;
|
|
1120
1258
|
});
|
|
1121
|
-
return __assign(__assign({}, pipeline), { promptTemplates: promptTemplates, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] });
|
|
1259
|
+
return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), { promptTemplates: promptTemplates, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }));
|
|
1122
1260
|
}
|
|
1123
1261
|
/**
|
|
1124
1262
|
* TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
|
|
@@ -1154,7 +1292,7 @@
|
|
|
1154
1292
|
var pipeline = pipelines_1_1.value;
|
|
1155
1293
|
// TODO: [👠] DRY
|
|
1156
1294
|
if (pipeline.pipelineUrl === undefined) {
|
|
1157
|
-
throw new
|
|
1295
|
+
throw new PipelineUrlError(spaceTrim.spaceTrim("\n Pipeline with name \"".concat(pipeline.title, "\" does not have defined URL\n\n File:\n ").concat(pipeline.sourceFile || 'Unknown', "\n\n Note: Pipelines without URLs are called anonymous pipelines\n They can be used as standalone pipelines, but they cannot be referenced by other pipelines\n And also they cannot be used in the pipeline collection\n\n ")));
|
|
1158
1296
|
}
|
|
1159
1297
|
// Note: [🐨]
|
|
1160
1298
|
validatePipeline(pipeline);
|
|
@@ -1166,7 +1304,7 @@
|
|
|
1166
1304
|
pipelineJsonToString(unpreparePipeline(pipeline)) !==
|
|
1167
1305
|
pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
|
|
1168
1306
|
var existing = this.collection.get(pipeline.pipelineUrl);
|
|
1169
|
-
throw new
|
|
1307
|
+
throw new PipelineUrlError(spaceTrim.spaceTrim("\n Pipeline with URL \"".concat(pipeline.pipelineUrl, "\" is already in the collection \uD83C\uDF4E\n\n Conflicting files:\n ").concat(existing.sourceFile || 'Unknown', "\n ").concat(pipeline.sourceFile || 'Unknown', "\n\n Note: You have probably forgotten to run \"ptbk make\" to update the collection\n Note: Pipelines with the same URL are not allowed\n Only exepction is when the pipelines are identical\n\n ")));
|
|
1170
1308
|
}
|
|
1171
1309
|
// Note: [🧠] Overwrite existing pipeline with the same URL
|
|
1172
1310
|
this.collection.set(pipeline.pipelineUrl, pipeline);
|
|
@@ -1330,7 +1468,7 @@
|
|
|
1330
1468
|
return __generator(this, function (_d) {
|
|
1331
1469
|
switch (_d.label) {
|
|
1332
1470
|
case 0:
|
|
1333
|
-
_a = options || {}, _b = _a.isVerbose, isVerbose = _b === void 0 ?
|
|
1471
|
+
_a = options || {}, _b = _a.isVerbose, isVerbose = _b === void 0 ? IS_VERBOSE : _b, _c = _a.isLazyLoaded, isLazyLoaded = _c === void 0 ? false : _c;
|
|
1334
1472
|
collection = createCollectionFromPromise(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1335
1473
|
return __generator(this, function (_a) {
|
|
1336
1474
|
if (isVerbose) {
|
|
@@ -1647,7 +1785,7 @@
|
|
|
1647
1785
|
});
|
|
1648
1786
|
}
|
|
1649
1787
|
|
|
1650
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.66.0
|
|
1788
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.66.0",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",dependentParameterNames:["knowledgeContent"],resultingParameterName:"knowledgePieces"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.66.0",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.66.0",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.66.0",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",modelRequirements:{modelVariant:"CHAT",modelName:"gpt-4-turbo"},content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Sample\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n### Option `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Option `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Option `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",expectFormat:"JSON",dependentParameterNames:["availableModelNames","personaDescription"],resultingParameterName:"modelRequirements"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
|
|
1651
1789
|
|
|
1652
1790
|
var defaultDiacriticsRemovalMap = [
|
|
1653
1791
|
{
|
|
@@ -2029,9 +2167,105 @@
|
|
|
2029
2167
|
}(Error));
|
|
2030
2168
|
|
|
2031
2169
|
/**
|
|
2032
|
-
*
|
|
2170
|
+
* This error indicates that the pipeline collection cannot be propperly loaded
|
|
2171
|
+
*
|
|
2172
|
+
* @public exported from `@promptbook/core`
|
|
2173
|
+
*/
|
|
2174
|
+
var CollectionError = /** @class */ (function (_super) {
|
|
2175
|
+
__extends(CollectionError, _super);
|
|
2176
|
+
function CollectionError(message) {
|
|
2177
|
+
var _this = _super.call(this, message) || this;
|
|
2178
|
+
_this.name = 'CollectionError';
|
|
2179
|
+
Object.setPrototypeOf(_this, CollectionError.prototype);
|
|
2180
|
+
return _this;
|
|
2181
|
+
}
|
|
2182
|
+
return CollectionError;
|
|
2183
|
+
}(Error));
|
|
2184
|
+
|
|
2185
|
+
/**
|
|
2186
|
+
* This error type indicates that you try to use a feature that is not available in the current environment
|
|
2187
|
+
*
|
|
2188
|
+
* @public exported from `@promptbook/core`
|
|
2189
|
+
*/
|
|
2190
|
+
var EnvironmentMismatchError = /** @class */ (function (_super) {
|
|
2191
|
+
__extends(EnvironmentMismatchError, _super);
|
|
2192
|
+
function EnvironmentMismatchError(message) {
|
|
2193
|
+
var _this = _super.call(this, message) || this;
|
|
2194
|
+
_this.name = 'EnvironmentMismatchError';
|
|
2195
|
+
Object.setPrototypeOf(_this, EnvironmentMismatchError.prototype);
|
|
2196
|
+
return _this;
|
|
2197
|
+
}
|
|
2198
|
+
return EnvironmentMismatchError;
|
|
2199
|
+
}(Error));
|
|
2200
|
+
|
|
2201
|
+
/**
|
|
2202
|
+
* This error type indicates that some limit was reached
|
|
2203
|
+
*
|
|
2204
|
+
* @public exported from `@promptbook/core`
|
|
2205
|
+
*/
|
|
2206
|
+
var LimitReachedError = /** @class */ (function (_super) {
|
|
2207
|
+
__extends(LimitReachedError, _super);
|
|
2208
|
+
function LimitReachedError(message) {
|
|
2209
|
+
var _this = _super.call(this, message) || this;
|
|
2210
|
+
_this.name = 'LimitReachedError';
|
|
2211
|
+
Object.setPrototypeOf(_this, LimitReachedError.prototype);
|
|
2212
|
+
return _this;
|
|
2213
|
+
}
|
|
2214
|
+
return LimitReachedError;
|
|
2215
|
+
}(Error));
|
|
2216
|
+
|
|
2217
|
+
/**
|
|
2218
|
+
* This error type indicates that some part of the code is not implemented yet
|
|
2219
|
+
*
|
|
2220
|
+
* @public exported from `@promptbook/core`
|
|
2221
|
+
*/
|
|
2222
|
+
var NotYetImplementedError = /** @class */ (function (_super) {
|
|
2223
|
+
__extends(NotYetImplementedError, _super);
|
|
2224
|
+
function NotYetImplementedError(message) {
|
|
2225
|
+
var _this = _super.call(this, spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(message), "\n\n Note: This feature is not implemented yet but it will be soon.\n\n If you want speed up the implementation or just read more, look here:\n https://github.com/webgptorg/promptbook\n\n Or contact us on me@pavolhejny.com\n\n "); })) || this;
|
|
2226
|
+
_this.name = 'NotYetImplementedError';
|
|
2227
|
+
Object.setPrototypeOf(_this, NotYetImplementedError.prototype);
|
|
2228
|
+
return _this;
|
|
2229
|
+
}
|
|
2230
|
+
return NotYetImplementedError;
|
|
2231
|
+
}(Error));
|
|
2232
|
+
|
|
2233
|
+
/**
|
|
2234
|
+
* Index of all custom errors
|
|
2235
|
+
*
|
|
2236
|
+
* @public exported from `@promptbook/core`
|
|
2237
|
+
*/
|
|
2238
|
+
var ERRORS = {
|
|
2239
|
+
CollectionError: CollectionError,
|
|
2240
|
+
EnvironmentMismatchError: EnvironmentMismatchError,
|
|
2241
|
+
LimitReachedError: LimitReachedError,
|
|
2242
|
+
NotFoundError: NotFoundError,
|
|
2243
|
+
NotYetImplementedError: NotYetImplementedError,
|
|
2244
|
+
ParsingError: ParsingError,
|
|
2245
|
+
PipelineExecutionError: PipelineExecutionError,
|
|
2246
|
+
PipelineLogicError: PipelineLogicError,
|
|
2247
|
+
PipelineUrlError: PipelineUrlError,
|
|
2248
|
+
UnexpectedError: UnexpectedError,
|
|
2249
|
+
// TODO: [🪑]> VersionMismatchError,
|
|
2250
|
+
};
|
|
2251
|
+
|
|
2252
|
+
/**
|
|
2253
|
+
* Deserializes the error object
|
|
2254
|
+
*
|
|
2255
|
+
* @public exported from `@promptbook/utils`
|
|
2256
|
+
*/
|
|
2257
|
+
function deserializeError(error) {
|
|
2258
|
+
if (error.name === 'Error') {
|
|
2259
|
+
return new Error(error.message);
|
|
2260
|
+
}
|
|
2261
|
+
var CustomError = ERRORS[error.name];
|
|
2262
|
+
return new CustomError(error.message);
|
|
2263
|
+
}
|
|
2264
|
+
|
|
2265
|
+
/**
|
|
2266
|
+
* Asserts that the execution of a Promptbook is successful
|
|
2033
2267
|
*
|
|
2034
|
-
* @param executionResult - The partial result of the
|
|
2268
|
+
* @param executionResult - The partial result of the Promptbook execution
|
|
2035
2269
|
* @throws {PipelineExecutionError} If the execution is not successful or if multiple errors occurred
|
|
2036
2270
|
* @public exported from `@promptbook/core`
|
|
2037
2271
|
*/
|
|
@@ -2041,15 +2275,16 @@
|
|
|
2041
2275
|
return;
|
|
2042
2276
|
}
|
|
2043
2277
|
if (errors.length === 0) {
|
|
2044
|
-
throw new PipelineExecutionError("
|
|
2278
|
+
throw new PipelineExecutionError("Promptbook Execution failed because of unknown reason");
|
|
2045
2279
|
}
|
|
2046
2280
|
else if (errors.length === 1) {
|
|
2047
|
-
throw errors[0];
|
|
2281
|
+
throw deserializeError(errors[0]);
|
|
2048
2282
|
}
|
|
2049
2283
|
else {
|
|
2050
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Multiple errors occurred during
|
|
2051
|
-
.map(function (
|
|
2052
|
-
|
|
2284
|
+
throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Multiple errors occurred during Promptbook execution\n\n ".concat(block(errors
|
|
2285
|
+
.map(function (_a, index) {
|
|
2286
|
+
var name = _a.name, stack = _a.stack, message = _a.message;
|
|
2287
|
+
return spaceTrim.spaceTrim(function (block) { return "\n ".concat(name, " ").concat(index + 1, ":\n ").concat(block(stack || message), "\n "); });
|
|
2053
2288
|
})
|
|
2054
2289
|
.join('\n')), "\n "); }));
|
|
2055
2290
|
}
|
|
@@ -2081,7 +2316,7 @@
|
|
|
2081
2316
|
var undefinedName = error.message.split(' ')[0];
|
|
2082
2317
|
/*
|
|
2083
2318
|
Note: Parsing the error
|
|
2084
|
-
[
|
|
2319
|
+
[PipelineUrlError: thing is not defined]
|
|
2085
2320
|
*/
|
|
2086
2321
|
if (!undefinedName) {
|
|
2087
2322
|
throw error;
|
|
@@ -2099,7 +2334,7 @@
|
|
|
2099
2334
|
if (!(error instanceof Error)) {
|
|
2100
2335
|
throw error;
|
|
2101
2336
|
}
|
|
2102
|
-
throw new ParsingError(spaceTrim.spaceTrim(function (block) { return "\n Can not extract variables from the script\n\n ".concat(block(error.
|
|
2337
|
+
throw new ParsingError(spaceTrim.spaceTrim(function (block) { return "\n Can not extract variables from the script\n\n ".concat(block(error.toString()), "}\n "); }));
|
|
2103
2338
|
}
|
|
2104
2339
|
return variables;
|
|
2105
2340
|
}
|
|
@@ -2186,6 +2421,23 @@
|
|
|
2186
2421
|
return ExpectError;
|
|
2187
2422
|
}(Error));
|
|
2188
2423
|
|
|
2424
|
+
/**
|
|
2425
|
+
* Serializes an error into a [🚉] JSON-serializable object
|
|
2426
|
+
*
|
|
2427
|
+
* @public exported from `@promptbook/utils`
|
|
2428
|
+
*/
|
|
2429
|
+
function serializeError(error) {
|
|
2430
|
+
var name = error.name, message = error.message, stack = error.stack;
|
|
2431
|
+
if (!__spreadArray(['Error'], __read(Object.keys(ERRORS)), false).includes(name)) {
|
|
2432
|
+
throw new UnexpectedError(spaceTrim__default["default"](function (block) { return "\n \n Cannot serialize error with name \"".concat(name, "\"\n\n ").concat(block(stack || message), "\n \n "); }));
|
|
2433
|
+
}
|
|
2434
|
+
return {
|
|
2435
|
+
name: name,
|
|
2436
|
+
message: message,
|
|
2437
|
+
stack: stack,
|
|
2438
|
+
};
|
|
2439
|
+
}
|
|
2440
|
+
|
|
2189
2441
|
/**
|
|
2190
2442
|
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
2191
2443
|
*
|
|
@@ -2567,22 +2819,6 @@
|
|
|
2567
2819
|
}
|
|
2568
2820
|
}
|
|
2569
2821
|
|
|
2570
|
-
/**
|
|
2571
|
-
* This error type indicates that some limit was reached
|
|
2572
|
-
*
|
|
2573
|
-
* @public exported from `@promptbook/core`
|
|
2574
|
-
*/
|
|
2575
|
-
var LimitReachedError = /** @class */ (function (_super) {
|
|
2576
|
-
__extends(LimitReachedError, _super);
|
|
2577
|
-
function LimitReachedError(message) {
|
|
2578
|
-
var _this = _super.call(this, message) || this;
|
|
2579
|
-
_this.name = 'LimitReachedError';
|
|
2580
|
-
Object.setPrototypeOf(_this, LimitReachedError.prototype);
|
|
2581
|
-
return _this;
|
|
2582
|
-
}
|
|
2583
|
-
return LimitReachedError;
|
|
2584
|
-
}(Error));
|
|
2585
|
-
|
|
2586
2822
|
/**
|
|
2587
2823
|
* Replaces parameters in template with values from parameters object
|
|
2588
2824
|
*
|
|
@@ -2896,7 +3132,7 @@
|
|
|
2896
3132
|
function createPipelineExecutor(options) {
|
|
2897
3133
|
var _this = this;
|
|
2898
3134
|
var pipeline = options.pipeline, tools = options.tools, _a = options.settings, settings = _a === void 0 ? {} : _a;
|
|
2899
|
-
var _b = settings.maxExecutionAttempts, maxExecutionAttempts = _b === void 0 ? MAX_EXECUTION_ATTEMPTS : _b, _c = settings.maxParallelCount, maxParallelCount = _c === void 0 ? MAX_PARALLEL_COUNT : _c, _d = settings.isVerbose, isVerbose = _d === void 0 ?
|
|
3135
|
+
var _b = settings.maxExecutionAttempts, maxExecutionAttempts = _b === void 0 ? MAX_EXECUTION_ATTEMPTS : _b, _c = settings.maxParallelCount, maxParallelCount = _c === void 0 ? MAX_PARALLEL_COUNT : _c, _d = settings.isVerbose, isVerbose = _d === void 0 ? IS_VERBOSE : _d, _e = settings.isNotPreparedWarningSupressed, isNotPreparedWarningSupressed = _e === void 0 ? false : _e;
|
|
2900
3136
|
validatePipeline(pipeline);
|
|
2901
3137
|
var llmTools = joinLlmExecutionTools.apply(void 0, __spreadArray([], __read(arrayableToArray(tools.llm)), false));
|
|
2902
3138
|
var preparedPipeline;
|
|
@@ -2990,7 +3226,6 @@
|
|
|
2990
3226
|
return __awaiter(this, void 0, void 0, function () {
|
|
2991
3227
|
var name, title, priority, usedParameterNames, dependentParameterNames, definedParameters, _a, _b, _c, definedParameterNames, parameters, _d, _e, parameterName, prompt, chatResult, completionResult, embeddingResult, result, resultString, expectError, scriptPipelineExecutionErrors, maxAttempts, jokerParameterNames, preparedContent, attempt, isJokerAttempt, jokerParameterName, _f, _g, _h, _j, scriptTools, error_2, e_4_1, _k, _l, functionName, postprocessingError, _m, _o, scriptTools, error_3, e_5_1, e_6_1, error_4;
|
|
2992
3228
|
var e_7, _p, e_4, _q, e_6, _r, e_5, _s, _t;
|
|
2993
|
-
var _this = this;
|
|
2994
3229
|
return __generator(this, function (_u) {
|
|
2995
3230
|
switch (_u.label) {
|
|
2996
3231
|
case 0:
|
|
@@ -3111,71 +3346,8 @@
|
|
|
3111
3346
|
return name === currentTemplate.personaName;
|
|
3112
3347
|
}) || {})), currentTemplate.expectations),
|
|
3113
3348
|
expectFormat: currentTemplate.expectFormat,
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
var e_8, _c;
|
|
3117
|
-
return __generator(this, function (_d) {
|
|
3118
|
-
switch (_d.label) {
|
|
3119
|
-
case 0:
|
|
3120
|
-
errors = [];
|
|
3121
|
-
_d.label = 1;
|
|
3122
|
-
case 1:
|
|
3123
|
-
_d.trys.push([1, 8, 9, 10]);
|
|
3124
|
-
_a = __values(arrayableToArray(tools.script)), _b = _a.next();
|
|
3125
|
-
_d.label = 2;
|
|
3126
|
-
case 2:
|
|
3127
|
-
if (!!_b.done) return [3 /*break*/, 7];
|
|
3128
|
-
scriptTools = _b.value;
|
|
3129
|
-
_d.label = 3;
|
|
3130
|
-
case 3:
|
|
3131
|
-
_d.trys.push([3, 5, , 6]);
|
|
3132
|
-
return [4 /*yield*/, scriptTools.execute({
|
|
3133
|
-
scriptLanguage: "javascript" /* <- TODO: Try it in each languages; In future allow postprocessing with arbitrary combination of languages to combine */,
|
|
3134
|
-
script: "".concat(functionName, "(result)"),
|
|
3135
|
-
parameters: {
|
|
3136
|
-
result: result || '',
|
|
3137
|
-
// Note: No ...parametersForTemplate, because working with result only
|
|
3138
|
-
},
|
|
3139
|
-
})];
|
|
3140
|
-
case 4: return [2 /*return*/, _d.sent()];
|
|
3141
|
-
case 5:
|
|
3142
|
-
error_5 = _d.sent();
|
|
3143
|
-
if (!(error_5 instanceof Error)) {
|
|
3144
|
-
throw error_5;
|
|
3145
|
-
}
|
|
3146
|
-
if (error_5 instanceof UnexpectedError) {
|
|
3147
|
-
throw error_5;
|
|
3148
|
-
}
|
|
3149
|
-
errors.push(error_5);
|
|
3150
|
-
return [3 /*break*/, 6];
|
|
3151
|
-
case 6:
|
|
3152
|
-
_b = _a.next();
|
|
3153
|
-
return [3 /*break*/, 2];
|
|
3154
|
-
case 7: return [3 /*break*/, 10];
|
|
3155
|
-
case 8:
|
|
3156
|
-
e_8_1 = _d.sent();
|
|
3157
|
-
e_8 = { error: e_8_1 };
|
|
3158
|
-
return [3 /*break*/, 10];
|
|
3159
|
-
case 9:
|
|
3160
|
-
try {
|
|
3161
|
-
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
3162
|
-
}
|
|
3163
|
-
finally { if (e_8) throw e_8.error; }
|
|
3164
|
-
return [7 /*endfinally*/];
|
|
3165
|
-
case 10:
|
|
3166
|
-
if (errors.length === 0) {
|
|
3167
|
-
throw new PipelineExecutionError('Postprocessing in LlmExecutionTools failed because no ScriptExecutionTools were provided');
|
|
3168
|
-
}
|
|
3169
|
-
else if (errors.length === 1) {
|
|
3170
|
-
throw errors[0];
|
|
3171
|
-
}
|
|
3172
|
-
else {
|
|
3173
|
-
throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Postprocessing in LlmExecutionTools failed ".concat(errors.length, "x\n\n ").concat(block(errors.map(function (error) { return '- ' + error.message; }).join('\n\n')), "\n "); }));
|
|
3174
|
-
}
|
|
3175
|
-
}
|
|
3176
|
-
});
|
|
3177
|
-
}); }; }),
|
|
3178
|
-
};
|
|
3349
|
+
postprocessingFunctionNames: currentTemplate.postprocessingFunctionNames,
|
|
3350
|
+
}; // <- TODO: Not very good type guard
|
|
3179
3351
|
_g = currentTemplate.modelRequirements.modelVariant;
|
|
3180
3352
|
switch (_g) {
|
|
3181
3353
|
case 'CHAT': return [3 /*break*/, 8];
|
|
@@ -3400,7 +3572,7 @@
|
|
|
3400
3572
|
executionReport.promptExecutions.push({
|
|
3401
3573
|
prompt: __assign({}, prompt),
|
|
3402
3574
|
result: result || undefined,
|
|
3403
|
-
error: expectError
|
|
3575
|
+
error: expectError === null ? undefined : serializeError(expectError),
|
|
3404
3576
|
});
|
|
3405
3577
|
}
|
|
3406
3578
|
return [7 /*endfinally*/];
|
|
@@ -3435,7 +3607,7 @@
|
|
|
3435
3607
|
});
|
|
3436
3608
|
}
|
|
3437
3609
|
function filterJustOutputParameters() {
|
|
3438
|
-
var
|
|
3610
|
+
var e_8, _a;
|
|
3439
3611
|
var outputParameters = {};
|
|
3440
3612
|
try {
|
|
3441
3613
|
// Note: Filter ONLY output parameters
|
|
@@ -3452,12 +3624,12 @@
|
|
|
3452
3624
|
outputParameters[parameter.name] = parametersToPass[parameter.name] || '';
|
|
3453
3625
|
}
|
|
3454
3626
|
}
|
|
3455
|
-
catch (
|
|
3627
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
3456
3628
|
finally {
|
|
3457
3629
|
try {
|
|
3458
3630
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3459
3631
|
}
|
|
3460
|
-
finally { if (
|
|
3632
|
+
finally { if (e_8) throw e_8.error; }
|
|
3461
3633
|
}
|
|
3462
3634
|
return outputParameters;
|
|
3463
3635
|
}
|
|
@@ -3494,11 +3666,11 @@
|
|
|
3494
3666
|
})), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
3495
3667
|
parameter = _b.value;
|
|
3496
3668
|
if (inputParameters[parameter.name] === undefined) {
|
|
3497
|
-
return [2 /*return*/,
|
|
3669
|
+
return [2 /*return*/, $asDeeplyFrozenSerializableJson("Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"), {
|
|
3498
3670
|
isSuccessful: false,
|
|
3499
3671
|
errors: __spreadArray([
|
|
3500
3672
|
new PipelineExecutionError("Parameter {".concat(parameter.name, "} is required as an input parameter"))
|
|
3501
|
-
], __read(errors), false),
|
|
3673
|
+
], __read(errors), false).map(serializeError),
|
|
3502
3674
|
warnings: [],
|
|
3503
3675
|
executionReport: executionReport,
|
|
3504
3676
|
outputParameters: {},
|
|
@@ -3524,12 +3696,12 @@
|
|
|
3524
3696
|
warnings.push(new PipelineExecutionError("Extra parameter {".concat(parameterName, "} is being passed which is not part of the pipeline.")));
|
|
3525
3697
|
}
|
|
3526
3698
|
else if (parameter.isInput === false) {
|
|
3527
|
-
return { value:
|
|
3699
|
+
return { value: $asDeeplyFrozenSerializableJson("Unuccessful PipelineExecutorResult (with extra parameter {".concat(parameter.name, "}) PipelineExecutorResult"), {
|
|
3528
3700
|
isSuccessful: false,
|
|
3529
3701
|
errors: __spreadArray([
|
|
3530
3702
|
new PipelineExecutionError("Parameter {".concat(parameter.name, "} is passed as input parameter but it is not input"))
|
|
3531
|
-
], __read(errors), false),
|
|
3532
|
-
warnings: warnings,
|
|
3703
|
+
], __read(errors), false).map(serializeError),
|
|
3704
|
+
warnings: warnings.map(serializeError),
|
|
3533
3705
|
executionReport: executionReport,
|
|
3534
3706
|
outputParameters: {},
|
|
3535
3707
|
usage: ZERO_USAGE,
|
|
@@ -3636,10 +3808,10 @@
|
|
|
3636
3808
|
return (result === null || result === void 0 ? void 0 : result.usage) || ZERO_USAGE;
|
|
3637
3809
|
})), false));
|
|
3638
3810
|
outputParameters_1 = filterJustOutputParameters();
|
|
3639
|
-
return [2 /*return*/,
|
|
3811
|
+
return [2 /*return*/, $asDeeplyFrozenSerializableJson('Unuccessful PipelineExecutorResult (with misc errors) PipelineExecutorResult', {
|
|
3640
3812
|
isSuccessful: false,
|
|
3641
|
-
errors: __spreadArray([error_1], __read(errors), false),
|
|
3642
|
-
warnings: warnings,
|
|
3813
|
+
errors: __spreadArray([error_1], __read(errors), false).map(serializeError),
|
|
3814
|
+
warnings: warnings.map(serializeError),
|
|
3643
3815
|
usage: usage_1,
|
|
3644
3816
|
executionReport: executionReport,
|
|
3645
3817
|
outputParameters: outputParameters_1,
|
|
@@ -3651,10 +3823,10 @@
|
|
|
3651
3823
|
return (result === null || result === void 0 ? void 0 : result.usage) || ZERO_USAGE;
|
|
3652
3824
|
})), false));
|
|
3653
3825
|
outputParameters = filterJustOutputParameters();
|
|
3654
|
-
return [2 /*return*/,
|
|
3826
|
+
return [2 /*return*/, $asDeeplyFrozenSerializableJson('Successful PipelineExecutorResult', {
|
|
3655
3827
|
isSuccessful: true,
|
|
3656
|
-
errors: errors,
|
|
3657
|
-
warnings: warnings,
|
|
3828
|
+
errors: errors.map(serializeError),
|
|
3829
|
+
warnings: warnings.map(serializeError),
|
|
3658
3830
|
usage: usage,
|
|
3659
3831
|
executionReport: executionReport,
|
|
3660
3832
|
outputParameters: outputParameters,
|
|
@@ -3691,7 +3863,7 @@
|
|
|
3691
3863
|
return __generator(this, function (_j) {
|
|
3692
3864
|
switch (_j.label) {
|
|
3693
3865
|
case 0:
|
|
3694
|
-
llmTools = options.llmTools, _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a, _b = options.isVerbose, isVerbose = _b === void 0 ?
|
|
3866
|
+
llmTools = options.llmTools, _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a, _b = options.isVerbose, isVerbose = _b === void 0 ? IS_VERBOSE : _b;
|
|
3695
3867
|
TODO_USE(maxParallelCount); // <- [🪂]
|
|
3696
3868
|
collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
|
|
3697
3869
|
_c = createPipelineExecutor;
|
|
@@ -3978,7 +4150,7 @@
|
|
|
3978
4150
|
return __generator(this, function (_d) {
|
|
3979
4151
|
switch (_d.label) {
|
|
3980
4152
|
case 0:
|
|
3981
|
-
llmTools = options.llmTools, _a = options.isVerbose, isVerbose = _a === void 0 ?
|
|
4153
|
+
llmTools = options.llmTools, _a = options.isVerbose, isVerbose = _a === void 0 ? IS_VERBOSE : _a;
|
|
3982
4154
|
collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
|
|
3983
4155
|
_b = createPipelineExecutor;
|
|
3984
4156
|
_c = {};
|
|
@@ -4124,7 +4296,7 @@
|
|
|
4124
4296
|
return __awaiter(this, void 0, void 0, function () {
|
|
4125
4297
|
var llmTools, _a, maxParallelCount, _b, isVerbose, parameters, promptTemplates,
|
|
4126
4298
|
/*
|
|
4127
|
-
<- TODO: [🧠][
|
|
4299
|
+
<- TODO: [🧠][🪑] `promptbookVersion` */
|
|
4128
4300
|
knowledgeSources /*
|
|
4129
4301
|
<- TODO: [🧊] `knowledgePieces` */, personas /*
|
|
4130
4302
|
<- TODO: [🧊] `preparations` */, llmToolsWithUsage, currentPreparation, preparations, preparedPersonas, knowledgeSourcesPrepared, partialknowledgePiecesPrepared, knowledgePiecesPrepared, promptTemplatesPrepared /* TODO: parameters: parametersPrepared*/;
|
|
@@ -4135,7 +4307,7 @@
|
|
|
4135
4307
|
if (isPipelinePrepared(pipeline)) {
|
|
4136
4308
|
return [2 /*return*/, pipeline];
|
|
4137
4309
|
}
|
|
4138
|
-
llmTools = options.llmTools, _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a, _b = options.isVerbose, isVerbose = _b === void 0 ?
|
|
4310
|
+
llmTools = options.llmTools, _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a, _b = options.isVerbose, isVerbose = _b === void 0 ? IS_VERBOSE : _b;
|
|
4139
4311
|
parameters = pipeline.parameters, promptTemplates = pipeline.promptTemplates, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
|
|
4140
4312
|
llmToolsWithUsage = countTotalUsage(llmTools);
|
|
4141
4313
|
currentPreparation = {
|
|
@@ -4194,7 +4366,7 @@
|
|
|
4194
4366
|
// ----- /Templates preparation -----
|
|
4195
4367
|
// Note: Count total usage
|
|
4196
4368
|
currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
|
|
4197
|
-
return [2 /*return*/, __assign(__assign({}, clonePipeline(pipeline)), { promptTemplates: promptTemplatesPrepared, knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: preparations })];
|
|
4369
|
+
return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { promptTemplates: promptTemplatesPrepared, knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: preparations }))];
|
|
4198
4370
|
}
|
|
4199
4371
|
});
|
|
4200
4372
|
});
|
|
@@ -5432,22 +5604,6 @@
|
|
|
5432
5604
|
return null;
|
|
5433
5605
|
}
|
|
5434
5606
|
|
|
5435
|
-
/**
|
|
5436
|
-
* This error type indicates that some part of the code is not implemented yet
|
|
5437
|
-
*
|
|
5438
|
-
* @public exported from `@promptbook/core`
|
|
5439
|
-
*/
|
|
5440
|
-
var NotYetImplementedError = /** @class */ (function (_super) {
|
|
5441
|
-
__extends(NotYetImplementedError, _super);
|
|
5442
|
-
function NotYetImplementedError(message) {
|
|
5443
|
-
var _this = _super.call(this, spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(message), "\n\n Note: This feature is not implemented yet but it will be soon.\n\n If you want speed up the implementation or just read more, look here:\n https://github.com/webgptorg/promptbook\n\n Or contact us on me@pavolhejny.com\n\n "); })) || this;
|
|
5444
|
-
_this.name = 'NotYetImplementedError';
|
|
5445
|
-
Object.setPrototypeOf(_this, NotYetImplementedError.prototype);
|
|
5446
|
-
return _this;
|
|
5447
|
-
}
|
|
5448
|
-
return NotYetImplementedError;
|
|
5449
|
-
}(Error));
|
|
5450
|
-
|
|
5451
5607
|
/**
|
|
5452
5608
|
* Supported script languages
|
|
5453
5609
|
*
|
|
@@ -6139,7 +6295,7 @@
|
|
|
6139
6295
|
}
|
|
6140
6296
|
});
|
|
6141
6297
|
// =============================================================
|
|
6142
|
-
return pipelineJson;
|
|
6298
|
+
return $asDeeplyFrozenSerializableJson('pipelineJson', pipelineJson);
|
|
6143
6299
|
}
|
|
6144
6300
|
/**
|
|
6145
6301
|
* TODO: !!!! Warn if used only sync version
|
|
@@ -6183,7 +6339,9 @@
|
|
|
6183
6339
|
case 1:
|
|
6184
6340
|
pipelineJson = _a.sent();
|
|
6185
6341
|
_a.label = 2;
|
|
6186
|
-
case 2:
|
|
6342
|
+
case 2:
|
|
6343
|
+
// Note: No need to use `$asDeeplyFrozenSerializableJson` because `pipelineStringToJsonSync` and `preparePipeline` already do that
|
|
6344
|
+
return [2 /*return*/, pipelineJson];
|
|
6187
6345
|
}
|
|
6188
6346
|
});
|
|
6189
6347
|
});
|
|
@@ -6386,6 +6544,39 @@
|
|
|
6386
6544
|
* TODO: [🕌] When more than 2 functionalities, split into separate functions
|
|
6387
6545
|
*/
|
|
6388
6546
|
|
|
6547
|
+
/**
|
|
6548
|
+
* Tests if the value is [🚉] serializable as JSON
|
|
6549
|
+
*
|
|
6550
|
+
* - Almost all primitives are serializable BUT:
|
|
6551
|
+
* - `undefined` is not serializable
|
|
6552
|
+
* - `NaN` is not serializable
|
|
6553
|
+
* - Objects and arrays are serializable if all their properties are serializable
|
|
6554
|
+
* - Functions are not serializable
|
|
6555
|
+
* - Circular references are not serializable
|
|
6556
|
+
* - `Date` objects are not serializable
|
|
6557
|
+
* - `Map` and `Set` objects are not serializable
|
|
6558
|
+
* - `RegExp` objects are not serializable
|
|
6559
|
+
* - `Error` objects are not serializable
|
|
6560
|
+
* - `Symbol` objects are not serializable
|
|
6561
|
+
* - And much more...
|
|
6562
|
+
*
|
|
6563
|
+
*
|
|
6564
|
+
* @public exported from `@promptbook/utils`
|
|
6565
|
+
*/
|
|
6566
|
+
function isSerializableAsJson(value) {
|
|
6567
|
+
try {
|
|
6568
|
+
checkSerializableAsJson('', value);
|
|
6569
|
+
return true;
|
|
6570
|
+
}
|
|
6571
|
+
catch (error) {
|
|
6572
|
+
return false;
|
|
6573
|
+
}
|
|
6574
|
+
}
|
|
6575
|
+
/**
|
|
6576
|
+
* TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
|
|
6577
|
+
* TODO: [🧠][💺] Can be done this on type-level?
|
|
6578
|
+
*/
|
|
6579
|
+
|
|
6389
6580
|
/**
|
|
6390
6581
|
* Stringify the PipelineJson with proper formatting
|
|
6391
6582
|
*
|
|
@@ -6395,6 +6586,9 @@
|
|
|
6395
6586
|
* @public exported from `@promptbook/core`
|
|
6396
6587
|
*/
|
|
6397
6588
|
function stringifyPipelineJson(pipeline) {
|
|
6589
|
+
if (!isSerializableAsJson(pipeline)) {
|
|
6590
|
+
throw new UnexpectedError(spaceTrim__default["default"]("\n Cannot stringify the pipeline, because it is not serializable as JSON\n\n There can be multiple reasons:\n 1) The pipeline contains circular references\n 2) It is not a valid PipelineJson\n "));
|
|
6591
|
+
}
|
|
6398
6592
|
var pipelineJsonStringified = JSON.stringify(pipeline, null, 4);
|
|
6399
6593
|
for (var i = 0; i < LOOP_LIMIT; i++) {
|
|
6400
6594
|
pipelineJsonStringified = pipelineJsonStringified.replace(/(-?0\.\d+),[\n\s]+(-?0\.\d+)/gms, "$1".concat(REPLACING_NONCE, "$2"));
|
|
@@ -6410,54 +6604,6 @@
|
|
|
6410
6604
|
* TODO: [🍙] Make some standart order of json properties
|
|
6411
6605
|
*/
|
|
6412
6606
|
|
|
6413
|
-
/**
|
|
6414
|
-
* This error indicates that the pipeline collection cannot be propperly loaded
|
|
6415
|
-
*
|
|
6416
|
-
* @public exported from `@promptbook/core`
|
|
6417
|
-
*/
|
|
6418
|
-
var CollectionError = /** @class */ (function (_super) {
|
|
6419
|
-
__extends(CollectionError, _super);
|
|
6420
|
-
function CollectionError(message) {
|
|
6421
|
-
var _this = _super.call(this, message) || this;
|
|
6422
|
-
_this.name = 'CollectionError';
|
|
6423
|
-
Object.setPrototypeOf(_this, CollectionError.prototype);
|
|
6424
|
-
return _this;
|
|
6425
|
-
}
|
|
6426
|
-
return CollectionError;
|
|
6427
|
-
}(Error));
|
|
6428
|
-
|
|
6429
|
-
/**
|
|
6430
|
-
* This error type indicates that you try to use a feature that is not available in the current environment
|
|
6431
|
-
*
|
|
6432
|
-
* @public exported from `@promptbook/core`
|
|
6433
|
-
*/
|
|
6434
|
-
var EnvironmentMismatchError = /** @class */ (function (_super) {
|
|
6435
|
-
__extends(EnvironmentMismatchError, _super);
|
|
6436
|
-
function EnvironmentMismatchError(message) {
|
|
6437
|
-
var _this = _super.call(this, message) || this;
|
|
6438
|
-
_this.name = 'EnvironmentMismatchError';
|
|
6439
|
-
Object.setPrototypeOf(_this, EnvironmentMismatchError.prototype);
|
|
6440
|
-
return _this;
|
|
6441
|
-
}
|
|
6442
|
-
return EnvironmentMismatchError;
|
|
6443
|
-
}(Error));
|
|
6444
|
-
|
|
6445
|
-
/**
|
|
6446
|
-
* This error type indicates that the version of the pipeline is not matching the expected version
|
|
6447
|
-
*
|
|
6448
|
-
* @public exported from `@promptbook/core`
|
|
6449
|
-
*/
|
|
6450
|
-
var VersionMismatchError = /** @class */ (function (_super) {
|
|
6451
|
-
__extends(VersionMismatchError, _super);
|
|
6452
|
-
function VersionMismatchError(message, expectedVersion) {
|
|
6453
|
-
var _this = _super.call(this, spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(message), "\n\n This error indicates that there is error with compatibility\n\n Expected version:\n ").concat(expectedVersion, "\n\n Current version:\n ").concat(PROMPTBOOK_VERSION, "\n\n "); })) || this;
|
|
6454
|
-
_this.name = 'UnexpectedError';
|
|
6455
|
-
Object.setPrototypeOf(_this, VersionMismatchError.prototype);
|
|
6456
|
-
return _this;
|
|
6457
|
-
}
|
|
6458
|
-
return VersionMismatchError;
|
|
6459
|
-
}(Error));
|
|
6460
|
-
|
|
6461
6607
|
/**
|
|
6462
6608
|
* Pretty print an embedding vector for logging
|
|
6463
6609
|
*
|
|
@@ -6550,14 +6696,11 @@
|
|
|
6550
6696
|
*
|
|
6551
6697
|
* Note: `$` is used to indicate that this function is not a pure function - it access global scope
|
|
6552
6698
|
*
|
|
6553
|
-
*
|
|
6699
|
+
* @private internal function of `$Register`
|
|
6554
6700
|
*/
|
|
6555
6701
|
function $getGlobalScope() {
|
|
6556
6702
|
return Function('return this')();
|
|
6557
6703
|
}
|
|
6558
|
-
/***
|
|
6559
|
-
* TODO: !!!!! Make private and promptbook registry from this
|
|
6560
|
-
*/
|
|
6561
6704
|
|
|
6562
6705
|
/**
|
|
6563
6706
|
* Register is @@@
|
|
@@ -6588,13 +6731,10 @@
|
|
|
6588
6731
|
var packageName = registered.packageName, className = registered.className;
|
|
6589
6732
|
var existingRegistrationIndex = this.storage.findIndex(function (item) { return item.packageName === packageName && item.className === className; });
|
|
6590
6733
|
var existingRegistration = this.storage[existingRegistrationIndex];
|
|
6591
|
-
// TODO: !!!!!! Global IS_VERBOSE mode
|
|
6592
6734
|
if (!existingRegistration) {
|
|
6593
|
-
console.warn("[\uD83D\uDCE6] Registering `".concat(packageName, ".").concat(className, "` to `").concat(this.storageName, "`"));
|
|
6594
6735
|
this.storage.push(registered);
|
|
6595
6736
|
}
|
|
6596
6737
|
else {
|
|
6597
|
-
console.warn("[\uD83D\uDCE6] Re-registering `".concat(packageName, ".").concat(className, "` to `").concat(this.storageName, "`"));
|
|
6598
6738
|
this.storage[existingRegistrationIndex] = registered;
|
|
6599
6739
|
}
|
|
6600
6740
|
};
|
|
@@ -6724,7 +6864,7 @@
|
|
|
6724
6864
|
*/
|
|
6725
6865
|
function createLlmToolsFromConfiguration(configuration, options) {
|
|
6726
6866
|
if (options === void 0) { options = {}; }
|
|
6727
|
-
var _a = options.isVerbose, isVerbose = _a === void 0 ?
|
|
6867
|
+
var _a = options.isVerbose, isVerbose = _a === void 0 ? IS_VERBOSE : _a;
|
|
6728
6868
|
var llmTools = configuration.map(function (llmConfiguration) {
|
|
6729
6869
|
var registeredItem = $llmToolsRegister
|
|
6730
6870
|
.list()
|
|
@@ -7458,10 +7598,12 @@
|
|
|
7458
7598
|
exports.CollectionError = CollectionError;
|
|
7459
7599
|
exports.DEFAULT_REMOTE_URL = DEFAULT_REMOTE_URL;
|
|
7460
7600
|
exports.DEFAULT_REMOTE_URL_PATH = DEFAULT_REMOTE_URL_PATH;
|
|
7601
|
+
exports.ERRORS = ERRORS;
|
|
7461
7602
|
exports.EXECUTIONS_CACHE_DIRNAME = EXECUTIONS_CACHE_DIRNAME;
|
|
7462
7603
|
exports.EXPECTATION_UNITS = EXPECTATION_UNITS;
|
|
7463
7604
|
exports.EnvironmentMismatchError = EnvironmentMismatchError;
|
|
7464
7605
|
exports.ExecutionReportStringOptionsDefaults = ExecutionReportStringOptionsDefaults;
|
|
7606
|
+
exports.IS_VERBOSE = IS_VERBOSE;
|
|
7465
7607
|
exports.LimitReachedError = LimitReachedError;
|
|
7466
7608
|
exports.MAX_EXECUTION_ATTEMPTS = MAX_EXECUTION_ATTEMPTS;
|
|
7467
7609
|
exports.MAX_FILENAME_LENGTH = MAX_FILENAME_LENGTH;
|
|
@@ -7477,11 +7619,10 @@
|
|
|
7477
7619
|
exports.ParsingError = ParsingError;
|
|
7478
7620
|
exports.PipelineExecutionError = PipelineExecutionError;
|
|
7479
7621
|
exports.PipelineLogicError = PipelineLogicError;
|
|
7622
|
+
exports.PipelineUrlError = PipelineUrlError;
|
|
7480
7623
|
exports.PrefixStorage = PrefixStorage;
|
|
7481
7624
|
exports.RESERVED_PARAMETER_NAMES = RESERVED_PARAMETER_NAMES;
|
|
7482
|
-
exports.ReferenceError = ReferenceError$1;
|
|
7483
7625
|
exports.UnexpectedError = UnexpectedError;
|
|
7484
|
-
exports.VersionMismatchError = VersionMismatchError;
|
|
7485
7626
|
exports.ZERO_USAGE = ZERO_USAGE;
|
|
7486
7627
|
exports._AnthropicClaudeMetadataRegistration = _AnthropicClaudeMetadataRegistration;
|
|
7487
7628
|
exports._AzureOpenAiMetadataRegistration = _AzureOpenAiMetadataRegistration;
|