@promptbook/node 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 +230 -353
- 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 +2 -2
- package/umd/index.umd.js +231 -353
- 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
|
@@ -16,10 +16,20 @@ import sha256 from 'crypto-js/sha256';
|
|
|
16
16
|
|
|
17
17
|
// ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
|
|
18
18
|
/**
|
|
19
|
-
* The version of the
|
|
19
|
+
* The version of the Book language
|
|
20
|
+
*
|
|
21
|
+
* @see https://github.com/webgptorg/book
|
|
22
|
+
*/
|
|
23
|
+
var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
24
|
+
/**
|
|
25
|
+
* The version of the Promptbook engine
|
|
26
|
+
*
|
|
27
|
+
* @see https://github.com/webgptorg/promptbook
|
|
28
|
+
*/
|
|
29
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.74.0-1';
|
|
30
|
+
/**
|
|
31
|
+
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
20
32
|
*/
|
|
21
|
-
var PROMPTBOOK_VERSION = '0.72.0';
|
|
22
|
-
// TODO: [main] !!!! List here all the versions and annotate + put into script
|
|
23
33
|
|
|
24
34
|
/*! *****************************************************************************
|
|
25
35
|
Copyright (c) Microsoft Corporation.
|
|
@@ -443,12 +453,6 @@ var DEFAULT_CSV_SETTINGS = Object.freeze({
|
|
|
443
453
|
* @public exported from `@promptbook/core`
|
|
444
454
|
*/
|
|
445
455
|
var DEFAULT_IS_VERBOSE = false;
|
|
446
|
-
/**
|
|
447
|
-
* @@@
|
|
448
|
-
*
|
|
449
|
-
* @public exported from `@promptbook/core`
|
|
450
|
-
*/
|
|
451
|
-
var DEFAULT_IS_AUTO_INSTALLED = false;
|
|
452
456
|
/**
|
|
453
457
|
* @@@
|
|
454
458
|
*
|
|
@@ -853,6 +857,188 @@ $deepFreeze({
|
|
|
853
857
|
},
|
|
854
858
|
});
|
|
855
859
|
|
|
860
|
+
/**
|
|
861
|
+
* @@@
|
|
862
|
+
*
|
|
863
|
+
* @public exported from `@promptbook/utils`
|
|
864
|
+
*/
|
|
865
|
+
function deepClone(objectValue) {
|
|
866
|
+
return JSON.parse(JSON.stringify(objectValue));
|
|
867
|
+
/*
|
|
868
|
+
TODO: [🧠] Is there a better implementation?
|
|
869
|
+
> const propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
870
|
+
> for (const propertyName of propertyNames) {
|
|
871
|
+
> const value = (objectValue as really_any)[propertyName];
|
|
872
|
+
> if (value && typeof value === 'object') {
|
|
873
|
+
> deepClone(value);
|
|
874
|
+
> }
|
|
875
|
+
> }
|
|
876
|
+
> return Object.assign({}, objectValue);
|
|
877
|
+
*/
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
881
|
+
*/
|
|
882
|
+
|
|
883
|
+
/**
|
|
884
|
+
* Function `addUsage` will add multiple usages into one
|
|
885
|
+
*
|
|
886
|
+
* Note: If you provide 0 values, it returns ZERO_USAGE
|
|
887
|
+
*
|
|
888
|
+
* @public exported from `@promptbook/core`
|
|
889
|
+
*/
|
|
890
|
+
function addUsage() {
|
|
891
|
+
var usageItems = [];
|
|
892
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
893
|
+
usageItems[_i] = arguments[_i];
|
|
894
|
+
}
|
|
895
|
+
return usageItems.reduce(function (acc, item) {
|
|
896
|
+
var e_1, _a, e_2, _b;
|
|
897
|
+
var _c;
|
|
898
|
+
acc.price.value += ((_c = item.price) === null || _c === void 0 ? void 0 : _c.value) || 0;
|
|
899
|
+
try {
|
|
900
|
+
for (var _d = __values(Object.keys(acc.input)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
901
|
+
var key = _e.value;
|
|
902
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
903
|
+
//@ts-ignore
|
|
904
|
+
if (item.input[key]) {
|
|
905
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
906
|
+
//@ts-ignore
|
|
907
|
+
acc.input[key].value += item.input[key].value || 0;
|
|
908
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
909
|
+
//@ts-ignore
|
|
910
|
+
if (item.input[key].isUncertain) {
|
|
911
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
912
|
+
//@ts-ignore
|
|
913
|
+
acc.input[key].isUncertain = true;
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
919
|
+
finally {
|
|
920
|
+
try {
|
|
921
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
922
|
+
}
|
|
923
|
+
finally { if (e_1) throw e_1.error; }
|
|
924
|
+
}
|
|
925
|
+
try {
|
|
926
|
+
for (var _f = __values(Object.keys(acc.output)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
927
|
+
var key = _g.value;
|
|
928
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
929
|
+
//@ts-ignore
|
|
930
|
+
if (item.output[key]) {
|
|
931
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
932
|
+
//@ts-ignore
|
|
933
|
+
acc.output[key].value += item.output[key].value || 0;
|
|
934
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
935
|
+
//@ts-ignore
|
|
936
|
+
if (item.output[key].isUncertain) {
|
|
937
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
938
|
+
//@ts-ignore
|
|
939
|
+
acc.output[key].isUncertain = true;
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
945
|
+
finally {
|
|
946
|
+
try {
|
|
947
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
948
|
+
}
|
|
949
|
+
finally { if (e_2) throw e_2.error; }
|
|
950
|
+
}
|
|
951
|
+
return acc;
|
|
952
|
+
}, deepClone(ZERO_USAGE));
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
/**
|
|
956
|
+
* Intercepts LLM tools and counts total usage of the tools
|
|
957
|
+
*
|
|
958
|
+
* @param llmTools LLM tools to be intercepted with usage counting
|
|
959
|
+
* @returns LLM tools with same functionality with added total cost counting
|
|
960
|
+
* @public exported from `@promptbook/core`
|
|
961
|
+
*/
|
|
962
|
+
function countTotalUsage(llmTools) {
|
|
963
|
+
var _this = this;
|
|
964
|
+
var totalUsage = ZERO_USAGE;
|
|
965
|
+
var proxyTools = {
|
|
966
|
+
get title() {
|
|
967
|
+
// TODO: [🧠] Maybe put here some suffix
|
|
968
|
+
return llmTools.title;
|
|
969
|
+
},
|
|
970
|
+
get description() {
|
|
971
|
+
// TODO: [🧠] Maybe put here some suffix
|
|
972
|
+
return llmTools.description;
|
|
973
|
+
},
|
|
974
|
+
checkConfiguration: function () {
|
|
975
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
976
|
+
return __generator(this, function (_a) {
|
|
977
|
+
return [2 /*return*/, /* not await */ llmTools.checkConfiguration()];
|
|
978
|
+
});
|
|
979
|
+
});
|
|
980
|
+
},
|
|
981
|
+
listModels: function () {
|
|
982
|
+
return /* not await */ llmTools.listModels();
|
|
983
|
+
},
|
|
984
|
+
getTotalUsage: function () {
|
|
985
|
+
// <- Note: [🥫] Not using getter `get totalUsage` but `getTotalUsage` to allow this object to be proxied
|
|
986
|
+
return totalUsage;
|
|
987
|
+
},
|
|
988
|
+
};
|
|
989
|
+
if (llmTools.callChatModel !== undefined) {
|
|
990
|
+
proxyTools.callChatModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
991
|
+
var promptResult;
|
|
992
|
+
return __generator(this, function (_a) {
|
|
993
|
+
switch (_a.label) {
|
|
994
|
+
case 0: return [4 /*yield*/, llmTools.callChatModel(prompt)];
|
|
995
|
+
case 1:
|
|
996
|
+
promptResult = _a.sent();
|
|
997
|
+
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
998
|
+
return [2 /*return*/, promptResult];
|
|
999
|
+
}
|
|
1000
|
+
});
|
|
1001
|
+
}); };
|
|
1002
|
+
}
|
|
1003
|
+
if (llmTools.callCompletionModel !== undefined) {
|
|
1004
|
+
proxyTools.callCompletionModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
1005
|
+
var promptResult;
|
|
1006
|
+
return __generator(this, function (_a) {
|
|
1007
|
+
switch (_a.label) {
|
|
1008
|
+
case 0: return [4 /*yield*/, llmTools.callCompletionModel(prompt)];
|
|
1009
|
+
case 1:
|
|
1010
|
+
promptResult = _a.sent();
|
|
1011
|
+
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
1012
|
+
return [2 /*return*/, promptResult];
|
|
1013
|
+
}
|
|
1014
|
+
});
|
|
1015
|
+
}); };
|
|
1016
|
+
}
|
|
1017
|
+
if (llmTools.callEmbeddingModel !== undefined) {
|
|
1018
|
+
proxyTools.callEmbeddingModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
1019
|
+
var promptResult;
|
|
1020
|
+
return __generator(this, function (_a) {
|
|
1021
|
+
switch (_a.label) {
|
|
1022
|
+
case 0: return [4 /*yield*/, llmTools.callEmbeddingModel(prompt)];
|
|
1023
|
+
case 1:
|
|
1024
|
+
promptResult = _a.sent();
|
|
1025
|
+
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
1026
|
+
return [2 /*return*/, promptResult];
|
|
1027
|
+
}
|
|
1028
|
+
});
|
|
1029
|
+
}); };
|
|
1030
|
+
}
|
|
1031
|
+
// <- Note: [🤖]
|
|
1032
|
+
return proxyTools;
|
|
1033
|
+
}
|
|
1034
|
+
/**
|
|
1035
|
+
* TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
|
|
1036
|
+
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
1037
|
+
* TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
|
|
1038
|
+
* > const [llmToolsWithUsage,getUsage] = countTotalUsage(llmTools);
|
|
1039
|
+
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
1040
|
+
*/
|
|
1041
|
+
|
|
856
1042
|
/**
|
|
857
1043
|
* This error indicates errors during the execution of the pipeline
|
|
858
1044
|
*
|
|
@@ -1161,188 +1347,6 @@ function joinLlmExecutionTools() {
|
|
|
1161
1347
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
1162
1348
|
*/
|
|
1163
1349
|
|
|
1164
|
-
/**
|
|
1165
|
-
* @@@
|
|
1166
|
-
*
|
|
1167
|
-
* @public exported from `@promptbook/utils`
|
|
1168
|
-
*/
|
|
1169
|
-
function deepClone(objectValue) {
|
|
1170
|
-
return JSON.parse(JSON.stringify(objectValue));
|
|
1171
|
-
/*
|
|
1172
|
-
TODO: [🧠] Is there a better implementation?
|
|
1173
|
-
> const propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
1174
|
-
> for (const propertyName of propertyNames) {
|
|
1175
|
-
> const value = (objectValue as really_any)[propertyName];
|
|
1176
|
-
> if (value && typeof value === 'object') {
|
|
1177
|
-
> deepClone(value);
|
|
1178
|
-
> }
|
|
1179
|
-
> }
|
|
1180
|
-
> return Object.assign({}, objectValue);
|
|
1181
|
-
*/
|
|
1182
|
-
}
|
|
1183
|
-
/**
|
|
1184
|
-
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
1185
|
-
*/
|
|
1186
|
-
|
|
1187
|
-
/**
|
|
1188
|
-
* Function `addUsage` will add multiple usages into one
|
|
1189
|
-
*
|
|
1190
|
-
* Note: If you provide 0 values, it returns ZERO_USAGE
|
|
1191
|
-
*
|
|
1192
|
-
* @public exported from `@promptbook/core`
|
|
1193
|
-
*/
|
|
1194
|
-
function addUsage() {
|
|
1195
|
-
var usageItems = [];
|
|
1196
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1197
|
-
usageItems[_i] = arguments[_i];
|
|
1198
|
-
}
|
|
1199
|
-
return usageItems.reduce(function (acc, item) {
|
|
1200
|
-
var e_1, _a, e_2, _b;
|
|
1201
|
-
var _c;
|
|
1202
|
-
acc.price.value += ((_c = item.price) === null || _c === void 0 ? void 0 : _c.value) || 0;
|
|
1203
|
-
try {
|
|
1204
|
-
for (var _d = __values(Object.keys(acc.input)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
1205
|
-
var key = _e.value;
|
|
1206
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1207
|
-
//@ts-ignore
|
|
1208
|
-
if (item.input[key]) {
|
|
1209
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1210
|
-
//@ts-ignore
|
|
1211
|
-
acc.input[key].value += item.input[key].value || 0;
|
|
1212
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1213
|
-
//@ts-ignore
|
|
1214
|
-
if (item.input[key].isUncertain) {
|
|
1215
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1216
|
-
//@ts-ignore
|
|
1217
|
-
acc.input[key].isUncertain = true;
|
|
1218
|
-
}
|
|
1219
|
-
}
|
|
1220
|
-
}
|
|
1221
|
-
}
|
|
1222
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1223
|
-
finally {
|
|
1224
|
-
try {
|
|
1225
|
-
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
1226
|
-
}
|
|
1227
|
-
finally { if (e_1) throw e_1.error; }
|
|
1228
|
-
}
|
|
1229
|
-
try {
|
|
1230
|
-
for (var _f = __values(Object.keys(acc.output)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
1231
|
-
var key = _g.value;
|
|
1232
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1233
|
-
//@ts-ignore
|
|
1234
|
-
if (item.output[key]) {
|
|
1235
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1236
|
-
//@ts-ignore
|
|
1237
|
-
acc.output[key].value += item.output[key].value || 0;
|
|
1238
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1239
|
-
//@ts-ignore
|
|
1240
|
-
if (item.output[key].isUncertain) {
|
|
1241
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1242
|
-
//@ts-ignore
|
|
1243
|
-
acc.output[key].isUncertain = true;
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
|
-
}
|
|
1247
|
-
}
|
|
1248
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1249
|
-
finally {
|
|
1250
|
-
try {
|
|
1251
|
-
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
1252
|
-
}
|
|
1253
|
-
finally { if (e_2) throw e_2.error; }
|
|
1254
|
-
}
|
|
1255
|
-
return acc;
|
|
1256
|
-
}, deepClone(ZERO_USAGE));
|
|
1257
|
-
}
|
|
1258
|
-
|
|
1259
|
-
/**
|
|
1260
|
-
* Intercepts LLM tools and counts total usage of the tools
|
|
1261
|
-
*
|
|
1262
|
-
* @param llmTools LLM tools to be intercepted with usage counting
|
|
1263
|
-
* @returns LLM tools with same functionality with added total cost counting
|
|
1264
|
-
* @public exported from `@promptbook/core`
|
|
1265
|
-
*/
|
|
1266
|
-
function countTotalUsage(llmTools) {
|
|
1267
|
-
var _this = this;
|
|
1268
|
-
var totalUsage = ZERO_USAGE;
|
|
1269
|
-
var proxyTools = {
|
|
1270
|
-
get title() {
|
|
1271
|
-
// TODO: [🧠] Maybe put here some suffix
|
|
1272
|
-
return llmTools.title;
|
|
1273
|
-
},
|
|
1274
|
-
get description() {
|
|
1275
|
-
// TODO: [🧠] Maybe put here some suffix
|
|
1276
|
-
return llmTools.description;
|
|
1277
|
-
},
|
|
1278
|
-
checkConfiguration: function () {
|
|
1279
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1280
|
-
return __generator(this, function (_a) {
|
|
1281
|
-
return [2 /*return*/, /* not await */ llmTools.checkConfiguration()];
|
|
1282
|
-
});
|
|
1283
|
-
});
|
|
1284
|
-
},
|
|
1285
|
-
listModels: function () {
|
|
1286
|
-
return /* not await */ llmTools.listModels();
|
|
1287
|
-
},
|
|
1288
|
-
getTotalUsage: function () {
|
|
1289
|
-
// <- Note: [🥫] Not using getter `get totalUsage` but `getTotalUsage` to allow this object to be proxied
|
|
1290
|
-
return totalUsage;
|
|
1291
|
-
},
|
|
1292
|
-
};
|
|
1293
|
-
if (llmTools.callChatModel !== undefined) {
|
|
1294
|
-
proxyTools.callChatModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
1295
|
-
var promptResult;
|
|
1296
|
-
return __generator(this, function (_a) {
|
|
1297
|
-
switch (_a.label) {
|
|
1298
|
-
case 0: return [4 /*yield*/, llmTools.callChatModel(prompt)];
|
|
1299
|
-
case 1:
|
|
1300
|
-
promptResult = _a.sent();
|
|
1301
|
-
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
1302
|
-
return [2 /*return*/, promptResult];
|
|
1303
|
-
}
|
|
1304
|
-
});
|
|
1305
|
-
}); };
|
|
1306
|
-
}
|
|
1307
|
-
if (llmTools.callCompletionModel !== undefined) {
|
|
1308
|
-
proxyTools.callCompletionModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
1309
|
-
var promptResult;
|
|
1310
|
-
return __generator(this, function (_a) {
|
|
1311
|
-
switch (_a.label) {
|
|
1312
|
-
case 0: return [4 /*yield*/, llmTools.callCompletionModel(prompt)];
|
|
1313
|
-
case 1:
|
|
1314
|
-
promptResult = _a.sent();
|
|
1315
|
-
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
1316
|
-
return [2 /*return*/, promptResult];
|
|
1317
|
-
}
|
|
1318
|
-
});
|
|
1319
|
-
}); };
|
|
1320
|
-
}
|
|
1321
|
-
if (llmTools.callEmbeddingModel !== undefined) {
|
|
1322
|
-
proxyTools.callEmbeddingModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
1323
|
-
var promptResult;
|
|
1324
|
-
return __generator(this, function (_a) {
|
|
1325
|
-
switch (_a.label) {
|
|
1326
|
-
case 0: return [4 /*yield*/, llmTools.callEmbeddingModel(prompt)];
|
|
1327
|
-
case 1:
|
|
1328
|
-
promptResult = _a.sent();
|
|
1329
|
-
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
1330
|
-
return [2 /*return*/, promptResult];
|
|
1331
|
-
}
|
|
1332
|
-
});
|
|
1333
|
-
}); };
|
|
1334
|
-
}
|
|
1335
|
-
// <- Note: [🤖]
|
|
1336
|
-
return proxyTools;
|
|
1337
|
-
}
|
|
1338
|
-
/**
|
|
1339
|
-
* TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
|
|
1340
|
-
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
1341
|
-
* TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
|
|
1342
|
-
* > const [llmToolsWithUsage,getUsage] = countTotalUsage(llmTools);
|
|
1343
|
-
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
1344
|
-
*/
|
|
1345
|
-
|
|
1346
1350
|
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"}];
|
|
1347
1351
|
|
|
1348
1352
|
/**
|
|
@@ -1418,7 +1422,7 @@ function isValidPromptbookVersion(version) {
|
|
|
1418
1422
|
if ( /* version === '1.0.0' || */version === '2.0.0' || version === '3.0.0') {
|
|
1419
1423
|
return false;
|
|
1420
1424
|
}
|
|
1421
|
-
// <- TODO: [main] !!! Check isValidPromptbookVersion against
|
|
1425
|
+
// <- TODO: [main] !!! Check isValidPromptbookVersion against PROMPTBOOK_ENGINE_VERSIONS
|
|
1422
1426
|
return true;
|
|
1423
1427
|
}
|
|
1424
1428
|
|
|
@@ -2383,23 +2387,6 @@ function union() {
|
|
|
2383
2387
|
return union;
|
|
2384
2388
|
}
|
|
2385
2389
|
|
|
2386
|
-
/**
|
|
2387
|
-
* Just marks a place of place where should be something implemented
|
|
2388
|
-
* No side effects.
|
|
2389
|
-
*
|
|
2390
|
-
* Note: It can be usefull suppressing eslint errors of unused variables
|
|
2391
|
-
*
|
|
2392
|
-
* @param value any values
|
|
2393
|
-
* @returns void
|
|
2394
|
-
* @private within the repository
|
|
2395
|
-
*/
|
|
2396
|
-
function TODO_USE() {
|
|
2397
|
-
var value = [];
|
|
2398
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2399
|
-
value[_i] = arguments[_i];
|
|
2400
|
-
}
|
|
2401
|
-
}
|
|
2402
|
-
|
|
2403
2390
|
/**
|
|
2404
2391
|
* This error indicates problems parsing the format value
|
|
2405
2392
|
*
|
|
@@ -2456,22 +2443,12 @@ var CsvFormatDefinition = {
|
|
|
2456
2443
|
formatName: 'CSV',
|
|
2457
2444
|
aliases: ['SPREADSHEET', 'TABLE'],
|
|
2458
2445
|
isValid: function (value, settings, schema) {
|
|
2459
|
-
// TODO: Implement CSV validation
|
|
2460
|
-
TODO_USE(value /* <- TODO: Use value here */);
|
|
2461
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2462
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2463
2446
|
return true;
|
|
2464
2447
|
},
|
|
2465
2448
|
canBeValid: function (partialValue, settings, schema) {
|
|
2466
|
-
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
2467
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2468
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2469
2449
|
return true;
|
|
2470
2450
|
},
|
|
2471
2451
|
heal: function (value, settings, schema) {
|
|
2472
|
-
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
2473
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2474
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2475
2452
|
throw new Error('Not implemented');
|
|
2476
2453
|
},
|
|
2477
2454
|
subvalueDefinitions: [
|
|
@@ -2590,20 +2567,12 @@ var JsonFormatDefinition = {
|
|
|
2590
2567
|
formatName: 'JSON',
|
|
2591
2568
|
mimeType: 'application/json',
|
|
2592
2569
|
isValid: function (value, settings, schema) {
|
|
2593
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2594
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2595
2570
|
return isValidJsonString(value);
|
|
2596
2571
|
},
|
|
2597
2572
|
canBeValid: function (partialValue, settings, schema) {
|
|
2598
|
-
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
2599
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2600
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2601
2573
|
return true;
|
|
2602
2574
|
},
|
|
2603
2575
|
heal: function (value, settings, schema) {
|
|
2604
|
-
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
2605
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2606
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2607
2576
|
throw new Error('Not implemented');
|
|
2608
2577
|
},
|
|
2609
2578
|
subvalueDefinitions: [],
|
|
@@ -2685,21 +2654,12 @@ var XmlFormatDefinition = {
|
|
|
2685
2654
|
formatName: 'XML',
|
|
2686
2655
|
mimeType: 'application/xml',
|
|
2687
2656
|
isValid: function (value, settings, schema) {
|
|
2688
|
-
TODO_USE(value /* <- TODO: Use value here */);
|
|
2689
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2690
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2691
2657
|
return true;
|
|
2692
2658
|
},
|
|
2693
2659
|
canBeValid: function (partialValue, settings, schema) {
|
|
2694
|
-
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
2695
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2696
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2697
2660
|
return true;
|
|
2698
2661
|
},
|
|
2699
2662
|
heal: function (value, settings, schema) {
|
|
2700
|
-
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
2701
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2702
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2703
2663
|
throw new Error('Not implemented');
|
|
2704
2664
|
},
|
|
2705
2665
|
subvalueDefinitions: [],
|
|
@@ -2932,27 +2892,6 @@ function arrayableToArray(input) {
|
|
|
2932
2892
|
return [input];
|
|
2933
2893
|
}
|
|
2934
2894
|
|
|
2935
|
-
/**
|
|
2936
|
-
* Just says that the variable is not used but should be kept
|
|
2937
|
-
* No side effects.
|
|
2938
|
-
*
|
|
2939
|
-
* Note: It can be usefull for:
|
|
2940
|
-
*
|
|
2941
|
-
* 1) Suppressing eager optimization of unused imports
|
|
2942
|
-
* 2) Suppressing eslint errors of unused variables in the tests
|
|
2943
|
-
* 3) Keeping the type of the variable for type testing
|
|
2944
|
-
*
|
|
2945
|
-
* @param value any values
|
|
2946
|
-
* @returns void
|
|
2947
|
-
* @private within the repository
|
|
2948
|
-
*/
|
|
2949
|
-
function keepUnused() {
|
|
2950
|
-
var valuesToKeep = [];
|
|
2951
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2952
|
-
valuesToKeep[_i] = arguments[_i];
|
|
2953
|
-
}
|
|
2954
|
-
}
|
|
2955
|
-
|
|
2956
2895
|
/**
|
|
2957
2896
|
* Replaces parameters in template with values from parameters object
|
|
2958
2897
|
*
|
|
@@ -3707,7 +3646,6 @@ function executeAttempts(options) {
|
|
|
3707
3646
|
$ongoingTemplateResult.$resultString = extractJsonBlock($ongoingTemplateResult.$resultString || '');
|
|
3708
3647
|
}
|
|
3709
3648
|
catch (error) {
|
|
3710
|
-
keepUnused(error);
|
|
3711
3649
|
throw new ExpectError(spaceTrim(function (block) { return "\n Expected valid JSON string\n\n ".concat(block(
|
|
3712
3650
|
/*<- Note: No need for `pipelineIdentification`, it will be catched and added later */ ''), "\n "); }));
|
|
3713
3651
|
}
|
|
@@ -3885,7 +3823,6 @@ function executeFormatSubvalues(options) {
|
|
|
3885
3823
|
function getContextForTemplate(template) {
|
|
3886
3824
|
return __awaiter(this, void 0, void 0, function () {
|
|
3887
3825
|
return __generator(this, function (_a) {
|
|
3888
|
-
TODO_USE(template);
|
|
3889
3826
|
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [🏍] Implement */];
|
|
3890
3827
|
});
|
|
3891
3828
|
});
|
|
@@ -3898,11 +3835,9 @@ function getContextForTemplate(template) {
|
|
|
3898
3835
|
*/
|
|
3899
3836
|
function getKnowledgeForTemplate(options) {
|
|
3900
3837
|
return __awaiter(this, void 0, void 0, function () {
|
|
3901
|
-
var preparedPipeline
|
|
3838
|
+
var preparedPipeline;
|
|
3902
3839
|
return __generator(this, function (_a) {
|
|
3903
|
-
preparedPipeline = options.preparedPipeline,
|
|
3904
|
-
// TODO: [♨] Implement Better - use real index and keyword search from `template` and {examples}
|
|
3905
|
-
TODO_USE(template);
|
|
3840
|
+
preparedPipeline = options.preparedPipeline, options.template;
|
|
3906
3841
|
return [2 /*return*/, preparedPipeline.knowledgePieces.map(function (_a) {
|
|
3907
3842
|
var content = _a.content;
|
|
3908
3843
|
return "- ".concat(content);
|
|
@@ -3919,8 +3854,6 @@ function getKnowledgeForTemplate(options) {
|
|
|
3919
3854
|
function getExamplesForTemplate(template) {
|
|
3920
3855
|
return __awaiter(this, void 0, void 0, function () {
|
|
3921
3856
|
return __generator(this, function (_a) {
|
|
3922
|
-
// TODO: [♨] Implement Better - use real index and keyword search
|
|
3923
|
-
TODO_USE(template);
|
|
3924
3857
|
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [♨] Implement */];
|
|
3925
3858
|
});
|
|
3926
3859
|
});
|
|
@@ -3939,13 +3872,13 @@ function getReservedParametersForTemplate(options) {
|
|
|
3939
3872
|
switch (_b.label) {
|
|
3940
3873
|
case 0:
|
|
3941
3874
|
preparedPipeline = options.preparedPipeline, template = options.template, pipelineIdentification = options.pipelineIdentification;
|
|
3942
|
-
return [4 /*yield*/, getContextForTemplate(
|
|
3875
|
+
return [4 /*yield*/, getContextForTemplate()];
|
|
3943
3876
|
case 1:
|
|
3944
3877
|
context = _b.sent();
|
|
3945
3878
|
return [4 /*yield*/, getKnowledgeForTemplate({ preparedPipeline: preparedPipeline, template: template })];
|
|
3946
3879
|
case 2:
|
|
3947
3880
|
knowledge = _b.sent();
|
|
3948
|
-
return [4 /*yield*/, getExamplesForTemplate(
|
|
3881
|
+
return [4 /*yield*/, getExamplesForTemplate()];
|
|
3949
3882
|
case 3:
|
|
3950
3883
|
examples = _b.sent();
|
|
3951
3884
|
currentDate = new Date().toISOString();
|
|
@@ -4180,7 +4113,7 @@ function executePipeline(options) {
|
|
|
4180
4113
|
executionReport = {
|
|
4181
4114
|
pipelineUrl: preparedPipeline.pipelineUrl,
|
|
4182
4115
|
title: preparedPipeline.title,
|
|
4183
|
-
promptbookUsedVersion:
|
|
4116
|
+
promptbookUsedVersion: PROMPTBOOK_ENGINE_VERSION,
|
|
4184
4117
|
promptbookRequestedVersion: preparedPipeline.promptbookVersion,
|
|
4185
4118
|
description: preparedPipeline.description,
|
|
4186
4119
|
promptExecutions: [],
|
|
@@ -5027,16 +4960,13 @@ function isValidFilePath(filename) {
|
|
|
5027
4960
|
function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
5028
4961
|
var _a;
|
|
5029
4962
|
return __awaiter(this, void 0, void 0, function () {
|
|
5030
|
-
var sourceContent, name, _b, _c, rootDirname,
|
|
5031
|
-
// <- TODO: process.cwd() if running in Node.js
|
|
5032
|
-
isVerbose, url, response_1, mimeType, filename_1, fileExtension, mimeType;
|
|
4963
|
+
var sourceContent, name, _b, _c, rootDirname, url, response_1, mimeType, filename_1, fileExtension, mimeType;
|
|
5033
4964
|
return __generator(this, function (_e) {
|
|
5034
4965
|
switch (_e.label) {
|
|
5035
4966
|
case 0:
|
|
5036
4967
|
sourceContent = knowledgeSource.sourceContent;
|
|
5037
4968
|
name = knowledgeSource.name;
|
|
5038
|
-
_b = options || {}, _c = _b.rootDirname, rootDirname = _c === void 0 ? null : _c,
|
|
5039
|
-
TODO_USE(isVerbose);
|
|
4969
|
+
_b = options || {}, _c = _b.rootDirname, rootDirname = _c === void 0 ? null : _c, _b.isVerbose;
|
|
5040
4970
|
if (!name) {
|
|
5041
4971
|
name = sourceContentToName(sourceContent);
|
|
5042
4972
|
}
|
|
@@ -5316,15 +5246,13 @@ function clonePipeline(pipeline) {
|
|
|
5316
5246
|
*/
|
|
5317
5247
|
function prepareTemplates(pipeline, tools, options) {
|
|
5318
5248
|
return __awaiter(this, void 0, void 0, function () {
|
|
5319
|
-
var _a, maxParallelCount, templates,
|
|
5249
|
+
var _a, maxParallelCount, templates, knowledgePiecesCount, templatesPrepared;
|
|
5320
5250
|
var _this = this;
|
|
5321
5251
|
return __generator(this, function (_b) {
|
|
5322
5252
|
switch (_b.label) {
|
|
5323
5253
|
case 0:
|
|
5324
5254
|
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a;
|
|
5325
|
-
templates = pipeline.templates,
|
|
5326
|
-
// TODO: [main] !! Apply examples to each template (if missing and is for the template defined)
|
|
5327
|
-
TODO_USE(parameters);
|
|
5255
|
+
templates = pipeline.templates, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
|
|
5328
5256
|
templatesPrepared = new Array(templates.length);
|
|
5329
5257
|
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 () {
|
|
5330
5258
|
var dependentParameterNames, preparedContent, preparedTemplate;
|
|
@@ -5394,7 +5322,7 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
5394
5322
|
currentPreparation = {
|
|
5395
5323
|
id: 1,
|
|
5396
5324
|
// TODO: [🍥]> date: $currentDate(),
|
|
5397
|
-
promptbookVersion:
|
|
5325
|
+
promptbookVersion: PROMPTBOOK_ENGINE_VERSION,
|
|
5398
5326
|
usage: ZERO_USAGE,
|
|
5399
5327
|
};
|
|
5400
5328
|
preparations = [
|
|
@@ -5534,7 +5462,6 @@ var knowledgeCommandParser = {
|
|
|
5534
5462
|
* Note: This is used in `pipelineJsonToString` utility
|
|
5535
5463
|
*/
|
|
5536
5464
|
stringify: function (command) {
|
|
5537
|
-
keepUnused(command);
|
|
5538
5465
|
return "---"; // <- TODO: [🛋] Implement
|
|
5539
5466
|
},
|
|
5540
5467
|
/**
|
|
@@ -5543,7 +5470,6 @@ var knowledgeCommandParser = {
|
|
|
5543
5470
|
* Note: This is used in `pipelineJsonToString` utility
|
|
5544
5471
|
*/
|
|
5545
5472
|
takeFromPipelineJson: function (pipelineJson) {
|
|
5546
|
-
keepUnused(pipelineJson);
|
|
5547
5473
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
5548
5474
|
},
|
|
5549
5475
|
};
|
|
@@ -5726,7 +5652,6 @@ var templateCommandParser = {
|
|
|
5726
5652
|
* Note: This is used in `pipelineJsonToString` utility
|
|
5727
5653
|
*/
|
|
5728
5654
|
stringify: function (command) {
|
|
5729
|
-
keepUnused(command);
|
|
5730
5655
|
return "---"; // <- TODO: [🛋] Implement
|
|
5731
5656
|
},
|
|
5732
5657
|
/**
|
|
@@ -5735,7 +5660,6 @@ var templateCommandParser = {
|
|
|
5735
5660
|
* Note: This is used in `pipelineJsonToString` utility
|
|
5736
5661
|
*/
|
|
5737
5662
|
takeFromTemplateJson: function ($templateJson) {
|
|
5738
|
-
keepUnused($templateJson);
|
|
5739
5663
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
5740
5664
|
},
|
|
5741
5665
|
};
|
|
@@ -5967,7 +5891,6 @@ var expectCommandParser = {
|
|
|
5967
5891
|
* Note: This is used in `pipelineJsonToString` utility
|
|
5968
5892
|
*/
|
|
5969
5893
|
stringify: function (command) {
|
|
5970
|
-
keepUnused(command);
|
|
5971
5894
|
return "---"; // <- TODO: [🛋] Implement
|
|
5972
5895
|
},
|
|
5973
5896
|
/**
|
|
@@ -5976,7 +5899,6 @@ var expectCommandParser = {
|
|
|
5976
5899
|
* Note: This is used in `pipelineJsonToString` utility
|
|
5977
5900
|
*/
|
|
5978
5901
|
takeFromTemplateJson: function ($templateJson) {
|
|
5979
|
-
keepUnused($templateJson);
|
|
5980
5902
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
5981
5903
|
},
|
|
5982
5904
|
};
|
|
@@ -6295,7 +6217,6 @@ var foreachCommandParser = {
|
|
|
6295
6217
|
inputSubparameterNames: inputSubparameterNames,
|
|
6296
6218
|
outputSubparameterName: outputSubparameterName,
|
|
6297
6219
|
};
|
|
6298
|
-
keepUnused($pipelineJson); // <- TODO: [🧠] Maybe register subparameter from foreach into parameters of the pipeline
|
|
6299
6220
|
// Note: [🍭] FOREACH apply has some sideeffects on different places in codebase
|
|
6300
6221
|
},
|
|
6301
6222
|
/**
|
|
@@ -6304,7 +6225,6 @@ var foreachCommandParser = {
|
|
|
6304
6225
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6305
6226
|
*/
|
|
6306
6227
|
stringify: function (command) {
|
|
6307
|
-
keepUnused(command);
|
|
6308
6228
|
return "---"; // <- TODO: [🛋] Implement
|
|
6309
6229
|
},
|
|
6310
6230
|
/**
|
|
@@ -6313,7 +6233,6 @@ var foreachCommandParser = {
|
|
|
6313
6233
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6314
6234
|
*/
|
|
6315
6235
|
takeFromTemplateJson: function ($templateJson) {
|
|
6316
|
-
keepUnused($templateJson);
|
|
6317
6236
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6318
6237
|
},
|
|
6319
6238
|
};
|
|
@@ -6381,7 +6300,6 @@ var formatCommandParser = {
|
|
|
6381
6300
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6382
6301
|
*/
|
|
6383
6302
|
stringify: function (command) {
|
|
6384
|
-
keepUnused(command);
|
|
6385
6303
|
return "---"; // <- TODO: [🛋] Implement
|
|
6386
6304
|
},
|
|
6387
6305
|
/**
|
|
@@ -6390,7 +6308,6 @@ var formatCommandParser = {
|
|
|
6390
6308
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6391
6309
|
*/
|
|
6392
6310
|
takeFromTemplateJson: function ($templateJson) {
|
|
6393
|
-
keepUnused($templateJson);
|
|
6394
6311
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6395
6312
|
},
|
|
6396
6313
|
};
|
|
@@ -6453,7 +6370,6 @@ var jokerCommandParser = {
|
|
|
6453
6370
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6454
6371
|
*/
|
|
6455
6372
|
stringify: function (command) {
|
|
6456
|
-
keepUnused(command);
|
|
6457
6373
|
return "---"; // <- TODO: [🛋] Implement
|
|
6458
6374
|
},
|
|
6459
6375
|
/**
|
|
@@ -6462,7 +6378,6 @@ var jokerCommandParser = {
|
|
|
6462
6378
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6463
6379
|
*/
|
|
6464
6380
|
takeFromTemplateJson: function ($templateJson) {
|
|
6465
|
-
keepUnused($templateJson);
|
|
6466
6381
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6467
6382
|
},
|
|
6468
6383
|
};
|
|
@@ -6598,7 +6513,6 @@ var modelCommandParser = {
|
|
|
6598
6513
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6599
6514
|
*/
|
|
6600
6515
|
stringify: function (command) {
|
|
6601
|
-
keepUnused(command);
|
|
6602
6516
|
return "---"; // <- TODO: [🛋] Implement
|
|
6603
6517
|
},
|
|
6604
6518
|
/**
|
|
@@ -6607,7 +6521,6 @@ var modelCommandParser = {
|
|
|
6607
6521
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6608
6522
|
*/
|
|
6609
6523
|
takeFromPipelineJson: function (pipelineJson) {
|
|
6610
|
-
keepUnused(pipelineJson);
|
|
6611
6524
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6612
6525
|
},
|
|
6613
6526
|
/**
|
|
@@ -6616,7 +6529,6 @@ var modelCommandParser = {
|
|
|
6616
6529
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6617
6530
|
*/
|
|
6618
6531
|
takeFromTemplateJson: function ($templateJson) {
|
|
6619
|
-
keepUnused($templateJson);
|
|
6620
6532
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6621
6533
|
},
|
|
6622
6534
|
};
|
|
@@ -6690,7 +6602,6 @@ var parameterCommandParser = {
|
|
|
6690
6602
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
6691
6603
|
*/
|
|
6692
6604
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
6693
|
-
keepUnused(command, $pipelineJson);
|
|
6694
6605
|
// Note: [🍣] Do nothing, its application is implemented separately in `pipelineStringToJsonSync`
|
|
6695
6606
|
},
|
|
6696
6607
|
/**
|
|
@@ -6699,7 +6610,6 @@ var parameterCommandParser = {
|
|
|
6699
6610
|
* Note: `$` is used to indicate that this function mutates given `templateJson`
|
|
6700
6611
|
*/
|
|
6701
6612
|
$applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
|
|
6702
|
-
keepUnused(command, $templateJson, $pipelineJson);
|
|
6703
6613
|
// Note: [🍣] Do nothing, its application is implemented separately in `pipelineStringToJsonSync`
|
|
6704
6614
|
},
|
|
6705
6615
|
/**
|
|
@@ -6708,7 +6618,6 @@ var parameterCommandParser = {
|
|
|
6708
6618
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6709
6619
|
*/
|
|
6710
6620
|
stringify: function (command) {
|
|
6711
|
-
keepUnused(command);
|
|
6712
6621
|
return "---"; // <- TODO: [🛋] Implement
|
|
6713
6622
|
},
|
|
6714
6623
|
/**
|
|
@@ -6717,7 +6626,6 @@ var parameterCommandParser = {
|
|
|
6717
6626
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6718
6627
|
*/
|
|
6719
6628
|
takeFromPipelineJson: function (pipelineJson) {
|
|
6720
|
-
keepUnused(pipelineJson);
|
|
6721
6629
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6722
6630
|
},
|
|
6723
6631
|
/**
|
|
@@ -6726,7 +6634,6 @@ var parameterCommandParser = {
|
|
|
6726
6634
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6727
6635
|
*/
|
|
6728
6636
|
takeFromTemplateJson: function ($templateJson) {
|
|
6729
|
-
keepUnused($templateJson);
|
|
6730
6637
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6731
6638
|
},
|
|
6732
6639
|
};
|
|
@@ -6798,7 +6705,6 @@ var personaCommandParser = {
|
|
|
6798
6705
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6799
6706
|
*/
|
|
6800
6707
|
stringify: function (command) {
|
|
6801
|
-
keepUnused(command);
|
|
6802
6708
|
return "---"; // <- TODO: [🛋] Implement
|
|
6803
6709
|
},
|
|
6804
6710
|
/**
|
|
@@ -6807,7 +6713,6 @@ var personaCommandParser = {
|
|
|
6807
6713
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6808
6714
|
*/
|
|
6809
6715
|
takeFromPipelineJson: function (pipelineJson) {
|
|
6810
|
-
keepUnused(pipelineJson);
|
|
6811
6716
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6812
6717
|
},
|
|
6813
6718
|
/**
|
|
@@ -6816,7 +6721,6 @@ var personaCommandParser = {
|
|
|
6816
6721
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6817
6722
|
*/
|
|
6818
6723
|
takeFromTemplateJson: function ($templateJson) {
|
|
6819
|
-
keepUnused($templateJson);
|
|
6820
6724
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6821
6725
|
},
|
|
6822
6726
|
};
|
|
@@ -6935,7 +6839,6 @@ var postprocessCommandParser = {
|
|
|
6935
6839
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6936
6840
|
*/
|
|
6937
6841
|
stringify: function (command) {
|
|
6938
|
-
keepUnused(command);
|
|
6939
6842
|
return "---"; // <- TODO: [🛋] Implement
|
|
6940
6843
|
},
|
|
6941
6844
|
/**
|
|
@@ -6944,42 +6847,41 @@ var postprocessCommandParser = {
|
|
|
6944
6847
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6945
6848
|
*/
|
|
6946
6849
|
takeFromTemplateJson: function ($templateJson) {
|
|
6947
|
-
keepUnused($templateJson);
|
|
6948
6850
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6949
6851
|
},
|
|
6950
6852
|
};
|
|
6951
6853
|
|
|
6952
6854
|
/**
|
|
6953
|
-
* Parses the
|
|
6855
|
+
* Parses the BOOK_VERSION command
|
|
6954
6856
|
*
|
|
6955
6857
|
* @see `documentationUrl` for more details
|
|
6956
6858
|
* @private within the commands folder
|
|
6957
6859
|
*/
|
|
6958
|
-
var
|
|
6860
|
+
var bookVersionCommandParser = {
|
|
6959
6861
|
/**
|
|
6960
6862
|
* Name of the command
|
|
6961
6863
|
*/
|
|
6962
|
-
name: '
|
|
6963
|
-
aliasNames: ['PTBK_VERSION', '
|
|
6864
|
+
name: 'BOOK_VERSION',
|
|
6865
|
+
aliasNames: ['PTBK_VERSION', 'PROMPTBOOK_VERSION', 'BOOK'],
|
|
6964
6866
|
/**
|
|
6965
6867
|
* BOILERPLATE command can be used in:
|
|
6966
6868
|
*/
|
|
6967
6869
|
isUsedInPipelineHead: true,
|
|
6968
6870
|
isUsedInPipelineTemplate: false,
|
|
6969
6871
|
/**
|
|
6970
|
-
* Description of the
|
|
6872
|
+
* Description of the BOOK_VERSION command
|
|
6971
6873
|
*/
|
|
6972
|
-
description: "Which version of the
|
|
6874
|
+
description: "Which version of the Book language is the .ptbk.md using",
|
|
6973
6875
|
/**
|
|
6974
6876
|
* Link to documentation
|
|
6975
6877
|
*/
|
|
6976
6878
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/69',
|
|
6977
6879
|
/**
|
|
6978
|
-
* Example usages of the
|
|
6880
|
+
* Example usages of the BOOK_VERSION command
|
|
6979
6881
|
*/
|
|
6980
|
-
examples: ["
|
|
6882
|
+
examples: ["BOOK VERSION ".concat(BOOK_LANGUAGE_VERSION), "BOOK ".concat(BOOK_LANGUAGE_VERSION)],
|
|
6981
6883
|
/**
|
|
6982
|
-
* Parses the
|
|
6884
|
+
* Parses the BOOK_VERSION command
|
|
6983
6885
|
*/
|
|
6984
6886
|
parse: function (input) {
|
|
6985
6887
|
var args = input.args;
|
|
@@ -6990,16 +6892,16 @@ var promptbookVersionCommandParser = {
|
|
|
6990
6892
|
if (!isValidPromptbookVersion(promptbookVersion)) {
|
|
6991
6893
|
throw new ParseError("Invalid Promptbook version \"".concat(promptbookVersion, "\""));
|
|
6992
6894
|
}
|
|
6993
|
-
if (args.length > 0) {
|
|
6895
|
+
if (args.length > 0 && !(((args.length === 1 && args[0]) || '').toUpperCase() === 'VERSION')) {
|
|
6994
6896
|
throw new ParseError("Can not have more than one Promptbook version");
|
|
6995
6897
|
}
|
|
6996
6898
|
return {
|
|
6997
|
-
type: '
|
|
6899
|
+
type: 'BOOK_VERSION',
|
|
6998
6900
|
promptbookVersion: promptbookVersion,
|
|
6999
6901
|
};
|
|
7000
6902
|
},
|
|
7001
6903
|
/**
|
|
7002
|
-
* Apply the
|
|
6904
|
+
* Apply the BOOK_VERSION command to the `pipelineJson`
|
|
7003
6905
|
*
|
|
7004
6906
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7005
6907
|
*/
|
|
@@ -7008,21 +6910,19 @@ var promptbookVersionCommandParser = {
|
|
|
7008
6910
|
$pipelineJson.promptbookVersion = command.promptbookVersion;
|
|
7009
6911
|
},
|
|
7010
6912
|
/**
|
|
7011
|
-
* Converts the
|
|
6913
|
+
* Converts the BOOK_VERSION command back to string
|
|
7012
6914
|
*
|
|
7013
6915
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7014
6916
|
*/
|
|
7015
6917
|
stringify: function (command) {
|
|
7016
|
-
keepUnused(command);
|
|
7017
6918
|
return "---"; // <- TODO: [🛋] Implement
|
|
7018
6919
|
},
|
|
7019
6920
|
/**
|
|
7020
|
-
* Reads the
|
|
6921
|
+
* Reads the BOOK_VERSION command from the `PipelineJson`
|
|
7021
6922
|
*
|
|
7022
6923
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7023
6924
|
*/
|
|
7024
6925
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7025
|
-
keepUnused(pipelineJson);
|
|
7026
6926
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7027
6927
|
},
|
|
7028
6928
|
};
|
|
@@ -7116,7 +7016,6 @@ var urlCommandParser = {
|
|
|
7116
7016
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7117
7017
|
*/
|
|
7118
7018
|
stringify: function (command) {
|
|
7119
|
-
keepUnused(command);
|
|
7120
7019
|
return "---"; // <- TODO: [🛋] Implement
|
|
7121
7020
|
},
|
|
7122
7021
|
/**
|
|
@@ -7125,7 +7024,6 @@ var urlCommandParser = {
|
|
|
7125
7024
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7126
7025
|
*/
|
|
7127
7026
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7128
|
-
keepUnused(pipelineJson);
|
|
7129
7027
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7130
7028
|
},
|
|
7131
7029
|
};
|
|
@@ -7162,8 +7060,7 @@ var actionCommandParser = {
|
|
|
7162
7060
|
* Parses the ACTION command
|
|
7163
7061
|
*/
|
|
7164
7062
|
parse: function (input) {
|
|
7165
|
-
|
|
7166
|
-
TODO_USE(args);
|
|
7063
|
+
input.args;
|
|
7167
7064
|
return {
|
|
7168
7065
|
type: 'ACTION',
|
|
7169
7066
|
};
|
|
@@ -7174,7 +7071,6 @@ var actionCommandParser = {
|
|
|
7174
7071
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7175
7072
|
*/
|
|
7176
7073
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
7177
|
-
keepUnused(command, $pipelineJson);
|
|
7178
7074
|
console.error(new NotYetImplementedError('[🛠] Actions are not implemented yet'));
|
|
7179
7075
|
},
|
|
7180
7076
|
/**
|
|
@@ -7183,7 +7079,6 @@ var actionCommandParser = {
|
|
|
7183
7079
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7184
7080
|
*/
|
|
7185
7081
|
stringify: function (command) {
|
|
7186
|
-
keepUnused(command);
|
|
7187
7082
|
throw new NotYetImplementedError('[🛠] Actions are not implemented yet');
|
|
7188
7083
|
},
|
|
7189
7084
|
/**
|
|
@@ -7192,7 +7087,6 @@ var actionCommandParser = {
|
|
|
7192
7087
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7193
7088
|
*/
|
|
7194
7089
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7195
|
-
keepUnused(pipelineJson);
|
|
7196
7090
|
throw new NotYetImplementedError('[🛠] Actions are not implemented yet');
|
|
7197
7091
|
},
|
|
7198
7092
|
};
|
|
@@ -7232,9 +7126,7 @@ var instrumentCommandParser = {
|
|
|
7232
7126
|
* Parses the INSTRUMENT command
|
|
7233
7127
|
*/
|
|
7234
7128
|
parse: function (input) {
|
|
7235
|
-
|
|
7236
|
-
// TODO: [🛠] Implement
|
|
7237
|
-
TODO_USE(args);
|
|
7129
|
+
input.args;
|
|
7238
7130
|
return {
|
|
7239
7131
|
type: 'INSTRUMENT',
|
|
7240
7132
|
};
|
|
@@ -7245,7 +7137,6 @@ var instrumentCommandParser = {
|
|
|
7245
7137
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7246
7138
|
*/
|
|
7247
7139
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
7248
|
-
keepUnused(command, $pipelineJson);
|
|
7249
7140
|
console.error(new NotYetImplementedError('[🛠] Instruments are not implemented yet'));
|
|
7250
7141
|
},
|
|
7251
7142
|
/**
|
|
@@ -7254,7 +7145,6 @@ var instrumentCommandParser = {
|
|
|
7254
7145
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7255
7146
|
*/
|
|
7256
7147
|
stringify: function (command) {
|
|
7257
|
-
keepUnused(command);
|
|
7258
7148
|
throw new NotYetImplementedError('[🛠] Instruments are not implemented yet');
|
|
7259
7149
|
},
|
|
7260
7150
|
/**
|
|
@@ -7263,7 +7153,6 @@ var instrumentCommandParser = {
|
|
|
7263
7153
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7264
7154
|
*/
|
|
7265
7155
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7266
|
-
keepUnused(pipelineJson);
|
|
7267
7156
|
throw new NotYetImplementedError('[🛠] Instruments are not implemented yet');
|
|
7268
7157
|
},
|
|
7269
7158
|
};
|
|
@@ -7328,7 +7217,6 @@ var boilerplateCommandParser = {
|
|
|
7328
7217
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7329
7218
|
*/
|
|
7330
7219
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
7331
|
-
keepUnused(command, $pipelineJson);
|
|
7332
7220
|
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
|
|
7333
7221
|
},
|
|
7334
7222
|
/**
|
|
@@ -7337,7 +7225,6 @@ var boilerplateCommandParser = {
|
|
|
7337
7225
|
* Note: `$` is used to indicate that this function mutates given `templateJson`
|
|
7338
7226
|
*/
|
|
7339
7227
|
$applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
|
|
7340
|
-
keepUnused(command, $templateJson, $pipelineJson);
|
|
7341
7228
|
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
|
|
7342
7229
|
},
|
|
7343
7230
|
/**
|
|
@@ -7346,7 +7233,6 @@ var boilerplateCommandParser = {
|
|
|
7346
7233
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7347
7234
|
*/
|
|
7348
7235
|
stringify: function (command) {
|
|
7349
|
-
keepUnused(command);
|
|
7350
7236
|
return "---"; // <- TODO: [🛋] Implement
|
|
7351
7237
|
},
|
|
7352
7238
|
/**
|
|
@@ -7355,7 +7241,6 @@ var boilerplateCommandParser = {
|
|
|
7355
7241
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7356
7242
|
*/
|
|
7357
7243
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7358
|
-
keepUnused(pipelineJson);
|
|
7359
7244
|
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
|
|
7360
7245
|
},
|
|
7361
7246
|
/**
|
|
@@ -7364,7 +7249,6 @@ var boilerplateCommandParser = {
|
|
|
7364
7249
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7365
7250
|
*/
|
|
7366
7251
|
takeFromTemplateJson: function ($templateJson) {
|
|
7367
|
-
keepUnused($templateJson);
|
|
7368
7252
|
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
|
|
7369
7253
|
},
|
|
7370
7254
|
};
|
|
@@ -7382,7 +7266,7 @@ var COMMANDS = [
|
|
|
7382
7266
|
modelCommandParser,
|
|
7383
7267
|
parameterCommandParser,
|
|
7384
7268
|
postprocessCommandParser,
|
|
7385
|
-
|
|
7269
|
+
bookVersionCommandParser,
|
|
7386
7270
|
urlCommandParser,
|
|
7387
7271
|
knowledgeCommandParser,
|
|
7388
7272
|
actionCommandParser,
|
|
@@ -7534,9 +7418,7 @@ function parseCommandVariant(input) {
|
|
|
7534
7418
|
var _loop_1 = function (commandParser) {
|
|
7535
7419
|
// <- Note: [🦦] Its strange that this type assertion is needed
|
|
7536
7420
|
var name_1 = commandParser.name, isUsedInPipelineHead = commandParser.isUsedInPipelineHead, isUsedInPipelineTemplate = commandParser.isUsedInPipelineTemplate, aliasNames = commandParser.aliasNames, deprecatedNames = commandParser.deprecatedNames, parse = commandParser.parse;
|
|
7537
|
-
if (just(false))
|
|
7538
|
-
keepUnused( /* for better indentation */);
|
|
7539
|
-
}
|
|
7421
|
+
if (just(false)) ;
|
|
7540
7422
|
else if (usagePlace === 'PIPELINE_HEAD' && !isUsedInPipelineHead) {
|
|
7541
7423
|
return "continue";
|
|
7542
7424
|
}
|
|
@@ -8255,8 +8137,7 @@ function $provideFilesystemForNode(options) {
|
|
|
8255
8137
|
if (!$isRunningInNode()) {
|
|
8256
8138
|
throw new EnvironmentMismatchError('Function `$provideFilesystemForNode` works only in Node.js environment');
|
|
8257
8139
|
}
|
|
8258
|
-
|
|
8259
|
-
TODO_USE(isVerbose);
|
|
8140
|
+
(options || {}).isVerbose;
|
|
8260
8141
|
return {
|
|
8261
8142
|
stat: stat,
|
|
8262
8143
|
access: access,
|
|
@@ -8502,7 +8383,7 @@ function locatePandoc() {
|
|
|
8502
8383
|
*/
|
|
8503
8384
|
function $provideExecutablesForNode(options) {
|
|
8504
8385
|
return __awaiter(this, void 0, void 0, function () {
|
|
8505
|
-
var _a
|
|
8386
|
+
var _a;
|
|
8506
8387
|
var _d;
|
|
8507
8388
|
return __generator(this, function (_e) {
|
|
8508
8389
|
switch (_e.label) {
|
|
@@ -8510,9 +8391,7 @@ function $provideExecutablesForNode(options) {
|
|
|
8510
8391
|
if (!$isRunningInNode()) {
|
|
8511
8392
|
throw new EnvironmentMismatchError('Function `$getScrapersForNode` works only in Node.js environment');
|
|
8512
8393
|
}
|
|
8513
|
-
_a = options || {},
|
|
8514
|
-
TODO_USE(isAutoInstalled); // <- TODO: [🔱][🧠] Auto-install the executables
|
|
8515
|
-
TODO_USE(isVerbose);
|
|
8394
|
+
_a = options || {}, _a.isAutoInstalled, _a.isVerbose;
|
|
8516
8395
|
_d = {};
|
|
8517
8396
|
return [4 /*yield*/, locatePandoc()];
|
|
8518
8397
|
case 1:
|
|
@@ -8769,7 +8648,7 @@ function $provideLlmToolsFromEnv(options) {
|
|
|
8769
8648
|
*/
|
|
8770
8649
|
function $provideScrapersForNode(tools, options) {
|
|
8771
8650
|
return __awaiter(this, void 0, void 0, function () {
|
|
8772
|
-
var _a,
|
|
8651
|
+
var _a, scrapers, _d, _e, scraperFactory, scraper, e_1_1;
|
|
8773
8652
|
var e_1, _f;
|
|
8774
8653
|
return __generator(this, function (_g) {
|
|
8775
8654
|
switch (_g.label) {
|
|
@@ -8777,9 +8656,7 @@ function $provideScrapersForNode(tools, options) {
|
|
|
8777
8656
|
if (!$isRunningInNode()) {
|
|
8778
8657
|
throw new EnvironmentMismatchError('Function `$getScrapersForNode` works only in Node.js environment');
|
|
8779
8658
|
}
|
|
8780
|
-
_a = options || {},
|
|
8781
|
-
TODO_USE(isAutoInstalled);
|
|
8782
|
-
TODO_USE(isVerbose);
|
|
8659
|
+
_a = options || {}, _a.isAutoInstalled, _a.isVerbose;
|
|
8783
8660
|
scrapers = [];
|
|
8784
8661
|
_g.label = 1;
|
|
8785
8662
|
case 1:
|
|
@@ -10088,5 +9965,5 @@ function $execCommands(_a) {
|
|
|
10088
9965
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
10089
9966
|
*/
|
|
10090
9967
|
|
|
10091
|
-
export { $execCommand, $execCommands, $provideExecutablesForNode, $provideExecutionToolsForNode, $provideFilesystemForNode, $provideLlmToolsConfigurationFromEnv, $provideLlmToolsFromEnv, $provideScrapersForNode, FileCacheStorage,
|
|
9968
|
+
export { $execCommand, $execCommands, $provideExecutablesForNode, $provideExecutionToolsForNode, $provideFilesystemForNode, $provideLlmToolsConfigurationFromEnv, $provideLlmToolsFromEnv, $provideScrapersForNode, BOOK_LANGUAGE_VERSION, FileCacheStorage, PROMPTBOOK_ENGINE_VERSION, createCollectionFromDirectory };
|
|
10092
9969
|
//# sourceMappingURL=index.es.js.map
|