@promptbook/cli 0.73.0 → 0.74.0-2
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 +130 -3
- package/esm/index.es.js +346 -359
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/anthropic-claude.index.d.ts +2 -2
- package/esm/typings/src/_packages/azure-openai.index.d.ts +2 -2
- package/esm/typings/src/_packages/browser.index.d.ts +2 -2
- package/esm/typings/src/_packages/cli.index.d.ts +2 -2
- package/esm/typings/src/_packages/core.index.d.ts +2 -2
- package/esm/typings/src/_packages/documents.index.d.ts +2 -2
- package/esm/typings/src/_packages/execute-javascript.index.d.ts +2 -2
- package/esm/typings/src/_packages/fake-llm.index.d.ts +2 -2
- package/esm/typings/src/_packages/langtail.index.d.ts +2 -2
- package/esm/typings/src/_packages/legacy-documents.index.d.ts +2 -2
- package/esm/typings/src/_packages/markdown-utils.index.d.ts +2 -2
- package/esm/typings/src/_packages/node.index.d.ts +2 -2
- package/esm/typings/src/_packages/openai.index.d.ts +2 -2
- package/esm/typings/src/_packages/pdf.index.d.ts +2 -2
- package/esm/typings/src/_packages/remote-client.index.d.ts +2 -2
- package/esm/typings/src/_packages/remote-server.index.d.ts +2 -2
- package/esm/typings/src/_packages/utils.index.d.ts +2 -2
- package/esm/typings/src/_packages/website-crawler.index.d.ts +2 -2
- package/esm/typings/src/cli/cli-commands/make.d.ts +0 -1
- package/esm/typings/src/cli/cli-commands/run.d.ts +13 -0
- package/esm/typings/src/cli/promptbookCli.d.ts +1 -0
- package/esm/typings/src/cli/test/ptbk.d.ts +4 -1
- package/esm/typings/src/commands/{PROMPTBOOK_VERSION/PromptbookVersionCommand.d.ts → BOOK_VERSION/BookVersionCommand.d.ts} +4 -4
- package/esm/typings/src/commands/BOOK_VERSION/bookVersionCommandParser.d.ts +9 -0
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +1 -1
- package/esm/typings/src/commands/index.d.ts +1 -1
- package/esm/typings/src/version.d.ts +13 -2
- package/package.json +4 -4
- package/umd/index.umd.js +347 -359
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommandParser.d.ts +0 -9
- /package/esm/typings/src/commands/{PROMPTBOOK_VERSION/promptbookVersionCommand.test.d.ts → BOOK_VERSION/bookVersionCommand.test.d.ts} +0 -0
package/esm/index.es.js
CHANGED
|
@@ -25,10 +25,20 @@ import { Converter } from 'showdown';
|
|
|
25
25
|
|
|
26
26
|
// ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
|
|
27
27
|
/**
|
|
28
|
-
* The version of the
|
|
28
|
+
* The version of the Book language
|
|
29
|
+
*
|
|
30
|
+
* @see https://github.com/webgptorg/book
|
|
31
|
+
*/
|
|
32
|
+
var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
33
|
+
/**
|
|
34
|
+
* The version of the Promptbook engine
|
|
35
|
+
*
|
|
36
|
+
* @see https://github.com/webgptorg/promptbook
|
|
37
|
+
*/
|
|
38
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.74.0-1';
|
|
39
|
+
/**
|
|
40
|
+
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
29
41
|
*/
|
|
30
|
-
var PROMPTBOOK_VERSION = '0.72.0';
|
|
31
|
-
// TODO: [main] !!!! List here all the versions and annotate + put into script
|
|
32
42
|
|
|
33
43
|
/*! *****************************************************************************
|
|
34
44
|
Copyright (c) Microsoft Corporation.
|
|
@@ -545,12 +555,6 @@ var DEFAULT_CSV_SETTINGS = Object.freeze({
|
|
|
545
555
|
* @public exported from `@promptbook/core`
|
|
546
556
|
*/
|
|
547
557
|
var DEFAULT_IS_VERBOSE = false;
|
|
548
|
-
/**
|
|
549
|
-
* @@@
|
|
550
|
-
*
|
|
551
|
-
* @public exported from `@promptbook/core`
|
|
552
|
-
*/
|
|
553
|
-
var DEFAULT_IS_AUTO_INSTALLED = false;
|
|
554
558
|
/**
|
|
555
559
|
* @@@
|
|
556
560
|
*
|
|
@@ -575,9 +579,10 @@ function initializeAboutCommand(program) {
|
|
|
575
579
|
makeCommand.description(spaceTrim$1("\n Tells about Promptbook CLI and its abilities\n "));
|
|
576
580
|
makeCommand.action(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
577
581
|
return __generator(this, function (_a) {
|
|
578
|
-
console.info(colors.cyan("Promptbook"));
|
|
579
|
-
console.info(colors.cyan(
|
|
580
|
-
console.info(colors.cyan("
|
|
582
|
+
console.info(colors.bold(colors.cyan("Promptbook: ".concat(CLAIM))));
|
|
583
|
+
console.info(colors.cyan("Book language version: ".concat(BOOK_LANGUAGE_VERSION)));
|
|
584
|
+
console.info(colors.cyan("Promptbook engine version: ".concat(PROMPTBOOK_ENGINE_VERSION)));
|
|
585
|
+
console.info(colors.cyan("https://github.com/webgptorg/promptbook"));
|
|
581
586
|
console.info(colors.cyan("https://ptbk.io"));
|
|
582
587
|
process.exit(0);
|
|
583
588
|
return [2 /*return*/];
|
|
@@ -1041,6 +1046,188 @@ var UNCERTAIN_USAGE = $deepFreeze({
|
|
|
1041
1046
|
},
|
|
1042
1047
|
});
|
|
1043
1048
|
|
|
1049
|
+
/**
|
|
1050
|
+
* @@@
|
|
1051
|
+
*
|
|
1052
|
+
* @public exported from `@promptbook/utils`
|
|
1053
|
+
*/
|
|
1054
|
+
function deepClone(objectValue) {
|
|
1055
|
+
return JSON.parse(JSON.stringify(objectValue));
|
|
1056
|
+
/*
|
|
1057
|
+
TODO: [🧠] Is there a better implementation?
|
|
1058
|
+
> const propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
1059
|
+
> for (const propertyName of propertyNames) {
|
|
1060
|
+
> const value = (objectValue as really_any)[propertyName];
|
|
1061
|
+
> if (value && typeof value === 'object') {
|
|
1062
|
+
> deepClone(value);
|
|
1063
|
+
> }
|
|
1064
|
+
> }
|
|
1065
|
+
> return Object.assign({}, objectValue);
|
|
1066
|
+
*/
|
|
1067
|
+
}
|
|
1068
|
+
/**
|
|
1069
|
+
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
1070
|
+
*/
|
|
1071
|
+
|
|
1072
|
+
/**
|
|
1073
|
+
* Function `addUsage` will add multiple usages into one
|
|
1074
|
+
*
|
|
1075
|
+
* Note: If you provide 0 values, it returns ZERO_USAGE
|
|
1076
|
+
*
|
|
1077
|
+
* @public exported from `@promptbook/core`
|
|
1078
|
+
*/
|
|
1079
|
+
function addUsage() {
|
|
1080
|
+
var usageItems = [];
|
|
1081
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1082
|
+
usageItems[_i] = arguments[_i];
|
|
1083
|
+
}
|
|
1084
|
+
return usageItems.reduce(function (acc, item) {
|
|
1085
|
+
var e_1, _a, e_2, _b;
|
|
1086
|
+
var _c;
|
|
1087
|
+
acc.price.value += ((_c = item.price) === null || _c === void 0 ? void 0 : _c.value) || 0;
|
|
1088
|
+
try {
|
|
1089
|
+
for (var _d = __values(Object.keys(acc.input)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
1090
|
+
var key = _e.value;
|
|
1091
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1092
|
+
//@ts-ignore
|
|
1093
|
+
if (item.input[key]) {
|
|
1094
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1095
|
+
//@ts-ignore
|
|
1096
|
+
acc.input[key].value += item.input[key].value || 0;
|
|
1097
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1098
|
+
//@ts-ignore
|
|
1099
|
+
if (item.input[key].isUncertain) {
|
|
1100
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1101
|
+
//@ts-ignore
|
|
1102
|
+
acc.input[key].isUncertain = true;
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1108
|
+
finally {
|
|
1109
|
+
try {
|
|
1110
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
1111
|
+
}
|
|
1112
|
+
finally { if (e_1) throw e_1.error; }
|
|
1113
|
+
}
|
|
1114
|
+
try {
|
|
1115
|
+
for (var _f = __values(Object.keys(acc.output)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
1116
|
+
var key = _g.value;
|
|
1117
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1118
|
+
//@ts-ignore
|
|
1119
|
+
if (item.output[key]) {
|
|
1120
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1121
|
+
//@ts-ignore
|
|
1122
|
+
acc.output[key].value += item.output[key].value || 0;
|
|
1123
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1124
|
+
//@ts-ignore
|
|
1125
|
+
if (item.output[key].isUncertain) {
|
|
1126
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1127
|
+
//@ts-ignore
|
|
1128
|
+
acc.output[key].isUncertain = true;
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1134
|
+
finally {
|
|
1135
|
+
try {
|
|
1136
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
1137
|
+
}
|
|
1138
|
+
finally { if (e_2) throw e_2.error; }
|
|
1139
|
+
}
|
|
1140
|
+
return acc;
|
|
1141
|
+
}, deepClone(ZERO_USAGE));
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
/**
|
|
1145
|
+
* Intercepts LLM tools and counts total usage of the tools
|
|
1146
|
+
*
|
|
1147
|
+
* @param llmTools LLM tools to be intercepted with usage counting
|
|
1148
|
+
* @returns LLM tools with same functionality with added total cost counting
|
|
1149
|
+
* @public exported from `@promptbook/core`
|
|
1150
|
+
*/
|
|
1151
|
+
function countTotalUsage(llmTools) {
|
|
1152
|
+
var _this = this;
|
|
1153
|
+
var totalUsage = ZERO_USAGE;
|
|
1154
|
+
var proxyTools = {
|
|
1155
|
+
get title() {
|
|
1156
|
+
// TODO: [🧠] Maybe put here some suffix
|
|
1157
|
+
return llmTools.title;
|
|
1158
|
+
},
|
|
1159
|
+
get description() {
|
|
1160
|
+
// TODO: [🧠] Maybe put here some suffix
|
|
1161
|
+
return llmTools.description;
|
|
1162
|
+
},
|
|
1163
|
+
checkConfiguration: function () {
|
|
1164
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1165
|
+
return __generator(this, function (_a) {
|
|
1166
|
+
return [2 /*return*/, /* not await */ llmTools.checkConfiguration()];
|
|
1167
|
+
});
|
|
1168
|
+
});
|
|
1169
|
+
},
|
|
1170
|
+
listModels: function () {
|
|
1171
|
+
return /* not await */ llmTools.listModels();
|
|
1172
|
+
},
|
|
1173
|
+
getTotalUsage: function () {
|
|
1174
|
+
// <- Note: [🥫] Not using getter `get totalUsage` but `getTotalUsage` to allow this object to be proxied
|
|
1175
|
+
return totalUsage;
|
|
1176
|
+
},
|
|
1177
|
+
};
|
|
1178
|
+
if (llmTools.callChatModel !== undefined) {
|
|
1179
|
+
proxyTools.callChatModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
1180
|
+
var promptResult;
|
|
1181
|
+
return __generator(this, function (_a) {
|
|
1182
|
+
switch (_a.label) {
|
|
1183
|
+
case 0: return [4 /*yield*/, llmTools.callChatModel(prompt)];
|
|
1184
|
+
case 1:
|
|
1185
|
+
promptResult = _a.sent();
|
|
1186
|
+
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
1187
|
+
return [2 /*return*/, promptResult];
|
|
1188
|
+
}
|
|
1189
|
+
});
|
|
1190
|
+
}); };
|
|
1191
|
+
}
|
|
1192
|
+
if (llmTools.callCompletionModel !== undefined) {
|
|
1193
|
+
proxyTools.callCompletionModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
1194
|
+
var promptResult;
|
|
1195
|
+
return __generator(this, function (_a) {
|
|
1196
|
+
switch (_a.label) {
|
|
1197
|
+
case 0: return [4 /*yield*/, llmTools.callCompletionModel(prompt)];
|
|
1198
|
+
case 1:
|
|
1199
|
+
promptResult = _a.sent();
|
|
1200
|
+
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
1201
|
+
return [2 /*return*/, promptResult];
|
|
1202
|
+
}
|
|
1203
|
+
});
|
|
1204
|
+
}); };
|
|
1205
|
+
}
|
|
1206
|
+
if (llmTools.callEmbeddingModel !== undefined) {
|
|
1207
|
+
proxyTools.callEmbeddingModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
1208
|
+
var promptResult;
|
|
1209
|
+
return __generator(this, function (_a) {
|
|
1210
|
+
switch (_a.label) {
|
|
1211
|
+
case 0: return [4 /*yield*/, llmTools.callEmbeddingModel(prompt)];
|
|
1212
|
+
case 1:
|
|
1213
|
+
promptResult = _a.sent();
|
|
1214
|
+
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
1215
|
+
return [2 /*return*/, promptResult];
|
|
1216
|
+
}
|
|
1217
|
+
});
|
|
1218
|
+
}); };
|
|
1219
|
+
}
|
|
1220
|
+
// <- Note: [🤖]
|
|
1221
|
+
return proxyTools;
|
|
1222
|
+
}
|
|
1223
|
+
/**
|
|
1224
|
+
* TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
|
|
1225
|
+
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
1226
|
+
* TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
|
|
1227
|
+
* > const [llmToolsWithUsage,getUsage] = countTotalUsage(llmTools);
|
|
1228
|
+
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
1229
|
+
*/
|
|
1230
|
+
|
|
1044
1231
|
/**
|
|
1045
1232
|
* This error indicates errors during the execution of the pipeline
|
|
1046
1233
|
*
|
|
@@ -1349,188 +1536,6 @@ function joinLlmExecutionTools() {
|
|
|
1349
1536
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
1350
1537
|
*/
|
|
1351
1538
|
|
|
1352
|
-
/**
|
|
1353
|
-
* @@@
|
|
1354
|
-
*
|
|
1355
|
-
* @public exported from `@promptbook/utils`
|
|
1356
|
-
*/
|
|
1357
|
-
function deepClone(objectValue) {
|
|
1358
|
-
return JSON.parse(JSON.stringify(objectValue));
|
|
1359
|
-
/*
|
|
1360
|
-
TODO: [🧠] Is there a better implementation?
|
|
1361
|
-
> const propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
1362
|
-
> for (const propertyName of propertyNames) {
|
|
1363
|
-
> const value = (objectValue as really_any)[propertyName];
|
|
1364
|
-
> if (value && typeof value === 'object') {
|
|
1365
|
-
> deepClone(value);
|
|
1366
|
-
> }
|
|
1367
|
-
> }
|
|
1368
|
-
> return Object.assign({}, objectValue);
|
|
1369
|
-
*/
|
|
1370
|
-
}
|
|
1371
|
-
/**
|
|
1372
|
-
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
1373
|
-
*/
|
|
1374
|
-
|
|
1375
|
-
/**
|
|
1376
|
-
* Function `addUsage` will add multiple usages into one
|
|
1377
|
-
*
|
|
1378
|
-
* Note: If you provide 0 values, it returns ZERO_USAGE
|
|
1379
|
-
*
|
|
1380
|
-
* @public exported from `@promptbook/core`
|
|
1381
|
-
*/
|
|
1382
|
-
function addUsage() {
|
|
1383
|
-
var usageItems = [];
|
|
1384
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1385
|
-
usageItems[_i] = arguments[_i];
|
|
1386
|
-
}
|
|
1387
|
-
return usageItems.reduce(function (acc, item) {
|
|
1388
|
-
var e_1, _a, e_2, _b;
|
|
1389
|
-
var _c;
|
|
1390
|
-
acc.price.value += ((_c = item.price) === null || _c === void 0 ? void 0 : _c.value) || 0;
|
|
1391
|
-
try {
|
|
1392
|
-
for (var _d = __values(Object.keys(acc.input)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
1393
|
-
var key = _e.value;
|
|
1394
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1395
|
-
//@ts-ignore
|
|
1396
|
-
if (item.input[key]) {
|
|
1397
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1398
|
-
//@ts-ignore
|
|
1399
|
-
acc.input[key].value += item.input[key].value || 0;
|
|
1400
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1401
|
-
//@ts-ignore
|
|
1402
|
-
if (item.input[key].isUncertain) {
|
|
1403
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1404
|
-
//@ts-ignore
|
|
1405
|
-
acc.input[key].isUncertain = true;
|
|
1406
|
-
}
|
|
1407
|
-
}
|
|
1408
|
-
}
|
|
1409
|
-
}
|
|
1410
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1411
|
-
finally {
|
|
1412
|
-
try {
|
|
1413
|
-
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
1414
|
-
}
|
|
1415
|
-
finally { if (e_1) throw e_1.error; }
|
|
1416
|
-
}
|
|
1417
|
-
try {
|
|
1418
|
-
for (var _f = __values(Object.keys(acc.output)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
1419
|
-
var key = _g.value;
|
|
1420
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1421
|
-
//@ts-ignore
|
|
1422
|
-
if (item.output[key]) {
|
|
1423
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1424
|
-
//@ts-ignore
|
|
1425
|
-
acc.output[key].value += item.output[key].value || 0;
|
|
1426
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1427
|
-
//@ts-ignore
|
|
1428
|
-
if (item.output[key].isUncertain) {
|
|
1429
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1430
|
-
//@ts-ignore
|
|
1431
|
-
acc.output[key].isUncertain = true;
|
|
1432
|
-
}
|
|
1433
|
-
}
|
|
1434
|
-
}
|
|
1435
|
-
}
|
|
1436
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1437
|
-
finally {
|
|
1438
|
-
try {
|
|
1439
|
-
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
1440
|
-
}
|
|
1441
|
-
finally { if (e_2) throw e_2.error; }
|
|
1442
|
-
}
|
|
1443
|
-
return acc;
|
|
1444
|
-
}, deepClone(ZERO_USAGE));
|
|
1445
|
-
}
|
|
1446
|
-
|
|
1447
|
-
/**
|
|
1448
|
-
* Intercepts LLM tools and counts total usage of the tools
|
|
1449
|
-
*
|
|
1450
|
-
* @param llmTools LLM tools to be intercepted with usage counting
|
|
1451
|
-
* @returns LLM tools with same functionality with added total cost counting
|
|
1452
|
-
* @public exported from `@promptbook/core`
|
|
1453
|
-
*/
|
|
1454
|
-
function countTotalUsage(llmTools) {
|
|
1455
|
-
var _this = this;
|
|
1456
|
-
var totalUsage = ZERO_USAGE;
|
|
1457
|
-
var proxyTools = {
|
|
1458
|
-
get title() {
|
|
1459
|
-
// TODO: [🧠] Maybe put here some suffix
|
|
1460
|
-
return llmTools.title;
|
|
1461
|
-
},
|
|
1462
|
-
get description() {
|
|
1463
|
-
// TODO: [🧠] Maybe put here some suffix
|
|
1464
|
-
return llmTools.description;
|
|
1465
|
-
},
|
|
1466
|
-
checkConfiguration: function () {
|
|
1467
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1468
|
-
return __generator(this, function (_a) {
|
|
1469
|
-
return [2 /*return*/, /* not await */ llmTools.checkConfiguration()];
|
|
1470
|
-
});
|
|
1471
|
-
});
|
|
1472
|
-
},
|
|
1473
|
-
listModels: function () {
|
|
1474
|
-
return /* not await */ llmTools.listModels();
|
|
1475
|
-
},
|
|
1476
|
-
getTotalUsage: function () {
|
|
1477
|
-
// <- Note: [🥫] Not using getter `get totalUsage` but `getTotalUsage` to allow this object to be proxied
|
|
1478
|
-
return totalUsage;
|
|
1479
|
-
},
|
|
1480
|
-
};
|
|
1481
|
-
if (llmTools.callChatModel !== undefined) {
|
|
1482
|
-
proxyTools.callChatModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
1483
|
-
var promptResult;
|
|
1484
|
-
return __generator(this, function (_a) {
|
|
1485
|
-
switch (_a.label) {
|
|
1486
|
-
case 0: return [4 /*yield*/, llmTools.callChatModel(prompt)];
|
|
1487
|
-
case 1:
|
|
1488
|
-
promptResult = _a.sent();
|
|
1489
|
-
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
1490
|
-
return [2 /*return*/, promptResult];
|
|
1491
|
-
}
|
|
1492
|
-
});
|
|
1493
|
-
}); };
|
|
1494
|
-
}
|
|
1495
|
-
if (llmTools.callCompletionModel !== undefined) {
|
|
1496
|
-
proxyTools.callCompletionModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
1497
|
-
var promptResult;
|
|
1498
|
-
return __generator(this, function (_a) {
|
|
1499
|
-
switch (_a.label) {
|
|
1500
|
-
case 0: return [4 /*yield*/, llmTools.callCompletionModel(prompt)];
|
|
1501
|
-
case 1:
|
|
1502
|
-
promptResult = _a.sent();
|
|
1503
|
-
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
1504
|
-
return [2 /*return*/, promptResult];
|
|
1505
|
-
}
|
|
1506
|
-
});
|
|
1507
|
-
}); };
|
|
1508
|
-
}
|
|
1509
|
-
if (llmTools.callEmbeddingModel !== undefined) {
|
|
1510
|
-
proxyTools.callEmbeddingModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
1511
|
-
var promptResult;
|
|
1512
|
-
return __generator(this, function (_a) {
|
|
1513
|
-
switch (_a.label) {
|
|
1514
|
-
case 0: return [4 /*yield*/, llmTools.callEmbeddingModel(prompt)];
|
|
1515
|
-
case 1:
|
|
1516
|
-
promptResult = _a.sent();
|
|
1517
|
-
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
1518
|
-
return [2 /*return*/, promptResult];
|
|
1519
|
-
}
|
|
1520
|
-
});
|
|
1521
|
-
}); };
|
|
1522
|
-
}
|
|
1523
|
-
// <- Note: [🤖]
|
|
1524
|
-
return proxyTools;
|
|
1525
|
-
}
|
|
1526
|
-
/**
|
|
1527
|
-
* TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
|
|
1528
|
-
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
1529
|
-
* TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
|
|
1530
|
-
* > const [llmToolsWithUsage,getUsage] = countTotalUsage(llmTools);
|
|
1531
|
-
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
1532
|
-
*/
|
|
1533
|
-
|
|
1534
1539
|
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",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"]}],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",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",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"]}],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",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",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"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",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}],templates:[{templateType:"PROMPT_TEMPLATE",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"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
|
|
1535
1540
|
|
|
1536
1541
|
/**
|
|
@@ -1606,7 +1611,7 @@ function isValidPromptbookVersion(version) {
|
|
|
1606
1611
|
if ( /* version === '1.0.0' || */version === '2.0.0' || version === '3.0.0') {
|
|
1607
1612
|
return false;
|
|
1608
1613
|
}
|
|
1609
|
-
// <- TODO: [main] !!! Check isValidPromptbookVersion against
|
|
1614
|
+
// <- TODO: [main] !!! Check isValidPromptbookVersion against PROMPTBOOK_ENGINE_VERSIONS
|
|
1610
1615
|
return true;
|
|
1611
1616
|
}
|
|
1612
1617
|
|
|
@@ -2566,10 +2571,6 @@ function union() {
|
|
|
2566
2571
|
* @private within the repository
|
|
2567
2572
|
*/
|
|
2568
2573
|
function TODO_USE() {
|
|
2569
|
-
var value = [];
|
|
2570
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2571
|
-
value[_i] = arguments[_i];
|
|
2572
|
-
}
|
|
2573
2574
|
}
|
|
2574
2575
|
|
|
2575
2576
|
/**
|
|
@@ -2628,22 +2629,12 @@ var CsvFormatDefinition = {
|
|
|
2628
2629
|
formatName: 'CSV',
|
|
2629
2630
|
aliases: ['SPREADSHEET', 'TABLE'],
|
|
2630
2631
|
isValid: function (value, settings, schema) {
|
|
2631
|
-
// TODO: Implement CSV validation
|
|
2632
|
-
TODO_USE(value /* <- TODO: Use value here */);
|
|
2633
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2634
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2635
2632
|
return true;
|
|
2636
2633
|
},
|
|
2637
2634
|
canBeValid: function (partialValue, settings, schema) {
|
|
2638
|
-
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
2639
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2640
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2641
2635
|
return true;
|
|
2642
2636
|
},
|
|
2643
2637
|
heal: function (value, settings, schema) {
|
|
2644
|
-
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
2645
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2646
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2647
2638
|
throw new Error('Not implemented');
|
|
2648
2639
|
},
|
|
2649
2640
|
subvalueDefinitions: [
|
|
@@ -2762,20 +2753,12 @@ var JsonFormatDefinition = {
|
|
|
2762
2753
|
formatName: 'JSON',
|
|
2763
2754
|
mimeType: 'application/json',
|
|
2764
2755
|
isValid: function (value, settings, schema) {
|
|
2765
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2766
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2767
2756
|
return isValidJsonString(value);
|
|
2768
2757
|
},
|
|
2769
2758
|
canBeValid: function (partialValue, settings, schema) {
|
|
2770
|
-
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
2771
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2772
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2773
2759
|
return true;
|
|
2774
2760
|
},
|
|
2775
2761
|
heal: function (value, settings, schema) {
|
|
2776
|
-
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
2777
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2778
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2779
2762
|
throw new Error('Not implemented');
|
|
2780
2763
|
},
|
|
2781
2764
|
subvalueDefinitions: [],
|
|
@@ -2857,21 +2840,12 @@ var XmlFormatDefinition = {
|
|
|
2857
2840
|
formatName: 'XML',
|
|
2858
2841
|
mimeType: 'application/xml',
|
|
2859
2842
|
isValid: function (value, settings, schema) {
|
|
2860
|
-
TODO_USE(value /* <- TODO: Use value here */);
|
|
2861
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2862
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2863
2843
|
return true;
|
|
2864
2844
|
},
|
|
2865
2845
|
canBeValid: function (partialValue, settings, schema) {
|
|
2866
|
-
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
2867
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2868
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2869
2846
|
return true;
|
|
2870
2847
|
},
|
|
2871
2848
|
heal: function (value, settings, schema) {
|
|
2872
|
-
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
2873
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2874
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2875
2849
|
throw new Error('Not implemented');
|
|
2876
2850
|
},
|
|
2877
2851
|
subvalueDefinitions: [],
|
|
@@ -3104,27 +3078,6 @@ function arrayableToArray(input) {
|
|
|
3104
3078
|
return [input];
|
|
3105
3079
|
}
|
|
3106
3080
|
|
|
3107
|
-
/**
|
|
3108
|
-
* Just says that the variable is not used but should be kept
|
|
3109
|
-
* No side effects.
|
|
3110
|
-
*
|
|
3111
|
-
* Note: It can be usefull for:
|
|
3112
|
-
*
|
|
3113
|
-
* 1) Suppressing eager optimization of unused imports
|
|
3114
|
-
* 2) Suppressing eslint errors of unused variables in the tests
|
|
3115
|
-
* 3) Keeping the type of the variable for type testing
|
|
3116
|
-
*
|
|
3117
|
-
* @param value any values
|
|
3118
|
-
* @returns void
|
|
3119
|
-
* @private within the repository
|
|
3120
|
-
*/
|
|
3121
|
-
function keepUnused() {
|
|
3122
|
-
var valuesToKeep = [];
|
|
3123
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3124
|
-
valuesToKeep[_i] = arguments[_i];
|
|
3125
|
-
}
|
|
3126
|
-
}
|
|
3127
|
-
|
|
3128
3081
|
/**
|
|
3129
3082
|
* Replaces parameters in template with values from parameters object
|
|
3130
3083
|
*
|
|
@@ -3879,7 +3832,6 @@ function executeAttempts(options) {
|
|
|
3879
3832
|
$ongoingTemplateResult.$resultString = extractJsonBlock($ongoingTemplateResult.$resultString || '');
|
|
3880
3833
|
}
|
|
3881
3834
|
catch (error) {
|
|
3882
|
-
keepUnused(error);
|
|
3883
3835
|
throw new ExpectError(spaceTrim(function (block) { return "\n Expected valid JSON string\n\n ".concat(block(
|
|
3884
3836
|
/*<- Note: No need for `pipelineIdentification`, it will be catched and added later */ ''), "\n "); }));
|
|
3885
3837
|
}
|
|
@@ -4057,7 +4009,6 @@ function executeFormatSubvalues(options) {
|
|
|
4057
4009
|
function getContextForTemplate(template) {
|
|
4058
4010
|
return __awaiter(this, void 0, void 0, function () {
|
|
4059
4011
|
return __generator(this, function (_a) {
|
|
4060
|
-
TODO_USE(template);
|
|
4061
4012
|
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [🏍] Implement */];
|
|
4062
4013
|
});
|
|
4063
4014
|
});
|
|
@@ -4070,11 +4021,9 @@ function getContextForTemplate(template) {
|
|
|
4070
4021
|
*/
|
|
4071
4022
|
function getKnowledgeForTemplate(options) {
|
|
4072
4023
|
return __awaiter(this, void 0, void 0, function () {
|
|
4073
|
-
var preparedPipeline
|
|
4024
|
+
var preparedPipeline;
|
|
4074
4025
|
return __generator(this, function (_a) {
|
|
4075
|
-
preparedPipeline = options.preparedPipeline,
|
|
4076
|
-
// TODO: [♨] Implement Better - use real index and keyword search from `template` and {examples}
|
|
4077
|
-
TODO_USE(template);
|
|
4026
|
+
preparedPipeline = options.preparedPipeline, options.template;
|
|
4078
4027
|
return [2 /*return*/, preparedPipeline.knowledgePieces.map(function (_a) {
|
|
4079
4028
|
var content = _a.content;
|
|
4080
4029
|
return "- ".concat(content);
|
|
@@ -4091,8 +4040,6 @@ function getKnowledgeForTemplate(options) {
|
|
|
4091
4040
|
function getExamplesForTemplate(template) {
|
|
4092
4041
|
return __awaiter(this, void 0, void 0, function () {
|
|
4093
4042
|
return __generator(this, function (_a) {
|
|
4094
|
-
// TODO: [♨] Implement Better - use real index and keyword search
|
|
4095
|
-
TODO_USE(template);
|
|
4096
4043
|
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [♨] Implement */];
|
|
4097
4044
|
});
|
|
4098
4045
|
});
|
|
@@ -4111,13 +4058,13 @@ function getReservedParametersForTemplate(options) {
|
|
|
4111
4058
|
switch (_b.label) {
|
|
4112
4059
|
case 0:
|
|
4113
4060
|
preparedPipeline = options.preparedPipeline, template = options.template, pipelineIdentification = options.pipelineIdentification;
|
|
4114
|
-
return [4 /*yield*/, getContextForTemplate(
|
|
4061
|
+
return [4 /*yield*/, getContextForTemplate()];
|
|
4115
4062
|
case 1:
|
|
4116
4063
|
context = _b.sent();
|
|
4117
4064
|
return [4 /*yield*/, getKnowledgeForTemplate({ preparedPipeline: preparedPipeline, template: template })];
|
|
4118
4065
|
case 2:
|
|
4119
4066
|
knowledge = _b.sent();
|
|
4120
|
-
return [4 /*yield*/, getExamplesForTemplate(
|
|
4067
|
+
return [4 /*yield*/, getExamplesForTemplate()];
|
|
4121
4068
|
case 3:
|
|
4122
4069
|
examples = _b.sent();
|
|
4123
4070
|
currentDate = new Date().toISOString();
|
|
@@ -4352,7 +4299,7 @@ function executePipeline(options) {
|
|
|
4352
4299
|
executionReport = {
|
|
4353
4300
|
pipelineUrl: preparedPipeline.pipelineUrl,
|
|
4354
4301
|
title: preparedPipeline.title,
|
|
4355
|
-
promptbookUsedVersion:
|
|
4302
|
+
promptbookUsedVersion: PROMPTBOOK_ENGINE_VERSION,
|
|
4356
4303
|
promptbookRequestedVersion: preparedPipeline.promptbookVersion,
|
|
4357
4304
|
description: preparedPipeline.description,
|
|
4358
4305
|
promptExecutions: [],
|
|
@@ -5199,16 +5146,13 @@ function isValidFilePath(filename) {
|
|
|
5199
5146
|
function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
5200
5147
|
var _a;
|
|
5201
5148
|
return __awaiter(this, void 0, void 0, function () {
|
|
5202
|
-
var sourceContent, name, _b, _c, rootDirname,
|
|
5203
|
-
// <- TODO: process.cwd() if running in Node.js
|
|
5204
|
-
isVerbose, url, response_1, mimeType, filename_1, fileExtension, mimeType;
|
|
5149
|
+
var sourceContent, name, _b, _c, rootDirname, url, response_1, mimeType, filename_1, fileExtension, mimeType;
|
|
5205
5150
|
return __generator(this, function (_e) {
|
|
5206
5151
|
switch (_e.label) {
|
|
5207
5152
|
case 0:
|
|
5208
5153
|
sourceContent = knowledgeSource.sourceContent;
|
|
5209
5154
|
name = knowledgeSource.name;
|
|
5210
|
-
_b = options || {}, _c = _b.rootDirname, rootDirname = _c === void 0 ? null : _c,
|
|
5211
|
-
TODO_USE(isVerbose);
|
|
5155
|
+
_b = options || {}, _c = _b.rootDirname, rootDirname = _c === void 0 ? null : _c, _b.isVerbose;
|
|
5212
5156
|
if (!name) {
|
|
5213
5157
|
name = sourceContentToName(sourceContent);
|
|
5214
5158
|
}
|
|
@@ -5488,15 +5432,13 @@ function clonePipeline(pipeline) {
|
|
|
5488
5432
|
*/
|
|
5489
5433
|
function prepareTemplates(pipeline, tools, options) {
|
|
5490
5434
|
return __awaiter(this, void 0, void 0, function () {
|
|
5491
|
-
var _a, maxParallelCount, templates,
|
|
5435
|
+
var _a, maxParallelCount, templates, knowledgePiecesCount, templatesPrepared;
|
|
5492
5436
|
var _this = this;
|
|
5493
5437
|
return __generator(this, function (_b) {
|
|
5494
5438
|
switch (_b.label) {
|
|
5495
5439
|
case 0:
|
|
5496
5440
|
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a;
|
|
5497
|
-
templates = pipeline.templates,
|
|
5498
|
-
// TODO: [main] !! Apply examples to each template (if missing and is for the template defined)
|
|
5499
|
-
TODO_USE(parameters);
|
|
5441
|
+
templates = pipeline.templates, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
|
|
5500
5442
|
templatesPrepared = new Array(templates.length);
|
|
5501
5443
|
return [4 /*yield*/, forEachAsync(templates, { maxParallelCount: maxParallelCount /* <- TODO: [🪂] When there are subtasks, this maximul limit can be broken */ }, function (template, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
5502
5444
|
var dependentParameterNames, preparedContent, preparedTemplate;
|
|
@@ -5566,7 +5508,7 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
5566
5508
|
currentPreparation = {
|
|
5567
5509
|
id: 1,
|
|
5568
5510
|
// TODO: [🍥]> date: $currentDate(),
|
|
5569
|
-
promptbookVersion:
|
|
5511
|
+
promptbookVersion: PROMPTBOOK_ENGINE_VERSION,
|
|
5570
5512
|
usage: ZERO_USAGE,
|
|
5571
5513
|
};
|
|
5572
5514
|
preparations = [
|
|
@@ -5706,7 +5648,6 @@ var knowledgeCommandParser = {
|
|
|
5706
5648
|
* Note: This is used in `pipelineJsonToString` utility
|
|
5707
5649
|
*/
|
|
5708
5650
|
stringify: function (command) {
|
|
5709
|
-
keepUnused(command);
|
|
5710
5651
|
return "---"; // <- TODO: [🛋] Implement
|
|
5711
5652
|
},
|
|
5712
5653
|
/**
|
|
@@ -5715,7 +5656,6 @@ var knowledgeCommandParser = {
|
|
|
5715
5656
|
* Note: This is used in `pipelineJsonToString` utility
|
|
5716
5657
|
*/
|
|
5717
5658
|
takeFromPipelineJson: function (pipelineJson) {
|
|
5718
|
-
keepUnused(pipelineJson);
|
|
5719
5659
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
5720
5660
|
},
|
|
5721
5661
|
};
|
|
@@ -5898,7 +5838,6 @@ var templateCommandParser = {
|
|
|
5898
5838
|
* Note: This is used in `pipelineJsonToString` utility
|
|
5899
5839
|
*/
|
|
5900
5840
|
stringify: function (command) {
|
|
5901
|
-
keepUnused(command);
|
|
5902
5841
|
return "---"; // <- TODO: [🛋] Implement
|
|
5903
5842
|
},
|
|
5904
5843
|
/**
|
|
@@ -5907,7 +5846,6 @@ var templateCommandParser = {
|
|
|
5907
5846
|
* Note: This is used in `pipelineJsonToString` utility
|
|
5908
5847
|
*/
|
|
5909
5848
|
takeFromTemplateJson: function ($templateJson) {
|
|
5910
|
-
keepUnused($templateJson);
|
|
5911
5849
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
5912
5850
|
},
|
|
5913
5851
|
};
|
|
@@ -6139,7 +6077,6 @@ var expectCommandParser = {
|
|
|
6139
6077
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6140
6078
|
*/
|
|
6141
6079
|
stringify: function (command) {
|
|
6142
|
-
keepUnused(command);
|
|
6143
6080
|
return "---"; // <- TODO: [🛋] Implement
|
|
6144
6081
|
},
|
|
6145
6082
|
/**
|
|
@@ -6148,7 +6085,6 @@ var expectCommandParser = {
|
|
|
6148
6085
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6149
6086
|
*/
|
|
6150
6087
|
takeFromTemplateJson: function ($templateJson) {
|
|
6151
|
-
keepUnused($templateJson);
|
|
6152
6088
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6153
6089
|
},
|
|
6154
6090
|
};
|
|
@@ -6467,7 +6403,6 @@ var foreachCommandParser = {
|
|
|
6467
6403
|
inputSubparameterNames: inputSubparameterNames,
|
|
6468
6404
|
outputSubparameterName: outputSubparameterName,
|
|
6469
6405
|
};
|
|
6470
|
-
keepUnused($pipelineJson); // <- TODO: [🧠] Maybe register subparameter from foreach into parameters of the pipeline
|
|
6471
6406
|
// Note: [🍭] FOREACH apply has some sideeffects on different places in codebase
|
|
6472
6407
|
},
|
|
6473
6408
|
/**
|
|
@@ -6476,7 +6411,6 @@ var foreachCommandParser = {
|
|
|
6476
6411
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6477
6412
|
*/
|
|
6478
6413
|
stringify: function (command) {
|
|
6479
|
-
keepUnused(command);
|
|
6480
6414
|
return "---"; // <- TODO: [🛋] Implement
|
|
6481
6415
|
},
|
|
6482
6416
|
/**
|
|
@@ -6485,7 +6419,6 @@ var foreachCommandParser = {
|
|
|
6485
6419
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6486
6420
|
*/
|
|
6487
6421
|
takeFromTemplateJson: function ($templateJson) {
|
|
6488
|
-
keepUnused($templateJson);
|
|
6489
6422
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6490
6423
|
},
|
|
6491
6424
|
};
|
|
@@ -6553,7 +6486,6 @@ var formatCommandParser = {
|
|
|
6553
6486
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6554
6487
|
*/
|
|
6555
6488
|
stringify: function (command) {
|
|
6556
|
-
keepUnused(command);
|
|
6557
6489
|
return "---"; // <- TODO: [🛋] Implement
|
|
6558
6490
|
},
|
|
6559
6491
|
/**
|
|
@@ -6562,7 +6494,6 @@ var formatCommandParser = {
|
|
|
6562
6494
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6563
6495
|
*/
|
|
6564
6496
|
takeFromTemplateJson: function ($templateJson) {
|
|
6565
|
-
keepUnused($templateJson);
|
|
6566
6497
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6567
6498
|
},
|
|
6568
6499
|
};
|
|
@@ -6625,7 +6556,6 @@ var jokerCommandParser = {
|
|
|
6625
6556
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6626
6557
|
*/
|
|
6627
6558
|
stringify: function (command) {
|
|
6628
|
-
keepUnused(command);
|
|
6629
6559
|
return "---"; // <- TODO: [🛋] Implement
|
|
6630
6560
|
},
|
|
6631
6561
|
/**
|
|
@@ -6634,7 +6564,6 @@ var jokerCommandParser = {
|
|
|
6634
6564
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6635
6565
|
*/
|
|
6636
6566
|
takeFromTemplateJson: function ($templateJson) {
|
|
6637
|
-
keepUnused($templateJson);
|
|
6638
6567
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6639
6568
|
},
|
|
6640
6569
|
};
|
|
@@ -6770,7 +6699,6 @@ var modelCommandParser = {
|
|
|
6770
6699
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6771
6700
|
*/
|
|
6772
6701
|
stringify: function (command) {
|
|
6773
|
-
keepUnused(command);
|
|
6774
6702
|
return "---"; // <- TODO: [🛋] Implement
|
|
6775
6703
|
},
|
|
6776
6704
|
/**
|
|
@@ -6779,7 +6707,6 @@ var modelCommandParser = {
|
|
|
6779
6707
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6780
6708
|
*/
|
|
6781
6709
|
takeFromPipelineJson: function (pipelineJson) {
|
|
6782
|
-
keepUnused(pipelineJson);
|
|
6783
6710
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6784
6711
|
},
|
|
6785
6712
|
/**
|
|
@@ -6788,7 +6715,6 @@ var modelCommandParser = {
|
|
|
6788
6715
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6789
6716
|
*/
|
|
6790
6717
|
takeFromTemplateJson: function ($templateJson) {
|
|
6791
|
-
keepUnused($templateJson);
|
|
6792
6718
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6793
6719
|
},
|
|
6794
6720
|
};
|
|
@@ -6862,7 +6788,6 @@ var parameterCommandParser = {
|
|
|
6862
6788
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
6863
6789
|
*/
|
|
6864
6790
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
6865
|
-
keepUnused(command, $pipelineJson);
|
|
6866
6791
|
// Note: [🍣] Do nothing, its application is implemented separately in `pipelineStringToJsonSync`
|
|
6867
6792
|
},
|
|
6868
6793
|
/**
|
|
@@ -6871,7 +6796,6 @@ var parameterCommandParser = {
|
|
|
6871
6796
|
* Note: `$` is used to indicate that this function mutates given `templateJson`
|
|
6872
6797
|
*/
|
|
6873
6798
|
$applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
|
|
6874
|
-
keepUnused(command, $templateJson, $pipelineJson);
|
|
6875
6799
|
// Note: [🍣] Do nothing, its application is implemented separately in `pipelineStringToJsonSync`
|
|
6876
6800
|
},
|
|
6877
6801
|
/**
|
|
@@ -6880,7 +6804,6 @@ var parameterCommandParser = {
|
|
|
6880
6804
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6881
6805
|
*/
|
|
6882
6806
|
stringify: function (command) {
|
|
6883
|
-
keepUnused(command);
|
|
6884
6807
|
return "---"; // <- TODO: [🛋] Implement
|
|
6885
6808
|
},
|
|
6886
6809
|
/**
|
|
@@ -6889,7 +6812,6 @@ var parameterCommandParser = {
|
|
|
6889
6812
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6890
6813
|
*/
|
|
6891
6814
|
takeFromPipelineJson: function (pipelineJson) {
|
|
6892
|
-
keepUnused(pipelineJson);
|
|
6893
6815
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6894
6816
|
},
|
|
6895
6817
|
/**
|
|
@@ -6898,7 +6820,6 @@ var parameterCommandParser = {
|
|
|
6898
6820
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6899
6821
|
*/
|
|
6900
6822
|
takeFromTemplateJson: function ($templateJson) {
|
|
6901
|
-
keepUnused($templateJson);
|
|
6902
6823
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6903
6824
|
},
|
|
6904
6825
|
};
|
|
@@ -6970,7 +6891,6 @@ var personaCommandParser = {
|
|
|
6970
6891
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6971
6892
|
*/
|
|
6972
6893
|
stringify: function (command) {
|
|
6973
|
-
keepUnused(command);
|
|
6974
6894
|
return "---"; // <- TODO: [🛋] Implement
|
|
6975
6895
|
},
|
|
6976
6896
|
/**
|
|
@@ -6979,7 +6899,6 @@ var personaCommandParser = {
|
|
|
6979
6899
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6980
6900
|
*/
|
|
6981
6901
|
takeFromPipelineJson: function (pipelineJson) {
|
|
6982
|
-
keepUnused(pipelineJson);
|
|
6983
6902
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6984
6903
|
},
|
|
6985
6904
|
/**
|
|
@@ -6988,7 +6907,6 @@ var personaCommandParser = {
|
|
|
6988
6907
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6989
6908
|
*/
|
|
6990
6909
|
takeFromTemplateJson: function ($templateJson) {
|
|
6991
|
-
keepUnused($templateJson);
|
|
6992
6910
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6993
6911
|
},
|
|
6994
6912
|
};
|
|
@@ -7107,7 +7025,6 @@ var postprocessCommandParser = {
|
|
|
7107
7025
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7108
7026
|
*/
|
|
7109
7027
|
stringify: function (command) {
|
|
7110
|
-
keepUnused(command);
|
|
7111
7028
|
return "---"; // <- TODO: [🛋] Implement
|
|
7112
7029
|
},
|
|
7113
7030
|
/**
|
|
@@ -7116,42 +7033,41 @@ var postprocessCommandParser = {
|
|
|
7116
7033
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7117
7034
|
*/
|
|
7118
7035
|
takeFromTemplateJson: function ($templateJson) {
|
|
7119
|
-
keepUnused($templateJson);
|
|
7120
7036
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7121
7037
|
},
|
|
7122
7038
|
};
|
|
7123
7039
|
|
|
7124
7040
|
/**
|
|
7125
|
-
* Parses the
|
|
7041
|
+
* Parses the BOOK_VERSION command
|
|
7126
7042
|
*
|
|
7127
7043
|
* @see `documentationUrl` for more details
|
|
7128
7044
|
* @private within the commands folder
|
|
7129
7045
|
*/
|
|
7130
|
-
var
|
|
7046
|
+
var bookVersionCommandParser = {
|
|
7131
7047
|
/**
|
|
7132
7048
|
* Name of the command
|
|
7133
7049
|
*/
|
|
7134
|
-
name: '
|
|
7135
|
-
aliasNames: ['PTBK_VERSION', '
|
|
7050
|
+
name: 'BOOK_VERSION',
|
|
7051
|
+
aliasNames: ['PTBK_VERSION', 'PROMPTBOOK_VERSION', 'BOOK'],
|
|
7136
7052
|
/**
|
|
7137
7053
|
* BOILERPLATE command can be used in:
|
|
7138
7054
|
*/
|
|
7139
7055
|
isUsedInPipelineHead: true,
|
|
7140
7056
|
isUsedInPipelineTemplate: false,
|
|
7141
7057
|
/**
|
|
7142
|
-
* Description of the
|
|
7058
|
+
* Description of the BOOK_VERSION command
|
|
7143
7059
|
*/
|
|
7144
|
-
description: "Which version of the
|
|
7060
|
+
description: "Which version of the Book language is the .ptbk.md using",
|
|
7145
7061
|
/**
|
|
7146
7062
|
* Link to documentation
|
|
7147
7063
|
*/
|
|
7148
7064
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/69',
|
|
7149
7065
|
/**
|
|
7150
|
-
* Example usages of the
|
|
7066
|
+
* Example usages of the BOOK_VERSION command
|
|
7151
7067
|
*/
|
|
7152
|
-
examples: ["
|
|
7068
|
+
examples: ["BOOK VERSION ".concat(BOOK_LANGUAGE_VERSION), "BOOK ".concat(BOOK_LANGUAGE_VERSION)],
|
|
7153
7069
|
/**
|
|
7154
|
-
* Parses the
|
|
7070
|
+
* Parses the BOOK_VERSION command
|
|
7155
7071
|
*/
|
|
7156
7072
|
parse: function (input) {
|
|
7157
7073
|
var args = input.args;
|
|
@@ -7162,16 +7078,16 @@ var promptbookVersionCommandParser = {
|
|
|
7162
7078
|
if (!isValidPromptbookVersion(promptbookVersion)) {
|
|
7163
7079
|
throw new ParseError("Invalid Promptbook version \"".concat(promptbookVersion, "\""));
|
|
7164
7080
|
}
|
|
7165
|
-
if (args.length > 0) {
|
|
7081
|
+
if (args.length > 0 && !(((args.length === 1 && args[0]) || '').toUpperCase() === 'VERSION')) {
|
|
7166
7082
|
throw new ParseError("Can not have more than one Promptbook version");
|
|
7167
7083
|
}
|
|
7168
7084
|
return {
|
|
7169
|
-
type: '
|
|
7085
|
+
type: 'BOOK_VERSION',
|
|
7170
7086
|
promptbookVersion: promptbookVersion,
|
|
7171
7087
|
};
|
|
7172
7088
|
},
|
|
7173
7089
|
/**
|
|
7174
|
-
* Apply the
|
|
7090
|
+
* Apply the BOOK_VERSION command to the `pipelineJson`
|
|
7175
7091
|
*
|
|
7176
7092
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7177
7093
|
*/
|
|
@@ -7180,21 +7096,19 @@ var promptbookVersionCommandParser = {
|
|
|
7180
7096
|
$pipelineJson.promptbookVersion = command.promptbookVersion;
|
|
7181
7097
|
},
|
|
7182
7098
|
/**
|
|
7183
|
-
* Converts the
|
|
7099
|
+
* Converts the BOOK_VERSION command back to string
|
|
7184
7100
|
*
|
|
7185
7101
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7186
7102
|
*/
|
|
7187
7103
|
stringify: function (command) {
|
|
7188
|
-
keepUnused(command);
|
|
7189
7104
|
return "---"; // <- TODO: [🛋] Implement
|
|
7190
7105
|
},
|
|
7191
7106
|
/**
|
|
7192
|
-
* Reads the
|
|
7107
|
+
* Reads the BOOK_VERSION command from the `PipelineJson`
|
|
7193
7108
|
*
|
|
7194
7109
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7195
7110
|
*/
|
|
7196
7111
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7197
|
-
keepUnused(pipelineJson);
|
|
7198
7112
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7199
7113
|
},
|
|
7200
7114
|
};
|
|
@@ -7288,7 +7202,6 @@ var urlCommandParser = {
|
|
|
7288
7202
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7289
7203
|
*/
|
|
7290
7204
|
stringify: function (command) {
|
|
7291
|
-
keepUnused(command);
|
|
7292
7205
|
return "---"; // <- TODO: [🛋] Implement
|
|
7293
7206
|
},
|
|
7294
7207
|
/**
|
|
@@ -7297,7 +7210,6 @@ var urlCommandParser = {
|
|
|
7297
7210
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7298
7211
|
*/
|
|
7299
7212
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7300
|
-
keepUnused(pipelineJson);
|
|
7301
7213
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7302
7214
|
},
|
|
7303
7215
|
};
|
|
@@ -7334,8 +7246,7 @@ var actionCommandParser = {
|
|
|
7334
7246
|
* Parses the ACTION command
|
|
7335
7247
|
*/
|
|
7336
7248
|
parse: function (input) {
|
|
7337
|
-
|
|
7338
|
-
TODO_USE(args);
|
|
7249
|
+
input.args;
|
|
7339
7250
|
return {
|
|
7340
7251
|
type: 'ACTION',
|
|
7341
7252
|
};
|
|
@@ -7346,7 +7257,6 @@ var actionCommandParser = {
|
|
|
7346
7257
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7347
7258
|
*/
|
|
7348
7259
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
7349
|
-
keepUnused(command, $pipelineJson);
|
|
7350
7260
|
console.error(new NotYetImplementedError('[🛠] Actions are not implemented yet'));
|
|
7351
7261
|
},
|
|
7352
7262
|
/**
|
|
@@ -7355,7 +7265,6 @@ var actionCommandParser = {
|
|
|
7355
7265
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7356
7266
|
*/
|
|
7357
7267
|
stringify: function (command) {
|
|
7358
|
-
keepUnused(command);
|
|
7359
7268
|
throw new NotYetImplementedError('[🛠] Actions are not implemented yet');
|
|
7360
7269
|
},
|
|
7361
7270
|
/**
|
|
@@ -7364,7 +7273,6 @@ var actionCommandParser = {
|
|
|
7364
7273
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7365
7274
|
*/
|
|
7366
7275
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7367
|
-
keepUnused(pipelineJson);
|
|
7368
7276
|
throw new NotYetImplementedError('[🛠] Actions are not implemented yet');
|
|
7369
7277
|
},
|
|
7370
7278
|
};
|
|
@@ -7404,9 +7312,7 @@ var instrumentCommandParser = {
|
|
|
7404
7312
|
* Parses the INSTRUMENT command
|
|
7405
7313
|
*/
|
|
7406
7314
|
parse: function (input) {
|
|
7407
|
-
|
|
7408
|
-
// TODO: [🛠] Implement
|
|
7409
|
-
TODO_USE(args);
|
|
7315
|
+
input.args;
|
|
7410
7316
|
return {
|
|
7411
7317
|
type: 'INSTRUMENT',
|
|
7412
7318
|
};
|
|
@@ -7417,7 +7323,6 @@ var instrumentCommandParser = {
|
|
|
7417
7323
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7418
7324
|
*/
|
|
7419
7325
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
7420
|
-
keepUnused(command, $pipelineJson);
|
|
7421
7326
|
console.error(new NotYetImplementedError('[🛠] Instruments are not implemented yet'));
|
|
7422
7327
|
},
|
|
7423
7328
|
/**
|
|
@@ -7426,7 +7331,6 @@ var instrumentCommandParser = {
|
|
|
7426
7331
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7427
7332
|
*/
|
|
7428
7333
|
stringify: function (command) {
|
|
7429
|
-
keepUnused(command);
|
|
7430
7334
|
throw new NotYetImplementedError('[🛠] Instruments are not implemented yet');
|
|
7431
7335
|
},
|
|
7432
7336
|
/**
|
|
@@ -7435,7 +7339,6 @@ var instrumentCommandParser = {
|
|
|
7435
7339
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7436
7340
|
*/
|
|
7437
7341
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7438
|
-
keepUnused(pipelineJson);
|
|
7439
7342
|
throw new NotYetImplementedError('[🛠] Instruments are not implemented yet');
|
|
7440
7343
|
},
|
|
7441
7344
|
};
|
|
@@ -7500,7 +7403,6 @@ var boilerplateCommandParser = {
|
|
|
7500
7403
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7501
7404
|
*/
|
|
7502
7405
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
7503
|
-
keepUnused(command, $pipelineJson);
|
|
7504
7406
|
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
|
|
7505
7407
|
},
|
|
7506
7408
|
/**
|
|
@@ -7509,7 +7411,6 @@ var boilerplateCommandParser = {
|
|
|
7509
7411
|
* Note: `$` is used to indicate that this function mutates given `templateJson`
|
|
7510
7412
|
*/
|
|
7511
7413
|
$applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
|
|
7512
|
-
keepUnused(command, $templateJson, $pipelineJson);
|
|
7513
7414
|
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
|
|
7514
7415
|
},
|
|
7515
7416
|
/**
|
|
@@ -7518,7 +7419,6 @@ var boilerplateCommandParser = {
|
|
|
7518
7419
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7519
7420
|
*/
|
|
7520
7421
|
stringify: function (command) {
|
|
7521
|
-
keepUnused(command);
|
|
7522
7422
|
return "---"; // <- TODO: [🛋] Implement
|
|
7523
7423
|
},
|
|
7524
7424
|
/**
|
|
@@ -7527,7 +7427,6 @@ var boilerplateCommandParser = {
|
|
|
7527
7427
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7528
7428
|
*/
|
|
7529
7429
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7530
|
-
keepUnused(pipelineJson);
|
|
7531
7430
|
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
|
|
7532
7431
|
},
|
|
7533
7432
|
/**
|
|
@@ -7536,7 +7435,6 @@ var boilerplateCommandParser = {
|
|
|
7536
7435
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7537
7436
|
*/
|
|
7538
7437
|
takeFromTemplateJson: function ($templateJson) {
|
|
7539
|
-
keepUnused($templateJson);
|
|
7540
7438
|
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
|
|
7541
7439
|
},
|
|
7542
7440
|
};
|
|
@@ -7554,7 +7452,7 @@ var COMMANDS = [
|
|
|
7554
7452
|
modelCommandParser,
|
|
7555
7453
|
parameterCommandParser,
|
|
7556
7454
|
postprocessCommandParser,
|
|
7557
|
-
|
|
7455
|
+
bookVersionCommandParser,
|
|
7558
7456
|
urlCommandParser,
|
|
7559
7457
|
knowledgeCommandParser,
|
|
7560
7458
|
actionCommandParser,
|
|
@@ -7706,9 +7604,7 @@ function parseCommandVariant(input) {
|
|
|
7706
7604
|
var _loop_1 = function (commandParser) {
|
|
7707
7605
|
// <- Note: [🦦] Its strange that this type assertion is needed
|
|
7708
7606
|
var name_1 = commandParser.name, isUsedInPipelineHead = commandParser.isUsedInPipelineHead, isUsedInPipelineTemplate = commandParser.isUsedInPipelineTemplate, aliasNames = commandParser.aliasNames, deprecatedNames = commandParser.deprecatedNames, parse = commandParser.parse;
|
|
7709
|
-
if (just(false))
|
|
7710
|
-
keepUnused( /* for better indentation */);
|
|
7711
|
-
}
|
|
7607
|
+
if (just(false)) ;
|
|
7712
7608
|
else if (usagePlace === 'PIPELINE_HEAD' && !isUsedInPipelineHead) {
|
|
7713
7609
|
return "continue";
|
|
7714
7610
|
}
|
|
@@ -8418,8 +8314,7 @@ function $provideFilesystemForNode(options) {
|
|
|
8418
8314
|
if (!$isRunningInNode()) {
|
|
8419
8315
|
throw new EnvironmentMismatchError('Function `$provideFilesystemForNode` works only in Node.js environment');
|
|
8420
8316
|
}
|
|
8421
|
-
|
|
8422
|
-
TODO_USE(isVerbose);
|
|
8317
|
+
(options || {}).isVerbose;
|
|
8423
8318
|
return {
|
|
8424
8319
|
stat: stat,
|
|
8425
8320
|
access: access,
|
|
@@ -8665,7 +8560,7 @@ function locatePandoc() {
|
|
|
8665
8560
|
*/
|
|
8666
8561
|
function $provideExecutablesForNode(options) {
|
|
8667
8562
|
return __awaiter(this, void 0, void 0, function () {
|
|
8668
|
-
var _a
|
|
8563
|
+
var _a;
|
|
8669
8564
|
var _d;
|
|
8670
8565
|
return __generator(this, function (_e) {
|
|
8671
8566
|
switch (_e.label) {
|
|
@@ -8673,9 +8568,7 @@ function $provideExecutablesForNode(options) {
|
|
|
8673
8568
|
if (!$isRunningInNode()) {
|
|
8674
8569
|
throw new EnvironmentMismatchError('Function `$getScrapersForNode` works only in Node.js environment');
|
|
8675
8570
|
}
|
|
8676
|
-
_a = options || {},
|
|
8677
|
-
TODO_USE(isAutoInstalled); // <- TODO: [🔱][🧠] Auto-install the executables
|
|
8678
|
-
TODO_USE(isVerbose);
|
|
8571
|
+
_a = options || {}, _a.isAutoInstalled, _a.isVerbose;
|
|
8679
8572
|
_d = {};
|
|
8680
8573
|
return [4 /*yield*/, locatePandoc()];
|
|
8681
8574
|
case 1:
|
|
@@ -8932,7 +8825,7 @@ function $provideLlmToolsFromEnv(options) {
|
|
|
8932
8825
|
*/
|
|
8933
8826
|
function $provideScrapersForNode(tools, options) {
|
|
8934
8827
|
return __awaiter(this, void 0, void 0, function () {
|
|
8935
|
-
var _a,
|
|
8828
|
+
var _a, scrapers, _d, _e, scraperFactory, scraper, e_1_1;
|
|
8936
8829
|
var e_1, _f;
|
|
8937
8830
|
return __generator(this, function (_g) {
|
|
8938
8831
|
switch (_g.label) {
|
|
@@ -8940,9 +8833,7 @@ function $provideScrapersForNode(tools, options) {
|
|
|
8940
8833
|
if (!$isRunningInNode()) {
|
|
8941
8834
|
throw new EnvironmentMismatchError('Function `$getScrapersForNode` works only in Node.js environment');
|
|
8942
8835
|
}
|
|
8943
|
-
_a = options || {},
|
|
8944
|
-
TODO_USE(isAutoInstalled);
|
|
8945
|
-
TODO_USE(isVerbose);
|
|
8836
|
+
_a = options || {}, _a.isAutoInstalled, _a.isVerbose;
|
|
8946
8837
|
scrapers = [];
|
|
8947
8838
|
_g.label = 1;
|
|
8948
8839
|
case 1:
|
|
@@ -10233,7 +10124,7 @@ function cacheLlmTools(llmTools, options) {
|
|
|
10233
10124
|
case 10: throw new PipelineExecutionError("Unknown model variant \"".concat(prompt.modelRequirements.modelVariant, "\""));
|
|
10234
10125
|
case 11: return [4 /*yield*/, storage.setItem(key, {
|
|
10235
10126
|
date: $currentDate(),
|
|
10236
|
-
promptbookVersion:
|
|
10127
|
+
promptbookVersion: PROMPTBOOK_ENGINE_VERSION,
|
|
10237
10128
|
prompt: prompt,
|
|
10238
10129
|
promptResult: promptResult,
|
|
10239
10130
|
})];
|
|
@@ -10311,6 +10202,7 @@ function initializeMakeCommand(program) {
|
|
|
10311
10202
|
var _this = this;
|
|
10312
10203
|
var makeCommand = program.command('make');
|
|
10313
10204
|
makeCommand.description(spaceTrim$1("\n Makes a new pipeline collection in given folder\n "));
|
|
10205
|
+
// TODO: [🧅] DRY command arguments
|
|
10314
10206
|
makeCommand.argument('[path]',
|
|
10315
10207
|
// <- TODO: [🧟♂️] Unite path to promptbook collection argument
|
|
10316
10208
|
'Path to promptbook collection directory', './promptbook-collection');
|
|
@@ -10322,7 +10214,7 @@ function initializeMakeCommand(program) {
|
|
|
10322
10214
|
makeCommand.option('--verbose', "Is output verbose", false);
|
|
10323
10215
|
makeCommand.option('-o, --out-file <path>', spaceTrim$1("\n Where to save the builded collection\n\n Note: If you keep it \"".concat(DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, "\" it will be saved in the root of the promptbook directory\n If you set it to a path, it will be saved in that path\n BUT you can use only one format and set correct extension\n ")), DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME);
|
|
10324
10216
|
makeCommand.action(function (path, _a) {
|
|
10325
|
-
var projectName = _a.projectName, format = _a.format, validation = _a.validation, isCacheReloaded = _a.
|
|
10217
|
+
var projectName = _a.projectName, format = _a.format, validation = _a.validation, isCacheReloaded = _a.reload, isVerbose = _a.verbose, outFile = _a.outFile;
|
|
10326
10218
|
return __awaiter(_this, void 0, void 0, function () {
|
|
10327
10219
|
var formats, validations, options, fs, llm, executables, tools, collection, validations_1, validations_1_1, validation_1, _b, _c, pipelineUrl, pipeline, e_1_1, e_2_1, collectionJson, collectionJsonString, collectionJsonItems, saveFile;
|
|
10328
10220
|
var _d, e_2, _e, e_1, _f;
|
|
@@ -10501,7 +10393,6 @@ function initializeMakeCommand(program) {
|
|
|
10501
10393
|
}
|
|
10502
10394
|
/**
|
|
10503
10395
|
* TODO: [🥃][main] !!! Allow `ptbk make` without configuring any llm tools
|
|
10504
|
-
* TODO: Maybe remove this command - "about" command should be enough?
|
|
10505
10396
|
* TODO: [0] DRY Javascript and typescript - Maybe make ONLY typescript and for javascript just remove types
|
|
10506
10397
|
* Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
|
|
10507
10398
|
* TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
|
|
@@ -10733,6 +10624,107 @@ function initializePrettifyCommand(program) {
|
|
|
10733
10624
|
* TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
|
|
10734
10625
|
*/
|
|
10735
10626
|
|
|
10627
|
+
/**
|
|
10628
|
+
* Initializes `run` command for Promptbook CLI utilities
|
|
10629
|
+
*
|
|
10630
|
+
* @private internal function of `promptbookCli`
|
|
10631
|
+
*/
|
|
10632
|
+
function initializeRunCommand(program) {
|
|
10633
|
+
var _this = this;
|
|
10634
|
+
var runCommand = program.command('run');
|
|
10635
|
+
runCommand.description(spaceTrim$1("\n Runs a pipeline\n "));
|
|
10636
|
+
// TODO: [🧅] DRY command arguments
|
|
10637
|
+
runCommand.argument('<path>',
|
|
10638
|
+
// <- Note: [🧟♂️] This is NOT promptbook collection directory BUT direct path to .ptbk.md file
|
|
10639
|
+
'Path to `.ptbk.md` file');
|
|
10640
|
+
runCommand.option('--reload', "Call LLM models even if same prompt with result is in the cache", false);
|
|
10641
|
+
runCommand.option('--verbose', "Is output verbose", false);
|
|
10642
|
+
runCommand.action(function (path, _a) {
|
|
10643
|
+
var isCacheReloaded = _a.reload, isVerbose = _a.verbose;
|
|
10644
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
10645
|
+
var options, fs, llm, executables, tools, pipelineString, pipeline, pipelineExecutor, inputParameters, result, isSuccessful, errors, outputParameters, executionReport, _b, _c, key, value, separator;
|
|
10646
|
+
var _d, e_1, _e;
|
|
10647
|
+
return __generator(this, function (_f) {
|
|
10648
|
+
switch (_f.label) {
|
|
10649
|
+
case 0:
|
|
10650
|
+
options = {
|
|
10651
|
+
isVerbose: isVerbose,
|
|
10652
|
+
isCacheReloaded: isCacheReloaded,
|
|
10653
|
+
};
|
|
10654
|
+
fs = $provideFilesystemForNode(options);
|
|
10655
|
+
llm = $provideLlmToolsForCli(options);
|
|
10656
|
+
return [4 /*yield*/, $provideExecutablesForNode(options)];
|
|
10657
|
+
case 1:
|
|
10658
|
+
executables = _f.sent();
|
|
10659
|
+
_d = {
|
|
10660
|
+
llm: llm,
|
|
10661
|
+
fs: fs
|
|
10662
|
+
};
|
|
10663
|
+
return [4 /*yield*/, $provideScrapersForNode({ fs: fs, llm: llm, executables: executables }, options)];
|
|
10664
|
+
case 2:
|
|
10665
|
+
tools = (_d.scrapers = _f.sent(),
|
|
10666
|
+
_d.script = [
|
|
10667
|
+
/*new JavascriptExecutionTools(options)*/
|
|
10668
|
+
],
|
|
10669
|
+
_d);
|
|
10670
|
+
return [4 /*yield*/, isFileExisting(path, fs)];
|
|
10671
|
+
case 3:
|
|
10672
|
+
if (!(_f.sent())) {
|
|
10673
|
+
throw new UnexpectedError("File \"".concat(path, "\" does not exist"));
|
|
10674
|
+
// <- TODO: !!!!!! Catch and wrap all errors from CLI
|
|
10675
|
+
}
|
|
10676
|
+
return [4 /*yield*/, fs.readFile(path, 'utf-8')];
|
|
10677
|
+
case 4:
|
|
10678
|
+
pipelineString = (_f.sent());
|
|
10679
|
+
return [4 /*yield*/, pipelineStringToJson(pipelineString, tools)];
|
|
10680
|
+
case 5:
|
|
10681
|
+
pipeline = _f.sent();
|
|
10682
|
+
validatePipeline(pipeline);
|
|
10683
|
+
pipelineExecutor = createPipelineExecutor({ pipeline: pipeline, tools: tools, isNotPreparedWarningSupressed: true });
|
|
10684
|
+
inputParameters = {
|
|
10685
|
+
eventTitle: 'OpenAlt',
|
|
10686
|
+
eventDescription: "Konference OpenAlt vznikla v roce 2014 jako v\u00FDsledek spojen\u00ED konferenc\u00ED LinuxAlt a Openmobility. LinuxAlt jako konference s dlouhodobou tradic\u00ED se ji\u017E od roku 2006 v\u011Bnovala otev\u0159en\u00E9mu softwaru a technologi\u00EDm. Z\u00E1hy se LinuxAlt s v\u00EDce jak 500 n\u00E1v\u0161t\u011Bvn\u00EDky stal nejv\u011Bt\u0161\u00ED akc\u00ED tohoto typu v \u010Cesk\u00E9 republice. Openmobility konference vznikla v roce 2010 a p\u0159inesla \u010Desk\u00FDm a slovensk\u00FDm n\u00E1v\u0161t\u011Bvn\u00EDk\u016Fm t\u00E9mata otev\u0159en\u00FDch mobiln\u00EDch platforem a otev\u0159en\u00E9ho hardware formou klasick\u00FDch p\u0159edn\u00E1\u0161ek a praktick\u00FDch workshop\u016F. OpenAlt vych\u00E1z\u00ED z toho nejlep\u0161\u00EDho na LinuxAltu a Openmobility a roz\u0161i\u0159uje oblast sv\u00E9ho z\u00E1jmu o t\u00E9mata otev\u0159en\u00FDch dat ve st\u00E1tn\u00ED spr\u00E1v\u011B a soukrom\u00E9m sektoru (Open Data) a otev\u0159en\u00E9ho p\u0159\u00EDstupu k v\u011Bdeck\u00FDm informac\u00EDm (Open Access). OpenAlt se v\u011Bnuje tak\u00E9 participativn\u00ED a svobodn\u00E9 kultu\u0159e, zejm\u00E9na online spolupr\u00E1ci, u\u010D\u00EDc\u00EDm se komunit\u00E1m a v souvislosti s t\u00EDm i alternativn\u00EDmu vzd\u011Bl\u00E1v\u00E1n\u00ED. Na sv\u00E9 si p\u0159ijdou i novodob\u00ED kutilov\u00E9 (Makers) \u0159\u00EDd\u00EDc\u00ED se pravidlem \u201EUd\u011Blej si s\u00E1m\u201C (DIY).",
|
|
10687
|
+
rules: '',
|
|
10688
|
+
};
|
|
10689
|
+
return [4 /*yield*/, pipelineExecutor(inputParameters, function (taskProgress) {
|
|
10690
|
+
// TODO: !!!!!!! Log if verbose
|
|
10691
|
+
console.log(taskProgress);
|
|
10692
|
+
})];
|
|
10693
|
+
case 6:
|
|
10694
|
+
result = _f.sent();
|
|
10695
|
+
isSuccessful = result.isSuccessful, errors = result.errors, outputParameters = result.outputParameters, executionReport = result.executionReport;
|
|
10696
|
+
console.log({ isSuccessful: isSuccessful, errors: errors, outputParameters: outputParameters, executionReport: executionReport });
|
|
10697
|
+
console.log(outputParameters);
|
|
10698
|
+
console.info(colors.gray('--- Result: ---'));
|
|
10699
|
+
try {
|
|
10700
|
+
for (_b = __values(Object.keys(outputParameters)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
10701
|
+
key = _c.value;
|
|
10702
|
+
value = outputParameters[key] || colors.grey(colors.italic('(nothing)'));
|
|
10703
|
+
separator = countLines(value) > 1 || countWords(value) > 100 ? ':\n' : ': ';
|
|
10704
|
+
console.info(colors.green(colors.bold(key) + separator + value));
|
|
10705
|
+
}
|
|
10706
|
+
}
|
|
10707
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
10708
|
+
finally {
|
|
10709
|
+
try {
|
|
10710
|
+
if (_c && !_c.done && (_e = _b.return)) _e.call(_b);
|
|
10711
|
+
}
|
|
10712
|
+
finally { if (e_1) throw e_1.error; }
|
|
10713
|
+
}
|
|
10714
|
+
process.exit(0);
|
|
10715
|
+
return [2 /*return*/];
|
|
10716
|
+
}
|
|
10717
|
+
});
|
|
10718
|
+
});
|
|
10719
|
+
});
|
|
10720
|
+
}
|
|
10721
|
+
/**
|
|
10722
|
+
* TODO: [🧠] Pass `maxExecutionAttempts`, `csvSettings`
|
|
10723
|
+
* TODO: [🥃][main] !!! Allow `ptbk run` without configuring any llm tools
|
|
10724
|
+
* Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
|
|
10725
|
+
* TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
|
|
10726
|
+
*/
|
|
10727
|
+
|
|
10736
10728
|
/**
|
|
10737
10729
|
* Initializes `test` command for Promptbook CLI utilities
|
|
10738
10730
|
*
|
|
@@ -10749,7 +10741,7 @@ function initializeTestCommand(program) {
|
|
|
10749
10741
|
testCommand.option('--reload', "Call LLM models even if same prompt with result is in the cache ", false);
|
|
10750
10742
|
testCommand.option('-v, --verbose', "Is output verbose", false);
|
|
10751
10743
|
testCommand.action(function (filesGlob, _a) {
|
|
10752
|
-
var ignore = _a.ignore, isCacheReloaded = _a.
|
|
10744
|
+
var ignore = _a.ignore, isCacheReloaded = _a.reload, isVerbose = _a.verbose;
|
|
10753
10745
|
return __awaiter(_this, void 0, void 0, function () {
|
|
10754
10746
|
var options, fs, llm, executables, tools, filenames, filenames_1, filenames_1_1, filename, pipeline, pipelineMarkdown, _b, _c, error_1, e_1_1;
|
|
10755
10747
|
var _d, e_1, _e;
|
|
@@ -10873,9 +10865,10 @@ function promptbookCli() {
|
|
|
10873
10865
|
program = new commander.Command();
|
|
10874
10866
|
program.name('promptbook');
|
|
10875
10867
|
program.alias('ptbk');
|
|
10876
|
-
program.version(
|
|
10868
|
+
program.version(PROMPTBOOK_ENGINE_VERSION);
|
|
10877
10869
|
program.description(spaceTrim("\n Promptbook utilities for enhancing workflow with promptbooks\n "));
|
|
10878
10870
|
initializeAboutCommand(program);
|
|
10871
|
+
initializeRunCommand(program);
|
|
10879
10872
|
initializeHelloCommand(program);
|
|
10880
10873
|
initializeMakeCommand(program);
|
|
10881
10874
|
initializePrettifyCommand(program);
|
|
@@ -10886,6 +10879,7 @@ function promptbookCli() {
|
|
|
10886
10879
|
});
|
|
10887
10880
|
}
|
|
10888
10881
|
/**
|
|
10882
|
+
* TODO: [🧠] Maybe `run` command the default, instead of `ptbk run ./foo.ptbk.md` -> `ptbk ./foo.ptbk.md`
|
|
10889
10883
|
* TODO: [🥠] Do not export, its just for CLI script
|
|
10890
10884
|
* TODO: [🕌] When more functionalities, rename
|
|
10891
10885
|
* Note: 11:11
|
|
@@ -12475,8 +12469,6 @@ var _OpenAiAssistantMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
|
12475
12469
|
};
|
|
12476
12470
|
},
|
|
12477
12471
|
createConfigurationFromEnv: function (env) {
|
|
12478
|
-
// TODO: Maybe auto-configure (multiple) assistants from env variables
|
|
12479
|
-
keepUnused(env);
|
|
12480
12472
|
return null;
|
|
12481
12473
|
/*
|
|
12482
12474
|
if (typeof env.OPENAI_API_KEY === 'string' || typeof env.OPENAI_XXX === 'string') {
|
|
@@ -13329,12 +13321,12 @@ function $execCommand(options) {
|
|
|
13329
13321
|
*/
|
|
13330
13322
|
function getScraperIntermediateSource(source, options) {
|
|
13331
13323
|
return __awaiter(this, void 0, void 0, function () {
|
|
13332
|
-
var sourceFilename, url,
|
|
13324
|
+
var sourceFilename, url, cacheDirname, intermediateFilesStrategy, extension, isVerbose, hash, semanticName, pieces, name, cacheFilename, isDestroyed, fileHandler;
|
|
13333
13325
|
return __generator(this, function (_a) {
|
|
13334
13326
|
switch (_a.label) {
|
|
13335
13327
|
case 0:
|
|
13336
13328
|
sourceFilename = source.filename, url = source.url;
|
|
13337
|
-
|
|
13329
|
+
options.rootDirname, cacheDirname = options.cacheDirname, intermediateFilesStrategy = options.intermediateFilesStrategy, extension = options.extension, isVerbose = options.isVerbose;
|
|
13338
13330
|
hash = SHA256(
|
|
13339
13331
|
// <- TODO: [🥬] Encapsulate sha256 to some private utility function
|
|
13340
13332
|
hexEncoder.parse(sourceFilename || url || 'untitled'))
|
|
@@ -13343,8 +13335,6 @@ function getScraperIntermediateSource(source, options) {
|
|
|
13343
13335
|
semanticName = normalizeToKebabCase(titleToName((sourceFilename || url || '').split('intermediate').join(''))).substring(0, 20);
|
|
13344
13336
|
pieces = ['intermediate', semanticName, hash].filter(function (piece) { return piece !== ''; });
|
|
13345
13337
|
name = pieces.join('-').split('--').join('-');
|
|
13346
|
-
// <- TODO: Use MAX_FILENAME_LENGTH
|
|
13347
|
-
TODO_USE(rootDirname); // <- TODO: [😡]
|
|
13348
13338
|
cacheFilename = join.apply(void 0, __spreadArray(__spreadArray([process.cwd(),
|
|
13349
13339
|
cacheDirname], __read(nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */)), false), [name], false)).split('\\')
|
|
13350
13340
|
.join('/') +
|
|
@@ -13443,13 +13433,13 @@ var MarkdownScraper = /** @class */ (function () {
|
|
|
13443
13433
|
*/
|
|
13444
13434
|
MarkdownScraper.prototype.scrape = function (source) {
|
|
13445
13435
|
return __awaiter(this, void 0, void 0, function () {
|
|
13446
|
-
var _a,
|
|
13436
|
+
var _a, _c, isVerbose, llm, _llms, llmTools, collection, prepareKnowledgeFromMarkdownExecutor, _d, prepareTitleExecutor, _e, prepareKeywordsExecutor, _f, knowledgeContent, result, outputParameters, knowledgePiecesRaw, knowledgeTextPieces, knowledge;
|
|
13447
13437
|
var _g, _h, _j;
|
|
13448
13438
|
var _this = this;
|
|
13449
13439
|
return __generator(this, function (_k) {
|
|
13450
13440
|
switch (_k.label) {
|
|
13451
13441
|
case 0:
|
|
13452
|
-
_a = this.options,
|
|
13442
|
+
_a = this.options, _a.maxParallelCount, _c = _a.isVerbose, isVerbose = _c === void 0 ? DEFAULT_IS_VERBOSE : _c;
|
|
13453
13443
|
llm = this.tools.llm;
|
|
13454
13444
|
if (llm === undefined) {
|
|
13455
13445
|
throw new MissingToolsError('LLM tools are required for scraping external files');
|
|
@@ -13457,7 +13447,6 @@ var MarkdownScraper = /** @class */ (function () {
|
|
|
13457
13447
|
}
|
|
13458
13448
|
_llms = arrayableToArray(llm);
|
|
13459
13449
|
llmTools = _llms.length === 1 ? _llms[0] : joinLlmExecutionTools.apply(void 0, __spreadArray([], __read(_llms), false));
|
|
13460
|
-
TODO_USE(maxParallelCount); // <- [🪂]
|
|
13461
13450
|
collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
|
|
13462
13451
|
_d = createPipelineExecutor;
|
|
13463
13452
|
_g = {};
|
|
@@ -14048,7 +14037,6 @@ var PdfScraper = /** @class */ (function () {
|
|
|
14048
14037
|
PdfScraper.prototype.$convert = function (source) {
|
|
14049
14038
|
return __awaiter(this, void 0, void 0, function () {
|
|
14050
14039
|
return __generator(this, function (_a) {
|
|
14051
|
-
TODO_USE(source);
|
|
14052
14040
|
TODO_USE(this.options);
|
|
14053
14041
|
throw new NotYetImplementedError('PDF conversion not yet implemented');
|
|
14054
14042
|
});
|
|
@@ -14060,7 +14048,6 @@ var PdfScraper = /** @class */ (function () {
|
|
|
14060
14048
|
PdfScraper.prototype.scrape = function (source) {
|
|
14061
14049
|
return __awaiter(this, void 0, void 0, function () {
|
|
14062
14050
|
return __generator(this, function (_a) {
|
|
14063
|
-
TODO_USE(source);
|
|
14064
14051
|
TODO_USE(this.options);
|
|
14065
14052
|
/*
|
|
14066
14053
|
const {
|
|
@@ -14303,5 +14290,5 @@ var _WebsiteScraperRegistration = $scrapersRegister.register(createWebsiteScrape
|
|
|
14303
14290
|
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
14304
14291
|
*/
|
|
14305
14292
|
|
|
14306
|
-
export {
|
|
14293
|
+
export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION, _AnthropicClaudeMetadataRegistration, _AnthropicClaudeRegistration, _AzureOpenAiMetadataRegistration, _AzureOpenAiRegistration, _CLI, _DocumentScraperMetadataRegistration, _DocumentScraperRegistration, _LegacyDocumentScraperMetadataRegistration, _LegacyDocumentScraperRegistration, _MarkdownScraperMetadataRegistration, _MarkdownScraperRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiAssistantRegistration, _OpenAiMetadataRegistration, _OpenAiRegistration, _PdfScraperMetadataRegistration, _PdfScraperRegistration, _WebsiteScraperMetadataRegistration, _WebsiteScraperRegistration };
|
|
14307
14294
|
//# sourceMappingURL=index.es.js.map
|