@promptbook/core 0.73.0 → 0.74.0-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +130 -3
- package/esm/index.es.js +227 -345
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/anthropic-claude.index.d.ts +2 -2
- package/esm/typings/src/_packages/azure-openai.index.d.ts +2 -2
- package/esm/typings/src/_packages/browser.index.d.ts +2 -2
- package/esm/typings/src/_packages/cli.index.d.ts +2 -2
- package/esm/typings/src/_packages/core.index.d.ts +2 -2
- package/esm/typings/src/_packages/documents.index.d.ts +2 -2
- package/esm/typings/src/_packages/execute-javascript.index.d.ts +2 -2
- package/esm/typings/src/_packages/fake-llm.index.d.ts +2 -2
- package/esm/typings/src/_packages/langtail.index.d.ts +2 -2
- package/esm/typings/src/_packages/legacy-documents.index.d.ts +2 -2
- package/esm/typings/src/_packages/markdown-utils.index.d.ts +2 -2
- package/esm/typings/src/_packages/node.index.d.ts +2 -2
- package/esm/typings/src/_packages/openai.index.d.ts +2 -2
- package/esm/typings/src/_packages/pdf.index.d.ts +2 -2
- package/esm/typings/src/_packages/remote-client.index.d.ts +2 -2
- package/esm/typings/src/_packages/remote-server.index.d.ts +2 -2
- package/esm/typings/src/_packages/utils.index.d.ts +2 -2
- package/esm/typings/src/_packages/website-crawler.index.d.ts +2 -2
- package/esm/typings/src/cli/cli-commands/make.d.ts +0 -1
- package/esm/typings/src/cli/cli-commands/run.d.ts +13 -0
- package/esm/typings/src/cli/promptbookCli.d.ts +1 -0
- package/esm/typings/src/cli/test/ptbk.d.ts +4 -1
- package/esm/typings/src/commands/{PROMPTBOOK_VERSION/PromptbookVersionCommand.d.ts → BOOK_VERSION/BookVersionCommand.d.ts} +4 -4
- package/esm/typings/src/commands/BOOK_VERSION/bookVersionCommandParser.d.ts +9 -0
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +1 -1
- package/esm/typings/src/commands/index.d.ts +1 -1
- package/esm/typings/src/version.d.ts +13 -2
- package/package.json +1 -1
- package/umd/index.umd.js +228 -345
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommandParser.d.ts +0 -9
- /package/esm/typings/src/commands/{PROMPTBOOK_VERSION/promptbookVersionCommand.test.d.ts → BOOK_VERSION/bookVersionCommand.test.d.ts} +0 -0
package/esm/index.es.js
CHANGED
|
@@ -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-1';
|
|
26
|
+
/**
|
|
27
|
+
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
16
28
|
*/
|
|
17
|
-
var PROMPTBOOK_VERSION = '0.72.0';
|
|
18
|
-
// TODO: [main] !!!! List here all the versions and annotate + put into script
|
|
19
29
|
|
|
20
30
|
/*! *****************************************************************************
|
|
21
31
|
Copyright (c) Microsoft Corporation.
|
|
@@ -875,7 +885,7 @@ function isValidPromptbookVersion(version) {
|
|
|
875
885
|
if ( /* version === '1.0.0' || */version === '2.0.0' || version === '3.0.0') {
|
|
876
886
|
return false;
|
|
877
887
|
}
|
|
878
|
-
// <- TODO: [main] !!! Check isValidPromptbookVersion against
|
|
888
|
+
// <- TODO: [main] !!! Check isValidPromptbookVersion against PROMPTBOOK_ENGINE_VERSIONS
|
|
879
889
|
return true;
|
|
880
890
|
}
|
|
881
891
|
|
|
@@ -1803,6 +1813,188 @@ var UNCERTAIN_USAGE = $deepFreeze({
|
|
|
1803
1813
|
},
|
|
1804
1814
|
});
|
|
1805
1815
|
|
|
1816
|
+
/**
|
|
1817
|
+
* @@@
|
|
1818
|
+
*
|
|
1819
|
+
* @public exported from `@promptbook/utils`
|
|
1820
|
+
*/
|
|
1821
|
+
function deepClone(objectValue) {
|
|
1822
|
+
return JSON.parse(JSON.stringify(objectValue));
|
|
1823
|
+
/*
|
|
1824
|
+
TODO: [🧠] Is there a better implementation?
|
|
1825
|
+
> const propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
1826
|
+
> for (const propertyName of propertyNames) {
|
|
1827
|
+
> const value = (objectValue as really_any)[propertyName];
|
|
1828
|
+
> if (value && typeof value === 'object') {
|
|
1829
|
+
> deepClone(value);
|
|
1830
|
+
> }
|
|
1831
|
+
> }
|
|
1832
|
+
> return Object.assign({}, objectValue);
|
|
1833
|
+
*/
|
|
1834
|
+
}
|
|
1835
|
+
/**
|
|
1836
|
+
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
1837
|
+
*/
|
|
1838
|
+
|
|
1839
|
+
/**
|
|
1840
|
+
* Function `addUsage` will add multiple usages into one
|
|
1841
|
+
*
|
|
1842
|
+
* Note: If you provide 0 values, it returns ZERO_USAGE
|
|
1843
|
+
*
|
|
1844
|
+
* @public exported from `@promptbook/core`
|
|
1845
|
+
*/
|
|
1846
|
+
function addUsage() {
|
|
1847
|
+
var usageItems = [];
|
|
1848
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1849
|
+
usageItems[_i] = arguments[_i];
|
|
1850
|
+
}
|
|
1851
|
+
return usageItems.reduce(function (acc, item) {
|
|
1852
|
+
var e_1, _a, e_2, _b;
|
|
1853
|
+
var _c;
|
|
1854
|
+
acc.price.value += ((_c = item.price) === null || _c === void 0 ? void 0 : _c.value) || 0;
|
|
1855
|
+
try {
|
|
1856
|
+
for (var _d = __values(Object.keys(acc.input)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
1857
|
+
var key = _e.value;
|
|
1858
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1859
|
+
//@ts-ignore
|
|
1860
|
+
if (item.input[key]) {
|
|
1861
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1862
|
+
//@ts-ignore
|
|
1863
|
+
acc.input[key].value += item.input[key].value || 0;
|
|
1864
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1865
|
+
//@ts-ignore
|
|
1866
|
+
if (item.input[key].isUncertain) {
|
|
1867
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1868
|
+
//@ts-ignore
|
|
1869
|
+
acc.input[key].isUncertain = true;
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1875
|
+
finally {
|
|
1876
|
+
try {
|
|
1877
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
1878
|
+
}
|
|
1879
|
+
finally { if (e_1) throw e_1.error; }
|
|
1880
|
+
}
|
|
1881
|
+
try {
|
|
1882
|
+
for (var _f = __values(Object.keys(acc.output)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
1883
|
+
var key = _g.value;
|
|
1884
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1885
|
+
//@ts-ignore
|
|
1886
|
+
if (item.output[key]) {
|
|
1887
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1888
|
+
//@ts-ignore
|
|
1889
|
+
acc.output[key].value += item.output[key].value || 0;
|
|
1890
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1891
|
+
//@ts-ignore
|
|
1892
|
+
if (item.output[key].isUncertain) {
|
|
1893
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1894
|
+
//@ts-ignore
|
|
1895
|
+
acc.output[key].isUncertain = true;
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1901
|
+
finally {
|
|
1902
|
+
try {
|
|
1903
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
1904
|
+
}
|
|
1905
|
+
finally { if (e_2) throw e_2.error; }
|
|
1906
|
+
}
|
|
1907
|
+
return acc;
|
|
1908
|
+
}, deepClone(ZERO_USAGE));
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
/**
|
|
1912
|
+
* Intercepts LLM tools and counts total usage of the tools
|
|
1913
|
+
*
|
|
1914
|
+
* @param llmTools LLM tools to be intercepted with usage counting
|
|
1915
|
+
* @returns LLM tools with same functionality with added total cost counting
|
|
1916
|
+
* @public exported from `@promptbook/core`
|
|
1917
|
+
*/
|
|
1918
|
+
function countTotalUsage(llmTools) {
|
|
1919
|
+
var _this = this;
|
|
1920
|
+
var totalUsage = ZERO_USAGE;
|
|
1921
|
+
var proxyTools = {
|
|
1922
|
+
get title() {
|
|
1923
|
+
// TODO: [🧠] Maybe put here some suffix
|
|
1924
|
+
return llmTools.title;
|
|
1925
|
+
},
|
|
1926
|
+
get description() {
|
|
1927
|
+
// TODO: [🧠] Maybe put here some suffix
|
|
1928
|
+
return llmTools.description;
|
|
1929
|
+
},
|
|
1930
|
+
checkConfiguration: function () {
|
|
1931
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1932
|
+
return __generator(this, function (_a) {
|
|
1933
|
+
return [2 /*return*/, /* not await */ llmTools.checkConfiguration()];
|
|
1934
|
+
});
|
|
1935
|
+
});
|
|
1936
|
+
},
|
|
1937
|
+
listModels: function () {
|
|
1938
|
+
return /* not await */ llmTools.listModels();
|
|
1939
|
+
},
|
|
1940
|
+
getTotalUsage: function () {
|
|
1941
|
+
// <- Note: [🥫] Not using getter `get totalUsage` but `getTotalUsage` to allow this object to be proxied
|
|
1942
|
+
return totalUsage;
|
|
1943
|
+
},
|
|
1944
|
+
};
|
|
1945
|
+
if (llmTools.callChatModel !== undefined) {
|
|
1946
|
+
proxyTools.callChatModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
1947
|
+
var promptResult;
|
|
1948
|
+
return __generator(this, function (_a) {
|
|
1949
|
+
switch (_a.label) {
|
|
1950
|
+
case 0: return [4 /*yield*/, llmTools.callChatModel(prompt)];
|
|
1951
|
+
case 1:
|
|
1952
|
+
promptResult = _a.sent();
|
|
1953
|
+
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
1954
|
+
return [2 /*return*/, promptResult];
|
|
1955
|
+
}
|
|
1956
|
+
});
|
|
1957
|
+
}); };
|
|
1958
|
+
}
|
|
1959
|
+
if (llmTools.callCompletionModel !== undefined) {
|
|
1960
|
+
proxyTools.callCompletionModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
1961
|
+
var promptResult;
|
|
1962
|
+
return __generator(this, function (_a) {
|
|
1963
|
+
switch (_a.label) {
|
|
1964
|
+
case 0: return [4 /*yield*/, llmTools.callCompletionModel(prompt)];
|
|
1965
|
+
case 1:
|
|
1966
|
+
promptResult = _a.sent();
|
|
1967
|
+
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
1968
|
+
return [2 /*return*/, promptResult];
|
|
1969
|
+
}
|
|
1970
|
+
});
|
|
1971
|
+
}); };
|
|
1972
|
+
}
|
|
1973
|
+
if (llmTools.callEmbeddingModel !== undefined) {
|
|
1974
|
+
proxyTools.callEmbeddingModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
1975
|
+
var promptResult;
|
|
1976
|
+
return __generator(this, function (_a) {
|
|
1977
|
+
switch (_a.label) {
|
|
1978
|
+
case 0: return [4 /*yield*/, llmTools.callEmbeddingModel(prompt)];
|
|
1979
|
+
case 1:
|
|
1980
|
+
promptResult = _a.sent();
|
|
1981
|
+
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
1982
|
+
return [2 /*return*/, promptResult];
|
|
1983
|
+
}
|
|
1984
|
+
});
|
|
1985
|
+
}); };
|
|
1986
|
+
}
|
|
1987
|
+
// <- Note: [🤖]
|
|
1988
|
+
return proxyTools;
|
|
1989
|
+
}
|
|
1990
|
+
/**
|
|
1991
|
+
* TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
|
|
1992
|
+
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
1993
|
+
* TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
|
|
1994
|
+
* > const [llmToolsWithUsage,getUsage] = countTotalUsage(llmTools);
|
|
1995
|
+
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
1996
|
+
*/
|
|
1997
|
+
|
|
1806
1998
|
/**
|
|
1807
1999
|
* This error indicates errors during the execution of the pipeline
|
|
1808
2000
|
*
|
|
@@ -2111,188 +2303,6 @@ function joinLlmExecutionTools() {
|
|
|
2111
2303
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
2112
2304
|
*/
|
|
2113
2305
|
|
|
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
2306
|
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"}];
|
|
2297
2307
|
|
|
2298
2308
|
/**
|
|
@@ -2697,23 +2707,6 @@ function union() {
|
|
|
2697
2707
|
return union;
|
|
2698
2708
|
}
|
|
2699
2709
|
|
|
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
2710
|
/**
|
|
2718
2711
|
* This error indicates problems parsing the format value
|
|
2719
2712
|
*
|
|
@@ -2770,22 +2763,12 @@ var CsvFormatDefinition = {
|
|
|
2770
2763
|
formatName: 'CSV',
|
|
2771
2764
|
aliases: ['SPREADSHEET', 'TABLE'],
|
|
2772
2765
|
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
2766
|
return true;
|
|
2778
2767
|
},
|
|
2779
2768
|
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
2769
|
return true;
|
|
2784
2770
|
},
|
|
2785
2771
|
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
2772
|
throw new Error('Not implemented');
|
|
2790
2773
|
},
|
|
2791
2774
|
subvalueDefinitions: [
|
|
@@ -2904,20 +2887,12 @@ var JsonFormatDefinition = {
|
|
|
2904
2887
|
formatName: 'JSON',
|
|
2905
2888
|
mimeType: 'application/json',
|
|
2906
2889
|
isValid: function (value, settings, schema) {
|
|
2907
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2908
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2909
2890
|
return isValidJsonString(value);
|
|
2910
2891
|
},
|
|
2911
2892
|
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
2893
|
return true;
|
|
2916
2894
|
},
|
|
2917
2895
|
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
2896
|
throw new Error('Not implemented');
|
|
2922
2897
|
},
|
|
2923
2898
|
subvalueDefinitions: [],
|
|
@@ -2999,21 +2974,12 @@ var XmlFormatDefinition = {
|
|
|
2999
2974
|
formatName: 'XML',
|
|
3000
2975
|
mimeType: 'application/xml',
|
|
3001
2976
|
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
2977
|
return true;
|
|
3006
2978
|
},
|
|
3007
2979
|
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
2980
|
return true;
|
|
3012
2981
|
},
|
|
3013
2982
|
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
2983
|
throw new Error('Not implemented');
|
|
3018
2984
|
},
|
|
3019
2985
|
subvalueDefinitions: [],
|
|
@@ -3246,27 +3212,6 @@ function arrayableToArray(input) {
|
|
|
3246
3212
|
return [input];
|
|
3247
3213
|
}
|
|
3248
3214
|
|
|
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
3215
|
/**
|
|
3271
3216
|
* Replaces parameters in template with values from parameters object
|
|
3272
3217
|
*
|
|
@@ -4043,7 +3988,6 @@ function executeAttempts(options) {
|
|
|
4043
3988
|
$ongoingTemplateResult.$resultString = extractJsonBlock($ongoingTemplateResult.$resultString || '');
|
|
4044
3989
|
}
|
|
4045
3990
|
catch (error) {
|
|
4046
|
-
keepUnused(error);
|
|
4047
3991
|
throw new ExpectError(spaceTrim$1(function (block) { return "\n Expected valid JSON string\n\n ".concat(block(
|
|
4048
3992
|
/*<- Note: No need for `pipelineIdentification`, it will be catched and added later */ ''), "\n "); }));
|
|
4049
3993
|
}
|
|
@@ -4221,7 +4165,6 @@ function executeFormatSubvalues(options) {
|
|
|
4221
4165
|
function getContextForTemplate(template) {
|
|
4222
4166
|
return __awaiter(this, void 0, void 0, function () {
|
|
4223
4167
|
return __generator(this, function (_a) {
|
|
4224
|
-
TODO_USE(template);
|
|
4225
4168
|
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [🏍] Implement */];
|
|
4226
4169
|
});
|
|
4227
4170
|
});
|
|
@@ -4234,11 +4177,9 @@ function getContextForTemplate(template) {
|
|
|
4234
4177
|
*/
|
|
4235
4178
|
function getKnowledgeForTemplate(options) {
|
|
4236
4179
|
return __awaiter(this, void 0, void 0, function () {
|
|
4237
|
-
var preparedPipeline
|
|
4180
|
+
var preparedPipeline;
|
|
4238
4181
|
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);
|
|
4182
|
+
preparedPipeline = options.preparedPipeline, options.template;
|
|
4242
4183
|
return [2 /*return*/, preparedPipeline.knowledgePieces.map(function (_a) {
|
|
4243
4184
|
var content = _a.content;
|
|
4244
4185
|
return "- ".concat(content);
|
|
@@ -4255,8 +4196,6 @@ function getKnowledgeForTemplate(options) {
|
|
|
4255
4196
|
function getExamplesForTemplate(template) {
|
|
4256
4197
|
return __awaiter(this, void 0, void 0, function () {
|
|
4257
4198
|
return __generator(this, function (_a) {
|
|
4258
|
-
// TODO: [♨] Implement Better - use real index and keyword search
|
|
4259
|
-
TODO_USE(template);
|
|
4260
4199
|
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [♨] Implement */];
|
|
4261
4200
|
});
|
|
4262
4201
|
});
|
|
@@ -4275,13 +4214,13 @@ function getReservedParametersForTemplate(options) {
|
|
|
4275
4214
|
switch (_b.label) {
|
|
4276
4215
|
case 0:
|
|
4277
4216
|
preparedPipeline = options.preparedPipeline, template = options.template, pipelineIdentification = options.pipelineIdentification;
|
|
4278
|
-
return [4 /*yield*/, getContextForTemplate(
|
|
4217
|
+
return [4 /*yield*/, getContextForTemplate()];
|
|
4279
4218
|
case 1:
|
|
4280
4219
|
context = _b.sent();
|
|
4281
4220
|
return [4 /*yield*/, getKnowledgeForTemplate({ preparedPipeline: preparedPipeline, template: template })];
|
|
4282
4221
|
case 2:
|
|
4283
4222
|
knowledge = _b.sent();
|
|
4284
|
-
return [4 /*yield*/, getExamplesForTemplate(
|
|
4223
|
+
return [4 /*yield*/, getExamplesForTemplate()];
|
|
4285
4224
|
case 3:
|
|
4286
4225
|
examples = _b.sent();
|
|
4287
4226
|
currentDate = new Date().toISOString();
|
|
@@ -4516,7 +4455,7 @@ function executePipeline(options) {
|
|
|
4516
4455
|
executionReport = {
|
|
4517
4456
|
pipelineUrl: preparedPipeline.pipelineUrl,
|
|
4518
4457
|
title: preparedPipeline.title,
|
|
4519
|
-
promptbookUsedVersion:
|
|
4458
|
+
promptbookUsedVersion: PROMPTBOOK_ENGINE_VERSION,
|
|
4520
4459
|
promptbookRequestedVersion: preparedPipeline.promptbookVersion,
|
|
4521
4460
|
description: preparedPipeline.description,
|
|
4522
4461
|
promptExecutions: [],
|
|
@@ -5363,16 +5302,13 @@ function isValidFilePath(filename) {
|
|
|
5363
5302
|
function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
5364
5303
|
var _a;
|
|
5365
5304
|
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;
|
|
5305
|
+
var sourceContent, name, _b, _c, rootDirname, url, response_1, mimeType, filename_1, fileExtension, mimeType;
|
|
5369
5306
|
return __generator(this, function (_e) {
|
|
5370
5307
|
switch (_e.label) {
|
|
5371
5308
|
case 0:
|
|
5372
5309
|
sourceContent = knowledgeSource.sourceContent;
|
|
5373
5310
|
name = knowledgeSource.name;
|
|
5374
|
-
_b = options || {}, _c = _b.rootDirname, rootDirname = _c === void 0 ? null : _c,
|
|
5375
|
-
TODO_USE(isVerbose);
|
|
5311
|
+
_b = options || {}, _c = _b.rootDirname, rootDirname = _c === void 0 ? null : _c, _b.isVerbose;
|
|
5376
5312
|
if (!name) {
|
|
5377
5313
|
name = sourceContentToName(sourceContent);
|
|
5378
5314
|
}
|
|
@@ -5652,15 +5588,13 @@ function clonePipeline(pipeline) {
|
|
|
5652
5588
|
*/
|
|
5653
5589
|
function prepareTemplates(pipeline, tools, options) {
|
|
5654
5590
|
return __awaiter(this, void 0, void 0, function () {
|
|
5655
|
-
var _a, maxParallelCount, templates,
|
|
5591
|
+
var _a, maxParallelCount, templates, knowledgePiecesCount, templatesPrepared;
|
|
5656
5592
|
var _this = this;
|
|
5657
5593
|
return __generator(this, function (_b) {
|
|
5658
5594
|
switch (_b.label) {
|
|
5659
5595
|
case 0:
|
|
5660
5596
|
_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);
|
|
5597
|
+
templates = pipeline.templates, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
|
|
5664
5598
|
templatesPrepared = new Array(templates.length);
|
|
5665
5599
|
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
5600
|
var dependentParameterNames, preparedContent, preparedTemplate;
|
|
@@ -5730,7 +5664,7 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
5730
5664
|
currentPreparation = {
|
|
5731
5665
|
id: 1,
|
|
5732
5666
|
// TODO: [🍥]> date: $currentDate(),
|
|
5733
|
-
promptbookVersion:
|
|
5667
|
+
promptbookVersion: PROMPTBOOK_ENGINE_VERSION,
|
|
5734
5668
|
usage: ZERO_USAGE,
|
|
5735
5669
|
};
|
|
5736
5670
|
preparations = [
|
|
@@ -5870,7 +5804,6 @@ var knowledgeCommandParser = {
|
|
|
5870
5804
|
* Note: This is used in `pipelineJsonToString` utility
|
|
5871
5805
|
*/
|
|
5872
5806
|
stringify: function (command) {
|
|
5873
|
-
keepUnused(command);
|
|
5874
5807
|
return "---"; // <- TODO: [🛋] Implement
|
|
5875
5808
|
},
|
|
5876
5809
|
/**
|
|
@@ -5879,7 +5812,6 @@ var knowledgeCommandParser = {
|
|
|
5879
5812
|
* Note: This is used in `pipelineJsonToString` utility
|
|
5880
5813
|
*/
|
|
5881
5814
|
takeFromPipelineJson: function (pipelineJson) {
|
|
5882
|
-
keepUnused(pipelineJson);
|
|
5883
5815
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
5884
5816
|
},
|
|
5885
5817
|
};
|
|
@@ -6044,7 +5976,6 @@ var templateCommandParser = {
|
|
|
6044
5976
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6045
5977
|
*/
|
|
6046
5978
|
stringify: function (command) {
|
|
6047
|
-
keepUnused(command);
|
|
6048
5979
|
return "---"; // <- TODO: [🛋] Implement
|
|
6049
5980
|
},
|
|
6050
5981
|
/**
|
|
@@ -6053,7 +5984,6 @@ var templateCommandParser = {
|
|
|
6053
5984
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6054
5985
|
*/
|
|
6055
5986
|
takeFromTemplateJson: function ($templateJson) {
|
|
6056
|
-
keepUnused($templateJson);
|
|
6057
5987
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6058
5988
|
},
|
|
6059
5989
|
};
|
|
@@ -6285,7 +6215,6 @@ var expectCommandParser = {
|
|
|
6285
6215
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6286
6216
|
*/
|
|
6287
6217
|
stringify: function (command) {
|
|
6288
|
-
keepUnused(command);
|
|
6289
6218
|
return "---"; // <- TODO: [🛋] Implement
|
|
6290
6219
|
},
|
|
6291
6220
|
/**
|
|
@@ -6294,7 +6223,6 @@ var expectCommandParser = {
|
|
|
6294
6223
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6295
6224
|
*/
|
|
6296
6225
|
takeFromTemplateJson: function ($templateJson) {
|
|
6297
|
-
keepUnused($templateJson);
|
|
6298
6226
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6299
6227
|
},
|
|
6300
6228
|
};
|
|
@@ -6613,7 +6541,6 @@ var foreachCommandParser = {
|
|
|
6613
6541
|
inputSubparameterNames: inputSubparameterNames,
|
|
6614
6542
|
outputSubparameterName: outputSubparameterName,
|
|
6615
6543
|
};
|
|
6616
|
-
keepUnused($pipelineJson); // <- TODO: [🧠] Maybe register subparameter from foreach into parameters of the pipeline
|
|
6617
6544
|
// Note: [🍭] FOREACH apply has some sideeffects on different places in codebase
|
|
6618
6545
|
},
|
|
6619
6546
|
/**
|
|
@@ -6622,7 +6549,6 @@ var foreachCommandParser = {
|
|
|
6622
6549
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6623
6550
|
*/
|
|
6624
6551
|
stringify: function (command) {
|
|
6625
|
-
keepUnused(command);
|
|
6626
6552
|
return "---"; // <- TODO: [🛋] Implement
|
|
6627
6553
|
},
|
|
6628
6554
|
/**
|
|
@@ -6631,7 +6557,6 @@ var foreachCommandParser = {
|
|
|
6631
6557
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6632
6558
|
*/
|
|
6633
6559
|
takeFromTemplateJson: function ($templateJson) {
|
|
6634
|
-
keepUnused($templateJson);
|
|
6635
6560
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6636
6561
|
},
|
|
6637
6562
|
};
|
|
@@ -6699,7 +6624,6 @@ var formatCommandParser = {
|
|
|
6699
6624
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6700
6625
|
*/
|
|
6701
6626
|
stringify: function (command) {
|
|
6702
|
-
keepUnused(command);
|
|
6703
6627
|
return "---"; // <- TODO: [🛋] Implement
|
|
6704
6628
|
},
|
|
6705
6629
|
/**
|
|
@@ -6708,7 +6632,6 @@ var formatCommandParser = {
|
|
|
6708
6632
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6709
6633
|
*/
|
|
6710
6634
|
takeFromTemplateJson: function ($templateJson) {
|
|
6711
|
-
keepUnused($templateJson);
|
|
6712
6635
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6713
6636
|
},
|
|
6714
6637
|
};
|
|
@@ -6771,7 +6694,6 @@ var jokerCommandParser = {
|
|
|
6771
6694
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6772
6695
|
*/
|
|
6773
6696
|
stringify: function (command) {
|
|
6774
|
-
keepUnused(command);
|
|
6775
6697
|
return "---"; // <- TODO: [🛋] Implement
|
|
6776
6698
|
},
|
|
6777
6699
|
/**
|
|
@@ -6780,7 +6702,6 @@ var jokerCommandParser = {
|
|
|
6780
6702
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6781
6703
|
*/
|
|
6782
6704
|
takeFromTemplateJson: function ($templateJson) {
|
|
6783
|
-
keepUnused($templateJson);
|
|
6784
6705
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6785
6706
|
},
|
|
6786
6707
|
};
|
|
@@ -6916,7 +6837,6 @@ var modelCommandParser = {
|
|
|
6916
6837
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6917
6838
|
*/
|
|
6918
6839
|
stringify: function (command) {
|
|
6919
|
-
keepUnused(command);
|
|
6920
6840
|
return "---"; // <- TODO: [🛋] Implement
|
|
6921
6841
|
},
|
|
6922
6842
|
/**
|
|
@@ -6925,7 +6845,6 @@ var modelCommandParser = {
|
|
|
6925
6845
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6926
6846
|
*/
|
|
6927
6847
|
takeFromPipelineJson: function (pipelineJson) {
|
|
6928
|
-
keepUnused(pipelineJson);
|
|
6929
6848
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6930
6849
|
},
|
|
6931
6850
|
/**
|
|
@@ -6934,7 +6853,6 @@ var modelCommandParser = {
|
|
|
6934
6853
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6935
6854
|
*/
|
|
6936
6855
|
takeFromTemplateJson: function ($templateJson) {
|
|
6937
|
-
keepUnused($templateJson);
|
|
6938
6856
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6939
6857
|
},
|
|
6940
6858
|
};
|
|
@@ -7008,7 +6926,6 @@ var parameterCommandParser = {
|
|
|
7008
6926
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7009
6927
|
*/
|
|
7010
6928
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
7011
|
-
keepUnused(command, $pipelineJson);
|
|
7012
6929
|
// Note: [🍣] Do nothing, its application is implemented separately in `pipelineStringToJsonSync`
|
|
7013
6930
|
},
|
|
7014
6931
|
/**
|
|
@@ -7017,7 +6934,6 @@ var parameterCommandParser = {
|
|
|
7017
6934
|
* Note: `$` is used to indicate that this function mutates given `templateJson`
|
|
7018
6935
|
*/
|
|
7019
6936
|
$applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
|
|
7020
|
-
keepUnused(command, $templateJson, $pipelineJson);
|
|
7021
6937
|
// Note: [🍣] Do nothing, its application is implemented separately in `pipelineStringToJsonSync`
|
|
7022
6938
|
},
|
|
7023
6939
|
/**
|
|
@@ -7026,7 +6942,6 @@ var parameterCommandParser = {
|
|
|
7026
6942
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7027
6943
|
*/
|
|
7028
6944
|
stringify: function (command) {
|
|
7029
|
-
keepUnused(command);
|
|
7030
6945
|
return "---"; // <- TODO: [🛋] Implement
|
|
7031
6946
|
},
|
|
7032
6947
|
/**
|
|
@@ -7035,7 +6950,6 @@ var parameterCommandParser = {
|
|
|
7035
6950
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7036
6951
|
*/
|
|
7037
6952
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7038
|
-
keepUnused(pipelineJson);
|
|
7039
6953
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7040
6954
|
},
|
|
7041
6955
|
/**
|
|
@@ -7044,7 +6958,6 @@ var parameterCommandParser = {
|
|
|
7044
6958
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7045
6959
|
*/
|
|
7046
6960
|
takeFromTemplateJson: function ($templateJson) {
|
|
7047
|
-
keepUnused($templateJson);
|
|
7048
6961
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7049
6962
|
},
|
|
7050
6963
|
};
|
|
@@ -7116,7 +7029,6 @@ var personaCommandParser = {
|
|
|
7116
7029
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7117
7030
|
*/
|
|
7118
7031
|
stringify: function (command) {
|
|
7119
|
-
keepUnused(command);
|
|
7120
7032
|
return "---"; // <- TODO: [🛋] Implement
|
|
7121
7033
|
},
|
|
7122
7034
|
/**
|
|
@@ -7125,7 +7037,6 @@ var personaCommandParser = {
|
|
|
7125
7037
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7126
7038
|
*/
|
|
7127
7039
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7128
|
-
keepUnused(pipelineJson);
|
|
7129
7040
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7130
7041
|
},
|
|
7131
7042
|
/**
|
|
@@ -7134,7 +7045,6 @@ var personaCommandParser = {
|
|
|
7134
7045
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7135
7046
|
*/
|
|
7136
7047
|
takeFromTemplateJson: function ($templateJson) {
|
|
7137
|
-
keepUnused($templateJson);
|
|
7138
7048
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7139
7049
|
},
|
|
7140
7050
|
};
|
|
@@ -7253,7 +7163,6 @@ var postprocessCommandParser = {
|
|
|
7253
7163
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7254
7164
|
*/
|
|
7255
7165
|
stringify: function (command) {
|
|
7256
|
-
keepUnused(command);
|
|
7257
7166
|
return "---"; // <- TODO: [🛋] Implement
|
|
7258
7167
|
},
|
|
7259
7168
|
/**
|
|
@@ -7262,42 +7171,41 @@ var postprocessCommandParser = {
|
|
|
7262
7171
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7263
7172
|
*/
|
|
7264
7173
|
takeFromTemplateJson: function ($templateJson) {
|
|
7265
|
-
keepUnused($templateJson);
|
|
7266
7174
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7267
7175
|
},
|
|
7268
7176
|
};
|
|
7269
7177
|
|
|
7270
7178
|
/**
|
|
7271
|
-
* Parses the
|
|
7179
|
+
* Parses the BOOK_VERSION command
|
|
7272
7180
|
*
|
|
7273
7181
|
* @see `documentationUrl` for more details
|
|
7274
7182
|
* @private within the commands folder
|
|
7275
7183
|
*/
|
|
7276
|
-
var
|
|
7184
|
+
var bookVersionCommandParser = {
|
|
7277
7185
|
/**
|
|
7278
7186
|
* Name of the command
|
|
7279
7187
|
*/
|
|
7280
|
-
name: '
|
|
7281
|
-
aliasNames: ['PTBK_VERSION', '
|
|
7188
|
+
name: 'BOOK_VERSION',
|
|
7189
|
+
aliasNames: ['PTBK_VERSION', 'PROMPTBOOK_VERSION', 'BOOK'],
|
|
7282
7190
|
/**
|
|
7283
7191
|
* BOILERPLATE command can be used in:
|
|
7284
7192
|
*/
|
|
7285
7193
|
isUsedInPipelineHead: true,
|
|
7286
7194
|
isUsedInPipelineTemplate: false,
|
|
7287
7195
|
/**
|
|
7288
|
-
* Description of the
|
|
7196
|
+
* Description of the BOOK_VERSION command
|
|
7289
7197
|
*/
|
|
7290
|
-
description: "Which version of the
|
|
7198
|
+
description: "Which version of the Book language is the .ptbk.md using",
|
|
7291
7199
|
/**
|
|
7292
7200
|
* Link to documentation
|
|
7293
7201
|
*/
|
|
7294
7202
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/69',
|
|
7295
7203
|
/**
|
|
7296
|
-
* Example usages of the
|
|
7204
|
+
* Example usages of the BOOK_VERSION command
|
|
7297
7205
|
*/
|
|
7298
|
-
examples: ["
|
|
7206
|
+
examples: ["BOOK VERSION ".concat(BOOK_LANGUAGE_VERSION), "BOOK ".concat(BOOK_LANGUAGE_VERSION)],
|
|
7299
7207
|
/**
|
|
7300
|
-
* Parses the
|
|
7208
|
+
* Parses the BOOK_VERSION command
|
|
7301
7209
|
*/
|
|
7302
7210
|
parse: function (input) {
|
|
7303
7211
|
var args = input.args;
|
|
@@ -7308,16 +7216,16 @@ var promptbookVersionCommandParser = {
|
|
|
7308
7216
|
if (!isValidPromptbookVersion(promptbookVersion)) {
|
|
7309
7217
|
throw new ParseError("Invalid Promptbook version \"".concat(promptbookVersion, "\""));
|
|
7310
7218
|
}
|
|
7311
|
-
if (args.length > 0) {
|
|
7219
|
+
if (args.length > 0 && !(((args.length === 1 && args[0]) || '').toUpperCase() === 'VERSION')) {
|
|
7312
7220
|
throw new ParseError("Can not have more than one Promptbook version");
|
|
7313
7221
|
}
|
|
7314
7222
|
return {
|
|
7315
|
-
type: '
|
|
7223
|
+
type: 'BOOK_VERSION',
|
|
7316
7224
|
promptbookVersion: promptbookVersion,
|
|
7317
7225
|
};
|
|
7318
7226
|
},
|
|
7319
7227
|
/**
|
|
7320
|
-
* Apply the
|
|
7228
|
+
* Apply the BOOK_VERSION command to the `pipelineJson`
|
|
7321
7229
|
*
|
|
7322
7230
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7323
7231
|
*/
|
|
@@ -7326,21 +7234,19 @@ var promptbookVersionCommandParser = {
|
|
|
7326
7234
|
$pipelineJson.promptbookVersion = command.promptbookVersion;
|
|
7327
7235
|
},
|
|
7328
7236
|
/**
|
|
7329
|
-
* Converts the
|
|
7237
|
+
* Converts the BOOK_VERSION command back to string
|
|
7330
7238
|
*
|
|
7331
7239
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7332
7240
|
*/
|
|
7333
7241
|
stringify: function (command) {
|
|
7334
|
-
keepUnused(command);
|
|
7335
7242
|
return "---"; // <- TODO: [🛋] Implement
|
|
7336
7243
|
},
|
|
7337
7244
|
/**
|
|
7338
|
-
* Reads the
|
|
7245
|
+
* Reads the BOOK_VERSION command from the `PipelineJson`
|
|
7339
7246
|
*
|
|
7340
7247
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7341
7248
|
*/
|
|
7342
7249
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7343
|
-
keepUnused(pipelineJson);
|
|
7344
7250
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7345
7251
|
},
|
|
7346
7252
|
};
|
|
@@ -7434,7 +7340,6 @@ var urlCommandParser = {
|
|
|
7434
7340
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7435
7341
|
*/
|
|
7436
7342
|
stringify: function (command) {
|
|
7437
|
-
keepUnused(command);
|
|
7438
7343
|
return "---"; // <- TODO: [🛋] Implement
|
|
7439
7344
|
},
|
|
7440
7345
|
/**
|
|
@@ -7443,7 +7348,6 @@ var urlCommandParser = {
|
|
|
7443
7348
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7444
7349
|
*/
|
|
7445
7350
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7446
|
-
keepUnused(pipelineJson);
|
|
7447
7351
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7448
7352
|
},
|
|
7449
7353
|
};
|
|
@@ -7480,8 +7384,7 @@ var actionCommandParser = {
|
|
|
7480
7384
|
* Parses the ACTION command
|
|
7481
7385
|
*/
|
|
7482
7386
|
parse: function (input) {
|
|
7483
|
-
|
|
7484
|
-
TODO_USE(args);
|
|
7387
|
+
input.args;
|
|
7485
7388
|
return {
|
|
7486
7389
|
type: 'ACTION',
|
|
7487
7390
|
};
|
|
@@ -7492,7 +7395,6 @@ var actionCommandParser = {
|
|
|
7492
7395
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7493
7396
|
*/
|
|
7494
7397
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
7495
|
-
keepUnused(command, $pipelineJson);
|
|
7496
7398
|
console.error(new NotYetImplementedError('[🛠] Actions are not implemented yet'));
|
|
7497
7399
|
},
|
|
7498
7400
|
/**
|
|
@@ -7501,7 +7403,6 @@ var actionCommandParser = {
|
|
|
7501
7403
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7502
7404
|
*/
|
|
7503
7405
|
stringify: function (command) {
|
|
7504
|
-
keepUnused(command);
|
|
7505
7406
|
throw new NotYetImplementedError('[🛠] Actions are not implemented yet');
|
|
7506
7407
|
},
|
|
7507
7408
|
/**
|
|
@@ -7510,7 +7411,6 @@ var actionCommandParser = {
|
|
|
7510
7411
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7511
7412
|
*/
|
|
7512
7413
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7513
|
-
keepUnused(pipelineJson);
|
|
7514
7414
|
throw new NotYetImplementedError('[🛠] Actions are not implemented yet');
|
|
7515
7415
|
},
|
|
7516
7416
|
};
|
|
@@ -7550,9 +7450,7 @@ var instrumentCommandParser = {
|
|
|
7550
7450
|
* Parses the INSTRUMENT command
|
|
7551
7451
|
*/
|
|
7552
7452
|
parse: function (input) {
|
|
7553
|
-
|
|
7554
|
-
// TODO: [🛠] Implement
|
|
7555
|
-
TODO_USE(args);
|
|
7453
|
+
input.args;
|
|
7556
7454
|
return {
|
|
7557
7455
|
type: 'INSTRUMENT',
|
|
7558
7456
|
};
|
|
@@ -7563,7 +7461,6 @@ var instrumentCommandParser = {
|
|
|
7563
7461
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7564
7462
|
*/
|
|
7565
7463
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
7566
|
-
keepUnused(command, $pipelineJson);
|
|
7567
7464
|
console.error(new NotYetImplementedError('[🛠] Instruments are not implemented yet'));
|
|
7568
7465
|
},
|
|
7569
7466
|
/**
|
|
@@ -7572,7 +7469,6 @@ var instrumentCommandParser = {
|
|
|
7572
7469
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7573
7470
|
*/
|
|
7574
7471
|
stringify: function (command) {
|
|
7575
|
-
keepUnused(command);
|
|
7576
7472
|
throw new NotYetImplementedError('[🛠] Instruments are not implemented yet');
|
|
7577
7473
|
},
|
|
7578
7474
|
/**
|
|
@@ -7581,7 +7477,6 @@ var instrumentCommandParser = {
|
|
|
7581
7477
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7582
7478
|
*/
|
|
7583
7479
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7584
|
-
keepUnused(pipelineJson);
|
|
7585
7480
|
throw new NotYetImplementedError('[🛠] Instruments are not implemented yet');
|
|
7586
7481
|
},
|
|
7587
7482
|
};
|
|
@@ -7646,7 +7541,6 @@ var boilerplateCommandParser = {
|
|
|
7646
7541
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7647
7542
|
*/
|
|
7648
7543
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
7649
|
-
keepUnused(command, $pipelineJson);
|
|
7650
7544
|
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
|
|
7651
7545
|
},
|
|
7652
7546
|
/**
|
|
@@ -7655,7 +7549,6 @@ var boilerplateCommandParser = {
|
|
|
7655
7549
|
* Note: `$` is used to indicate that this function mutates given `templateJson`
|
|
7656
7550
|
*/
|
|
7657
7551
|
$applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
|
|
7658
|
-
keepUnused(command, $templateJson, $pipelineJson);
|
|
7659
7552
|
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
|
|
7660
7553
|
},
|
|
7661
7554
|
/**
|
|
@@ -7664,7 +7557,6 @@ var boilerplateCommandParser = {
|
|
|
7664
7557
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7665
7558
|
*/
|
|
7666
7559
|
stringify: function (command) {
|
|
7667
|
-
keepUnused(command);
|
|
7668
7560
|
return "---"; // <- TODO: [🛋] Implement
|
|
7669
7561
|
},
|
|
7670
7562
|
/**
|
|
@@ -7673,7 +7565,6 @@ var boilerplateCommandParser = {
|
|
|
7673
7565
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7674
7566
|
*/
|
|
7675
7567
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7676
|
-
keepUnused(pipelineJson);
|
|
7677
7568
|
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
|
|
7678
7569
|
},
|
|
7679
7570
|
/**
|
|
@@ -7682,7 +7573,6 @@ var boilerplateCommandParser = {
|
|
|
7682
7573
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7683
7574
|
*/
|
|
7684
7575
|
takeFromTemplateJson: function ($templateJson) {
|
|
7685
|
-
keepUnused($templateJson);
|
|
7686
7576
|
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
|
|
7687
7577
|
},
|
|
7688
7578
|
};
|
|
@@ -7700,7 +7590,7 @@ var COMMANDS = [
|
|
|
7700
7590
|
modelCommandParser,
|
|
7701
7591
|
parameterCommandParser,
|
|
7702
7592
|
postprocessCommandParser,
|
|
7703
|
-
|
|
7593
|
+
bookVersionCommandParser,
|
|
7704
7594
|
urlCommandParser,
|
|
7705
7595
|
knowledgeCommandParser,
|
|
7706
7596
|
actionCommandParser,
|
|
@@ -7852,9 +7742,7 @@ function parseCommandVariant(input) {
|
|
|
7852
7742
|
var _loop_1 = function (commandParser) {
|
|
7853
7743
|
// <- Note: [🦦] Its strange that this type assertion is needed
|
|
7854
7744
|
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
|
-
}
|
|
7745
|
+
if (just(false)) ;
|
|
7858
7746
|
else if (usagePlace === 'PIPELINE_HEAD' && !isUsedInPipelineHead) {
|
|
7859
7747
|
return "continue";
|
|
7860
7748
|
}
|
|
@@ -9108,7 +8996,7 @@ function cacheLlmTools(llmTools, options) {
|
|
|
9108
8996
|
case 10: throw new PipelineExecutionError("Unknown model variant \"".concat(prompt.modelRequirements.modelVariant, "\""));
|
|
9109
8997
|
case 11: return [4 /*yield*/, storage.setItem(key, {
|
|
9110
8998
|
date: $currentDate(),
|
|
9111
|
-
promptbookVersion:
|
|
8999
|
+
promptbookVersion: PROMPTBOOK_ENGINE_VERSION,
|
|
9112
9000
|
prompt: prompt,
|
|
9113
9001
|
promptResult: promptResult,
|
|
9114
9002
|
})];
|
|
@@ -9158,8 +9046,7 @@ function cacheLlmTools(llmTools, options) {
|
|
|
9158
9046
|
function limitTotalUsage(llmTools, options) {
|
|
9159
9047
|
var _this = this;
|
|
9160
9048
|
if (options === void 0) { options = {}; }
|
|
9161
|
-
var _a = options.maxTotalUsage, maxTotalUsage = _a === void 0 ? ZERO_USAGE : _a, _b = options.storage
|
|
9162
|
-
TODO_USE(storage);
|
|
9049
|
+
var _a = options.maxTotalUsage, maxTotalUsage = _a === void 0 ? ZERO_USAGE : _a, _b = options.storage; _b === void 0 ? new MemoryStorage() : _b;
|
|
9163
9050
|
var proxyTools = countTotalUsage(llmTools);
|
|
9164
9051
|
if (maxTotalUsage.price.value !== 0) {
|
|
9165
9052
|
throw new NotYetImplementedError('`limitTotalUsage` is not yet implemented for non-zero price');
|
|
@@ -9168,7 +9055,6 @@ function limitTotalUsage(llmTools, options) {
|
|
|
9168
9055
|
if (proxyTools.callChatModel !== undefined) {
|
|
9169
9056
|
proxyTools.callChatModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
9170
9057
|
return __generator(this, function (_a) {
|
|
9171
|
-
TODO_USE(prompt);
|
|
9172
9058
|
throw new LimitReachedError('Cannot call `callChatModel` because you are not allowed to spend any cost');
|
|
9173
9059
|
});
|
|
9174
9060
|
}); };
|
|
@@ -9176,7 +9062,6 @@ function limitTotalUsage(llmTools, options) {
|
|
|
9176
9062
|
if (proxyTools.callCompletionModel !== undefined) {
|
|
9177
9063
|
proxyTools.callCompletionModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
9178
9064
|
return __generator(this, function (_a) {
|
|
9179
|
-
TODO_USE(prompt);
|
|
9180
9065
|
throw new LimitReachedError('Cannot call `callCompletionModel` because you are not allowed to spend any cost');
|
|
9181
9066
|
});
|
|
9182
9067
|
}); };
|
|
@@ -9184,7 +9069,6 @@ function limitTotalUsage(llmTools, options) {
|
|
|
9184
9069
|
if (proxyTools.callEmbeddingModel !== undefined) {
|
|
9185
9070
|
proxyTools.callEmbeddingModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
9186
9071
|
return __generator(this, function (_a) {
|
|
9187
|
-
TODO_USE(prompt);
|
|
9188
9072
|
throw new LimitReachedError('Cannot call `callEmbeddingModel` because you are not allowed to spend any cost');
|
|
9189
9073
|
});
|
|
9190
9074
|
}); };
|
|
@@ -9349,8 +9233,6 @@ var _OpenAiAssistantMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
|
9349
9233
|
};
|
|
9350
9234
|
},
|
|
9351
9235
|
createConfigurationFromEnv: function (env) {
|
|
9352
|
-
// TODO: Maybe auto-configure (multiple) assistants from env variables
|
|
9353
|
-
keepUnused(env);
|
|
9354
9236
|
return null;
|
|
9355
9237
|
/*
|
|
9356
9238
|
if (typeof env.OPENAI_API_KEY === 'string' || typeof env.OPENAI_XXX === 'string') {
|
|
@@ -9844,5 +9726,5 @@ function executionReportJsonToString(executionReportJson, options) {
|
|
|
9844
9726
|
* TODO: [🧠] Should be in generated file GENERATOR_WARNING
|
|
9845
9727
|
*/
|
|
9846
9728
|
|
|
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,
|
|
9729
|
+
export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, AbstractFormatError, BOOK_LANGUAGE_VERSION, 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, 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
9730
|
//# sourceMappingURL=index.es.js.map
|