@promptbook/markdown-utils 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 +1 -1
- package/umd/index.umd.js +60 -56
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -20,7 +20,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
20
20
|
*
|
|
21
21
|
* @see https://github.com/webgptorg/promptbook
|
|
22
22
|
*/
|
|
23
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.75.
|
|
23
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.75.5';
|
|
24
24
|
/**
|
|
25
25
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
26
26
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1963,6 +1963,42 @@ var PipelineExecutionError = /** @class */ (function (_super) {
|
|
|
1963
1963
|
return PipelineExecutionError;
|
|
1964
1964
|
}(Error));
|
|
1965
1965
|
|
|
1966
|
+
/**
|
|
1967
|
+
* This error indicates problems parsing the format value
|
|
1968
|
+
*
|
|
1969
|
+
* For example, when the format value is not a valid JSON or CSV
|
|
1970
|
+
* This is not thrown directly but in extended classes
|
|
1971
|
+
*
|
|
1972
|
+
* @public exported from `@promptbook/core`
|
|
1973
|
+
*/
|
|
1974
|
+
var AbstractFormatError = /** @class */ (function (_super) {
|
|
1975
|
+
__extends(AbstractFormatError, _super);
|
|
1976
|
+
// Note: To allow instanceof do not put here error `name`
|
|
1977
|
+
// public readonly name = 'AbstractFormatError';
|
|
1978
|
+
function AbstractFormatError(message) {
|
|
1979
|
+
var _this = _super.call(this, message) || this;
|
|
1980
|
+
Object.setPrototypeOf(_this, AbstractFormatError.prototype);
|
|
1981
|
+
return _this;
|
|
1982
|
+
}
|
|
1983
|
+
return AbstractFormatError;
|
|
1984
|
+
}(Error));
|
|
1985
|
+
|
|
1986
|
+
/**
|
|
1987
|
+
* This error indicates problem with parsing of CSV
|
|
1988
|
+
*
|
|
1989
|
+
* @public exported from `@promptbook/core`
|
|
1990
|
+
*/
|
|
1991
|
+
var CsvFormatError = /** @class */ (function (_super) {
|
|
1992
|
+
__extends(CsvFormatError, _super);
|
|
1993
|
+
function CsvFormatError(message) {
|
|
1994
|
+
var _this = _super.call(this, message) || this;
|
|
1995
|
+
_this.name = 'CsvFormatError';
|
|
1996
|
+
Object.setPrototypeOf(_this, CsvFormatError.prototype);
|
|
1997
|
+
return _this;
|
|
1998
|
+
}
|
|
1999
|
+
return CsvFormatError;
|
|
2000
|
+
}(AbstractFormatError));
|
|
2001
|
+
|
|
1966
2002
|
/**
|
|
1967
2003
|
* This error indicates that the pipeline collection cannot be propperly loaded
|
|
1968
2004
|
*
|
|
@@ -2014,6 +2050,22 @@ var ExpectError = /** @class */ (function (_super) {
|
|
|
2014
2050
|
return ExpectError;
|
|
2015
2051
|
}(Error));
|
|
2016
2052
|
|
|
2053
|
+
/**
|
|
2054
|
+
* This error indicates that the promptbook can not retrieve knowledge from external sources
|
|
2055
|
+
*
|
|
2056
|
+
* @public exported from `@promptbook/core`
|
|
2057
|
+
*/
|
|
2058
|
+
var KnowledgeScrapeError = /** @class */ (function (_super) {
|
|
2059
|
+
__extends(KnowledgeScrapeError, _super);
|
|
2060
|
+
function KnowledgeScrapeError(message) {
|
|
2061
|
+
var _this = _super.call(this, message) || this;
|
|
2062
|
+
_this.name = 'KnowledgeScrapeError';
|
|
2063
|
+
Object.setPrototypeOf(_this, KnowledgeScrapeError.prototype);
|
|
2064
|
+
return _this;
|
|
2065
|
+
}
|
|
2066
|
+
return KnowledgeScrapeError;
|
|
2067
|
+
}(Error));
|
|
2068
|
+
|
|
2017
2069
|
/**
|
|
2018
2070
|
* This error type indicates that some limit was reached
|
|
2019
2071
|
*
|
|
@@ -2052,10 +2104,14 @@ var NotYetImplementedError = /** @class */ (function (_super) {
|
|
|
2052
2104
|
* @public exported from `@promptbook/core`
|
|
2053
2105
|
*/
|
|
2054
2106
|
var ERRORS = {
|
|
2055
|
-
|
|
2107
|
+
AbstractFormatError: AbstractFormatError,
|
|
2108
|
+
CsvFormatError: CsvFormatError,
|
|
2056
2109
|
CollectionError: CollectionError,
|
|
2057
2110
|
EnvironmentMismatchError: EnvironmentMismatchError,
|
|
2111
|
+
ExpectError: ExpectError,
|
|
2112
|
+
KnowledgeScrapeError: KnowledgeScrapeError,
|
|
2058
2113
|
LimitReachedError: LimitReachedError,
|
|
2114
|
+
MissingToolsError: MissingToolsError,
|
|
2059
2115
|
NotFoundError: NotFoundError,
|
|
2060
2116
|
NotYetImplementedError: NotYetImplementedError,
|
|
2061
2117
|
ParseError: ParseError,
|
|
@@ -2856,22 +2912,6 @@ function preparePersona(personaDescription, tools, options) {
|
|
|
2856
2912
|
* TODO: [🏢] !! Check validity of `temperature` in pipeline
|
|
2857
2913
|
*/
|
|
2858
2914
|
|
|
2859
|
-
/**
|
|
2860
|
-
* This error indicates that the promptbook can not retrieve knowledge from external sources
|
|
2861
|
-
*
|
|
2862
|
-
* @public exported from `@promptbook/core`
|
|
2863
|
-
*/
|
|
2864
|
-
var KnowledgeScrapeError = /** @class */ (function (_super) {
|
|
2865
|
-
__extends(KnowledgeScrapeError, _super);
|
|
2866
|
-
function KnowledgeScrapeError(message) {
|
|
2867
|
-
var _this = _super.call(this, message) || this;
|
|
2868
|
-
_this.name = 'KnowledgeScrapeError';
|
|
2869
|
-
Object.setPrototypeOf(_this, KnowledgeScrapeError.prototype);
|
|
2870
|
-
return _this;
|
|
2871
|
-
}
|
|
2872
|
-
return KnowledgeScrapeError;
|
|
2873
|
-
}(Error));
|
|
2874
|
-
|
|
2875
2915
|
/**
|
|
2876
2916
|
* @@@
|
|
2877
2917
|
*
|
|
@@ -3891,42 +3931,6 @@ function union() {
|
|
|
3891
3931
|
return union;
|
|
3892
3932
|
}
|
|
3893
3933
|
|
|
3894
|
-
/**
|
|
3895
|
-
* This error indicates problems parsing the format value
|
|
3896
|
-
*
|
|
3897
|
-
* For example, when the format value is not a valid JSON or CSV
|
|
3898
|
-
* This is not thrown directly but in extended classes
|
|
3899
|
-
*
|
|
3900
|
-
* @public exported from `@promptbook/core`
|
|
3901
|
-
*/
|
|
3902
|
-
var AbstractFormatError = /** @class */ (function (_super) {
|
|
3903
|
-
__extends(AbstractFormatError, _super);
|
|
3904
|
-
// Note: To allow instanceof do not put here error `name`
|
|
3905
|
-
// public readonly name = 'AbstractFormatError';
|
|
3906
|
-
function AbstractFormatError(message) {
|
|
3907
|
-
var _this = _super.call(this, message) || this;
|
|
3908
|
-
Object.setPrototypeOf(_this, AbstractFormatError.prototype);
|
|
3909
|
-
return _this;
|
|
3910
|
-
}
|
|
3911
|
-
return AbstractFormatError;
|
|
3912
|
-
}(Error));
|
|
3913
|
-
|
|
3914
|
-
/**
|
|
3915
|
-
* This error indicates problem with parsing of CSV
|
|
3916
|
-
*
|
|
3917
|
-
* @public exported from `@promptbook/core`
|
|
3918
|
-
*/
|
|
3919
|
-
var CsvFormatError = /** @class */ (function (_super) {
|
|
3920
|
-
__extends(CsvFormatError, _super);
|
|
3921
|
-
function CsvFormatError(message) {
|
|
3922
|
-
var _this = _super.call(this, message) || this;
|
|
3923
|
-
_this.name = 'CsvFormatError';
|
|
3924
|
-
Object.setPrototypeOf(_this, CsvFormatError.prototype);
|
|
3925
|
-
return _this;
|
|
3926
|
-
}
|
|
3927
|
-
return CsvFormatError;
|
|
3928
|
-
}(AbstractFormatError));
|
|
3929
|
-
|
|
3930
3934
|
/**
|
|
3931
3935
|
* @@@
|
|
3932
3936
|
*
|
|
@@ -3967,7 +3971,7 @@ var CsvFormatDefinition = {
|
|
|
3967
3971
|
case 0:
|
|
3968
3972
|
csv = parse(value, __assign(__assign({}, settings), MANDATORY_CSV_SETTINGS));
|
|
3969
3973
|
if (csv.errors.length !== 0) {
|
|
3970
|
-
throw new CsvFormatError(spaceTrim(function (block) { return "\n CSV parsing error\n\n ".concat(block(csv.errors.map(function (error) { return error.message; }).join('\n\n')), "\n "); }));
|
|
3974
|
+
throw new CsvFormatError(spaceTrim(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 "); }));
|
|
3971
3975
|
}
|
|
3972
3976
|
return [4 /*yield*/, Promise.all(csv.data.map(function (row, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
3973
3977
|
var _a, _b;
|
|
@@ -4005,7 +4009,7 @@ var CsvFormatDefinition = {
|
|
|
4005
4009
|
case 0:
|
|
4006
4010
|
csv = parse(value, __assign(__assign({}, settings), MANDATORY_CSV_SETTINGS));
|
|
4007
4011
|
if (csv.errors.length !== 0) {
|
|
4008
|
-
throw new CsvFormatError(spaceTrim(function (block) { return "\n CSV parsing error\n\n ".concat(block(csv.errors.map(function (error) { return error.message; }).join('\n\n')), "\n "); }));
|
|
4012
|
+
throw new CsvFormatError(spaceTrim(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 "); }));
|
|
4009
4013
|
}
|
|
4010
4014
|
return [4 /*yield*/, Promise.all(csv.data.map(function (row, rowIndex) { return __awaiter(_this, void 0, void 0, function () {
|
|
4011
4015
|
var _this = this;
|