@promptbook/cli 0.75.4 → 0.75.5
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
|
@@ -34,11 +34,12 @@ import { stringifyPipelineJson } from '../conversion/utils/stringifyPipelineJson
|
|
|
34
34
|
import { validatePipeline } from '../conversion/validation/validatePipeline';
|
|
35
35
|
import { CallbackInterfaceTools } from '../dialogs/callback/CallbackInterfaceTools';
|
|
36
36
|
import type { CallbackInterfaceToolsOptions } from '../dialogs/callback/CallbackInterfaceToolsOptions';
|
|
37
|
+
import { BoilerplateError } from '../errors/0-BoilerplateError';
|
|
38
|
+
import { ERRORS } from '../errors/0-index';
|
|
37
39
|
import { AbstractFormatError } from '../errors/AbstractFormatError';
|
|
38
40
|
import { CollectionError } from '../errors/CollectionError';
|
|
39
41
|
import { EnvironmentMismatchError } from '../errors/EnvironmentMismatchError';
|
|
40
42
|
import { ExpectError } from '../errors/ExpectError';
|
|
41
|
-
import { ERRORS } from '../errors/index';
|
|
42
43
|
import { KnowledgeScrapeError } from '../errors/KnowledgeScrapeError';
|
|
43
44
|
import { LimitReachedError } from '../errors/LimitReachedError';
|
|
44
45
|
import { MissingToolsError } from '../errors/MissingToolsError';
|
|
@@ -147,11 +148,12 @@ export { stringifyPipelineJson };
|
|
|
147
148
|
export { validatePipeline };
|
|
148
149
|
export { CallbackInterfaceTools };
|
|
149
150
|
export type { CallbackInterfaceToolsOptions };
|
|
151
|
+
export { BoilerplateError };
|
|
152
|
+
export { ERRORS };
|
|
150
153
|
export { AbstractFormatError };
|
|
151
154
|
export { CollectionError };
|
|
152
155
|
export { EnvironmentMismatchError };
|
|
153
156
|
export { ExpectError };
|
|
154
|
-
export { ERRORS };
|
|
155
157
|
export { KnowledgeScrapeError };
|
|
156
158
|
export { LimitReachedError };
|
|
157
159
|
export { MissingToolsError };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This error indicates @@@
|
|
3
|
+
*
|
|
4
|
+
* @public exported from `@promptbook/core`
|
|
5
|
+
*/
|
|
6
|
+
export declare class BoilerplateError extends Error {
|
|
7
|
+
readonly name = "BoilerplateError";
|
|
8
|
+
constructor(message: string);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* TODO: @@@ Do not forget to add the error into `0-index.ts` ERRORS
|
|
12
|
+
*/
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import { CsvFormatError } from '../formats/csv/CsvFormatError';
|
|
2
|
+
import { AbstractFormatError } from './AbstractFormatError';
|
|
1
3
|
import { CollectionError } from './CollectionError';
|
|
2
4
|
import { EnvironmentMismatchError } from './EnvironmentMismatchError';
|
|
3
5
|
import { ExpectError } from './ExpectError';
|
|
6
|
+
import { KnowledgeScrapeError } from './KnowledgeScrapeError';
|
|
4
7
|
import { LimitReachedError } from './LimitReachedError';
|
|
8
|
+
import { MissingToolsError } from './MissingToolsError';
|
|
5
9
|
import { NotFoundError } from './NotFoundError';
|
|
6
10
|
import { NotYetImplementedError } from './NotYetImplementedError';
|
|
7
11
|
import { ParseError } from './ParseError';
|
|
@@ -15,10 +19,14 @@ import { UnexpectedError } from './UnexpectedError';
|
|
|
15
19
|
* @public exported from `@promptbook/core`
|
|
16
20
|
*/
|
|
17
21
|
export declare const ERRORS: {
|
|
18
|
-
readonly
|
|
22
|
+
readonly AbstractFormatError: typeof AbstractFormatError;
|
|
23
|
+
readonly CsvFormatError: typeof CsvFormatError;
|
|
19
24
|
readonly CollectionError: typeof CollectionError;
|
|
20
25
|
readonly EnvironmentMismatchError: typeof EnvironmentMismatchError;
|
|
26
|
+
readonly ExpectError: typeof ExpectError;
|
|
27
|
+
readonly KnowledgeScrapeError: typeof KnowledgeScrapeError;
|
|
21
28
|
readonly LimitReachedError: typeof LimitReachedError;
|
|
29
|
+
readonly MissingToolsError: typeof MissingToolsError;
|
|
22
30
|
readonly NotFoundError: typeof NotFoundError;
|
|
23
31
|
readonly NotYetImplementedError: typeof NotYetImplementedError;
|
|
24
32
|
readonly ParseError: typeof ParseError;
|
|
@@ -29,4 +37,4 @@ export declare const ERRORS: {
|
|
|
29
37
|
};
|
|
30
38
|
/**
|
|
31
39
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
32
|
-
*/
|
|
40
|
+
*/
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
*
|
|
50
50
|
* @see https://github.com/webgptorg/promptbook
|
|
51
51
|
*/
|
|
52
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.75.
|
|
52
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.75.4';
|
|
53
53
|
/**
|
|
54
54
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
55
55
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -2227,6 +2227,42 @@
|
|
|
2227
2227
|
return new (SimplePipelineCollection.bind.apply(SimplePipelineCollection, __spreadArray([void 0], __read(promptbooks), false)))();
|
|
2228
2228
|
}
|
|
2229
2229
|
|
|
2230
|
+
/**
|
|
2231
|
+
* This error indicates problems parsing the format value
|
|
2232
|
+
*
|
|
2233
|
+
* For example, when the format value is not a valid JSON or CSV
|
|
2234
|
+
* This is not thrown directly but in extended classes
|
|
2235
|
+
*
|
|
2236
|
+
* @public exported from `@promptbook/core`
|
|
2237
|
+
*/
|
|
2238
|
+
var AbstractFormatError = /** @class */ (function (_super) {
|
|
2239
|
+
__extends(AbstractFormatError, _super);
|
|
2240
|
+
// Note: To allow instanceof do not put here error `name`
|
|
2241
|
+
// public readonly name = 'AbstractFormatError';
|
|
2242
|
+
function AbstractFormatError(message) {
|
|
2243
|
+
var _this = _super.call(this, message) || this;
|
|
2244
|
+
Object.setPrototypeOf(_this, AbstractFormatError.prototype);
|
|
2245
|
+
return _this;
|
|
2246
|
+
}
|
|
2247
|
+
return AbstractFormatError;
|
|
2248
|
+
}(Error));
|
|
2249
|
+
|
|
2250
|
+
/**
|
|
2251
|
+
* This error indicates problem with parsing of CSV
|
|
2252
|
+
*
|
|
2253
|
+
* @public exported from `@promptbook/core`
|
|
2254
|
+
*/
|
|
2255
|
+
var CsvFormatError = /** @class */ (function (_super) {
|
|
2256
|
+
__extends(CsvFormatError, _super);
|
|
2257
|
+
function CsvFormatError(message) {
|
|
2258
|
+
var _this = _super.call(this, message) || this;
|
|
2259
|
+
_this.name = 'CsvFormatError';
|
|
2260
|
+
Object.setPrototypeOf(_this, CsvFormatError.prototype);
|
|
2261
|
+
return _this;
|
|
2262
|
+
}
|
|
2263
|
+
return CsvFormatError;
|
|
2264
|
+
}(AbstractFormatError));
|
|
2265
|
+
|
|
2230
2266
|
/**
|
|
2231
2267
|
* This error indicates that the pipeline collection cannot be propperly loaded
|
|
2232
2268
|
*
|
|
@@ -2262,6 +2298,22 @@
|
|
|
2262
2298
|
return ExpectError;
|
|
2263
2299
|
}(Error));
|
|
2264
2300
|
|
|
2301
|
+
/**
|
|
2302
|
+
* This error indicates that the promptbook can not retrieve knowledge from external sources
|
|
2303
|
+
*
|
|
2304
|
+
* @public exported from `@promptbook/core`
|
|
2305
|
+
*/
|
|
2306
|
+
var KnowledgeScrapeError = /** @class */ (function (_super) {
|
|
2307
|
+
__extends(KnowledgeScrapeError, _super);
|
|
2308
|
+
function KnowledgeScrapeError(message) {
|
|
2309
|
+
var _this = _super.call(this, message) || this;
|
|
2310
|
+
_this.name = 'KnowledgeScrapeError';
|
|
2311
|
+
Object.setPrototypeOf(_this, KnowledgeScrapeError.prototype);
|
|
2312
|
+
return _this;
|
|
2313
|
+
}
|
|
2314
|
+
return KnowledgeScrapeError;
|
|
2315
|
+
}(Error));
|
|
2316
|
+
|
|
2265
2317
|
/**
|
|
2266
2318
|
* This error type indicates that some limit was reached
|
|
2267
2319
|
*
|
|
@@ -2300,10 +2352,14 @@
|
|
|
2300
2352
|
* @public exported from `@promptbook/core`
|
|
2301
2353
|
*/
|
|
2302
2354
|
var ERRORS = {
|
|
2303
|
-
|
|
2355
|
+
AbstractFormatError: AbstractFormatError,
|
|
2356
|
+
CsvFormatError: CsvFormatError,
|
|
2304
2357
|
CollectionError: CollectionError,
|
|
2305
2358
|
EnvironmentMismatchError: EnvironmentMismatchError,
|
|
2359
|
+
ExpectError: ExpectError,
|
|
2360
|
+
KnowledgeScrapeError: KnowledgeScrapeError,
|
|
2306
2361
|
LimitReachedError: LimitReachedError,
|
|
2362
|
+
MissingToolsError: MissingToolsError,
|
|
2307
2363
|
NotFoundError: NotFoundError,
|
|
2308
2364
|
NotYetImplementedError: NotYetImplementedError,
|
|
2309
2365
|
ParseError: ParseError,
|
|
@@ -2629,42 +2685,6 @@
|
|
|
2629
2685
|
function TODO_USE() {
|
|
2630
2686
|
}
|
|
2631
2687
|
|
|
2632
|
-
/**
|
|
2633
|
-
* This error indicates problems parsing the format value
|
|
2634
|
-
*
|
|
2635
|
-
* For example, when the format value is not a valid JSON or CSV
|
|
2636
|
-
* This is not thrown directly but in extended classes
|
|
2637
|
-
*
|
|
2638
|
-
* @public exported from `@promptbook/core`
|
|
2639
|
-
*/
|
|
2640
|
-
var AbstractFormatError = /** @class */ (function (_super) {
|
|
2641
|
-
__extends(AbstractFormatError, _super);
|
|
2642
|
-
// Note: To allow instanceof do not put here error `name`
|
|
2643
|
-
// public readonly name = 'AbstractFormatError';
|
|
2644
|
-
function AbstractFormatError(message) {
|
|
2645
|
-
var _this = _super.call(this, message) || this;
|
|
2646
|
-
Object.setPrototypeOf(_this, AbstractFormatError.prototype);
|
|
2647
|
-
return _this;
|
|
2648
|
-
}
|
|
2649
|
-
return AbstractFormatError;
|
|
2650
|
-
}(Error));
|
|
2651
|
-
|
|
2652
|
-
/**
|
|
2653
|
-
* This error indicates problem with parsing of CSV
|
|
2654
|
-
*
|
|
2655
|
-
* @public exported from `@promptbook/core`
|
|
2656
|
-
*/
|
|
2657
|
-
var CsvFormatError = /** @class */ (function (_super) {
|
|
2658
|
-
__extends(CsvFormatError, _super);
|
|
2659
|
-
function CsvFormatError(message) {
|
|
2660
|
-
var _this = _super.call(this, message) || this;
|
|
2661
|
-
_this.name = 'CsvFormatError';
|
|
2662
|
-
Object.setPrototypeOf(_this, CsvFormatError.prototype);
|
|
2663
|
-
return _this;
|
|
2664
|
-
}
|
|
2665
|
-
return CsvFormatError;
|
|
2666
|
-
}(AbstractFormatError));
|
|
2667
|
-
|
|
2668
2688
|
/**
|
|
2669
2689
|
* @@@
|
|
2670
2690
|
*
|
|
@@ -2705,7 +2725,7 @@
|
|
|
2705
2725
|
case 0:
|
|
2706
2726
|
csv = papaparse.parse(value, __assign(__assign({}, settings), MANDATORY_CSV_SETTINGS));
|
|
2707
2727
|
if (csv.errors.length !== 0) {
|
|
2708
|
-
throw new CsvFormatError(spaceTrim__default["default"](function (block) { return "\n CSV parsing error\n\n ".concat(block(csv.errors.map(function (error) { return error.message; }).join('\n\n')), "\n "); }));
|
|
2728
|
+
throw new CsvFormatError(spaceTrim__default["default"](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 data:\n ").concat(block(value), "\n "); }));
|
|
2709
2729
|
}
|
|
2710
2730
|
return [4 /*yield*/, Promise.all(csv.data.map(function (row, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
2711
2731
|
var _a, _b;
|
|
@@ -2743,7 +2763,7 @@
|
|
|
2743
2763
|
case 0:
|
|
2744
2764
|
csv = papaparse.parse(value, __assign(__assign({}, settings), MANDATORY_CSV_SETTINGS));
|
|
2745
2765
|
if (csv.errors.length !== 0) {
|
|
2746
|
-
throw new CsvFormatError(spaceTrim__default["default"](function (block) { return "\n CSV parsing error\n\n ".concat(block(csv.errors.map(function (error) { return error.message; }).join('\n\n')), "\n "); }));
|
|
2766
|
+
throw new CsvFormatError(spaceTrim__default["default"](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 data:\n ").concat(block(value), "\n "); }));
|
|
2747
2767
|
}
|
|
2748
2768
|
return [4 /*yield*/, Promise.all(csv.data.map(function (row, rowIndex) { return __awaiter(_this, void 0, void 0, function () {
|
|
2749
2769
|
var _this = this;
|
|
@@ -4781,22 +4801,6 @@
|
|
|
4781
4801
|
* TODO: [🏢] !! Check validity of `temperature` in pipeline
|
|
4782
4802
|
*/
|
|
4783
4803
|
|
|
4784
|
-
/**
|
|
4785
|
-
* This error indicates that the promptbook can not retrieve knowledge from external sources
|
|
4786
|
-
*
|
|
4787
|
-
* @public exported from `@promptbook/core`
|
|
4788
|
-
*/
|
|
4789
|
-
var KnowledgeScrapeError = /** @class */ (function (_super) {
|
|
4790
|
-
__extends(KnowledgeScrapeError, _super);
|
|
4791
|
-
function KnowledgeScrapeError(message) {
|
|
4792
|
-
var _this = _super.call(this, message) || this;
|
|
4793
|
-
_this.name = 'KnowledgeScrapeError';
|
|
4794
|
-
Object.setPrototypeOf(_this, KnowledgeScrapeError.prototype);
|
|
4795
|
-
return _this;
|
|
4796
|
-
}
|
|
4797
|
-
return KnowledgeScrapeError;
|
|
4798
|
-
}(Error));
|
|
4799
|
-
|
|
4800
4804
|
/**
|
|
4801
4805
|
* @@@
|
|
4802
4806
|
*
|