@promptbook/website-crawler 0.78.4 → 0.80.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/README.md +4 -0
- package/esm/index.es.js +358 -279
- package/esm/index.es.js.map +1 -1
- package/esm/typings/books/index.d.ts +6 -6
- package/esm/typings/src/_packages/core.index.d.ts +4 -2
- package/esm/typings/src/_packages/types.index.d.ts +10 -0
- package/esm/typings/src/_packages/utils.index.d.ts +4 -0
- package/esm/typings/src/cli/cli-commands/runInteractiveChatbot.d.ts +32 -0
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +5 -2
- package/esm/typings/src/config.d.ts +0 -25
- package/esm/typings/src/constants.d.ts +35 -0
- package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -0
- package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +1 -0
- package/esm/typings/src/formfactors/generator/GeneratorFormfactorDefinition.d.ts +6 -1
- package/esm/typings/src/formfactors/index.d.ts +12 -2
- package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +6 -1
- package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +20 -0
- package/esm/typings/src/high-level-abstractions/implicit-formfactor/ImplicitFormfactorHla.d.ts +10 -0
- package/esm/typings/src/high-level-abstractions/index.d.ts +44 -0
- package/esm/typings/src/high-level-abstractions/quick-chatbot/QuickChatbotHla.d.ts +10 -0
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -1
- package/esm/typings/src/prepare/prepareTasks.d.ts +1 -0
- package/esm/typings/src/types/typeAliases.d.ts +1 -1
- package/esm/typings/src/utils/normalization/orderJson.d.ts +21 -0
- package/esm/typings/src/utils/normalization/orderJson.test.d.ts +4 -0
- package/esm/typings/src/utils/organization/keepTypeImported.d.ts +9 -0
- package/esm/typings/src/utils/serialization/$deepFreeze.d.ts +1 -1
- package/esm/typings/src/utils/serialization/checkSerializableAsJson.d.ts +20 -2
- package/esm/typings/src/utils/serialization/deepClone.test.d.ts +1 -0
- package/esm/typings/src/utils/serialization/exportJson.d.ts +29 -0
- package/esm/typings/src/utils/serialization/isSerializableAsJson.d.ts +2 -1
- package/package.json +2 -2
- package/umd/index.umd.js +358 -279
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/utils/serialization/$asDeeplyFrozenSerializableJson.d.ts +0 -17
package/umd/index.umd.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*
|
|
23
23
|
* @see https://github.com/webgptorg/promptbook
|
|
24
24
|
*/
|
|
25
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
25
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.79.0';
|
|
26
26
|
/**
|
|
27
27
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
28
28
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
/**
|
|
151
|
-
*
|
|
151
|
+
* Freezes the given object and all its nested objects recursively
|
|
152
152
|
*
|
|
153
153
|
* Note: `$` is used to indicate that this function is not a pure function - it mutates given object
|
|
154
154
|
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
|
|
@@ -158,6 +158,9 @@
|
|
|
158
158
|
*/
|
|
159
159
|
function $deepFreeze(objectValue) {
|
|
160
160
|
var e_1, _a;
|
|
161
|
+
if (Array.isArray(objectValue)) {
|
|
162
|
+
return Object.freeze(objectValue.map(function (item) { return $deepFreeze(item); }));
|
|
163
|
+
}
|
|
161
164
|
var propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
162
165
|
try {
|
|
163
166
|
for (var propertyNames_1 = __values(propertyNames), propertyNames_1_1 = propertyNames_1.next(); !propertyNames_1_1.done; propertyNames_1_1 = propertyNames_1.next()) {
|
|
@@ -175,7 +178,8 @@
|
|
|
175
178
|
}
|
|
176
179
|
finally { if (e_1) throw e_1.error; }
|
|
177
180
|
}
|
|
178
|
-
|
|
181
|
+
Object.freeze(objectValue);
|
|
182
|
+
return objectValue;
|
|
179
183
|
}
|
|
180
184
|
/**
|
|
181
185
|
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
@@ -261,41 +265,6 @@
|
|
|
261
265
|
* @public exported from `@promptbook/core`
|
|
262
266
|
*/
|
|
263
267
|
var DEFAULT_SCRAPE_CACHE_DIRNAME = './.promptbook/scrape-cache';
|
|
264
|
-
/**
|
|
265
|
-
* Nonce which is used for replacing things in strings
|
|
266
|
-
*
|
|
267
|
-
* @private within the repository
|
|
268
|
-
*/
|
|
269
|
-
var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
|
|
270
|
-
/**
|
|
271
|
-
* The names of the parameters that are reserved for special purposes
|
|
272
|
-
*
|
|
273
|
-
* @public exported from `@promptbook/core`
|
|
274
|
-
*/
|
|
275
|
-
var RESERVED_PARAMETER_NAMES =
|
|
276
|
-
/* !!!!!! $asDeeplyFrozenSerializableJson('RESERVED_PARAMETER_NAMES', _____ as const); */ [
|
|
277
|
-
'content',
|
|
278
|
-
'context',
|
|
279
|
-
'knowledge',
|
|
280
|
-
'examples',
|
|
281
|
-
'modelName',
|
|
282
|
-
'currentDate',
|
|
283
|
-
// <- TODO: list here all command names
|
|
284
|
-
// <- TODO: Add more like 'date', 'modelName',...
|
|
285
|
-
// <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
|
|
286
|
-
];
|
|
287
|
-
/**
|
|
288
|
-
* @@@
|
|
289
|
-
*
|
|
290
|
-
* @private within the repository
|
|
291
|
-
*/
|
|
292
|
-
var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
|
|
293
|
-
/**
|
|
294
|
-
* @@@
|
|
295
|
-
*
|
|
296
|
-
* @private within the repository
|
|
297
|
-
*/
|
|
298
|
-
var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
|
|
299
268
|
// <- TODO: [🧜♂️]
|
|
300
269
|
/**
|
|
301
270
|
* @@@
|
|
@@ -330,7 +299,6 @@
|
|
|
330
299
|
// Note: In normal situations, we check the pipeline logic:
|
|
331
300
|
true);
|
|
332
301
|
/**
|
|
333
|
-
* TODO: Extract `constants.ts` from `config.ts`
|
|
334
302
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
335
303
|
* TODO: [🧠][🧜♂️] Maybe join remoteUrl and path into single value
|
|
336
304
|
*/
|
|
@@ -549,7 +517,7 @@
|
|
|
549
517
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
550
518
|
isAvilableInBrowser: false,
|
|
551
519
|
requiredExecutables: [],
|
|
552
|
-
}); /* <-
|
|
520
|
+
}); /* <- Note: [🤛] */
|
|
553
521
|
/**
|
|
554
522
|
* Registration of known scraper metadata
|
|
555
523
|
*
|
|
@@ -1093,7 +1061,7 @@
|
|
|
1093
1061
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
1094
1062
|
*/
|
|
1095
1063
|
|
|
1096
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",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}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],
|
|
1064
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",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}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sourceFile:"./books/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",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}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sourceFile:"./books/prepare-knowledge-keywords.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",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}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sourceFile:"./books/prepare-knowledge-title.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",formfactorName:"GENERIC",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}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\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- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `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### Key `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}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sourceFile:"./books/prepare-persona.book.md"}];
|
|
1097
1065
|
|
|
1098
1066
|
/**
|
|
1099
1067
|
* Prettify the html code
|
|
@@ -1141,6 +1109,7 @@
|
|
|
1141
1109
|
/**
|
|
1142
1110
|
* Converts promptbook in JSON format to string format
|
|
1143
1111
|
*
|
|
1112
|
+
* @deprecated TODO: [🥍][🧠] Backup original files in `PipelineJson` same as in Promptbook.studio
|
|
1144
1113
|
* @param pipelineJson Promptbook in JSON format (.book.json)
|
|
1145
1114
|
* @returns Promptbook in string format (.book.md)
|
|
1146
1115
|
* @public exported from `@promptbook/core`
|
|
@@ -1344,6 +1313,260 @@
|
|
|
1344
1313
|
* TODO: [🧠] Should be in generated .book.md file GENERATOR_WARNING
|
|
1345
1314
|
*/
|
|
1346
1315
|
|
|
1316
|
+
/**
|
|
1317
|
+
* Orders JSON object by keys
|
|
1318
|
+
*
|
|
1319
|
+
* @returns The same type of object as the input re-ordered
|
|
1320
|
+
* @public exported from `@promptbook/utils`
|
|
1321
|
+
*/
|
|
1322
|
+
function orderJson(options) {
|
|
1323
|
+
var value = options.value, order = options.order;
|
|
1324
|
+
var orderedValue = __assign(__assign({}, (order === undefined ? {} : Object.fromEntries(order.map(function (key) { return [key, undefined]; })))), value);
|
|
1325
|
+
return orderedValue;
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
/**
|
|
1329
|
+
* Checks if the value is [🚉] serializable as JSON
|
|
1330
|
+
* If not, throws an UnexpectedError with a rich error message and tracking
|
|
1331
|
+
*
|
|
1332
|
+
* - Almost all primitives are serializable BUT:
|
|
1333
|
+
* - `undefined` is not serializable
|
|
1334
|
+
* - `NaN` is not serializable
|
|
1335
|
+
* - Objects and arrays are serializable if all their properties are serializable
|
|
1336
|
+
* - Functions are not serializable
|
|
1337
|
+
* - Circular references are not serializable
|
|
1338
|
+
* - `Date` objects are not serializable
|
|
1339
|
+
* - `Map` and `Set` objects are not serializable
|
|
1340
|
+
* - `RegExp` objects are not serializable
|
|
1341
|
+
* - `Error` objects are not serializable
|
|
1342
|
+
* - `Symbol` objects are not serializable
|
|
1343
|
+
* - And much more...
|
|
1344
|
+
*
|
|
1345
|
+
* @throws UnexpectedError if the value is not serializable as JSON
|
|
1346
|
+
* @public exported from `@promptbook/utils`
|
|
1347
|
+
*/
|
|
1348
|
+
function checkSerializableAsJson(options) {
|
|
1349
|
+
var e_1, _a;
|
|
1350
|
+
var value = options.value, name = options.name, message = options.message;
|
|
1351
|
+
if (value === undefined) {
|
|
1352
|
+
throw new UnexpectedError("".concat(name, " is undefined"));
|
|
1353
|
+
}
|
|
1354
|
+
else if (value === null) {
|
|
1355
|
+
return;
|
|
1356
|
+
}
|
|
1357
|
+
else if (typeof value === 'boolean') {
|
|
1358
|
+
return;
|
|
1359
|
+
}
|
|
1360
|
+
else if (typeof value === 'number' && !isNaN(value)) {
|
|
1361
|
+
return;
|
|
1362
|
+
}
|
|
1363
|
+
else if (typeof value === 'string') {
|
|
1364
|
+
return;
|
|
1365
|
+
}
|
|
1366
|
+
else if (typeof value === 'symbol') {
|
|
1367
|
+
throw new UnexpectedError("".concat(name, " is symbol"));
|
|
1368
|
+
}
|
|
1369
|
+
else if (typeof value === 'function') {
|
|
1370
|
+
throw new UnexpectedError("".concat(name, " is function"));
|
|
1371
|
+
}
|
|
1372
|
+
else if (typeof value === 'object' && Array.isArray(value)) {
|
|
1373
|
+
for (var i = 0; i < value.length; i++) {
|
|
1374
|
+
checkSerializableAsJson({ name: "".concat(name, "[").concat(i, "]"), value: value[i], message: message });
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
else if (typeof value === 'object') {
|
|
1378
|
+
if (value instanceof Date) {
|
|
1379
|
+
throw new UnexpectedError(spaceTrim__default["default"](function (block) { return "\n `".concat(name, "` is Date\n\n Use `string_date_iso8601` instead\n\n Additional message for `").concat(name, "`:\n ").concat(block(message || '(nothing)'), "\n "); }));
|
|
1380
|
+
}
|
|
1381
|
+
else if (value instanceof Map) {
|
|
1382
|
+
throw new UnexpectedError("".concat(name, " is Map"));
|
|
1383
|
+
}
|
|
1384
|
+
else if (value instanceof Set) {
|
|
1385
|
+
throw new UnexpectedError("".concat(name, " is Set"));
|
|
1386
|
+
}
|
|
1387
|
+
else if (value instanceof RegExp) {
|
|
1388
|
+
throw new UnexpectedError("".concat(name, " is RegExp"));
|
|
1389
|
+
}
|
|
1390
|
+
else if (value instanceof Error) {
|
|
1391
|
+
throw new UnexpectedError(spaceTrim__default["default"](function (block) { return "\n `".concat(name, "` is unserialized Error\n\n Use function `serializeError`\n\n Additional message for `").concat(name, "`:\n ").concat(block(message || '(nothing)'), "\n\n "); }));
|
|
1392
|
+
}
|
|
1393
|
+
else {
|
|
1394
|
+
try {
|
|
1395
|
+
for (var _b = __values(Object.entries(value)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1396
|
+
var _d = __read(_c.value, 2), subName = _d[0], subValue = _d[1];
|
|
1397
|
+
if (subValue === undefined) {
|
|
1398
|
+
// Note: undefined in object is serializable - it is just omited
|
|
1399
|
+
continue;
|
|
1400
|
+
}
|
|
1401
|
+
checkSerializableAsJson({ name: "".concat(name, ".").concat(subName), value: subValue, message: message });
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1405
|
+
finally {
|
|
1406
|
+
try {
|
|
1407
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1408
|
+
}
|
|
1409
|
+
finally { if (e_1) throw e_1.error; }
|
|
1410
|
+
}
|
|
1411
|
+
try {
|
|
1412
|
+
JSON.stringify(value); // <- TODO: [0]
|
|
1413
|
+
}
|
|
1414
|
+
catch (error) {
|
|
1415
|
+
if (!(error instanceof Error)) {
|
|
1416
|
+
throw error;
|
|
1417
|
+
}
|
|
1418
|
+
throw new UnexpectedError(spaceTrim__default["default"](function (block) { return "\n `".concat(name, "` is not serializable\n\n ").concat(block(error.toString()), "\n\n Additional message for `").concat(name, "`:\n ").concat(block(message || '(nothing)'), "\n "); }));
|
|
1419
|
+
}
|
|
1420
|
+
/*
|
|
1421
|
+
TODO: [0] Is there some more elegant way to check circular references?
|
|
1422
|
+
const seen = new Set();
|
|
1423
|
+
const stack = [{ value }];
|
|
1424
|
+
while (stack.length > 0) {
|
|
1425
|
+
const { value } = stack.pop()!;
|
|
1426
|
+
if (typeof value === 'object' && value !== null) {
|
|
1427
|
+
if (seen.has(value)) {
|
|
1428
|
+
throw new UnexpectedError(`${name} has circular reference`);
|
|
1429
|
+
}
|
|
1430
|
+
seen.add(value);
|
|
1431
|
+
if (Array.isArray(value)) {
|
|
1432
|
+
stack.push(...value.map((value) => ({ value })));
|
|
1433
|
+
} else {
|
|
1434
|
+
stack.push(...Object.values(value).map((value) => ({ value })));
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
*/
|
|
1439
|
+
return;
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
else {
|
|
1443
|
+
throw new UnexpectedError(spaceTrim__default["default"](function (block) { return "\n `".concat(name, "` is unknown type\n\n Additional message for `").concat(name, "`:\n ").concat(block(message || '(nothing)'), "\n "); }));
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
/**
|
|
1447
|
+
* TODO: Can be return type more type-safe? like `asserts options.value is JsonValue`
|
|
1448
|
+
* TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
|
|
1449
|
+
* Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
|
|
1450
|
+
*/
|
|
1451
|
+
|
|
1452
|
+
/**
|
|
1453
|
+
* @@@
|
|
1454
|
+
*
|
|
1455
|
+
* @public exported from `@promptbook/utils`
|
|
1456
|
+
*/
|
|
1457
|
+
function deepClone(objectValue) {
|
|
1458
|
+
return JSON.parse(JSON.stringify(objectValue));
|
|
1459
|
+
/*
|
|
1460
|
+
!!!!!!!!
|
|
1461
|
+
TODO: [🧠] Is there a better implementation?
|
|
1462
|
+
> const propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
1463
|
+
> for (const propertyName of propertyNames) {
|
|
1464
|
+
> const value = (objectValue as really_any)[propertyName];
|
|
1465
|
+
> if (value && typeof value === 'object') {
|
|
1466
|
+
> deepClone(value);
|
|
1467
|
+
> }
|
|
1468
|
+
> }
|
|
1469
|
+
> return Object.assign({}, objectValue);
|
|
1470
|
+
*/
|
|
1471
|
+
}
|
|
1472
|
+
/**
|
|
1473
|
+
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
1474
|
+
*/
|
|
1475
|
+
|
|
1476
|
+
/**
|
|
1477
|
+
* Utility to export a JSON object from a function
|
|
1478
|
+
*
|
|
1479
|
+
* 1) Checks if the value is serializable as JSON
|
|
1480
|
+
* 2) Makes a deep clone of the object
|
|
1481
|
+
* 2) Orders the object properties
|
|
1482
|
+
* 2) Deeply freezes the cloned object
|
|
1483
|
+
*
|
|
1484
|
+
* Note: This function does not mutates the given object
|
|
1485
|
+
*
|
|
1486
|
+
* @returns The same type of object as the input but read-only and re-ordered
|
|
1487
|
+
* @public exported from `@promptbook/utils`
|
|
1488
|
+
*/
|
|
1489
|
+
function exportJson(options) {
|
|
1490
|
+
var name = options.name, value = options.value, order = options.order, message = options.message;
|
|
1491
|
+
checkSerializableAsJson({ name: name, value: value, message: message });
|
|
1492
|
+
var orderedValue =
|
|
1493
|
+
// TODO: Fix error "Type instantiation is excessively deep and possibly infinite."
|
|
1494
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1495
|
+
// @ts-ignore
|
|
1496
|
+
order === undefined
|
|
1497
|
+
? deepClone(value)
|
|
1498
|
+
: orderJson({
|
|
1499
|
+
value: value,
|
|
1500
|
+
// <- Note: checkSerializableAsJson asserts that the value is serializable as JSON
|
|
1501
|
+
order: order,
|
|
1502
|
+
});
|
|
1503
|
+
$deepFreeze(orderedValue);
|
|
1504
|
+
return orderedValue;
|
|
1505
|
+
}
|
|
1506
|
+
/**
|
|
1507
|
+
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
1508
|
+
*/
|
|
1509
|
+
|
|
1510
|
+
/**
|
|
1511
|
+
* Order of keys in the pipeline JSON
|
|
1512
|
+
*
|
|
1513
|
+
* @public exported from `@promptbook/core`
|
|
1514
|
+
*/
|
|
1515
|
+
var ORDER_OF_PIPELINE_JSON = [
|
|
1516
|
+
'title',
|
|
1517
|
+
'pipelineUrl',
|
|
1518
|
+
'bookVersion',
|
|
1519
|
+
'description',
|
|
1520
|
+
'formfactorName',
|
|
1521
|
+
'parameters',
|
|
1522
|
+
'tasks',
|
|
1523
|
+
'personas',
|
|
1524
|
+
'preparations',
|
|
1525
|
+
'knowledgeSources',
|
|
1526
|
+
'knowledgePieces',
|
|
1527
|
+
];
|
|
1528
|
+
/**
|
|
1529
|
+
* Nonce which is used for replacing things in strings
|
|
1530
|
+
*
|
|
1531
|
+
* @private within the repository
|
|
1532
|
+
*/
|
|
1533
|
+
var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
|
|
1534
|
+
/**
|
|
1535
|
+
* @@@
|
|
1536
|
+
*
|
|
1537
|
+
* @private within the repository
|
|
1538
|
+
*/
|
|
1539
|
+
var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
|
|
1540
|
+
/**
|
|
1541
|
+
* @@@
|
|
1542
|
+
*
|
|
1543
|
+
* @private within the repository
|
|
1544
|
+
*/
|
|
1545
|
+
var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
|
|
1546
|
+
/**
|
|
1547
|
+
* The names of the parameters that are reserved for special purposes
|
|
1548
|
+
*
|
|
1549
|
+
* @public exported from `@promptbook/core`
|
|
1550
|
+
*/
|
|
1551
|
+
var RESERVED_PARAMETER_NAMES = exportJson({
|
|
1552
|
+
name: 'RESERVED_PARAMETER_NAMES',
|
|
1553
|
+
message: "The names of the parameters that are reserved for special purposes",
|
|
1554
|
+
value: [
|
|
1555
|
+
'content',
|
|
1556
|
+
'context',
|
|
1557
|
+
'knowledge',
|
|
1558
|
+
'examples',
|
|
1559
|
+
'modelName',
|
|
1560
|
+
'currentDate',
|
|
1561
|
+
// <- TODO: list here all command names
|
|
1562
|
+
// <- TODO: Add more like 'date', 'modelName',...
|
|
1563
|
+
// <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
|
|
1564
|
+
],
|
|
1565
|
+
});
|
|
1566
|
+
/**
|
|
1567
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
1568
|
+
*/
|
|
1569
|
+
|
|
1347
1570
|
/**
|
|
1348
1571
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
1349
1572
|
*
|
|
@@ -1587,6 +1810,21 @@
|
|
|
1587
1810
|
}
|
|
1588
1811
|
};
|
|
1589
1812
|
try {
|
|
1813
|
+
/*
|
|
1814
|
+
TODO: [🧠][🅾] Should be empty pipeline valid or not
|
|
1815
|
+
// Note: Check that pipeline has some tasks
|
|
1816
|
+
if (pipeline.tasks.length === 0) {
|
|
1817
|
+
throw new PipelineLogicError(
|
|
1818
|
+
spaceTrim(
|
|
1819
|
+
(block) => `
|
|
1820
|
+
Pipeline must have at least one task
|
|
1821
|
+
|
|
1822
|
+
${block(pipelineIdentification)}
|
|
1823
|
+
`,
|
|
1824
|
+
),
|
|
1825
|
+
);
|
|
1826
|
+
}
|
|
1827
|
+
*/
|
|
1590
1828
|
// Note: Check each parameter individually
|
|
1591
1829
|
for (var _d = __values(pipeline.parameters), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
1592
1830
|
var parameter = _e.value;
|
|
@@ -1747,6 +1985,9 @@
|
|
|
1747
1985
|
while (unresovedTasks.length > 0) {
|
|
1748
1986
|
_loop_3();
|
|
1749
1987
|
}
|
|
1988
|
+
// Note: Check that formfactor is corresponding to the pipeline interface
|
|
1989
|
+
// TODO: !!!!!! Implement this
|
|
1990
|
+
// pipeline.formfactorName
|
|
1750
1991
|
}
|
|
1751
1992
|
/**
|
|
1752
1993
|
* TODO: !! [🧞♀️] Do not allow joker + foreach
|
|
@@ -1830,149 +2071,6 @@
|
|
|
1830
2071
|
return parameterNames;
|
|
1831
2072
|
}
|
|
1832
2073
|
|
|
1833
|
-
/**
|
|
1834
|
-
* Checks if the value is [🚉] serializable as JSON
|
|
1835
|
-
* If not, throws an UnexpectedError with a rich error message and tracking
|
|
1836
|
-
*
|
|
1837
|
-
* - Almost all primitives are serializable BUT:
|
|
1838
|
-
* - `undefined` is not serializable
|
|
1839
|
-
* - `NaN` is not serializable
|
|
1840
|
-
* - Objects and arrays are serializable if all their properties are serializable
|
|
1841
|
-
* - Functions are not serializable
|
|
1842
|
-
* - Circular references are not serializable
|
|
1843
|
-
* - `Date` objects are not serializable
|
|
1844
|
-
* - `Map` and `Set` objects are not serializable
|
|
1845
|
-
* - `RegExp` objects are not serializable
|
|
1846
|
-
* - `Error` objects are not serializable
|
|
1847
|
-
* - `Symbol` objects are not serializable
|
|
1848
|
-
* - And much more...
|
|
1849
|
-
*
|
|
1850
|
-
* @throws UnexpectedError if the value is not serializable as JSON
|
|
1851
|
-
* @public exported from `@promptbook/utils`
|
|
1852
|
-
*/
|
|
1853
|
-
function checkSerializableAsJson(name, value) {
|
|
1854
|
-
var e_1, _a;
|
|
1855
|
-
if (value === undefined) {
|
|
1856
|
-
throw new UnexpectedError("".concat(name, " is undefined"));
|
|
1857
|
-
}
|
|
1858
|
-
else if (value === null) {
|
|
1859
|
-
return;
|
|
1860
|
-
}
|
|
1861
|
-
else if (typeof value === 'boolean') {
|
|
1862
|
-
return;
|
|
1863
|
-
}
|
|
1864
|
-
else if (typeof value === 'number' && !isNaN(value)) {
|
|
1865
|
-
return;
|
|
1866
|
-
}
|
|
1867
|
-
else if (typeof value === 'string') {
|
|
1868
|
-
return;
|
|
1869
|
-
}
|
|
1870
|
-
else if (typeof value === 'symbol') {
|
|
1871
|
-
throw new UnexpectedError("".concat(name, " is symbol"));
|
|
1872
|
-
}
|
|
1873
|
-
else if (typeof value === 'function') {
|
|
1874
|
-
throw new UnexpectedError("".concat(name, " is function"));
|
|
1875
|
-
}
|
|
1876
|
-
else if (typeof value === 'object' && Array.isArray(value)) {
|
|
1877
|
-
for (var i = 0; i < value.length; i++) {
|
|
1878
|
-
checkSerializableAsJson("".concat(name, "[").concat(i, "]"), value[i]);
|
|
1879
|
-
}
|
|
1880
|
-
}
|
|
1881
|
-
else if (typeof value === 'object') {
|
|
1882
|
-
if (value instanceof Date) {
|
|
1883
|
-
throw new UnexpectedError(spaceTrim__default["default"]("\n ".concat(name, " is Date\n\n Use `string_date_iso8601` instead\n ")));
|
|
1884
|
-
}
|
|
1885
|
-
else if (value instanceof Map) {
|
|
1886
|
-
throw new UnexpectedError("".concat(name, " is Map"));
|
|
1887
|
-
}
|
|
1888
|
-
else if (value instanceof Set) {
|
|
1889
|
-
throw new UnexpectedError("".concat(name, " is Set"));
|
|
1890
|
-
}
|
|
1891
|
-
else if (value instanceof RegExp) {
|
|
1892
|
-
throw new UnexpectedError("".concat(name, " is RegExp"));
|
|
1893
|
-
}
|
|
1894
|
-
else if (value instanceof Error) {
|
|
1895
|
-
throw new UnexpectedError(spaceTrim__default["default"]("\n ".concat(name, " is unserialized Error\n\n Use function `serializeError`\n ")));
|
|
1896
|
-
}
|
|
1897
|
-
else {
|
|
1898
|
-
try {
|
|
1899
|
-
for (var _b = __values(Object.entries(value)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1900
|
-
var _d = __read(_c.value, 2), subName = _d[0], subValue = _d[1];
|
|
1901
|
-
if (subValue === undefined) {
|
|
1902
|
-
// Note: undefined in object is serializable - it is just omited
|
|
1903
|
-
continue;
|
|
1904
|
-
}
|
|
1905
|
-
checkSerializableAsJson("".concat(name, ".").concat(subName), subValue);
|
|
1906
|
-
}
|
|
1907
|
-
}
|
|
1908
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1909
|
-
finally {
|
|
1910
|
-
try {
|
|
1911
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1912
|
-
}
|
|
1913
|
-
finally { if (e_1) throw e_1.error; }
|
|
1914
|
-
}
|
|
1915
|
-
try {
|
|
1916
|
-
JSON.stringify(value); // <- TODO: [0]
|
|
1917
|
-
}
|
|
1918
|
-
catch (error) {
|
|
1919
|
-
if (!(error instanceof Error)) {
|
|
1920
|
-
throw error;
|
|
1921
|
-
}
|
|
1922
|
-
throw new UnexpectedError(spaceTrim__default["default"](function (block) { return "\n ".concat(name, " is not serializable\n\n ").concat(block(error.toString()), "\n "); }));
|
|
1923
|
-
}
|
|
1924
|
-
/*
|
|
1925
|
-
TODO: [0] Is there some more elegant way to check circular references?
|
|
1926
|
-
const seen = new Set();
|
|
1927
|
-
const stack = [{ value }];
|
|
1928
|
-
while (stack.length > 0) {
|
|
1929
|
-
const { value } = stack.pop()!;
|
|
1930
|
-
if (typeof value === 'object' && value !== null) {
|
|
1931
|
-
if (seen.has(value)) {
|
|
1932
|
-
throw new UnexpectedError(`${name} has circular reference`);
|
|
1933
|
-
}
|
|
1934
|
-
seen.add(value);
|
|
1935
|
-
if (Array.isArray(value)) {
|
|
1936
|
-
stack.push(...value.map((value) => ({ value })));
|
|
1937
|
-
} else {
|
|
1938
|
-
stack.push(...Object.values(value).map((value) => ({ value })));
|
|
1939
|
-
}
|
|
1940
|
-
}
|
|
1941
|
-
}
|
|
1942
|
-
*/
|
|
1943
|
-
return;
|
|
1944
|
-
}
|
|
1945
|
-
}
|
|
1946
|
-
else {
|
|
1947
|
-
throw new UnexpectedError("".concat(name, " is unknown"));
|
|
1948
|
-
}
|
|
1949
|
-
}
|
|
1950
|
-
/**
|
|
1951
|
-
* TODO: [🧠][🛣] More elegant way to tracking than passing `name`
|
|
1952
|
-
* TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
|
|
1953
|
-
* Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
|
|
1954
|
-
*/
|
|
1955
|
-
|
|
1956
|
-
/**
|
|
1957
|
-
* @@@
|
|
1958
|
-
* @@@
|
|
1959
|
-
*
|
|
1960
|
-
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
|
|
1961
|
-
*
|
|
1962
|
-
* @param name - Name of the object for debugging purposes
|
|
1963
|
-
* @param objectValue - Object to be deeply frozen
|
|
1964
|
-
* @returns The same object as the input, but deeply frozen
|
|
1965
|
-
* @private this is in comparison to `deepFreeze` a more specific utility and maybe not very good practice to use without specific reason and considerations
|
|
1966
|
-
*/
|
|
1967
|
-
function $asDeeplyFrozenSerializableJson(name, objectValue) {
|
|
1968
|
-
checkSerializableAsJson(name, objectValue);
|
|
1969
|
-
return $deepFreeze(objectValue);
|
|
1970
|
-
}
|
|
1971
|
-
/**
|
|
1972
|
-
* TODO: [🧠][🛣] More elegant way to tracking than passing `name`
|
|
1973
|
-
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
1974
|
-
*/
|
|
1975
|
-
|
|
1976
2074
|
/**
|
|
1977
2075
|
* Unprepare just strips the preparation data of the pipeline
|
|
1978
2076
|
*
|
|
@@ -1990,7 +2088,12 @@
|
|
|
1990
2088
|
delete taskUnprepared.preparedContent;
|
|
1991
2089
|
return taskUnprepared;
|
|
1992
2090
|
});
|
|
1993
|
-
return
|
|
2091
|
+
return exportJson({
|
|
2092
|
+
name: 'pipelineJson',
|
|
2093
|
+
message: "Result of `unpreparePipeline`",
|
|
2094
|
+
order: ORDER_OF_PIPELINE_JSON,
|
|
2095
|
+
value: __assign(__assign({}, pipeline), { tasks: tasks, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }),
|
|
2096
|
+
});
|
|
1994
2097
|
}
|
|
1995
2098
|
/**
|
|
1996
2099
|
* TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
|
|
@@ -2504,29 +2607,6 @@
|
|
|
2504
2607
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
2505
2608
|
*/
|
|
2506
2609
|
|
|
2507
|
-
/**
|
|
2508
|
-
* @@@
|
|
2509
|
-
*
|
|
2510
|
-
* @public exported from `@promptbook/utils`
|
|
2511
|
-
*/
|
|
2512
|
-
function deepClone(objectValue) {
|
|
2513
|
-
return JSON.parse(JSON.stringify(objectValue));
|
|
2514
|
-
/*
|
|
2515
|
-
TODO: [🧠] Is there a better implementation?
|
|
2516
|
-
> const propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
2517
|
-
> for (const propertyName of propertyNames) {
|
|
2518
|
-
> const value = (objectValue as really_any)[propertyName];
|
|
2519
|
-
> if (value && typeof value === 'object') {
|
|
2520
|
-
> deepClone(value);
|
|
2521
|
-
> }
|
|
2522
|
-
> }
|
|
2523
|
-
> return Object.assign({}, objectValue);
|
|
2524
|
-
*/
|
|
2525
|
-
}
|
|
2526
|
-
/**
|
|
2527
|
-
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
2528
|
-
*/
|
|
2529
|
-
|
|
2530
2610
|
/**
|
|
2531
2611
|
* Function `addUsage` will add multiple usages into one
|
|
2532
2612
|
*
|
|
@@ -3552,36 +3632,6 @@
|
|
|
3552
3632
|
* [ ] One piece can have multiple sources
|
|
3553
3633
|
*/
|
|
3554
3634
|
|
|
3555
|
-
/**
|
|
3556
|
-
* @@@
|
|
3557
|
-
*
|
|
3558
|
-
* Note: It is usefull @@@
|
|
3559
|
-
*
|
|
3560
|
-
* @param pipeline
|
|
3561
|
-
* @public exported from `@promptbook/utils`
|
|
3562
|
-
*/
|
|
3563
|
-
function clonePipeline(pipeline) {
|
|
3564
|
-
// Note: Not using spread operator (...) because @@@
|
|
3565
|
-
var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title, bookVersion = pipeline.bookVersion, description = pipeline.description, formfactorName = pipeline.formfactorName, parameters = pipeline.parameters, tasks = pipeline.tasks, knowledgeSources = pipeline.knowledgeSources, knowledgePieces = pipeline.knowledgePieces, personas = pipeline.personas, preparations = pipeline.preparations;
|
|
3566
|
-
return {
|
|
3567
|
-
pipelineUrl: pipelineUrl,
|
|
3568
|
-
sourceFile: sourceFile,
|
|
3569
|
-
title: title,
|
|
3570
|
-
bookVersion: bookVersion,
|
|
3571
|
-
description: description,
|
|
3572
|
-
formfactorName: formfactorName,
|
|
3573
|
-
parameters: parameters,
|
|
3574
|
-
tasks: tasks,
|
|
3575
|
-
knowledgeSources: knowledgeSources,
|
|
3576
|
-
knowledgePieces: knowledgePieces,
|
|
3577
|
-
personas: personas,
|
|
3578
|
-
preparations: preparations,
|
|
3579
|
-
};
|
|
3580
|
-
}
|
|
3581
|
-
/**
|
|
3582
|
-
* TODO: [🍙] Make some standard order of json properties
|
|
3583
|
-
*/
|
|
3584
|
-
|
|
3585
3635
|
/**
|
|
3586
3636
|
* @@@
|
|
3587
3637
|
*
|
|
@@ -3622,6 +3672,7 @@
|
|
|
3622
3672
|
});
|
|
3623
3673
|
}
|
|
3624
3674
|
/**
|
|
3675
|
+
* TODO: [😂] Adding knowledge should be convert to async high-level abstractions, simmilar thing with expectations to sync high-level abstractions
|
|
3625
3676
|
* TODO: [🧠] Add context to each task (if missing)
|
|
3626
3677
|
* TODO: [🧠] What is better name `prepareTask` or `prepareTaskAndParameters`
|
|
3627
3678
|
* TODO: [♨][main] !!! Prepare index the examples and maybe tasks
|
|
@@ -3710,11 +3761,19 @@
|
|
|
3710
3761
|
case 3:
|
|
3711
3762
|
tasksPrepared = (_c.sent()).tasksPrepared;
|
|
3712
3763
|
// ----- /Tasks preparation -----
|
|
3764
|
+
// TODO: [😂] Use here all `AsyncHighLevelAbstraction`
|
|
3713
3765
|
// Note: Count total usage
|
|
3714
3766
|
currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
|
|
3715
|
-
return [2 /*return*/,
|
|
3716
|
-
|
|
3717
|
-
|
|
3767
|
+
return [2 /*return*/, exportJson({
|
|
3768
|
+
name: 'pipelineJson',
|
|
3769
|
+
message: "Result of `preparePipeline`",
|
|
3770
|
+
order: ORDER_OF_PIPELINE_JSON,
|
|
3771
|
+
value: __assign(__assign({}, pipeline), {
|
|
3772
|
+
// <- TODO: Probbably deeply clone the pipeline because `$exportJson` freezes the subobjects
|
|
3773
|
+
knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, tasks: __spreadArray([], __read(tasksPrepared), false),
|
|
3774
|
+
// <- TODO: [🪓] Here should be no need for spreading new array, just ` tasks: tasksPrepared`
|
|
3775
|
+
personas: preparedPersonas, preparations: __spreadArray([], __read(preparations), false) }),
|
|
3776
|
+
})];
|
|
3718
3777
|
}
|
|
3719
3778
|
});
|
|
3720
3779
|
});
|
|
@@ -5411,16 +5470,21 @@
|
|
|
5411
5470
|
// Note: Wait a short time to prevent race conditions
|
|
5412
5471
|
_g.sent();
|
|
5413
5472
|
_g.label = 6;
|
|
5414
|
-
case 6: return [2 /*return*/,
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5473
|
+
case 6: return [2 /*return*/, exportJson({
|
|
5474
|
+
name: "executionReport",
|
|
5475
|
+
message: "Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"),
|
|
5476
|
+
order: [],
|
|
5477
|
+
value: {
|
|
5478
|
+
isSuccessful: false,
|
|
5479
|
+
errors: __spreadArray([
|
|
5480
|
+
new PipelineExecutionError("Parameter `{".concat(parameter.name, "}` is required as an input parameter"))
|
|
5481
|
+
], __read(errors), false).map(serializeError),
|
|
5482
|
+
warnings: [],
|
|
5483
|
+
executionReport: executionReport,
|
|
5484
|
+
outputParameters: {},
|
|
5485
|
+
usage: ZERO_USAGE,
|
|
5486
|
+
preparedPipeline: preparedPipeline,
|
|
5487
|
+
},
|
|
5424
5488
|
})];
|
|
5425
5489
|
case 7:
|
|
5426
5490
|
_b = _a.next();
|
|
@@ -5459,16 +5523,21 @@
|
|
|
5459
5523
|
// Note: Wait a short time to prevent race conditions
|
|
5460
5524
|
_h.sent();
|
|
5461
5525
|
_h.label = 3;
|
|
5462
|
-
case 3: return [2 /*return*/, { value:
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5526
|
+
case 3: return [2 /*return*/, { value: exportJson({
|
|
5527
|
+
name: 'pipelineExecutorResult',
|
|
5528
|
+
message: spaceTrim.spaceTrim(function (block) { return "\n Unuccessful PipelineExecutorResult (with extra parameter {".concat(parameter.name, "}) PipelineExecutorResult\n\n ").concat(block(pipelineIdentification), "\n "); }),
|
|
5529
|
+
order: [],
|
|
5530
|
+
value: {
|
|
5531
|
+
isSuccessful: false,
|
|
5532
|
+
errors: __spreadArray([
|
|
5533
|
+
new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
|
|
5534
|
+
], __read(errors), false).map(serializeError),
|
|
5535
|
+
warnings: warnings.map(serializeError),
|
|
5536
|
+
executionReport: executionReport,
|
|
5537
|
+
outputParameters: {},
|
|
5538
|
+
usage: ZERO_USAGE,
|
|
5539
|
+
preparedPipeline: preparedPipeline,
|
|
5540
|
+
},
|
|
5472
5541
|
}) }];
|
|
5473
5542
|
case 4: return [2 /*return*/];
|
|
5474
5543
|
}
|
|
@@ -5622,14 +5691,19 @@
|
|
|
5622
5691
|
// Note: Wait a short time to prevent race conditions
|
|
5623
5692
|
_g.sent();
|
|
5624
5693
|
_g.label = 27;
|
|
5625
|
-
case 27: return [2 /*return*/,
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5694
|
+
case 27: return [2 /*return*/, exportJson({
|
|
5695
|
+
name: 'pipelineExecutorResult',
|
|
5696
|
+
message: "Unuccessful PipelineExecutorResult (with misc errors) PipelineExecutorResult",
|
|
5697
|
+
order: [],
|
|
5698
|
+
value: {
|
|
5699
|
+
isSuccessful: false,
|
|
5700
|
+
errors: __spreadArray([error_1], __read(errors), false).map(serializeError),
|
|
5701
|
+
warnings: warnings.map(serializeError),
|
|
5702
|
+
usage: usage_1,
|
|
5703
|
+
executionReport: executionReport,
|
|
5704
|
+
outputParameters: outputParameters_1,
|
|
5705
|
+
preparedPipeline: preparedPipeline,
|
|
5706
|
+
},
|
|
5633
5707
|
})];
|
|
5634
5708
|
case 28:
|
|
5635
5709
|
usage = addUsage.apply(void 0, __spreadArray([], __read(executionReport.promptExecutions.map(function (_a) {
|
|
@@ -5650,14 +5724,19 @@
|
|
|
5650
5724
|
// Note: Wait a short time to prevent race conditions
|
|
5651
5725
|
_g.sent();
|
|
5652
5726
|
_g.label = 30;
|
|
5653
|
-
case 30: return [2 /*return*/,
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5727
|
+
case 30: return [2 /*return*/, exportJson({
|
|
5728
|
+
name: 'pipelineExecutorResult',
|
|
5729
|
+
message: "Successful PipelineExecutorResult",
|
|
5730
|
+
order: [],
|
|
5731
|
+
value: {
|
|
5732
|
+
isSuccessful: true,
|
|
5733
|
+
errors: errors.map(serializeError),
|
|
5734
|
+
warnings: warnings.map(serializeError),
|
|
5735
|
+
usage: usage,
|
|
5736
|
+
executionReport: executionReport,
|
|
5737
|
+
outputParameters: outputParameters,
|
|
5738
|
+
preparedPipeline: preparedPipeline,
|
|
5739
|
+
},
|
|
5661
5740
|
})];
|
|
5662
5741
|
}
|
|
5663
5742
|
});
|
|
@@ -5741,7 +5820,7 @@
|
|
|
5741
5820
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
5742
5821
|
isAvilableInBrowser: true,
|
|
5743
5822
|
requiredExecutables: [],
|
|
5744
|
-
}); /* <-
|
|
5823
|
+
}); /* <- Note: [🤛] */
|
|
5745
5824
|
/**
|
|
5746
5825
|
* Registration of known scraper metadata
|
|
5747
5826
|
*
|
|
@@ -6080,7 +6159,7 @@
|
|
|
6080
6159
|
*/
|
|
6081
6160
|
var createWebsiteScraper = Object.assign(function (tools, options) {
|
|
6082
6161
|
return new WebsiteScraper(tools, options);
|
|
6083
|
-
}, websiteScraperMetadata); /* <-
|
|
6162
|
+
}, websiteScraperMetadata); /* <- Note: [🤛] */
|
|
6084
6163
|
/**
|
|
6085
6164
|
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
6086
6165
|
*/
|