@promptbook/core 0.74.0-0 → 0.74.0-12
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 +135 -30
- package/esm/index.es.js +427 -410
- 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 +7 -3
- 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 +14 -0
- package/esm/typings/src/cli/promptbookCli.d.ts +1 -0
- package/esm/typings/src/cli/test/ptbk.d.ts +5 -2
- package/esm/typings/src/collection/collectionToJson.test.d.ts +1 -1
- package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -1
- package/esm/typings/src/commands/BOOK_VERSION/BookVersionCommand.d.ts +11 -0
- package/esm/typings/src/commands/BOOK_VERSION/bookVersionCommandParser.d.ts +9 -0
- package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -1
- 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/config.d.ts +6 -0
- package/esm/typings/src/conversion/pipelineJsonToString.d.ts +3 -3
- package/esm/typings/src/conversion/pipelineStringToJson.d.ts +2 -2
- package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +2 -2
- package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -1
- package/esm/typings/src/conversion/validation/_importPipeline.d.ts +7 -7
- package/esm/typings/src/formats/_common/FormatDefinition.d.ts +1 -1
- package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +1 -1
- package/esm/typings/src/storage/blackhole/BlackholeStorage.d.ts +33 -0
- package/esm/typings/src/storage/memory/MemoryStorage.d.ts +1 -1
- package/esm/typings/src/storage/{memory/utils → utils}/PrefixStorage.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +6 -4
- package/esm/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -1
- package/esm/typings/src/types/Prompt.d.ts +1 -1
- package/esm/typings/src/types/typeAliases.d.ts +2 -2
- package/esm/typings/src/version.d.ts +13 -2
- package/package.json +1 -1
- package/umd/index.umd.js +430 -410
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/commands/PROMPTBOOK_VERSION/PromptbookVersionCommand.d.ts +0 -11
- 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/typings/src/storage/{memory → local-storage}/utils/makePromptbookStorageFromWebStorage.d.ts +0 -0
package/esm/index.es.js
CHANGED
|
@@ -12,10 +12,20 @@ import moment from 'moment';
|
|
|
12
12
|
|
|
13
13
|
// ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
|
|
14
14
|
/**
|
|
15
|
-
* The version of the
|
|
15
|
+
* The version of the Book language
|
|
16
|
+
*
|
|
17
|
+
* @see https://github.com/webgptorg/book
|
|
18
|
+
*/
|
|
19
|
+
var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
20
|
+
/**
|
|
21
|
+
* The version of the Promptbook engine
|
|
22
|
+
*
|
|
23
|
+
* @see https://github.com/webgptorg/promptbook
|
|
24
|
+
*/
|
|
25
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.74.0-11';
|
|
26
|
+
/**
|
|
27
|
+
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
16
28
|
*/
|
|
17
|
-
var PROMPTBOOK_VERSION = '0.73.0';
|
|
18
|
-
// TODO: [main] !!!! List here all the versions and annotate + put into script
|
|
19
29
|
|
|
20
30
|
/*! *****************************************************************************
|
|
21
31
|
Copyright (c) Microsoft Corporation.
|
|
@@ -209,13 +219,13 @@ function capitalize(word) {
|
|
|
209
219
|
/**
|
|
210
220
|
* Converts promptbook in JSON format to string format
|
|
211
221
|
*
|
|
212
|
-
* @param pipelineJson Promptbook in JSON format (.
|
|
213
|
-
* @returns Promptbook in string format (.
|
|
222
|
+
* @param pipelineJson Promptbook in JSON format (.book.json)
|
|
223
|
+
* @returns Promptbook in string format (.book.md)
|
|
214
224
|
* @public exported from `@promptbook/core`
|
|
215
225
|
*/
|
|
216
226
|
function pipelineJsonToString(pipelineJson) {
|
|
217
227
|
var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
|
|
218
|
-
var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl,
|
|
228
|
+
var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl, bookVersion = pipelineJson.bookVersion, description = pipelineJson.description, parameters = pipelineJson.parameters, templates = pipelineJson.templates;
|
|
219
229
|
var pipelineString = "# ".concat(title);
|
|
220
230
|
if (description) {
|
|
221
231
|
pipelineString += '\n\n';
|
|
@@ -225,8 +235,10 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
225
235
|
if (pipelineUrl) {
|
|
226
236
|
commands.push("PIPELINE URL ".concat(pipelineUrl));
|
|
227
237
|
}
|
|
228
|
-
|
|
229
|
-
|
|
238
|
+
if (bookVersion !== "undefined") {
|
|
239
|
+
commands.push("BOOK VERSION ".concat(bookVersion));
|
|
240
|
+
}
|
|
241
|
+
// TODO: [main] !!!!!! This increase size of the bundle and is probbably not necessary
|
|
230
242
|
pipelineString = prettifyMarkdown(pipelineString);
|
|
231
243
|
try {
|
|
232
244
|
for (var _g = __values(parameters.filter(function (_a) {
|
|
@@ -406,7 +418,7 @@ function templateParameterJsonToString(templateParameterJson) {
|
|
|
406
418
|
* TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
|
|
407
419
|
* TODO: [🏛] Maybe make some markdown builder
|
|
408
420
|
* TODO: [🏛] Escape all
|
|
409
|
-
* TODO: [🧠] Should be in generated .
|
|
421
|
+
* TODO: [🧠] Should be in generated .book.md file GENERATOR_WARNING
|
|
410
422
|
*/
|
|
411
423
|
|
|
412
424
|
/**
|
|
@@ -636,6 +648,13 @@ var GENERATOR_WARNING = "\u26A0\uFE0F WARNING: This code has been generated so t
|
|
|
636
648
|
* @public exported from `@promptbook/core`
|
|
637
649
|
*/
|
|
638
650
|
var CLAIM = "Build responsible, controlled and transparent applications on top of LLM models!";
|
|
651
|
+
// <- TODO: [🐊] Pick the best claim
|
|
652
|
+
/**
|
|
653
|
+
* When the title is not provided, the default title is used
|
|
654
|
+
*
|
|
655
|
+
* @public exported from `@promptbook/core`
|
|
656
|
+
*/
|
|
657
|
+
var DEFAULT_TITLE = "Untitled";
|
|
639
658
|
// <- TODO: [🧠] Better system for generator warnings - not always "code" and "by `@promptbook/cli`"
|
|
640
659
|
/**
|
|
641
660
|
* The maximum number of iterations for a loops
|
|
@@ -875,7 +894,7 @@ function isValidPromptbookVersion(version) {
|
|
|
875
894
|
if ( /* version === '1.0.0' || */version === '2.0.0' || version === '3.0.0') {
|
|
876
895
|
return false;
|
|
877
896
|
}
|
|
878
|
-
// <- TODO: [main] !!! Check isValidPromptbookVersion against
|
|
897
|
+
// <- TODO: [main] !!! Check isValidPromptbookVersion against PROMPTBOOK_ENGINE_VERSIONS
|
|
879
898
|
return true;
|
|
880
899
|
}
|
|
881
900
|
|
|
@@ -975,7 +994,7 @@ function isValidPipelineUrl(url) {
|
|
|
975
994
|
if (!url.startsWith('https://')) {
|
|
976
995
|
return false;
|
|
977
996
|
}
|
|
978
|
-
if (!url.endsWith('.
|
|
997
|
+
if (!(url.endsWith('.book.md') || url.endsWith('.book') || url.endsWith('.book.md') || url.endsWith('.ptbk'))) {
|
|
979
998
|
return false;
|
|
980
999
|
}
|
|
981
1000
|
if (url.includes('#')) {
|
|
@@ -1044,9 +1063,9 @@ function validatePipelineCore(pipeline) {
|
|
|
1044
1063
|
// <- Note: [🚲]
|
|
1045
1064
|
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Invalid promptbook URL \"".concat(pipeline.pipelineUrl, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1046
1065
|
}
|
|
1047
|
-
if (pipeline.
|
|
1066
|
+
if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
|
|
1048
1067
|
// <- Note: [🚲]
|
|
1049
|
-
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.
|
|
1068
|
+
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.bookVersion, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1050
1069
|
}
|
|
1051
1070
|
// TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
|
|
1052
1071
|
if (!Array.isArray(pipeline.parameters)) {
|
|
@@ -1803,6 +1822,188 @@ var UNCERTAIN_USAGE = $deepFreeze({
|
|
|
1803
1822
|
},
|
|
1804
1823
|
});
|
|
1805
1824
|
|
|
1825
|
+
/**
|
|
1826
|
+
* @@@
|
|
1827
|
+
*
|
|
1828
|
+
* @public exported from `@promptbook/utils`
|
|
1829
|
+
*/
|
|
1830
|
+
function deepClone(objectValue) {
|
|
1831
|
+
return JSON.parse(JSON.stringify(objectValue));
|
|
1832
|
+
/*
|
|
1833
|
+
TODO: [🧠] Is there a better implementation?
|
|
1834
|
+
> const propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
1835
|
+
> for (const propertyName of propertyNames) {
|
|
1836
|
+
> const value = (objectValue as really_any)[propertyName];
|
|
1837
|
+
> if (value && typeof value === 'object') {
|
|
1838
|
+
> deepClone(value);
|
|
1839
|
+
> }
|
|
1840
|
+
> }
|
|
1841
|
+
> return Object.assign({}, objectValue);
|
|
1842
|
+
*/
|
|
1843
|
+
}
|
|
1844
|
+
/**
|
|
1845
|
+
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
1846
|
+
*/
|
|
1847
|
+
|
|
1848
|
+
/**
|
|
1849
|
+
* Function `addUsage` will add multiple usages into one
|
|
1850
|
+
*
|
|
1851
|
+
* Note: If you provide 0 values, it returns ZERO_USAGE
|
|
1852
|
+
*
|
|
1853
|
+
* @public exported from `@promptbook/core`
|
|
1854
|
+
*/
|
|
1855
|
+
function addUsage() {
|
|
1856
|
+
var usageItems = [];
|
|
1857
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1858
|
+
usageItems[_i] = arguments[_i];
|
|
1859
|
+
}
|
|
1860
|
+
return usageItems.reduce(function (acc, item) {
|
|
1861
|
+
var e_1, _a, e_2, _b;
|
|
1862
|
+
var _c;
|
|
1863
|
+
acc.price.value += ((_c = item.price) === null || _c === void 0 ? void 0 : _c.value) || 0;
|
|
1864
|
+
try {
|
|
1865
|
+
for (var _d = __values(Object.keys(acc.input)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
1866
|
+
var key = _e.value;
|
|
1867
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1868
|
+
//@ts-ignore
|
|
1869
|
+
if (item.input[key]) {
|
|
1870
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1871
|
+
//@ts-ignore
|
|
1872
|
+
acc.input[key].value += item.input[key].value || 0;
|
|
1873
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1874
|
+
//@ts-ignore
|
|
1875
|
+
if (item.input[key].isUncertain) {
|
|
1876
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1877
|
+
//@ts-ignore
|
|
1878
|
+
acc.input[key].isUncertain = true;
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1884
|
+
finally {
|
|
1885
|
+
try {
|
|
1886
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
1887
|
+
}
|
|
1888
|
+
finally { if (e_1) throw e_1.error; }
|
|
1889
|
+
}
|
|
1890
|
+
try {
|
|
1891
|
+
for (var _f = __values(Object.keys(acc.output)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
1892
|
+
var key = _g.value;
|
|
1893
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1894
|
+
//@ts-ignore
|
|
1895
|
+
if (item.output[key]) {
|
|
1896
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1897
|
+
//@ts-ignore
|
|
1898
|
+
acc.output[key].value += item.output[key].value || 0;
|
|
1899
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1900
|
+
//@ts-ignore
|
|
1901
|
+
if (item.output[key].isUncertain) {
|
|
1902
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1903
|
+
//@ts-ignore
|
|
1904
|
+
acc.output[key].isUncertain = true;
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1910
|
+
finally {
|
|
1911
|
+
try {
|
|
1912
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
1913
|
+
}
|
|
1914
|
+
finally { if (e_2) throw e_2.error; }
|
|
1915
|
+
}
|
|
1916
|
+
return acc;
|
|
1917
|
+
}, deepClone(ZERO_USAGE));
|
|
1918
|
+
}
|
|
1919
|
+
|
|
1920
|
+
/**
|
|
1921
|
+
* Intercepts LLM tools and counts total usage of the tools
|
|
1922
|
+
*
|
|
1923
|
+
* @param llmTools LLM tools to be intercepted with usage counting
|
|
1924
|
+
* @returns LLM tools with same functionality with added total cost counting
|
|
1925
|
+
* @public exported from `@promptbook/core`
|
|
1926
|
+
*/
|
|
1927
|
+
function countTotalUsage(llmTools) {
|
|
1928
|
+
var _this = this;
|
|
1929
|
+
var totalUsage = ZERO_USAGE;
|
|
1930
|
+
var proxyTools = {
|
|
1931
|
+
get title() {
|
|
1932
|
+
// TODO: [🧠] Maybe put here some suffix
|
|
1933
|
+
return llmTools.title;
|
|
1934
|
+
},
|
|
1935
|
+
get description() {
|
|
1936
|
+
// TODO: [🧠] Maybe put here some suffix
|
|
1937
|
+
return llmTools.description;
|
|
1938
|
+
},
|
|
1939
|
+
checkConfiguration: function () {
|
|
1940
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1941
|
+
return __generator(this, function (_a) {
|
|
1942
|
+
return [2 /*return*/, /* not await */ llmTools.checkConfiguration()];
|
|
1943
|
+
});
|
|
1944
|
+
});
|
|
1945
|
+
},
|
|
1946
|
+
listModels: function () {
|
|
1947
|
+
return /* not await */ llmTools.listModels();
|
|
1948
|
+
},
|
|
1949
|
+
getTotalUsage: function () {
|
|
1950
|
+
// <- Note: [🥫] Not using getter `get totalUsage` but `getTotalUsage` to allow this object to be proxied
|
|
1951
|
+
return totalUsage;
|
|
1952
|
+
},
|
|
1953
|
+
};
|
|
1954
|
+
if (llmTools.callChatModel !== undefined) {
|
|
1955
|
+
proxyTools.callChatModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
1956
|
+
var promptResult;
|
|
1957
|
+
return __generator(this, function (_a) {
|
|
1958
|
+
switch (_a.label) {
|
|
1959
|
+
case 0: return [4 /*yield*/, llmTools.callChatModel(prompt)];
|
|
1960
|
+
case 1:
|
|
1961
|
+
promptResult = _a.sent();
|
|
1962
|
+
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
1963
|
+
return [2 /*return*/, promptResult];
|
|
1964
|
+
}
|
|
1965
|
+
});
|
|
1966
|
+
}); };
|
|
1967
|
+
}
|
|
1968
|
+
if (llmTools.callCompletionModel !== undefined) {
|
|
1969
|
+
proxyTools.callCompletionModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
1970
|
+
var promptResult;
|
|
1971
|
+
return __generator(this, function (_a) {
|
|
1972
|
+
switch (_a.label) {
|
|
1973
|
+
case 0: return [4 /*yield*/, llmTools.callCompletionModel(prompt)];
|
|
1974
|
+
case 1:
|
|
1975
|
+
promptResult = _a.sent();
|
|
1976
|
+
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
1977
|
+
return [2 /*return*/, promptResult];
|
|
1978
|
+
}
|
|
1979
|
+
});
|
|
1980
|
+
}); };
|
|
1981
|
+
}
|
|
1982
|
+
if (llmTools.callEmbeddingModel !== undefined) {
|
|
1983
|
+
proxyTools.callEmbeddingModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
1984
|
+
var promptResult;
|
|
1985
|
+
return __generator(this, function (_a) {
|
|
1986
|
+
switch (_a.label) {
|
|
1987
|
+
case 0: return [4 /*yield*/, llmTools.callEmbeddingModel(prompt)];
|
|
1988
|
+
case 1:
|
|
1989
|
+
promptResult = _a.sent();
|
|
1990
|
+
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
1991
|
+
return [2 /*return*/, promptResult];
|
|
1992
|
+
}
|
|
1993
|
+
});
|
|
1994
|
+
}); };
|
|
1995
|
+
}
|
|
1996
|
+
// <- Note: [🤖]
|
|
1997
|
+
return proxyTools;
|
|
1998
|
+
}
|
|
1999
|
+
/**
|
|
2000
|
+
* TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
|
|
2001
|
+
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
2002
|
+
* TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
|
|
2003
|
+
* > const [llmToolsWithUsage,getUsage] = countTotalUsage(llmTools);
|
|
2004
|
+
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
2005
|
+
*/
|
|
2006
|
+
|
|
1806
2007
|
/**
|
|
1807
2008
|
* This error indicates errors during the execution of the pipeline
|
|
1808
2009
|
*
|
|
@@ -2111,189 +2312,7 @@ function joinLlmExecutionTools() {
|
|
|
2111
2312
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
2112
2313
|
*/
|
|
2113
2314
|
|
|
2114
|
-
|
|
2115
|
-
* @@@
|
|
2116
|
-
*
|
|
2117
|
-
* @public exported from `@promptbook/utils`
|
|
2118
|
-
*/
|
|
2119
|
-
function deepClone(objectValue) {
|
|
2120
|
-
return JSON.parse(JSON.stringify(objectValue));
|
|
2121
|
-
/*
|
|
2122
|
-
TODO: [🧠] Is there a better implementation?
|
|
2123
|
-
> const propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
2124
|
-
> for (const propertyName of propertyNames) {
|
|
2125
|
-
> const value = (objectValue as really_any)[propertyName];
|
|
2126
|
-
> if (value && typeof value === 'object') {
|
|
2127
|
-
> deepClone(value);
|
|
2128
|
-
> }
|
|
2129
|
-
> }
|
|
2130
|
-
> return Object.assign({}, objectValue);
|
|
2131
|
-
*/
|
|
2132
|
-
}
|
|
2133
|
-
/**
|
|
2134
|
-
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
2135
|
-
*/
|
|
2136
|
-
|
|
2137
|
-
/**
|
|
2138
|
-
* Function `addUsage` will add multiple usages into one
|
|
2139
|
-
*
|
|
2140
|
-
* Note: If you provide 0 values, it returns ZERO_USAGE
|
|
2141
|
-
*
|
|
2142
|
-
* @public exported from `@promptbook/core`
|
|
2143
|
-
*/
|
|
2144
|
-
function addUsage() {
|
|
2145
|
-
var usageItems = [];
|
|
2146
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2147
|
-
usageItems[_i] = arguments[_i];
|
|
2148
|
-
}
|
|
2149
|
-
return usageItems.reduce(function (acc, item) {
|
|
2150
|
-
var e_1, _a, e_2, _b;
|
|
2151
|
-
var _c;
|
|
2152
|
-
acc.price.value += ((_c = item.price) === null || _c === void 0 ? void 0 : _c.value) || 0;
|
|
2153
|
-
try {
|
|
2154
|
-
for (var _d = __values(Object.keys(acc.input)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
2155
|
-
var key = _e.value;
|
|
2156
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2157
|
-
//@ts-ignore
|
|
2158
|
-
if (item.input[key]) {
|
|
2159
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2160
|
-
//@ts-ignore
|
|
2161
|
-
acc.input[key].value += item.input[key].value || 0;
|
|
2162
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2163
|
-
//@ts-ignore
|
|
2164
|
-
if (item.input[key].isUncertain) {
|
|
2165
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2166
|
-
//@ts-ignore
|
|
2167
|
-
acc.input[key].isUncertain = true;
|
|
2168
|
-
}
|
|
2169
|
-
}
|
|
2170
|
-
}
|
|
2171
|
-
}
|
|
2172
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2173
|
-
finally {
|
|
2174
|
-
try {
|
|
2175
|
-
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
2176
|
-
}
|
|
2177
|
-
finally { if (e_1) throw e_1.error; }
|
|
2178
|
-
}
|
|
2179
|
-
try {
|
|
2180
|
-
for (var _f = __values(Object.keys(acc.output)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
2181
|
-
var key = _g.value;
|
|
2182
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2183
|
-
//@ts-ignore
|
|
2184
|
-
if (item.output[key]) {
|
|
2185
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2186
|
-
//@ts-ignore
|
|
2187
|
-
acc.output[key].value += item.output[key].value || 0;
|
|
2188
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2189
|
-
//@ts-ignore
|
|
2190
|
-
if (item.output[key].isUncertain) {
|
|
2191
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2192
|
-
//@ts-ignore
|
|
2193
|
-
acc.output[key].isUncertain = true;
|
|
2194
|
-
}
|
|
2195
|
-
}
|
|
2196
|
-
}
|
|
2197
|
-
}
|
|
2198
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
2199
|
-
finally {
|
|
2200
|
-
try {
|
|
2201
|
-
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
2202
|
-
}
|
|
2203
|
-
finally { if (e_2) throw e_2.error; }
|
|
2204
|
-
}
|
|
2205
|
-
return acc;
|
|
2206
|
-
}, deepClone(ZERO_USAGE));
|
|
2207
|
-
}
|
|
2208
|
-
|
|
2209
|
-
/**
|
|
2210
|
-
* Intercepts LLM tools and counts total usage of the tools
|
|
2211
|
-
*
|
|
2212
|
-
* @param llmTools LLM tools to be intercepted with usage counting
|
|
2213
|
-
* @returns LLM tools with same functionality with added total cost counting
|
|
2214
|
-
* @public exported from `@promptbook/core`
|
|
2215
|
-
*/
|
|
2216
|
-
function countTotalUsage(llmTools) {
|
|
2217
|
-
var _this = this;
|
|
2218
|
-
var totalUsage = ZERO_USAGE;
|
|
2219
|
-
var proxyTools = {
|
|
2220
|
-
get title() {
|
|
2221
|
-
// TODO: [🧠] Maybe put here some suffix
|
|
2222
|
-
return llmTools.title;
|
|
2223
|
-
},
|
|
2224
|
-
get description() {
|
|
2225
|
-
// TODO: [🧠] Maybe put here some suffix
|
|
2226
|
-
return llmTools.description;
|
|
2227
|
-
},
|
|
2228
|
-
checkConfiguration: function () {
|
|
2229
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2230
|
-
return __generator(this, function (_a) {
|
|
2231
|
-
return [2 /*return*/, /* not await */ llmTools.checkConfiguration()];
|
|
2232
|
-
});
|
|
2233
|
-
});
|
|
2234
|
-
},
|
|
2235
|
-
listModels: function () {
|
|
2236
|
-
return /* not await */ llmTools.listModels();
|
|
2237
|
-
},
|
|
2238
|
-
getTotalUsage: function () {
|
|
2239
|
-
// <- Note: [🥫] Not using getter `get totalUsage` but `getTotalUsage` to allow this object to be proxied
|
|
2240
|
-
return totalUsage;
|
|
2241
|
-
},
|
|
2242
|
-
};
|
|
2243
|
-
if (llmTools.callChatModel !== undefined) {
|
|
2244
|
-
proxyTools.callChatModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
2245
|
-
var promptResult;
|
|
2246
|
-
return __generator(this, function (_a) {
|
|
2247
|
-
switch (_a.label) {
|
|
2248
|
-
case 0: return [4 /*yield*/, llmTools.callChatModel(prompt)];
|
|
2249
|
-
case 1:
|
|
2250
|
-
promptResult = _a.sent();
|
|
2251
|
-
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
2252
|
-
return [2 /*return*/, promptResult];
|
|
2253
|
-
}
|
|
2254
|
-
});
|
|
2255
|
-
}); };
|
|
2256
|
-
}
|
|
2257
|
-
if (llmTools.callCompletionModel !== undefined) {
|
|
2258
|
-
proxyTools.callCompletionModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
2259
|
-
var promptResult;
|
|
2260
|
-
return __generator(this, function (_a) {
|
|
2261
|
-
switch (_a.label) {
|
|
2262
|
-
case 0: return [4 /*yield*/, llmTools.callCompletionModel(prompt)];
|
|
2263
|
-
case 1:
|
|
2264
|
-
promptResult = _a.sent();
|
|
2265
|
-
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
2266
|
-
return [2 /*return*/, promptResult];
|
|
2267
|
-
}
|
|
2268
|
-
});
|
|
2269
|
-
}); };
|
|
2270
|
-
}
|
|
2271
|
-
if (llmTools.callEmbeddingModel !== undefined) {
|
|
2272
|
-
proxyTools.callEmbeddingModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
2273
|
-
var promptResult;
|
|
2274
|
-
return __generator(this, function (_a) {
|
|
2275
|
-
switch (_a.label) {
|
|
2276
|
-
case 0: return [4 /*yield*/, llmTools.callEmbeddingModel(prompt)];
|
|
2277
|
-
case 1:
|
|
2278
|
-
promptResult = _a.sent();
|
|
2279
|
-
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
2280
|
-
return [2 /*return*/, promptResult];
|
|
2281
|
-
}
|
|
2282
|
-
});
|
|
2283
|
-
}); };
|
|
2284
|
-
}
|
|
2285
|
-
// <- Note: [🤖]
|
|
2286
|
-
return proxyTools;
|
|
2287
|
-
}
|
|
2288
|
-
/**
|
|
2289
|
-
* TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
|
|
2290
|
-
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
2291
|
-
* TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
|
|
2292
|
-
* > const [llmToolsWithUsage,getUsage] = countTotalUsage(llmTools);
|
|
2293
|
-
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
2294
|
-
*/
|
|
2295
|
-
|
|
2296
|
-
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"}];
|
|
2315
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.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.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.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.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.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.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.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.book.md"}];
|
|
2297
2316
|
|
|
2298
2317
|
/**
|
|
2299
2318
|
* This error indicates that the pipeline collection cannot be propperly loaded
|
|
@@ -2697,23 +2716,6 @@ function union() {
|
|
|
2697
2716
|
return union;
|
|
2698
2717
|
}
|
|
2699
2718
|
|
|
2700
|
-
/**
|
|
2701
|
-
* Just marks a place of place where should be something implemented
|
|
2702
|
-
* No side effects.
|
|
2703
|
-
*
|
|
2704
|
-
* Note: It can be usefull suppressing eslint errors of unused variables
|
|
2705
|
-
*
|
|
2706
|
-
* @param value any values
|
|
2707
|
-
* @returns void
|
|
2708
|
-
* @private within the repository
|
|
2709
|
-
*/
|
|
2710
|
-
function TODO_USE() {
|
|
2711
|
-
var value = [];
|
|
2712
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2713
|
-
value[_i] = arguments[_i];
|
|
2714
|
-
}
|
|
2715
|
-
}
|
|
2716
|
-
|
|
2717
2719
|
/**
|
|
2718
2720
|
* This error indicates problems parsing the format value
|
|
2719
2721
|
*
|
|
@@ -2770,22 +2772,12 @@ var CsvFormatDefinition = {
|
|
|
2770
2772
|
formatName: 'CSV',
|
|
2771
2773
|
aliases: ['SPREADSHEET', 'TABLE'],
|
|
2772
2774
|
isValid: function (value, settings, schema) {
|
|
2773
|
-
// TODO: Implement CSV validation
|
|
2774
|
-
TODO_USE(value /* <- TODO: Use value here */);
|
|
2775
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2776
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2777
2775
|
return true;
|
|
2778
2776
|
},
|
|
2779
2777
|
canBeValid: function (partialValue, settings, schema) {
|
|
2780
|
-
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
2781
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2782
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2783
2778
|
return true;
|
|
2784
2779
|
},
|
|
2785
2780
|
heal: function (value, settings, schema) {
|
|
2786
|
-
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
2787
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2788
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2789
2781
|
throw new Error('Not implemented');
|
|
2790
2782
|
},
|
|
2791
2783
|
subvalueDefinitions: [
|
|
@@ -2904,20 +2896,12 @@ var JsonFormatDefinition = {
|
|
|
2904
2896
|
formatName: 'JSON',
|
|
2905
2897
|
mimeType: 'application/json',
|
|
2906
2898
|
isValid: function (value, settings, schema) {
|
|
2907
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2908
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2909
2899
|
return isValidJsonString(value);
|
|
2910
2900
|
},
|
|
2911
2901
|
canBeValid: function (partialValue, settings, schema) {
|
|
2912
|
-
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
2913
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2914
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2915
2902
|
return true;
|
|
2916
2903
|
},
|
|
2917
2904
|
heal: function (value, settings, schema) {
|
|
2918
|
-
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
2919
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2920
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2921
2905
|
throw new Error('Not implemented');
|
|
2922
2906
|
},
|
|
2923
2907
|
subvalueDefinitions: [],
|
|
@@ -2999,21 +2983,12 @@ var XmlFormatDefinition = {
|
|
|
2999
2983
|
formatName: 'XML',
|
|
3000
2984
|
mimeType: 'application/xml',
|
|
3001
2985
|
isValid: function (value, settings, schema) {
|
|
3002
|
-
TODO_USE(value /* <- TODO: Use value here */);
|
|
3003
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3004
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3005
2986
|
return true;
|
|
3006
2987
|
},
|
|
3007
2988
|
canBeValid: function (partialValue, settings, schema) {
|
|
3008
|
-
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
3009
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3010
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3011
2989
|
return true;
|
|
3012
2990
|
},
|
|
3013
2991
|
heal: function (value, settings, schema) {
|
|
3014
|
-
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
3015
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3016
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3017
2992
|
throw new Error('Not implemented');
|
|
3018
2993
|
},
|
|
3019
2994
|
subvalueDefinitions: [],
|
|
@@ -3246,27 +3221,6 @@ function arrayableToArray(input) {
|
|
|
3246
3221
|
return [input];
|
|
3247
3222
|
}
|
|
3248
3223
|
|
|
3249
|
-
/**
|
|
3250
|
-
* Just says that the variable is not used but should be kept
|
|
3251
|
-
* No side effects.
|
|
3252
|
-
*
|
|
3253
|
-
* Note: It can be usefull for:
|
|
3254
|
-
*
|
|
3255
|
-
* 1) Suppressing eager optimization of unused imports
|
|
3256
|
-
* 2) Suppressing eslint errors of unused variables in the tests
|
|
3257
|
-
* 3) Keeping the type of the variable for type testing
|
|
3258
|
-
*
|
|
3259
|
-
* @param value any values
|
|
3260
|
-
* @returns void
|
|
3261
|
-
* @private within the repository
|
|
3262
|
-
*/
|
|
3263
|
-
function keepUnused() {
|
|
3264
|
-
var valuesToKeep = [];
|
|
3265
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3266
|
-
valuesToKeep[_i] = arguments[_i];
|
|
3267
|
-
}
|
|
3268
|
-
}
|
|
3269
|
-
|
|
3270
3224
|
/**
|
|
3271
3225
|
* Replaces parameters in template with values from parameters object
|
|
3272
3226
|
*
|
|
@@ -3379,10 +3333,12 @@ function countLines(text) {
|
|
|
3379
3333
|
* @public exported from `@promptbook/utils`
|
|
3380
3334
|
*/
|
|
3381
3335
|
function countPages(text) {
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3336
|
+
if (text === '') {
|
|
3337
|
+
return 0;
|
|
3338
|
+
}
|
|
3339
|
+
var pagesByLinesCount = Math.ceil(countLines(text) / 44);
|
|
3340
|
+
var pagesByCharactersCount = Math.ceil(countCharacters(text) / 2772);
|
|
3341
|
+
return Math.max(pagesByLinesCount, pagesByCharactersCount);
|
|
3386
3342
|
}
|
|
3387
3343
|
|
|
3388
3344
|
/**
|
|
@@ -3945,7 +3901,7 @@ function executeAttempts(options) {
|
|
|
3945
3901
|
promptTitle: template.title,
|
|
3946
3902
|
promptMessage: replaceParameters(template.description || '', parameters),
|
|
3947
3903
|
defaultValue: replaceParameters(preparedContent, parameters),
|
|
3948
|
-
// TODO: [🧠] !! Figure out how to define placeholder in .
|
|
3904
|
+
// TODO: [🧠] !! Figure out how to define placeholder in .book.md file
|
|
3949
3905
|
placeholder: undefined,
|
|
3950
3906
|
priority: priority,
|
|
3951
3907
|
}))];
|
|
@@ -4043,7 +3999,6 @@ function executeAttempts(options) {
|
|
|
4043
3999
|
$ongoingTemplateResult.$resultString = extractJsonBlock($ongoingTemplateResult.$resultString || '');
|
|
4044
4000
|
}
|
|
4045
4001
|
catch (error) {
|
|
4046
|
-
keepUnused(error);
|
|
4047
4002
|
throw new ExpectError(spaceTrim$1(function (block) { return "\n Expected valid JSON string\n\n ".concat(block(
|
|
4048
4003
|
/*<- Note: No need for `pipelineIdentification`, it will be catched and added later */ ''), "\n "); }));
|
|
4049
4004
|
}
|
|
@@ -4221,7 +4176,6 @@ function executeFormatSubvalues(options) {
|
|
|
4221
4176
|
function getContextForTemplate(template) {
|
|
4222
4177
|
return __awaiter(this, void 0, void 0, function () {
|
|
4223
4178
|
return __generator(this, function (_a) {
|
|
4224
|
-
TODO_USE(template);
|
|
4225
4179
|
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [🏍] Implement */];
|
|
4226
4180
|
});
|
|
4227
4181
|
});
|
|
@@ -4234,11 +4188,9 @@ function getContextForTemplate(template) {
|
|
|
4234
4188
|
*/
|
|
4235
4189
|
function getKnowledgeForTemplate(options) {
|
|
4236
4190
|
return __awaiter(this, void 0, void 0, function () {
|
|
4237
|
-
var preparedPipeline
|
|
4191
|
+
var preparedPipeline;
|
|
4238
4192
|
return __generator(this, function (_a) {
|
|
4239
|
-
preparedPipeline = options.preparedPipeline,
|
|
4240
|
-
// TODO: [♨] Implement Better - use real index and keyword search from `template` and {examples}
|
|
4241
|
-
TODO_USE(template);
|
|
4193
|
+
preparedPipeline = options.preparedPipeline, options.template;
|
|
4242
4194
|
return [2 /*return*/, preparedPipeline.knowledgePieces.map(function (_a) {
|
|
4243
4195
|
var content = _a.content;
|
|
4244
4196
|
return "- ".concat(content);
|
|
@@ -4255,8 +4207,6 @@ function getKnowledgeForTemplate(options) {
|
|
|
4255
4207
|
function getExamplesForTemplate(template) {
|
|
4256
4208
|
return __awaiter(this, void 0, void 0, function () {
|
|
4257
4209
|
return __generator(this, function (_a) {
|
|
4258
|
-
// TODO: [♨] Implement Better - use real index and keyword search
|
|
4259
|
-
TODO_USE(template);
|
|
4260
4210
|
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [♨] Implement */];
|
|
4261
4211
|
});
|
|
4262
4212
|
});
|
|
@@ -4275,13 +4225,13 @@ function getReservedParametersForTemplate(options) {
|
|
|
4275
4225
|
switch (_b.label) {
|
|
4276
4226
|
case 0:
|
|
4277
4227
|
preparedPipeline = options.preparedPipeline, template = options.template, pipelineIdentification = options.pipelineIdentification;
|
|
4278
|
-
return [4 /*yield*/, getContextForTemplate(
|
|
4228
|
+
return [4 /*yield*/, getContextForTemplate()];
|
|
4279
4229
|
case 1:
|
|
4280
4230
|
context = _b.sent();
|
|
4281
4231
|
return [4 /*yield*/, getKnowledgeForTemplate({ preparedPipeline: preparedPipeline, template: template })];
|
|
4282
4232
|
case 2:
|
|
4283
4233
|
knowledge = _b.sent();
|
|
4284
|
-
return [4 /*yield*/, getExamplesForTemplate(
|
|
4234
|
+
return [4 /*yield*/, getExamplesForTemplate()];
|
|
4285
4235
|
case 3:
|
|
4286
4236
|
examples = _b.sent();
|
|
4287
4237
|
currentDate = new Date().toISOString();
|
|
@@ -4516,8 +4466,8 @@ function executePipeline(options) {
|
|
|
4516
4466
|
executionReport = {
|
|
4517
4467
|
pipelineUrl: preparedPipeline.pipelineUrl,
|
|
4518
4468
|
title: preparedPipeline.title,
|
|
4519
|
-
promptbookUsedVersion:
|
|
4520
|
-
promptbookRequestedVersion: preparedPipeline.
|
|
4469
|
+
promptbookUsedVersion: PROMPTBOOK_ENGINE_VERSION,
|
|
4470
|
+
promptbookRequestedVersion: preparedPipeline.bookVersion,
|
|
4521
4471
|
description: preparedPipeline.description,
|
|
4522
4472
|
promptExecutions: [],
|
|
4523
4473
|
};
|
|
@@ -4866,7 +4816,7 @@ function preparePersona(personaDescription, tools, options) {
|
|
|
4866
4816
|
collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
|
|
4867
4817
|
_b = createPipelineExecutor;
|
|
4868
4818
|
_c = {};
|
|
4869
|
-
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.
|
|
4819
|
+
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book.md')];
|
|
4870
4820
|
case 1:
|
|
4871
4821
|
preparePersonaExecutor = _b.apply(void 0, [(_c.pipeline = _d.sent(),
|
|
4872
4822
|
_c.tools = tools,
|
|
@@ -5363,16 +5313,13 @@ function isValidFilePath(filename) {
|
|
|
5363
5313
|
function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
5364
5314
|
var _a;
|
|
5365
5315
|
return __awaiter(this, void 0, void 0, function () {
|
|
5366
|
-
var sourceContent, name, _b, _c, rootDirname,
|
|
5367
|
-
// <- TODO: process.cwd() if running in Node.js
|
|
5368
|
-
isVerbose, url, response_1, mimeType, filename_1, fileExtension, mimeType;
|
|
5316
|
+
var sourceContent, name, _b, _c, rootDirname, url, response_1, mimeType, filename_1, fileExtension, mimeType;
|
|
5369
5317
|
return __generator(this, function (_e) {
|
|
5370
5318
|
switch (_e.label) {
|
|
5371
5319
|
case 0:
|
|
5372
5320
|
sourceContent = knowledgeSource.sourceContent;
|
|
5373
5321
|
name = knowledgeSource.name;
|
|
5374
|
-
_b = options || {}, _c = _b.rootDirname, rootDirname = _c === void 0 ? null : _c,
|
|
5375
|
-
TODO_USE(isVerbose);
|
|
5322
|
+
_b = options || {}, _c = _b.rootDirname, rootDirname = _c === void 0 ? null : _c, _b.isVerbose;
|
|
5376
5323
|
if (!name) {
|
|
5377
5324
|
name = sourceContentToName(sourceContent);
|
|
5378
5325
|
}
|
|
@@ -5626,12 +5573,12 @@ TODO: [🧊] This is how it can look in future
|
|
|
5626
5573
|
*/
|
|
5627
5574
|
function clonePipeline(pipeline) {
|
|
5628
5575
|
// Note: Not using spread operator (...) because @@@
|
|
5629
|
-
var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title,
|
|
5576
|
+
var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title, bookVersion = pipeline.bookVersion, description = pipeline.description, parameters = pipeline.parameters, templates = pipeline.templates, knowledgeSources = pipeline.knowledgeSources, knowledgePieces = pipeline.knowledgePieces, personas = pipeline.personas, preparations = pipeline.preparations;
|
|
5630
5577
|
return {
|
|
5631
5578
|
pipelineUrl: pipelineUrl,
|
|
5632
5579
|
sourceFile: sourceFile,
|
|
5633
5580
|
title: title,
|
|
5634
|
-
|
|
5581
|
+
bookVersion: bookVersion,
|
|
5635
5582
|
description: description,
|
|
5636
5583
|
parameters: parameters,
|
|
5637
5584
|
templates: templates,
|
|
@@ -5652,15 +5599,13 @@ function clonePipeline(pipeline) {
|
|
|
5652
5599
|
*/
|
|
5653
5600
|
function prepareTemplates(pipeline, tools, options) {
|
|
5654
5601
|
return __awaiter(this, void 0, void 0, function () {
|
|
5655
|
-
var _a, maxParallelCount, templates,
|
|
5602
|
+
var _a, maxParallelCount, templates, knowledgePiecesCount, templatesPrepared;
|
|
5656
5603
|
var _this = this;
|
|
5657
5604
|
return __generator(this, function (_b) {
|
|
5658
5605
|
switch (_b.label) {
|
|
5659
5606
|
case 0:
|
|
5660
5607
|
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a;
|
|
5661
|
-
templates = pipeline.templates,
|
|
5662
|
-
// TODO: [main] !! Apply examples to each template (if missing and is for the template defined)
|
|
5663
|
-
TODO_USE(parameters);
|
|
5608
|
+
templates = pipeline.templates, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
|
|
5664
5609
|
templatesPrepared = new Array(templates.length);
|
|
5665
5610
|
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 () {
|
|
5666
5611
|
var dependentParameterNames, preparedContent, preparedTemplate;
|
|
@@ -5730,7 +5675,7 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
5730
5675
|
currentPreparation = {
|
|
5731
5676
|
id: 1,
|
|
5732
5677
|
// TODO: [🍥]> date: $currentDate(),
|
|
5733
|
-
promptbookVersion:
|
|
5678
|
+
promptbookVersion: PROMPTBOOK_ENGINE_VERSION,
|
|
5734
5679
|
usage: ZERO_USAGE,
|
|
5735
5680
|
};
|
|
5736
5681
|
preparations = [
|
|
@@ -5845,7 +5790,7 @@ var knowledgeCommandParser = {
|
|
|
5845
5790
|
throw new ParseError("Source not valid");
|
|
5846
5791
|
}
|
|
5847
5792
|
if (sourceContent.startsWith('../') || sourceContent.startsWith('/') || /^[A-Z]:[\\/]+/i.test(sourceContent)) {
|
|
5848
|
-
throw new ParseError("Source cannot be outside of the .
|
|
5793
|
+
throw new ParseError("Source cannot be outside of the .book.md folder");
|
|
5849
5794
|
}
|
|
5850
5795
|
return {
|
|
5851
5796
|
type: 'KNOWLEDGE',
|
|
@@ -5870,7 +5815,6 @@ var knowledgeCommandParser = {
|
|
|
5870
5815
|
* Note: This is used in `pipelineJsonToString` utility
|
|
5871
5816
|
*/
|
|
5872
5817
|
stringify: function (command) {
|
|
5873
|
-
keepUnused(command);
|
|
5874
5818
|
return "---"; // <- TODO: [🛋] Implement
|
|
5875
5819
|
},
|
|
5876
5820
|
/**
|
|
@@ -5879,7 +5823,6 @@ var knowledgeCommandParser = {
|
|
|
5879
5823
|
* Note: This is used in `pipelineJsonToString` utility
|
|
5880
5824
|
*/
|
|
5881
5825
|
takeFromPipelineJson: function (pipelineJson) {
|
|
5882
|
-
keepUnused(pipelineJson);
|
|
5883
5826
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
5884
5827
|
},
|
|
5885
5828
|
};
|
|
@@ -6044,7 +5987,6 @@ var templateCommandParser = {
|
|
|
6044
5987
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6045
5988
|
*/
|
|
6046
5989
|
stringify: function (command) {
|
|
6047
|
-
keepUnused(command);
|
|
6048
5990
|
return "---"; // <- TODO: [🛋] Implement
|
|
6049
5991
|
},
|
|
6050
5992
|
/**
|
|
@@ -6053,7 +5995,6 @@ var templateCommandParser = {
|
|
|
6053
5995
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6054
5996
|
*/
|
|
6055
5997
|
takeFromTemplateJson: function ($templateJson) {
|
|
6056
|
-
keepUnused($templateJson);
|
|
6057
5998
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6058
5999
|
},
|
|
6059
6000
|
};
|
|
@@ -6285,7 +6226,6 @@ var expectCommandParser = {
|
|
|
6285
6226
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6286
6227
|
*/
|
|
6287
6228
|
stringify: function (command) {
|
|
6288
|
-
keepUnused(command);
|
|
6289
6229
|
return "---"; // <- TODO: [🛋] Implement
|
|
6290
6230
|
},
|
|
6291
6231
|
/**
|
|
@@ -6294,7 +6234,6 @@ var expectCommandParser = {
|
|
|
6294
6234
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6295
6235
|
*/
|
|
6296
6236
|
takeFromTemplateJson: function ($templateJson) {
|
|
6297
|
-
keepUnused($templateJson);
|
|
6298
6237
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6299
6238
|
},
|
|
6300
6239
|
};
|
|
@@ -6483,7 +6422,7 @@ function validateParameterName(parameterName) {
|
|
|
6483
6422
|
/**
|
|
6484
6423
|
* Parses the foreach command
|
|
6485
6424
|
*
|
|
6486
|
-
* Note: @@@ This command is used as foreach for new commands - it should NOT be used in any `.
|
|
6425
|
+
* Note: @@@ This command is used as foreach for new commands - it should NOT be used in any `.book.md` file
|
|
6487
6426
|
*
|
|
6488
6427
|
* @see `documentationUrl` for more details
|
|
6489
6428
|
* @private within the commands folder
|
|
@@ -6613,7 +6552,6 @@ var foreachCommandParser = {
|
|
|
6613
6552
|
inputSubparameterNames: inputSubparameterNames,
|
|
6614
6553
|
outputSubparameterName: outputSubparameterName,
|
|
6615
6554
|
};
|
|
6616
|
-
keepUnused($pipelineJson); // <- TODO: [🧠] Maybe register subparameter from foreach into parameters of the pipeline
|
|
6617
6555
|
// Note: [🍭] FOREACH apply has some sideeffects on different places in codebase
|
|
6618
6556
|
},
|
|
6619
6557
|
/**
|
|
@@ -6622,7 +6560,6 @@ var foreachCommandParser = {
|
|
|
6622
6560
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6623
6561
|
*/
|
|
6624
6562
|
stringify: function (command) {
|
|
6625
|
-
keepUnused(command);
|
|
6626
6563
|
return "---"; // <- TODO: [🛋] Implement
|
|
6627
6564
|
},
|
|
6628
6565
|
/**
|
|
@@ -6631,12 +6568,11 @@ var foreachCommandParser = {
|
|
|
6631
6568
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6632
6569
|
*/
|
|
6633
6570
|
takeFromTemplateJson: function ($templateJson) {
|
|
6634
|
-
keepUnused($templateJson);
|
|
6635
6571
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6636
6572
|
},
|
|
6637
6573
|
};
|
|
6638
6574
|
/**
|
|
6639
|
-
* TODO: [🍭] Make .
|
|
6575
|
+
* TODO: [🍭] Make .book.md file with examples of the FOREACH with wrong parsing and logic
|
|
6640
6576
|
*/
|
|
6641
6577
|
|
|
6642
6578
|
/**
|
|
@@ -6699,7 +6635,6 @@ var formatCommandParser = {
|
|
|
6699
6635
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6700
6636
|
*/
|
|
6701
6637
|
stringify: function (command) {
|
|
6702
|
-
keepUnused(command);
|
|
6703
6638
|
return "---"; // <- TODO: [🛋] Implement
|
|
6704
6639
|
},
|
|
6705
6640
|
/**
|
|
@@ -6708,7 +6643,6 @@ var formatCommandParser = {
|
|
|
6708
6643
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6709
6644
|
*/
|
|
6710
6645
|
takeFromTemplateJson: function ($templateJson) {
|
|
6711
|
-
keepUnused($templateJson);
|
|
6712
6646
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6713
6647
|
},
|
|
6714
6648
|
};
|
|
@@ -6771,7 +6705,6 @@ var jokerCommandParser = {
|
|
|
6771
6705
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6772
6706
|
*/
|
|
6773
6707
|
stringify: function (command) {
|
|
6774
|
-
keepUnused(command);
|
|
6775
6708
|
return "---"; // <- TODO: [🛋] Implement
|
|
6776
6709
|
},
|
|
6777
6710
|
/**
|
|
@@ -6780,7 +6713,6 @@ var jokerCommandParser = {
|
|
|
6780
6713
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6781
6714
|
*/
|
|
6782
6715
|
takeFromTemplateJson: function ($templateJson) {
|
|
6783
|
-
keepUnused($templateJson);
|
|
6784
6716
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6785
6717
|
},
|
|
6786
6718
|
};
|
|
@@ -6916,7 +6848,6 @@ var modelCommandParser = {
|
|
|
6916
6848
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6917
6849
|
*/
|
|
6918
6850
|
stringify: function (command) {
|
|
6919
|
-
keepUnused(command);
|
|
6920
6851
|
return "---"; // <- TODO: [🛋] Implement
|
|
6921
6852
|
},
|
|
6922
6853
|
/**
|
|
@@ -6925,7 +6856,6 @@ var modelCommandParser = {
|
|
|
6925
6856
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6926
6857
|
*/
|
|
6927
6858
|
takeFromPipelineJson: function (pipelineJson) {
|
|
6928
|
-
keepUnused(pipelineJson);
|
|
6929
6859
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6930
6860
|
},
|
|
6931
6861
|
/**
|
|
@@ -6934,7 +6864,6 @@ var modelCommandParser = {
|
|
|
6934
6864
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6935
6865
|
*/
|
|
6936
6866
|
takeFromTemplateJson: function ($templateJson) {
|
|
6937
|
-
keepUnused($templateJson);
|
|
6938
6867
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6939
6868
|
},
|
|
6940
6869
|
};
|
|
@@ -7008,7 +6937,6 @@ var parameterCommandParser = {
|
|
|
7008
6937
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7009
6938
|
*/
|
|
7010
6939
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
7011
|
-
keepUnused(command, $pipelineJson);
|
|
7012
6940
|
// Note: [🍣] Do nothing, its application is implemented separately in `pipelineStringToJsonSync`
|
|
7013
6941
|
},
|
|
7014
6942
|
/**
|
|
@@ -7017,7 +6945,6 @@ var parameterCommandParser = {
|
|
|
7017
6945
|
* Note: `$` is used to indicate that this function mutates given `templateJson`
|
|
7018
6946
|
*/
|
|
7019
6947
|
$applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
|
|
7020
|
-
keepUnused(command, $templateJson, $pipelineJson);
|
|
7021
6948
|
// Note: [🍣] Do nothing, its application is implemented separately in `pipelineStringToJsonSync`
|
|
7022
6949
|
},
|
|
7023
6950
|
/**
|
|
@@ -7026,7 +6953,6 @@ var parameterCommandParser = {
|
|
|
7026
6953
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7027
6954
|
*/
|
|
7028
6955
|
stringify: function (command) {
|
|
7029
|
-
keepUnused(command);
|
|
7030
6956
|
return "---"; // <- TODO: [🛋] Implement
|
|
7031
6957
|
},
|
|
7032
6958
|
/**
|
|
@@ -7035,7 +6961,6 @@ var parameterCommandParser = {
|
|
|
7035
6961
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7036
6962
|
*/
|
|
7037
6963
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7038
|
-
keepUnused(pipelineJson);
|
|
7039
6964
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7040
6965
|
},
|
|
7041
6966
|
/**
|
|
@@ -7044,7 +6969,6 @@ var parameterCommandParser = {
|
|
|
7044
6969
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7045
6970
|
*/
|
|
7046
6971
|
takeFromTemplateJson: function ($templateJson) {
|
|
7047
|
-
keepUnused($templateJson);
|
|
7048
6972
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7049
6973
|
},
|
|
7050
6974
|
};
|
|
@@ -7116,7 +7040,6 @@ var personaCommandParser = {
|
|
|
7116
7040
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7117
7041
|
*/
|
|
7118
7042
|
stringify: function (command) {
|
|
7119
|
-
keepUnused(command);
|
|
7120
7043
|
return "---"; // <- TODO: [🛋] Implement
|
|
7121
7044
|
},
|
|
7122
7045
|
/**
|
|
@@ -7125,7 +7048,6 @@ var personaCommandParser = {
|
|
|
7125
7048
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7126
7049
|
*/
|
|
7127
7050
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7128
|
-
keepUnused(pipelineJson);
|
|
7129
7051
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7130
7052
|
},
|
|
7131
7053
|
/**
|
|
@@ -7134,7 +7056,6 @@ var personaCommandParser = {
|
|
|
7134
7056
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7135
7057
|
*/
|
|
7136
7058
|
takeFromTemplateJson: function ($templateJson) {
|
|
7137
|
-
keepUnused($templateJson);
|
|
7138
7059
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7139
7060
|
},
|
|
7140
7061
|
};
|
|
@@ -7253,7 +7174,6 @@ var postprocessCommandParser = {
|
|
|
7253
7174
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7254
7175
|
*/
|
|
7255
7176
|
stringify: function (command) {
|
|
7256
|
-
keepUnused(command);
|
|
7257
7177
|
return "---"; // <- TODO: [🛋] Implement
|
|
7258
7178
|
},
|
|
7259
7179
|
/**
|
|
@@ -7262,85 +7182,82 @@ var postprocessCommandParser = {
|
|
|
7262
7182
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7263
7183
|
*/
|
|
7264
7184
|
takeFromTemplateJson: function ($templateJson) {
|
|
7265
|
-
keepUnused($templateJson);
|
|
7266
7185
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7267
7186
|
},
|
|
7268
7187
|
};
|
|
7269
7188
|
|
|
7270
7189
|
/**
|
|
7271
|
-
* Parses the
|
|
7190
|
+
* Parses the BOOK_VERSION command
|
|
7272
7191
|
*
|
|
7273
7192
|
* @see `documentationUrl` for more details
|
|
7274
7193
|
* @private within the commands folder
|
|
7275
7194
|
*/
|
|
7276
|
-
var
|
|
7195
|
+
var bookVersionCommandParser = {
|
|
7277
7196
|
/**
|
|
7278
7197
|
* Name of the command
|
|
7279
7198
|
*/
|
|
7280
|
-
name: '
|
|
7281
|
-
aliasNames: ['PTBK_VERSION', '
|
|
7199
|
+
name: 'BOOK_VERSION',
|
|
7200
|
+
aliasNames: ['PTBK_VERSION', 'PROMPTBOOK_VERSION', 'BOOK'],
|
|
7282
7201
|
/**
|
|
7283
7202
|
* BOILERPLATE command can be used in:
|
|
7284
7203
|
*/
|
|
7285
7204
|
isUsedInPipelineHead: true,
|
|
7286
7205
|
isUsedInPipelineTemplate: false,
|
|
7287
7206
|
/**
|
|
7288
|
-
* Description of the
|
|
7207
|
+
* Description of the BOOK_VERSION command
|
|
7289
7208
|
*/
|
|
7290
|
-
description: "Which version of the
|
|
7209
|
+
description: "Which version of the Book language is the .book.md using",
|
|
7291
7210
|
/**
|
|
7292
7211
|
* Link to documentation
|
|
7293
7212
|
*/
|
|
7294
7213
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/69',
|
|
7295
7214
|
/**
|
|
7296
|
-
* Example usages of the
|
|
7215
|
+
* Example usages of the BOOK_VERSION command
|
|
7297
7216
|
*/
|
|
7298
|
-
examples: ["
|
|
7217
|
+
examples: ["BOOK VERSION ".concat(BOOK_LANGUAGE_VERSION), "BOOK ".concat(BOOK_LANGUAGE_VERSION)],
|
|
7299
7218
|
/**
|
|
7300
|
-
* Parses the
|
|
7219
|
+
* Parses the BOOK_VERSION command
|
|
7301
7220
|
*/
|
|
7302
7221
|
parse: function (input) {
|
|
7303
7222
|
var args = input.args;
|
|
7304
|
-
var
|
|
7305
|
-
if (
|
|
7223
|
+
var bookVersion = args.pop();
|
|
7224
|
+
if (bookVersion === undefined) {
|
|
7306
7225
|
throw new ParseError("Version is required");
|
|
7307
7226
|
}
|
|
7308
|
-
if (!isValidPromptbookVersion(
|
|
7309
|
-
throw new ParseError("Invalid Promptbook version \"".concat(
|
|
7227
|
+
if (!isValidPromptbookVersion(bookVersion)) {
|
|
7228
|
+
throw new ParseError("Invalid Promptbook version \"".concat(bookVersion, "\""));
|
|
7310
7229
|
}
|
|
7311
|
-
if (args.length > 0) {
|
|
7230
|
+
if (args.length > 0 && !(((args.length === 1 && args[0]) || '').toUpperCase() === 'VERSION')) {
|
|
7312
7231
|
throw new ParseError("Can not have more than one Promptbook version");
|
|
7313
7232
|
}
|
|
7314
7233
|
return {
|
|
7315
|
-
type: '
|
|
7316
|
-
|
|
7234
|
+
type: 'BOOK_VERSION',
|
|
7235
|
+
bookVersion: bookVersion,
|
|
7317
7236
|
};
|
|
7318
7237
|
},
|
|
7319
7238
|
/**
|
|
7320
|
-
* Apply the
|
|
7239
|
+
* Apply the BOOK_VERSION command to the `pipelineJson`
|
|
7321
7240
|
*
|
|
7322
7241
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7323
7242
|
*/
|
|
7324
7243
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
7325
7244
|
// TODO: Warn if the version is overridden
|
|
7326
|
-
$pipelineJson.
|
|
7245
|
+
$pipelineJson.bookVersion = command.bookVersion;
|
|
7327
7246
|
},
|
|
7328
7247
|
/**
|
|
7329
|
-
* Converts the
|
|
7248
|
+
* Converts the BOOK_VERSION command back to string
|
|
7330
7249
|
*
|
|
7331
7250
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7332
7251
|
*/
|
|
7333
7252
|
stringify: function (command) {
|
|
7334
|
-
keepUnused(command);
|
|
7335
7253
|
return "---"; // <- TODO: [🛋] Implement
|
|
7336
7254
|
},
|
|
7337
7255
|
/**
|
|
7338
|
-
* Reads the
|
|
7256
|
+
* Reads the BOOK_VERSION command from the `PipelineJson`
|
|
7339
7257
|
*
|
|
7340
7258
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7341
7259
|
*/
|
|
7342
7260
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7343
|
-
keepUnused(pipelineJson);
|
|
7344
7261
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7345
7262
|
},
|
|
7346
7263
|
};
|
|
@@ -7378,9 +7295,9 @@ var urlCommandParser = {
|
|
|
7378
7295
|
* Example usages of the URL command
|
|
7379
7296
|
*/
|
|
7380
7297
|
examples: [
|
|
7381
|
-
'PIPELINE URL https://promptbook.studio/library/write-cv.
|
|
7382
|
-
'URL https://promptbook.studio/library/write-cv.
|
|
7383
|
-
'https://promptbook.studio/library/write-cv.
|
|
7298
|
+
'PIPELINE URL https://promptbook.studio/library/write-cv.book.md',
|
|
7299
|
+
'URL https://promptbook.studio/library/write-cv.book.md',
|
|
7300
|
+
'https://promptbook.studio/library/write-cv.book.md',
|
|
7384
7301
|
],
|
|
7385
7302
|
/**
|
|
7386
7303
|
* Parses the URL command
|
|
@@ -7434,7 +7351,6 @@ var urlCommandParser = {
|
|
|
7434
7351
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7435
7352
|
*/
|
|
7436
7353
|
stringify: function (command) {
|
|
7437
|
-
keepUnused(command);
|
|
7438
7354
|
return "---"; // <- TODO: [🛋] Implement
|
|
7439
7355
|
},
|
|
7440
7356
|
/**
|
|
@@ -7443,7 +7359,6 @@ var urlCommandParser = {
|
|
|
7443
7359
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7444
7360
|
*/
|
|
7445
7361
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7446
|
-
keepUnused(pipelineJson);
|
|
7447
7362
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7448
7363
|
},
|
|
7449
7364
|
};
|
|
@@ -7480,8 +7395,7 @@ var actionCommandParser = {
|
|
|
7480
7395
|
* Parses the ACTION command
|
|
7481
7396
|
*/
|
|
7482
7397
|
parse: function (input) {
|
|
7483
|
-
|
|
7484
|
-
TODO_USE(args);
|
|
7398
|
+
input.args;
|
|
7485
7399
|
return {
|
|
7486
7400
|
type: 'ACTION',
|
|
7487
7401
|
};
|
|
@@ -7492,7 +7406,6 @@ var actionCommandParser = {
|
|
|
7492
7406
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7493
7407
|
*/
|
|
7494
7408
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
7495
|
-
keepUnused(command, $pipelineJson);
|
|
7496
7409
|
console.error(new NotYetImplementedError('[🛠] Actions are not implemented yet'));
|
|
7497
7410
|
},
|
|
7498
7411
|
/**
|
|
@@ -7501,7 +7414,6 @@ var actionCommandParser = {
|
|
|
7501
7414
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7502
7415
|
*/
|
|
7503
7416
|
stringify: function (command) {
|
|
7504
|
-
keepUnused(command);
|
|
7505
7417
|
throw new NotYetImplementedError('[🛠] Actions are not implemented yet');
|
|
7506
7418
|
},
|
|
7507
7419
|
/**
|
|
@@ -7510,7 +7422,6 @@ var actionCommandParser = {
|
|
|
7510
7422
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7511
7423
|
*/
|
|
7512
7424
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7513
|
-
keepUnused(pipelineJson);
|
|
7514
7425
|
throw new NotYetImplementedError('[🛠] Actions are not implemented yet');
|
|
7515
7426
|
},
|
|
7516
7427
|
};
|
|
@@ -7550,9 +7461,7 @@ var instrumentCommandParser = {
|
|
|
7550
7461
|
* Parses the INSTRUMENT command
|
|
7551
7462
|
*/
|
|
7552
7463
|
parse: function (input) {
|
|
7553
|
-
|
|
7554
|
-
// TODO: [🛠] Implement
|
|
7555
|
-
TODO_USE(args);
|
|
7464
|
+
input.args;
|
|
7556
7465
|
return {
|
|
7557
7466
|
type: 'INSTRUMENT',
|
|
7558
7467
|
};
|
|
@@ -7563,7 +7472,6 @@ var instrumentCommandParser = {
|
|
|
7563
7472
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7564
7473
|
*/
|
|
7565
7474
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
7566
|
-
keepUnused(command, $pipelineJson);
|
|
7567
7475
|
console.error(new NotYetImplementedError('[🛠] Instruments are not implemented yet'));
|
|
7568
7476
|
},
|
|
7569
7477
|
/**
|
|
@@ -7572,7 +7480,6 @@ var instrumentCommandParser = {
|
|
|
7572
7480
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7573
7481
|
*/
|
|
7574
7482
|
stringify: function (command) {
|
|
7575
|
-
keepUnused(command);
|
|
7576
7483
|
throw new NotYetImplementedError('[🛠] Instruments are not implemented yet');
|
|
7577
7484
|
},
|
|
7578
7485
|
/**
|
|
@@ -7581,7 +7488,6 @@ var instrumentCommandParser = {
|
|
|
7581
7488
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7582
7489
|
*/
|
|
7583
7490
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7584
|
-
keepUnused(pipelineJson);
|
|
7585
7491
|
throw new NotYetImplementedError('[🛠] Instruments are not implemented yet');
|
|
7586
7492
|
},
|
|
7587
7493
|
};
|
|
@@ -7592,7 +7498,7 @@ var instrumentCommandParser = {
|
|
|
7592
7498
|
/**
|
|
7593
7499
|
* Parses the boilerplate command
|
|
7594
7500
|
*
|
|
7595
|
-
* Note: @@@ This command is used as boilerplate for new commands - it should NOT be used in any `.
|
|
7501
|
+
* Note: @@@ This command is used as boilerplate for new commands - it should NOT be used in any `.book.md` file
|
|
7596
7502
|
*
|
|
7597
7503
|
* @see `documentationUrl` for more details
|
|
7598
7504
|
* @private within the commands folder
|
|
@@ -7646,8 +7552,7 @@ var boilerplateCommandParser = {
|
|
|
7646
7552
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7647
7553
|
*/
|
|
7648
7554
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
7649
|
-
|
|
7650
|
-
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
|
|
7555
|
+
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
|
|
7651
7556
|
},
|
|
7652
7557
|
/**
|
|
7653
7558
|
* Apply the BOILERPLATE command to the `pipelineJson`
|
|
@@ -7655,8 +7560,7 @@ var boilerplateCommandParser = {
|
|
|
7655
7560
|
* Note: `$` is used to indicate that this function mutates given `templateJson`
|
|
7656
7561
|
*/
|
|
7657
7562
|
$applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
|
|
7658
|
-
|
|
7659
|
-
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
|
|
7563
|
+
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
|
|
7660
7564
|
},
|
|
7661
7565
|
/**
|
|
7662
7566
|
* Converts the BOILERPLATE command back to string
|
|
@@ -7664,7 +7568,6 @@ var boilerplateCommandParser = {
|
|
|
7664
7568
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7665
7569
|
*/
|
|
7666
7570
|
stringify: function (command) {
|
|
7667
|
-
keepUnused(command);
|
|
7668
7571
|
return "---"; // <- TODO: [🛋] Implement
|
|
7669
7572
|
},
|
|
7670
7573
|
/**
|
|
@@ -7673,8 +7576,7 @@ var boilerplateCommandParser = {
|
|
|
7673
7576
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7674
7577
|
*/
|
|
7675
7578
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7676
|
-
|
|
7677
|
-
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
|
|
7579
|
+
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
|
|
7678
7580
|
},
|
|
7679
7581
|
/**
|
|
7680
7582
|
* Reads the BOILERPLATE command from the `TemplateJson`
|
|
@@ -7682,8 +7584,7 @@ var boilerplateCommandParser = {
|
|
|
7682
7584
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7683
7585
|
*/
|
|
7684
7586
|
takeFromTemplateJson: function ($templateJson) {
|
|
7685
|
-
|
|
7686
|
-
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
|
|
7587
|
+
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
|
|
7687
7588
|
},
|
|
7688
7589
|
};
|
|
7689
7590
|
|
|
@@ -7700,7 +7601,7 @@ var COMMANDS = [
|
|
|
7700
7601
|
modelCommandParser,
|
|
7701
7602
|
parameterCommandParser,
|
|
7702
7603
|
postprocessCommandParser,
|
|
7703
|
-
|
|
7604
|
+
bookVersionCommandParser,
|
|
7704
7605
|
urlCommandParser,
|
|
7705
7606
|
knowledgeCommandParser,
|
|
7706
7607
|
actionCommandParser,
|
|
@@ -7852,9 +7753,7 @@ function parseCommandVariant(input) {
|
|
|
7852
7753
|
var _loop_1 = function (commandParser) {
|
|
7853
7754
|
// <- Note: [🦦] Its strange that this type assertion is needed
|
|
7854
7755
|
var name_1 = commandParser.name, isUsedInPipelineHead = commandParser.isUsedInPipelineHead, isUsedInPipelineTemplate = commandParser.isUsedInPipelineTemplate, aliasNames = commandParser.aliasNames, deprecatedNames = commandParser.deprecatedNames, parse = commandParser.parse;
|
|
7855
|
-
if (just(false))
|
|
7856
|
-
keepUnused( /* for better indentation */);
|
|
7857
|
-
}
|
|
7756
|
+
if (just(false)) ;
|
|
7858
7757
|
else if (usagePlace === 'PIPELINE_HEAD' && !isUsedInPipelineHead) {
|
|
7859
7758
|
return "continue";
|
|
7860
7759
|
}
|
|
@@ -8014,7 +7913,7 @@ function splitMarkdownIntoSections(markdown) {
|
|
|
8014
7913
|
return;
|
|
8015
7914
|
}
|
|
8016
7915
|
if (!section.startsWith('#')) {
|
|
8017
|
-
section = "#
|
|
7916
|
+
section = "# ".concat(DEFAULT_TITLE, "\n\n").concat(section);
|
|
8018
7917
|
}
|
|
8019
7918
|
sections.push(section);
|
|
8020
7919
|
buffer = [];
|
|
@@ -8078,7 +7977,7 @@ function flattenMarkdown(markdown) {
|
|
|
8078
7977
|
var e_1, _a;
|
|
8079
7978
|
var sections = splitMarkdownIntoSections(markdown);
|
|
8080
7979
|
if (sections.length === 0) {
|
|
8081
|
-
return
|
|
7980
|
+
return "# ".concat(DEFAULT_TITLE);
|
|
8082
7981
|
}
|
|
8083
7982
|
var flattenedMarkdown = '';
|
|
8084
7983
|
var parsedSections = sections.map(parseMarkdownSection);
|
|
@@ -8089,7 +7988,7 @@ function flattenMarkdown(markdown) {
|
|
|
8089
7988
|
}
|
|
8090
7989
|
else {
|
|
8091
7990
|
parsedSections.unshift(firstSection);
|
|
8092
|
-
flattenedMarkdown += "#
|
|
7991
|
+
flattenedMarkdown += "# ".concat(DEFAULT_TITLE) + "\n\n"; // <- [🧠] Maybe 3 new lines?
|
|
8093
7992
|
}
|
|
8094
7993
|
try {
|
|
8095
7994
|
for (var parsedSections_1 = __values(parsedSections), parsedSections_1_1 = parsedSections_1.next(); !parsedSections_1_1.done; parsedSections_1_1 = parsedSections_1.next()) {
|
|
@@ -8161,17 +8060,17 @@ function titleToName(value) {
|
|
|
8161
8060
|
* Note: This function does not validate logic of the pipeline only the parsing
|
|
8162
8061
|
* Note: This function acts as compilation process
|
|
8163
8062
|
*
|
|
8164
|
-
* @param pipelineString {Promptbook} in string markdown format (.
|
|
8165
|
-
* @returns {Promptbook} compiled in JSON format (.
|
|
8063
|
+
* @param pipelineString {Promptbook} in string markdown format (.book.md)
|
|
8064
|
+
* @returns {Promptbook} compiled in JSON format (.book.json)
|
|
8166
8065
|
* @throws {ParseError} if the promptbook string is not valid
|
|
8167
8066
|
* @public exported from `@promptbook/core`
|
|
8168
8067
|
*/
|
|
8169
8068
|
function pipelineStringToJsonSync(pipelineString) {
|
|
8170
|
-
var e_1, _a, e_2, _b;
|
|
8069
|
+
var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
|
|
8171
8070
|
var $pipelineJson = {
|
|
8172
8071
|
title: undefined /* <- Note: [🍙] Putting here placeholder to keep `title` on top at final JSON */,
|
|
8173
8072
|
pipelineUrl: undefined /* <- Note: Putting here placeholder to keep `pipelineUrl` on top at final JSON */,
|
|
8174
|
-
|
|
8073
|
+
bookVersion: undefined /* <- Note: By default no explicit version */,
|
|
8175
8074
|
description: undefined /* <- Note: [🍙] Putting here placeholder to keep `description` on top at final JSON */,
|
|
8176
8075
|
parameters: [],
|
|
8177
8076
|
templates: [],
|
|
@@ -8194,11 +8093,18 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
8194
8093
|
}
|
|
8195
8094
|
// =============================================================
|
|
8196
8095
|
// Note: 1️⃣ Parsing of the markdown into object
|
|
8096
|
+
if (pipelineString.startsWith('#!')) {
|
|
8097
|
+
var _e = __read(pipelineString.split('\n')), shebangLine_1 = _e[0], restLines = _e.slice(1);
|
|
8098
|
+
if (!(shebangLine_1 || '').includes('ptbk')) {
|
|
8099
|
+
throw new ParseError(spaceTrim$1(function (block) { return "\n It seems that you try to parse a book file which has non-standard shebang line for book files:\n Shebang line must contain 'ptbk'\n\n You have:\n ".concat(block(shebangLine_1 || '(empty line)'), "\n\n It should look like this:\n #!/usr/bin/env ptbk\n\n ").concat(block(getPipelineIdentification()), "\n "); }));
|
|
8100
|
+
}
|
|
8101
|
+
pipelineString = restLines.join('\n');
|
|
8102
|
+
}
|
|
8197
8103
|
pipelineString = removeContentComments(pipelineString);
|
|
8198
8104
|
pipelineString = flattenMarkdown(pipelineString) /* <- Note: [🥞] */;
|
|
8199
8105
|
pipelineString = pipelineString.replaceAll(/`\{(?<parameterName>[a-z0-9_]+)\}`/gi, '{$<parameterName>}');
|
|
8200
8106
|
pipelineString = pipelineString.replaceAll(/`->\s+\{(?<parameterName>[a-z0-9_]+)\}`/gi, '-> {$<parameterName>}');
|
|
8201
|
-
var
|
|
8107
|
+
var _f = __read(splitMarkdownIntoSections(pipelineString).map(parseMarkdownSection)), pipelineHead = _f[0], pipelineSections = _f.slice(1); /* <- Note: [🥞] */
|
|
8202
8108
|
if (pipelineHead === undefined) {
|
|
8203
8109
|
throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Pipeline head is not defined\n\n ".concat(block(getPipelineIdentification()), "\n\n This should never happen, because the pipeline already flattened\n "); }));
|
|
8204
8110
|
}
|
|
@@ -8226,6 +8132,8 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
8226
8132
|
if (parameterDescription) {
|
|
8227
8133
|
existingParameter.description = parameterDescription;
|
|
8228
8134
|
}
|
|
8135
|
+
existingParameter.isInput = existingParameter.isInput || isInput;
|
|
8136
|
+
existingParameter.isOutput = existingParameter.isOutput || isOutput;
|
|
8229
8137
|
}
|
|
8230
8138
|
else {
|
|
8231
8139
|
$pipelineJson.parameters.push({
|
|
@@ -8288,10 +8196,10 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
8288
8196
|
finally { if (e_1) throw e_1.error; }
|
|
8289
8197
|
}
|
|
8290
8198
|
var _loop_2 = function (section) {
|
|
8291
|
-
var
|
|
8199
|
+
var e_5, _l, e_6, _m;
|
|
8292
8200
|
// TODO: Parse template description (the content out of the codeblock and lists)
|
|
8293
8201
|
var listItems_2 = extractAllListItemsFromMarkdown(section.content);
|
|
8294
|
-
var
|
|
8202
|
+
var _o = extractOneBlockFromMarkdown(section.content), language = _o.language, content = _o.content;
|
|
8295
8203
|
// TODO: [🎾][1] DRY description
|
|
8296
8204
|
var description_1 = section.content;
|
|
8297
8205
|
// Note: Remove codeblocks - TODO: [🎾]
|
|
@@ -8332,7 +8240,7 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
8332
8240
|
}) === false) {
|
|
8333
8241
|
templateCommandParser.$applyToTemplateJson({ type: 'TEMPLATE', templateType: 'PROMPT_TEMPLATE' }, $templateJson, $pipelineJson);
|
|
8334
8242
|
}
|
|
8335
|
-
var
|
|
8243
|
+
var _loop_4 = function (listItem, command) {
|
|
8336
8244
|
var commandParser = getParserForCommand(command);
|
|
8337
8245
|
if (commandParser.isUsedInPipelineTemplate !== true /* <- Note: [🦦][4] */) {
|
|
8338
8246
|
throw new ParseError(spaceTrim$1(function (block) { return "\n Command ".concat(command.type, " is not allowed in the template of the promptbook ONLY at the pipeline head\n\n ").concat(block(getPipelineIdentification()), "\n "); })); // <- TODO: [🚞]
|
|
@@ -8355,17 +8263,17 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
8355
8263
|
};
|
|
8356
8264
|
try {
|
|
8357
8265
|
// TODO [♓️] List commands and before apply order them to achieve order-agnostic commands
|
|
8358
|
-
for (var commands_1 = (
|
|
8359
|
-
var
|
|
8360
|
-
|
|
8266
|
+
for (var commands_1 = (e_5 = void 0, __values(commands)), commands_1_1 = commands_1.next(); !commands_1_1.done; commands_1_1 = commands_1.next()) {
|
|
8267
|
+
var _p = commands_1_1.value, listItem = _p.listItem, command = _p.command;
|
|
8268
|
+
_loop_4(listItem, command);
|
|
8361
8269
|
}
|
|
8362
8270
|
}
|
|
8363
|
-
catch (
|
|
8271
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
8364
8272
|
finally {
|
|
8365
8273
|
try {
|
|
8366
|
-
if (commands_1_1 && !commands_1_1.done && (
|
|
8274
|
+
if (commands_1_1 && !commands_1_1.done && (_l = commands_1.return)) _l.call(commands_1);
|
|
8367
8275
|
}
|
|
8368
|
-
finally { if (
|
|
8276
|
+
finally { if (e_5) throw e_5.error; }
|
|
8369
8277
|
}
|
|
8370
8278
|
// TODO: [🍧] Should be done in TEMPLATE command
|
|
8371
8279
|
if ($templateJson.templateType === 'SCRIPT_TEMPLATE') {
|
|
@@ -8379,6 +8287,26 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
8379
8287
|
language;
|
|
8380
8288
|
}
|
|
8381
8289
|
$templateJson.dependentParameterNames = Array.from(extractParameterNamesFromTemplate($templateJson));
|
|
8290
|
+
try {
|
|
8291
|
+
for (var _q = (e_6 = void 0, __values($templateJson.dependentParameterNames)), _r = _q.next(); !_r.done; _r = _q.next()) {
|
|
8292
|
+
var parameterName = _r.value;
|
|
8293
|
+
// TODO: [🧠] This definition should be made first in the template
|
|
8294
|
+
defineParam({
|
|
8295
|
+
parameterName: parameterName,
|
|
8296
|
+
parameterDescription: null,
|
|
8297
|
+
isInput: false,
|
|
8298
|
+
isOutput: false,
|
|
8299
|
+
// <- Note: In this case null+false+false means that we do not know yet if it is input or output and we will set it later
|
|
8300
|
+
});
|
|
8301
|
+
}
|
|
8302
|
+
}
|
|
8303
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
8304
|
+
finally {
|
|
8305
|
+
try {
|
|
8306
|
+
if (_r && !_r.done && (_m = _q.return)) _m.call(_q);
|
|
8307
|
+
}
|
|
8308
|
+
finally { if (e_6) throw e_6.error; }
|
|
8309
|
+
}
|
|
8382
8310
|
/*
|
|
8383
8311
|
// TODO: [🍧] This should be checked in `MODEL` command + better error message
|
|
8384
8312
|
if ($templateJson.templateType !== 'PROMPT_TEMPLATE' && $templateJson.modelRequirements !== undefined) {
|
|
@@ -8420,9 +8348,51 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
8420
8348
|
finally { if (e_2) throw e_2.error; }
|
|
8421
8349
|
}
|
|
8422
8350
|
// =============================================================
|
|
8423
|
-
// Note: 5️⃣
|
|
8351
|
+
// Note: 5️⃣ Mark parameters as INPUT if not explicitly set
|
|
8352
|
+
if ($pipelineJson.parameters.every(function (parameter) { return !parameter.isInput; })) {
|
|
8353
|
+
var _loop_3 = function (parameter) {
|
|
8354
|
+
var isThisParameterResulting = $pipelineJson.templates.some(function (template) { return template.resultingParameterName === parameter.name; });
|
|
8355
|
+
if (!isThisParameterResulting) {
|
|
8356
|
+
parameter.isInput = true;
|
|
8357
|
+
}
|
|
8358
|
+
};
|
|
8359
|
+
try {
|
|
8360
|
+
for (var _g = __values($pipelineJson.parameters), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
8361
|
+
var parameter = _h.value;
|
|
8362
|
+
_loop_3(parameter);
|
|
8363
|
+
}
|
|
8364
|
+
}
|
|
8365
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
8366
|
+
finally {
|
|
8367
|
+
try {
|
|
8368
|
+
if (_h && !_h.done && (_c = _g.return)) _c.call(_g);
|
|
8369
|
+
}
|
|
8370
|
+
finally { if (e_3) throw e_3.error; }
|
|
8371
|
+
}
|
|
8372
|
+
}
|
|
8373
|
+
// =============================================================
|
|
8374
|
+
// Note: 6️⃣ Mark all non-INPUT parameters as OUTPUT if any OUTPUT is not set
|
|
8375
|
+
if ($pipelineJson.parameters.every(function (parameter) { return !parameter.isOutput; })) {
|
|
8376
|
+
try {
|
|
8377
|
+
for (var _j = __values($pipelineJson.parameters), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
8378
|
+
var parameter = _k.value;
|
|
8379
|
+
if (!parameter.isInput) {
|
|
8380
|
+
parameter.isOutput = true;
|
|
8381
|
+
}
|
|
8382
|
+
}
|
|
8383
|
+
}
|
|
8384
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
8385
|
+
finally {
|
|
8386
|
+
try {
|
|
8387
|
+
if (_k && !_k.done && (_d = _j.return)) _d.call(_j);
|
|
8388
|
+
}
|
|
8389
|
+
finally { if (e_4) throw e_4.error; }
|
|
8390
|
+
}
|
|
8391
|
+
}
|
|
8392
|
+
// =============================================================
|
|
8393
|
+
// Note: 7️⃣ Cleanup of undefined values
|
|
8424
8394
|
$pipelineJson.templates.forEach(function (templates) {
|
|
8425
|
-
var
|
|
8395
|
+
var e_7, _a;
|
|
8426
8396
|
try {
|
|
8427
8397
|
for (var _b = __values(Object.entries(templates)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
8428
8398
|
var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
|
|
@@ -8431,16 +8401,16 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
8431
8401
|
}
|
|
8432
8402
|
}
|
|
8433
8403
|
}
|
|
8434
|
-
catch (
|
|
8404
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
8435
8405
|
finally {
|
|
8436
8406
|
try {
|
|
8437
8407
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
8438
8408
|
}
|
|
8439
|
-
finally { if (
|
|
8409
|
+
finally { if (e_7) throw e_7.error; }
|
|
8440
8410
|
}
|
|
8441
8411
|
});
|
|
8442
8412
|
$pipelineJson.parameters.forEach(function (parameter) {
|
|
8443
|
-
var
|
|
8413
|
+
var e_8, _a;
|
|
8444
8414
|
try {
|
|
8445
8415
|
for (var _b = __values(Object.entries(parameter)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
8446
8416
|
var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
|
|
@@ -8449,12 +8419,12 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
8449
8419
|
}
|
|
8450
8420
|
}
|
|
8451
8421
|
}
|
|
8452
|
-
catch (
|
|
8422
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
8453
8423
|
finally {
|
|
8454
8424
|
try {
|
|
8455
8425
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
8456
8426
|
}
|
|
8457
|
-
finally { if (
|
|
8427
|
+
finally { if (e_8) throw e_8.error; }
|
|
8458
8428
|
}
|
|
8459
8429
|
});
|
|
8460
8430
|
// =============================================================
|
|
@@ -8483,10 +8453,10 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
8483
8453
|
* Note: This function does not validate logic of the pipeline only the parsing
|
|
8484
8454
|
* Note: This function acts as compilation process
|
|
8485
8455
|
*
|
|
8486
|
-
* @param pipelineString {Promptbook} in string markdown format (.
|
|
8456
|
+
* @param pipelineString {Promptbook} in string markdown format (.book.md)
|
|
8487
8457
|
* @param tools - Tools for the preparation and scraping - if not provided together with `llm`, the preparation will be skipped
|
|
8488
8458
|
* @param options - Options and tools for the compilation
|
|
8489
|
-
* @returns {Promptbook} compiled in JSON format (.
|
|
8459
|
+
* @returns {Promptbook} compiled in JSON format (.book.json)
|
|
8490
8460
|
* @throws {ParseError} if the promptbook string is not valid
|
|
8491
8461
|
* @public exported from `@promptbook/core`
|
|
8492
8462
|
*/
|
|
@@ -8702,7 +8672,7 @@ function stringifyPipelineJson(pipeline) {
|
|
|
8702
8672
|
return pipelineJsonStringified;
|
|
8703
8673
|
}
|
|
8704
8674
|
/**
|
|
8705
|
-
* TODO: [🐝] Not Working propperly @see https://promptbook.studio/examples/mixed-knowledge.
|
|
8675
|
+
* TODO: [🐝] Not Working propperly @see https://promptbook.studio/examples/mixed-knowledge.book.md
|
|
8706
8676
|
* TODO: [🧠][0] Maybe rename to `stringifyPipelineJson`, `stringifyIndexedJson`,...
|
|
8707
8677
|
* TODO: [🧠] Maybe more elegant solution than replacing via regex
|
|
8708
8678
|
* TODO: [🍙] Make some standard order of json properties
|
|
@@ -8976,7 +8946,7 @@ function createLlmToolsFromConfiguration(configuration, options) {
|
|
|
8976
8946
|
*/
|
|
8977
8947
|
|
|
8978
8948
|
/**
|
|
8979
|
-
* Stores
|
|
8949
|
+
* Stores data in memory (HEAP)
|
|
8980
8950
|
*
|
|
8981
8951
|
* @public exported from `@promptbook/core`
|
|
8982
8952
|
*/
|
|
@@ -9106,13 +9076,18 @@ function cacheLlmTools(llmTools, options) {
|
|
|
9106
9076
|
promptResult = _c.sent();
|
|
9107
9077
|
return [3 /*break*/, 11];
|
|
9108
9078
|
case 10: throw new PipelineExecutionError("Unknown model variant \"".concat(prompt.modelRequirements.modelVariant, "\""));
|
|
9109
|
-
case 11:
|
|
9079
|
+
case 11:
|
|
9080
|
+
// TODO: [🧠] !!!!!! How to do timing in mixed cache / non-cache situation
|
|
9081
|
+
// promptResult.timing: FromtoItems
|
|
9082
|
+
return [4 /*yield*/, storage.setItem(key, {
|
|
9110
9083
|
date: $currentDate(),
|
|
9111
|
-
promptbookVersion:
|
|
9084
|
+
promptbookVersion: PROMPTBOOK_ENGINE_VERSION,
|
|
9112
9085
|
prompt: prompt,
|
|
9113
9086
|
promptResult: promptResult,
|
|
9114
9087
|
})];
|
|
9115
9088
|
case 12:
|
|
9089
|
+
// TODO: [🧠] !!!!!! How to do timing in mixed cache / non-cache situation
|
|
9090
|
+
// promptResult.timing: FromtoItems
|
|
9116
9091
|
_c.sent();
|
|
9117
9092
|
return [2 /*return*/, promptResult];
|
|
9118
9093
|
}
|
|
@@ -9158,8 +9133,7 @@ function cacheLlmTools(llmTools, options) {
|
|
|
9158
9133
|
function limitTotalUsage(llmTools, options) {
|
|
9159
9134
|
var _this = this;
|
|
9160
9135
|
if (options === void 0) { options = {}; }
|
|
9161
|
-
var _a = options.maxTotalUsage, maxTotalUsage = _a === void 0 ? ZERO_USAGE : _a, _b = options.storage
|
|
9162
|
-
TODO_USE(storage);
|
|
9136
|
+
var _a = options.maxTotalUsage, maxTotalUsage = _a === void 0 ? ZERO_USAGE : _a, _b = options.storage; _b === void 0 ? new MemoryStorage() : _b;
|
|
9163
9137
|
var proxyTools = countTotalUsage(llmTools);
|
|
9164
9138
|
if (maxTotalUsage.price.value !== 0) {
|
|
9165
9139
|
throw new NotYetImplementedError('`limitTotalUsage` is not yet implemented for non-zero price');
|
|
@@ -9168,7 +9142,6 @@ function limitTotalUsage(llmTools, options) {
|
|
|
9168
9142
|
if (proxyTools.callChatModel !== undefined) {
|
|
9169
9143
|
proxyTools.callChatModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
9170
9144
|
return __generator(this, function (_a) {
|
|
9171
|
-
TODO_USE(prompt);
|
|
9172
9145
|
throw new LimitReachedError('Cannot call `callChatModel` because you are not allowed to spend any cost');
|
|
9173
9146
|
});
|
|
9174
9147
|
}); };
|
|
@@ -9176,7 +9149,6 @@ function limitTotalUsage(llmTools, options) {
|
|
|
9176
9149
|
if (proxyTools.callCompletionModel !== undefined) {
|
|
9177
9150
|
proxyTools.callCompletionModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
9178
9151
|
return __generator(this, function (_a) {
|
|
9179
|
-
TODO_USE(prompt);
|
|
9180
9152
|
throw new LimitReachedError('Cannot call `callCompletionModel` because you are not allowed to spend any cost');
|
|
9181
9153
|
});
|
|
9182
9154
|
}); };
|
|
@@ -9184,7 +9156,6 @@ function limitTotalUsage(llmTools, options) {
|
|
|
9184
9156
|
if (proxyTools.callEmbeddingModel !== undefined) {
|
|
9185
9157
|
proxyTools.callEmbeddingModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
9186
9158
|
return __generator(this, function (_a) {
|
|
9187
|
-
TODO_USE(prompt);
|
|
9188
9159
|
throw new LimitReachedError('Cannot call `callEmbeddingModel` because you are not allowed to spend any cost');
|
|
9189
9160
|
});
|
|
9190
9161
|
}); };
|
|
@@ -9349,8 +9320,6 @@ var _OpenAiAssistantMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
|
9349
9320
|
};
|
|
9350
9321
|
},
|
|
9351
9322
|
createConfigurationFromEnv: function (env) {
|
|
9352
|
-
// TODO: Maybe auto-configure (multiple) assistants from env variables
|
|
9353
|
-
keepUnused(env);
|
|
9354
9323
|
return null;
|
|
9355
9324
|
/*
|
|
9356
9325
|
if (typeof env.OPENAI_API_KEY === 'string' || typeof env.OPENAI_XXX === 'string') {
|
|
@@ -9494,6 +9463,54 @@ var websiteScraperMetadata = $deepFreeze({
|
|
|
9494
9463
|
*/
|
|
9495
9464
|
var _WebsiteScraperMetadataRegistration = $scrapersMetadataRegister.register(websiteScraperMetadata);
|
|
9496
9465
|
|
|
9466
|
+
/**
|
|
9467
|
+
* Behaves like a storage but forgets everything you put in it
|
|
9468
|
+
*
|
|
9469
|
+
* @public exported from `@promptbook/core`
|
|
9470
|
+
*/
|
|
9471
|
+
var BlackholeStorage = /** @class */ (function () {
|
|
9472
|
+
function BlackholeStorage() {
|
|
9473
|
+
}
|
|
9474
|
+
Object.defineProperty(BlackholeStorage.prototype, "length", {
|
|
9475
|
+
/**
|
|
9476
|
+
* Returns the number of key/value pairs currently present in the list associated with the object.
|
|
9477
|
+
*/
|
|
9478
|
+
get: function () {
|
|
9479
|
+
return 0;
|
|
9480
|
+
},
|
|
9481
|
+
enumerable: false,
|
|
9482
|
+
configurable: true
|
|
9483
|
+
});
|
|
9484
|
+
/**
|
|
9485
|
+
* Empties the list associated with the object of all key/value pairs, if there are any.
|
|
9486
|
+
*/
|
|
9487
|
+
BlackholeStorage.prototype.clear = function () { };
|
|
9488
|
+
/**
|
|
9489
|
+
* Returns the current value associated with the given key, or null if the given key does not exist in the list associated with the object.
|
|
9490
|
+
* @param key
|
|
9491
|
+
*/
|
|
9492
|
+
BlackholeStorage.prototype.getItem = function (key) {
|
|
9493
|
+
return null;
|
|
9494
|
+
};
|
|
9495
|
+
/**
|
|
9496
|
+
* Returns the name of the nth key in the list, or null if n is greater than or equal to the number of key/value pairs in the object.
|
|
9497
|
+
*/
|
|
9498
|
+
BlackholeStorage.prototype.key = function (index) {
|
|
9499
|
+
return null;
|
|
9500
|
+
};
|
|
9501
|
+
/**
|
|
9502
|
+
* Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.
|
|
9503
|
+
*/
|
|
9504
|
+
BlackholeStorage.prototype.setItem = function (key, value) {
|
|
9505
|
+
};
|
|
9506
|
+
/**
|
|
9507
|
+
* Removes the key/value pair with the given key from the list associated with the object, if a key/value pair with the given key exists.
|
|
9508
|
+
*/
|
|
9509
|
+
BlackholeStorage.prototype.removeItem = function (key) {
|
|
9510
|
+
};
|
|
9511
|
+
return BlackholeStorage;
|
|
9512
|
+
}());
|
|
9513
|
+
|
|
9497
9514
|
/**
|
|
9498
9515
|
* This class behaves like LocalStorage but separates keys by prefix
|
|
9499
9516
|
*
|
|
@@ -9844,5 +9861,5 @@ function executionReportJsonToString(executionReportJson, options) {
|
|
|
9844
9861
|
* TODO: [🧠] Should be in generated file GENERATOR_WARNING
|
|
9845
9862
|
*/
|
|
9846
9863
|
|
|
9847
|
-
export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, AbstractFormatError, CLAIM, CallbackInterfaceTools, CollectionError, CsvFormatDefinition, CsvFormatError, DEFAULT_CSV_SETTINGS, DEFAULT_EXECUTIONS_CACHE_DIRNAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_REMOTE_URL, DEFAULT_REMOTE_URL_PATH, DEFAULT_SCRAPE_CACHE_DIRNAME, ERRORS, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, KnowledgeScrapeError, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_VARIANTS, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NotFoundError, NotYetImplementedError,
|
|
9864
|
+
export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, AbstractFormatError, BOOK_LANGUAGE_VERSION, BlackholeStorage, CLAIM, CallbackInterfaceTools, CollectionError, CsvFormatDefinition, CsvFormatError, DEFAULT_CSV_SETTINGS, DEFAULT_EXECUTIONS_CACHE_DIRNAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_REMOTE_URL, DEFAULT_REMOTE_URL_PATH, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TITLE, ERRORS, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, KnowledgeScrapeError, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_VARIANTS, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NotFoundError, NotYetImplementedError, PROMPTBOOK_ENGINE_VERSION, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, RESERVED_PARAMETER_NAMES, TemplateTypes, TextFormatDefinition, UNCERTAIN_USAGE, UnexpectedError, ZERO_USAGE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _DocumentScraperMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, addUsage, assertsExecutionSuccessful, cacheLlmTools, collectionToJson, countTotalUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, isPassingExpectations, isPipelinePrepared, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, pipelineJsonToString, pipelineStringToJson, pipelineStringToJsonSync, prepareKnowledgePieces, preparePersona, preparePipeline, prepareTemplates, prettifyPipelineString, stringifyPipelineJson, unpreparePipeline, usageToHuman, usageToWorktime, validatePipeline };
|
|
9848
9865
|
//# sourceMappingURL=index.es.js.map
|