@promptbook/node 0.75.4 → 0.75.6
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 +60 -56
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +4 -2
- package/esm/typings/src/errors/0-BoilerplateError.d.ts +12 -0
- package/esm/typings/src/errors/{index.d.ts → 0-index.d.ts} +10 -2
- package/esm/typings/src/errors/utils/ErrorJson.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +60 -56
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -26,7 +26,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
26
26
|
*
|
|
27
27
|
* @see https://github.com/webgptorg/promptbook
|
|
28
28
|
*/
|
|
29
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.75.
|
|
29
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.75.5';
|
|
30
30
|
/**
|
|
31
31
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
32
32
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -2009,6 +2009,42 @@ function createCollectionFromJson() {
|
|
|
2009
2009
|
return new (SimplePipelineCollection.bind.apply(SimplePipelineCollection, __spreadArray([void 0], __read(promptbooks), false)))();
|
|
2010
2010
|
}
|
|
2011
2011
|
|
|
2012
|
+
/**
|
|
2013
|
+
* This error indicates problems parsing the format value
|
|
2014
|
+
*
|
|
2015
|
+
* For example, when the format value is not a valid JSON or CSV
|
|
2016
|
+
* This is not thrown directly but in extended classes
|
|
2017
|
+
*
|
|
2018
|
+
* @public exported from `@promptbook/core`
|
|
2019
|
+
*/
|
|
2020
|
+
var AbstractFormatError = /** @class */ (function (_super) {
|
|
2021
|
+
__extends(AbstractFormatError, _super);
|
|
2022
|
+
// Note: To allow instanceof do not put here error `name`
|
|
2023
|
+
// public readonly name = 'AbstractFormatError';
|
|
2024
|
+
function AbstractFormatError(message) {
|
|
2025
|
+
var _this = _super.call(this, message) || this;
|
|
2026
|
+
Object.setPrototypeOf(_this, AbstractFormatError.prototype);
|
|
2027
|
+
return _this;
|
|
2028
|
+
}
|
|
2029
|
+
return AbstractFormatError;
|
|
2030
|
+
}(Error));
|
|
2031
|
+
|
|
2032
|
+
/**
|
|
2033
|
+
* This error indicates problem with parsing of CSV
|
|
2034
|
+
*
|
|
2035
|
+
* @public exported from `@promptbook/core`
|
|
2036
|
+
*/
|
|
2037
|
+
var CsvFormatError = /** @class */ (function (_super) {
|
|
2038
|
+
__extends(CsvFormatError, _super);
|
|
2039
|
+
function CsvFormatError(message) {
|
|
2040
|
+
var _this = _super.call(this, message) || this;
|
|
2041
|
+
_this.name = 'CsvFormatError';
|
|
2042
|
+
Object.setPrototypeOf(_this, CsvFormatError.prototype);
|
|
2043
|
+
return _this;
|
|
2044
|
+
}
|
|
2045
|
+
return CsvFormatError;
|
|
2046
|
+
}(AbstractFormatError));
|
|
2047
|
+
|
|
2012
2048
|
/**
|
|
2013
2049
|
* This error indicates that the pipeline collection cannot be propperly loaded
|
|
2014
2050
|
*
|
|
@@ -2060,6 +2096,22 @@ var ExpectError = /** @class */ (function (_super) {
|
|
|
2060
2096
|
return ExpectError;
|
|
2061
2097
|
}(Error));
|
|
2062
2098
|
|
|
2099
|
+
/**
|
|
2100
|
+
* This error indicates that the promptbook can not retrieve knowledge from external sources
|
|
2101
|
+
*
|
|
2102
|
+
* @public exported from `@promptbook/core`
|
|
2103
|
+
*/
|
|
2104
|
+
var KnowledgeScrapeError = /** @class */ (function (_super) {
|
|
2105
|
+
__extends(KnowledgeScrapeError, _super);
|
|
2106
|
+
function KnowledgeScrapeError(message) {
|
|
2107
|
+
var _this = _super.call(this, message) || this;
|
|
2108
|
+
_this.name = 'KnowledgeScrapeError';
|
|
2109
|
+
Object.setPrototypeOf(_this, KnowledgeScrapeError.prototype);
|
|
2110
|
+
return _this;
|
|
2111
|
+
}
|
|
2112
|
+
return KnowledgeScrapeError;
|
|
2113
|
+
}(Error));
|
|
2114
|
+
|
|
2063
2115
|
/**
|
|
2064
2116
|
* This error type indicates that some limit was reached
|
|
2065
2117
|
*
|
|
@@ -2098,10 +2150,14 @@ var NotYetImplementedError = /** @class */ (function (_super) {
|
|
|
2098
2150
|
* @public exported from `@promptbook/core`
|
|
2099
2151
|
*/
|
|
2100
2152
|
var ERRORS = {
|
|
2101
|
-
|
|
2153
|
+
AbstractFormatError: AbstractFormatError,
|
|
2154
|
+
CsvFormatError: CsvFormatError,
|
|
2102
2155
|
CollectionError: CollectionError,
|
|
2103
2156
|
EnvironmentMismatchError: EnvironmentMismatchError,
|
|
2157
|
+
ExpectError: ExpectError,
|
|
2158
|
+
KnowledgeScrapeError: KnowledgeScrapeError,
|
|
2104
2159
|
LimitReachedError: LimitReachedError,
|
|
2160
|
+
MissingToolsError: MissingToolsError,
|
|
2105
2161
|
NotFoundError: NotFoundError,
|
|
2106
2162
|
NotYetImplementedError: NotYetImplementedError,
|
|
2107
2163
|
ParseError: ParseError,
|
|
@@ -2414,42 +2470,6 @@ function union() {
|
|
|
2414
2470
|
return union;
|
|
2415
2471
|
}
|
|
2416
2472
|
|
|
2417
|
-
/**
|
|
2418
|
-
* This error indicates problems parsing the format value
|
|
2419
|
-
*
|
|
2420
|
-
* For example, when the format value is not a valid JSON or CSV
|
|
2421
|
-
* This is not thrown directly but in extended classes
|
|
2422
|
-
*
|
|
2423
|
-
* @public exported from `@promptbook/core`
|
|
2424
|
-
*/
|
|
2425
|
-
var AbstractFormatError = /** @class */ (function (_super) {
|
|
2426
|
-
__extends(AbstractFormatError, _super);
|
|
2427
|
-
// Note: To allow instanceof do not put here error `name`
|
|
2428
|
-
// public readonly name = 'AbstractFormatError';
|
|
2429
|
-
function AbstractFormatError(message) {
|
|
2430
|
-
var _this = _super.call(this, message) || this;
|
|
2431
|
-
Object.setPrototypeOf(_this, AbstractFormatError.prototype);
|
|
2432
|
-
return _this;
|
|
2433
|
-
}
|
|
2434
|
-
return AbstractFormatError;
|
|
2435
|
-
}(Error));
|
|
2436
|
-
|
|
2437
|
-
/**
|
|
2438
|
-
* This error indicates problem with parsing of CSV
|
|
2439
|
-
*
|
|
2440
|
-
* @public exported from `@promptbook/core`
|
|
2441
|
-
*/
|
|
2442
|
-
var CsvFormatError = /** @class */ (function (_super) {
|
|
2443
|
-
__extends(CsvFormatError, _super);
|
|
2444
|
-
function CsvFormatError(message) {
|
|
2445
|
-
var _this = _super.call(this, message) || this;
|
|
2446
|
-
_this.name = 'CsvFormatError';
|
|
2447
|
-
Object.setPrototypeOf(_this, CsvFormatError.prototype);
|
|
2448
|
-
return _this;
|
|
2449
|
-
}
|
|
2450
|
-
return CsvFormatError;
|
|
2451
|
-
}(AbstractFormatError));
|
|
2452
|
-
|
|
2453
2473
|
/**
|
|
2454
2474
|
* @@@
|
|
2455
2475
|
*
|
|
@@ -2490,7 +2510,7 @@ var CsvFormatDefinition = {
|
|
|
2490
2510
|
case 0:
|
|
2491
2511
|
csv = parse(value, __assign(__assign({}, settings), MANDATORY_CSV_SETTINGS));
|
|
2492
2512
|
if (csv.errors.length !== 0) {
|
|
2493
|
-
throw new CsvFormatError(spaceTrim$1(function (block) { return "\n CSV parsing error\n\n ".concat(block(csv.errors.map(function (error) { return error.message; }).join('\n\n')), "\n "); }));
|
|
2513
|
+
throw new CsvFormatError(spaceTrim$1(function (block) { return "\n CSV parsing error\n\n Error(s) from CSV parsing:\n ".concat(block(csv.errors.map(function (error) { return error.message; }).join('\n\n')), "\n\n The CSV setings:\n ").concat(block(JSON.stringify(__assign(__assign({}, settings), MANDATORY_CSV_SETTINGS), null, 2)), "\n\n The CSV data:\n ").concat(block(value), "\n "); }));
|
|
2494
2514
|
}
|
|
2495
2515
|
return [4 /*yield*/, Promise.all(csv.data.map(function (row, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
2496
2516
|
var _a, _b;
|
|
@@ -2528,7 +2548,7 @@ var CsvFormatDefinition = {
|
|
|
2528
2548
|
case 0:
|
|
2529
2549
|
csv = parse(value, __assign(__assign({}, settings), MANDATORY_CSV_SETTINGS));
|
|
2530
2550
|
if (csv.errors.length !== 0) {
|
|
2531
|
-
throw new CsvFormatError(spaceTrim$1(function (block) { return "\n CSV parsing error\n\n ".concat(block(csv.errors.map(function (error) { return error.message; }).join('\n\n')), "\n "); }));
|
|
2551
|
+
throw new CsvFormatError(spaceTrim$1(function (block) { return "\n CSV parsing error\n\n Error(s) from CSV parsing:\n ".concat(block(csv.errors.map(function (error) { return error.message; }).join('\n\n')), "\n\n The CSV setings:\n ").concat(block(JSON.stringify(__assign(__assign({}, settings), MANDATORY_CSV_SETTINGS), null, 2)), "\n\n The CSV data:\n ").concat(block(value), "\n "); }));
|
|
2532
2552
|
}
|
|
2533
2553
|
return [4 /*yield*/, Promise.all(csv.data.map(function (row, rowIndex) { return __awaiter(_this, void 0, void 0, function () {
|
|
2534
2554
|
var _this = this;
|
|
@@ -4566,22 +4586,6 @@ function preparePersona(personaDescription, tools, options) {
|
|
|
4566
4586
|
* TODO: [🏢] !! Check validity of `temperature` in pipeline
|
|
4567
4587
|
*/
|
|
4568
4588
|
|
|
4569
|
-
/**
|
|
4570
|
-
* This error indicates that the promptbook can not retrieve knowledge from external sources
|
|
4571
|
-
*
|
|
4572
|
-
* @public exported from `@promptbook/core`
|
|
4573
|
-
*/
|
|
4574
|
-
var KnowledgeScrapeError = /** @class */ (function (_super) {
|
|
4575
|
-
__extends(KnowledgeScrapeError, _super);
|
|
4576
|
-
function KnowledgeScrapeError(message) {
|
|
4577
|
-
var _this = _super.call(this, message) || this;
|
|
4578
|
-
_this.name = 'KnowledgeScrapeError';
|
|
4579
|
-
Object.setPrototypeOf(_this, KnowledgeScrapeError.prototype);
|
|
4580
|
-
return _this;
|
|
4581
|
-
}
|
|
4582
|
-
return KnowledgeScrapeError;
|
|
4583
|
-
}(Error));
|
|
4584
|
-
|
|
4585
4589
|
/**
|
|
4586
4590
|
* @@@
|
|
4587
4591
|
*
|