@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/umd/index.umd.js
CHANGED
|
@@ -14,10 +14,20 @@
|
|
|
14
14
|
|
|
15
15
|
// ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
|
|
16
16
|
/**
|
|
17
|
-
* The version of the
|
|
17
|
+
* The version of the Book language
|
|
18
|
+
*
|
|
19
|
+
* @see https://github.com/webgptorg/book
|
|
20
|
+
*/
|
|
21
|
+
var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
22
|
+
/**
|
|
23
|
+
* The version of the Promptbook engine
|
|
24
|
+
*
|
|
25
|
+
* @see https://github.com/webgptorg/promptbook
|
|
26
|
+
*/
|
|
27
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.74.0-1';
|
|
28
|
+
/**
|
|
29
|
+
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
18
30
|
*/
|
|
19
|
-
var PROMPTBOOK_VERSION = '0.72.0';
|
|
20
|
-
// TODO: [main] !!!! List here all the versions and annotate + put into script
|
|
21
31
|
|
|
22
32
|
/*! *****************************************************************************
|
|
23
33
|
Copyright (c) Microsoft Corporation.
|
|
@@ -877,7 +887,7 @@
|
|
|
877
887
|
if ( /* version === '1.0.0' || */version === '2.0.0' || version === '3.0.0') {
|
|
878
888
|
return false;
|
|
879
889
|
}
|
|
880
|
-
// <- TODO: [main] !!! Check isValidPromptbookVersion against
|
|
890
|
+
// <- TODO: [main] !!! Check isValidPromptbookVersion against PROMPTBOOK_ENGINE_VERSIONS
|
|
881
891
|
return true;
|
|
882
892
|
}
|
|
883
893
|
|
|
@@ -1805,6 +1815,188 @@
|
|
|
1805
1815
|
},
|
|
1806
1816
|
});
|
|
1807
1817
|
|
|
1818
|
+
/**
|
|
1819
|
+
* @@@
|
|
1820
|
+
*
|
|
1821
|
+
* @public exported from `@promptbook/utils`
|
|
1822
|
+
*/
|
|
1823
|
+
function deepClone(objectValue) {
|
|
1824
|
+
return JSON.parse(JSON.stringify(objectValue));
|
|
1825
|
+
/*
|
|
1826
|
+
TODO: [🧠] Is there a better implementation?
|
|
1827
|
+
> const propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
1828
|
+
> for (const propertyName of propertyNames) {
|
|
1829
|
+
> const value = (objectValue as really_any)[propertyName];
|
|
1830
|
+
> if (value && typeof value === 'object') {
|
|
1831
|
+
> deepClone(value);
|
|
1832
|
+
> }
|
|
1833
|
+
> }
|
|
1834
|
+
> return Object.assign({}, objectValue);
|
|
1835
|
+
*/
|
|
1836
|
+
}
|
|
1837
|
+
/**
|
|
1838
|
+
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
1839
|
+
*/
|
|
1840
|
+
|
|
1841
|
+
/**
|
|
1842
|
+
* Function `addUsage` will add multiple usages into one
|
|
1843
|
+
*
|
|
1844
|
+
* Note: If you provide 0 values, it returns ZERO_USAGE
|
|
1845
|
+
*
|
|
1846
|
+
* @public exported from `@promptbook/core`
|
|
1847
|
+
*/
|
|
1848
|
+
function addUsage() {
|
|
1849
|
+
var usageItems = [];
|
|
1850
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1851
|
+
usageItems[_i] = arguments[_i];
|
|
1852
|
+
}
|
|
1853
|
+
return usageItems.reduce(function (acc, item) {
|
|
1854
|
+
var e_1, _a, e_2, _b;
|
|
1855
|
+
var _c;
|
|
1856
|
+
acc.price.value += ((_c = item.price) === null || _c === void 0 ? void 0 : _c.value) || 0;
|
|
1857
|
+
try {
|
|
1858
|
+
for (var _d = __values(Object.keys(acc.input)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
1859
|
+
var key = _e.value;
|
|
1860
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1861
|
+
//@ts-ignore
|
|
1862
|
+
if (item.input[key]) {
|
|
1863
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1864
|
+
//@ts-ignore
|
|
1865
|
+
acc.input[key].value += item.input[key].value || 0;
|
|
1866
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1867
|
+
//@ts-ignore
|
|
1868
|
+
if (item.input[key].isUncertain) {
|
|
1869
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1870
|
+
//@ts-ignore
|
|
1871
|
+
acc.input[key].isUncertain = true;
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1875
|
+
}
|
|
1876
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1877
|
+
finally {
|
|
1878
|
+
try {
|
|
1879
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
1880
|
+
}
|
|
1881
|
+
finally { if (e_1) throw e_1.error; }
|
|
1882
|
+
}
|
|
1883
|
+
try {
|
|
1884
|
+
for (var _f = __values(Object.keys(acc.output)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
1885
|
+
var key = _g.value;
|
|
1886
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1887
|
+
//@ts-ignore
|
|
1888
|
+
if (item.output[key]) {
|
|
1889
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1890
|
+
//@ts-ignore
|
|
1891
|
+
acc.output[key].value += item.output[key].value || 0;
|
|
1892
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1893
|
+
//@ts-ignore
|
|
1894
|
+
if (item.output[key].isUncertain) {
|
|
1895
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1896
|
+
//@ts-ignore
|
|
1897
|
+
acc.output[key].isUncertain = true;
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1903
|
+
finally {
|
|
1904
|
+
try {
|
|
1905
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
1906
|
+
}
|
|
1907
|
+
finally { if (e_2) throw e_2.error; }
|
|
1908
|
+
}
|
|
1909
|
+
return acc;
|
|
1910
|
+
}, deepClone(ZERO_USAGE));
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1913
|
+
/**
|
|
1914
|
+
* Intercepts LLM tools and counts total usage of the tools
|
|
1915
|
+
*
|
|
1916
|
+
* @param llmTools LLM tools to be intercepted with usage counting
|
|
1917
|
+
* @returns LLM tools with same functionality with added total cost counting
|
|
1918
|
+
* @public exported from `@promptbook/core`
|
|
1919
|
+
*/
|
|
1920
|
+
function countTotalUsage(llmTools) {
|
|
1921
|
+
var _this = this;
|
|
1922
|
+
var totalUsage = ZERO_USAGE;
|
|
1923
|
+
var proxyTools = {
|
|
1924
|
+
get title() {
|
|
1925
|
+
// TODO: [🧠] Maybe put here some suffix
|
|
1926
|
+
return llmTools.title;
|
|
1927
|
+
},
|
|
1928
|
+
get description() {
|
|
1929
|
+
// TODO: [🧠] Maybe put here some suffix
|
|
1930
|
+
return llmTools.description;
|
|
1931
|
+
},
|
|
1932
|
+
checkConfiguration: function () {
|
|
1933
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1934
|
+
return __generator(this, function (_a) {
|
|
1935
|
+
return [2 /*return*/, /* not await */ llmTools.checkConfiguration()];
|
|
1936
|
+
});
|
|
1937
|
+
});
|
|
1938
|
+
},
|
|
1939
|
+
listModels: function () {
|
|
1940
|
+
return /* not await */ llmTools.listModels();
|
|
1941
|
+
},
|
|
1942
|
+
getTotalUsage: function () {
|
|
1943
|
+
// <- Note: [🥫] Not using getter `get totalUsage` but `getTotalUsage` to allow this object to be proxied
|
|
1944
|
+
return totalUsage;
|
|
1945
|
+
},
|
|
1946
|
+
};
|
|
1947
|
+
if (llmTools.callChatModel !== undefined) {
|
|
1948
|
+
proxyTools.callChatModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
1949
|
+
var promptResult;
|
|
1950
|
+
return __generator(this, function (_a) {
|
|
1951
|
+
switch (_a.label) {
|
|
1952
|
+
case 0: return [4 /*yield*/, llmTools.callChatModel(prompt)];
|
|
1953
|
+
case 1:
|
|
1954
|
+
promptResult = _a.sent();
|
|
1955
|
+
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
1956
|
+
return [2 /*return*/, promptResult];
|
|
1957
|
+
}
|
|
1958
|
+
});
|
|
1959
|
+
}); };
|
|
1960
|
+
}
|
|
1961
|
+
if (llmTools.callCompletionModel !== undefined) {
|
|
1962
|
+
proxyTools.callCompletionModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
1963
|
+
var promptResult;
|
|
1964
|
+
return __generator(this, function (_a) {
|
|
1965
|
+
switch (_a.label) {
|
|
1966
|
+
case 0: return [4 /*yield*/, llmTools.callCompletionModel(prompt)];
|
|
1967
|
+
case 1:
|
|
1968
|
+
promptResult = _a.sent();
|
|
1969
|
+
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
1970
|
+
return [2 /*return*/, promptResult];
|
|
1971
|
+
}
|
|
1972
|
+
});
|
|
1973
|
+
}); };
|
|
1974
|
+
}
|
|
1975
|
+
if (llmTools.callEmbeddingModel !== undefined) {
|
|
1976
|
+
proxyTools.callEmbeddingModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
1977
|
+
var promptResult;
|
|
1978
|
+
return __generator(this, function (_a) {
|
|
1979
|
+
switch (_a.label) {
|
|
1980
|
+
case 0: return [4 /*yield*/, llmTools.callEmbeddingModel(prompt)];
|
|
1981
|
+
case 1:
|
|
1982
|
+
promptResult = _a.sent();
|
|
1983
|
+
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
1984
|
+
return [2 /*return*/, promptResult];
|
|
1985
|
+
}
|
|
1986
|
+
});
|
|
1987
|
+
}); };
|
|
1988
|
+
}
|
|
1989
|
+
// <- Note: [🤖]
|
|
1990
|
+
return proxyTools;
|
|
1991
|
+
}
|
|
1992
|
+
/**
|
|
1993
|
+
* TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
|
|
1994
|
+
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
1995
|
+
* TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
|
|
1996
|
+
* > const [llmToolsWithUsage,getUsage] = countTotalUsage(llmTools);
|
|
1997
|
+
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
1998
|
+
*/
|
|
1999
|
+
|
|
1808
2000
|
/**
|
|
1809
2001
|
* This error indicates errors during the execution of the pipeline
|
|
1810
2002
|
*
|
|
@@ -2113,188 +2305,6 @@
|
|
|
2113
2305
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
2114
2306
|
*/
|
|
2115
2307
|
|
|
2116
|
-
/**
|
|
2117
|
-
* @@@
|
|
2118
|
-
*
|
|
2119
|
-
* @public exported from `@promptbook/utils`
|
|
2120
|
-
*/
|
|
2121
|
-
function deepClone(objectValue) {
|
|
2122
|
-
return JSON.parse(JSON.stringify(objectValue));
|
|
2123
|
-
/*
|
|
2124
|
-
TODO: [🧠] Is there a better implementation?
|
|
2125
|
-
> const propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
2126
|
-
> for (const propertyName of propertyNames) {
|
|
2127
|
-
> const value = (objectValue as really_any)[propertyName];
|
|
2128
|
-
> if (value && typeof value === 'object') {
|
|
2129
|
-
> deepClone(value);
|
|
2130
|
-
> }
|
|
2131
|
-
> }
|
|
2132
|
-
> return Object.assign({}, objectValue);
|
|
2133
|
-
*/
|
|
2134
|
-
}
|
|
2135
|
-
/**
|
|
2136
|
-
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
2137
|
-
*/
|
|
2138
|
-
|
|
2139
|
-
/**
|
|
2140
|
-
* Function `addUsage` will add multiple usages into one
|
|
2141
|
-
*
|
|
2142
|
-
* Note: If you provide 0 values, it returns ZERO_USAGE
|
|
2143
|
-
*
|
|
2144
|
-
* @public exported from `@promptbook/core`
|
|
2145
|
-
*/
|
|
2146
|
-
function addUsage() {
|
|
2147
|
-
var usageItems = [];
|
|
2148
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2149
|
-
usageItems[_i] = arguments[_i];
|
|
2150
|
-
}
|
|
2151
|
-
return usageItems.reduce(function (acc, item) {
|
|
2152
|
-
var e_1, _a, e_2, _b;
|
|
2153
|
-
var _c;
|
|
2154
|
-
acc.price.value += ((_c = item.price) === null || _c === void 0 ? void 0 : _c.value) || 0;
|
|
2155
|
-
try {
|
|
2156
|
-
for (var _d = __values(Object.keys(acc.input)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
2157
|
-
var key = _e.value;
|
|
2158
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2159
|
-
//@ts-ignore
|
|
2160
|
-
if (item.input[key]) {
|
|
2161
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2162
|
-
//@ts-ignore
|
|
2163
|
-
acc.input[key].value += item.input[key].value || 0;
|
|
2164
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2165
|
-
//@ts-ignore
|
|
2166
|
-
if (item.input[key].isUncertain) {
|
|
2167
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2168
|
-
//@ts-ignore
|
|
2169
|
-
acc.input[key].isUncertain = true;
|
|
2170
|
-
}
|
|
2171
|
-
}
|
|
2172
|
-
}
|
|
2173
|
-
}
|
|
2174
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2175
|
-
finally {
|
|
2176
|
-
try {
|
|
2177
|
-
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
2178
|
-
}
|
|
2179
|
-
finally { if (e_1) throw e_1.error; }
|
|
2180
|
-
}
|
|
2181
|
-
try {
|
|
2182
|
-
for (var _f = __values(Object.keys(acc.output)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
2183
|
-
var key = _g.value;
|
|
2184
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2185
|
-
//@ts-ignore
|
|
2186
|
-
if (item.output[key]) {
|
|
2187
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2188
|
-
//@ts-ignore
|
|
2189
|
-
acc.output[key].value += item.output[key].value || 0;
|
|
2190
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2191
|
-
//@ts-ignore
|
|
2192
|
-
if (item.output[key].isUncertain) {
|
|
2193
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2194
|
-
//@ts-ignore
|
|
2195
|
-
acc.output[key].isUncertain = true;
|
|
2196
|
-
}
|
|
2197
|
-
}
|
|
2198
|
-
}
|
|
2199
|
-
}
|
|
2200
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
2201
|
-
finally {
|
|
2202
|
-
try {
|
|
2203
|
-
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
2204
|
-
}
|
|
2205
|
-
finally { if (e_2) throw e_2.error; }
|
|
2206
|
-
}
|
|
2207
|
-
return acc;
|
|
2208
|
-
}, deepClone(ZERO_USAGE));
|
|
2209
|
-
}
|
|
2210
|
-
|
|
2211
|
-
/**
|
|
2212
|
-
* Intercepts LLM tools and counts total usage of the tools
|
|
2213
|
-
*
|
|
2214
|
-
* @param llmTools LLM tools to be intercepted with usage counting
|
|
2215
|
-
* @returns LLM tools with same functionality with added total cost counting
|
|
2216
|
-
* @public exported from `@promptbook/core`
|
|
2217
|
-
*/
|
|
2218
|
-
function countTotalUsage(llmTools) {
|
|
2219
|
-
var _this = this;
|
|
2220
|
-
var totalUsage = ZERO_USAGE;
|
|
2221
|
-
var proxyTools = {
|
|
2222
|
-
get title() {
|
|
2223
|
-
// TODO: [🧠] Maybe put here some suffix
|
|
2224
|
-
return llmTools.title;
|
|
2225
|
-
},
|
|
2226
|
-
get description() {
|
|
2227
|
-
// TODO: [🧠] Maybe put here some suffix
|
|
2228
|
-
return llmTools.description;
|
|
2229
|
-
},
|
|
2230
|
-
checkConfiguration: function () {
|
|
2231
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2232
|
-
return __generator(this, function (_a) {
|
|
2233
|
-
return [2 /*return*/, /* not await */ llmTools.checkConfiguration()];
|
|
2234
|
-
});
|
|
2235
|
-
});
|
|
2236
|
-
},
|
|
2237
|
-
listModels: function () {
|
|
2238
|
-
return /* not await */ llmTools.listModels();
|
|
2239
|
-
},
|
|
2240
|
-
getTotalUsage: function () {
|
|
2241
|
-
// <- Note: [🥫] Not using getter `get totalUsage` but `getTotalUsage` to allow this object to be proxied
|
|
2242
|
-
return totalUsage;
|
|
2243
|
-
},
|
|
2244
|
-
};
|
|
2245
|
-
if (llmTools.callChatModel !== undefined) {
|
|
2246
|
-
proxyTools.callChatModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
2247
|
-
var promptResult;
|
|
2248
|
-
return __generator(this, function (_a) {
|
|
2249
|
-
switch (_a.label) {
|
|
2250
|
-
case 0: return [4 /*yield*/, llmTools.callChatModel(prompt)];
|
|
2251
|
-
case 1:
|
|
2252
|
-
promptResult = _a.sent();
|
|
2253
|
-
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
2254
|
-
return [2 /*return*/, promptResult];
|
|
2255
|
-
}
|
|
2256
|
-
});
|
|
2257
|
-
}); };
|
|
2258
|
-
}
|
|
2259
|
-
if (llmTools.callCompletionModel !== undefined) {
|
|
2260
|
-
proxyTools.callCompletionModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
2261
|
-
var promptResult;
|
|
2262
|
-
return __generator(this, function (_a) {
|
|
2263
|
-
switch (_a.label) {
|
|
2264
|
-
case 0: return [4 /*yield*/, llmTools.callCompletionModel(prompt)];
|
|
2265
|
-
case 1:
|
|
2266
|
-
promptResult = _a.sent();
|
|
2267
|
-
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
2268
|
-
return [2 /*return*/, promptResult];
|
|
2269
|
-
}
|
|
2270
|
-
});
|
|
2271
|
-
}); };
|
|
2272
|
-
}
|
|
2273
|
-
if (llmTools.callEmbeddingModel !== undefined) {
|
|
2274
|
-
proxyTools.callEmbeddingModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
2275
|
-
var promptResult;
|
|
2276
|
-
return __generator(this, function (_a) {
|
|
2277
|
-
switch (_a.label) {
|
|
2278
|
-
case 0: return [4 /*yield*/, llmTools.callEmbeddingModel(prompt)];
|
|
2279
|
-
case 1:
|
|
2280
|
-
promptResult = _a.sent();
|
|
2281
|
-
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
2282
|
-
return [2 /*return*/, promptResult];
|
|
2283
|
-
}
|
|
2284
|
-
});
|
|
2285
|
-
}); };
|
|
2286
|
-
}
|
|
2287
|
-
// <- Note: [🤖]
|
|
2288
|
-
return proxyTools;
|
|
2289
|
-
}
|
|
2290
|
-
/**
|
|
2291
|
-
* TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
|
|
2292
|
-
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
2293
|
-
* TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
|
|
2294
|
-
* > const [llmToolsWithUsage,getUsage] = countTotalUsage(llmTools);
|
|
2295
|
-
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
2296
|
-
*/
|
|
2297
|
-
|
|
2298
2308
|
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"}];
|
|
2299
2309
|
|
|
2300
2310
|
/**
|
|
@@ -2699,23 +2709,6 @@
|
|
|
2699
2709
|
return union;
|
|
2700
2710
|
}
|
|
2701
2711
|
|
|
2702
|
-
/**
|
|
2703
|
-
* Just marks a place of place where should be something implemented
|
|
2704
|
-
* No side effects.
|
|
2705
|
-
*
|
|
2706
|
-
* Note: It can be usefull suppressing eslint errors of unused variables
|
|
2707
|
-
*
|
|
2708
|
-
* @param value any values
|
|
2709
|
-
* @returns void
|
|
2710
|
-
* @private within the repository
|
|
2711
|
-
*/
|
|
2712
|
-
function TODO_USE() {
|
|
2713
|
-
var value = [];
|
|
2714
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2715
|
-
value[_i] = arguments[_i];
|
|
2716
|
-
}
|
|
2717
|
-
}
|
|
2718
|
-
|
|
2719
2712
|
/**
|
|
2720
2713
|
* This error indicates problems parsing the format value
|
|
2721
2714
|
*
|
|
@@ -2772,22 +2765,12 @@
|
|
|
2772
2765
|
formatName: 'CSV',
|
|
2773
2766
|
aliases: ['SPREADSHEET', 'TABLE'],
|
|
2774
2767
|
isValid: function (value, settings, schema) {
|
|
2775
|
-
// TODO: Implement CSV validation
|
|
2776
|
-
TODO_USE(value /* <- TODO: Use value here */);
|
|
2777
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2778
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2779
2768
|
return true;
|
|
2780
2769
|
},
|
|
2781
2770
|
canBeValid: function (partialValue, settings, schema) {
|
|
2782
|
-
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
2783
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2784
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2785
2771
|
return true;
|
|
2786
2772
|
},
|
|
2787
2773
|
heal: function (value, settings, schema) {
|
|
2788
|
-
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
2789
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2790
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2791
2774
|
throw new Error('Not implemented');
|
|
2792
2775
|
},
|
|
2793
2776
|
subvalueDefinitions: [
|
|
@@ -2906,20 +2889,12 @@
|
|
|
2906
2889
|
formatName: 'JSON',
|
|
2907
2890
|
mimeType: 'application/json',
|
|
2908
2891
|
isValid: function (value, settings, schema) {
|
|
2909
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2910
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2911
2892
|
return isValidJsonString(value);
|
|
2912
2893
|
},
|
|
2913
2894
|
canBeValid: function (partialValue, settings, schema) {
|
|
2914
|
-
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
2915
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2916
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2917
2895
|
return true;
|
|
2918
2896
|
},
|
|
2919
2897
|
heal: function (value, settings, schema) {
|
|
2920
|
-
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
2921
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
2922
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
2923
2898
|
throw new Error('Not implemented');
|
|
2924
2899
|
},
|
|
2925
2900
|
subvalueDefinitions: [],
|
|
@@ -3001,21 +2976,12 @@
|
|
|
3001
2976
|
formatName: 'XML',
|
|
3002
2977
|
mimeType: 'application/xml',
|
|
3003
2978
|
isValid: function (value, settings, schema) {
|
|
3004
|
-
TODO_USE(value /* <- TODO: Use value here */);
|
|
3005
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3006
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3007
2979
|
return true;
|
|
3008
2980
|
},
|
|
3009
2981
|
canBeValid: function (partialValue, settings, schema) {
|
|
3010
|
-
TODO_USE(partialValue /* <- TODO: Use partialValue here */);
|
|
3011
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3012
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3013
2982
|
return true;
|
|
3014
2983
|
},
|
|
3015
2984
|
heal: function (value, settings, schema) {
|
|
3016
|
-
TODO_USE(value /* <- TODO: Use partialValue here */);
|
|
3017
|
-
TODO_USE(settings /* <- TODO: Use settings here */);
|
|
3018
|
-
TODO_USE(schema /* <- TODO: Use schema here */);
|
|
3019
2985
|
throw new Error('Not implemented');
|
|
3020
2986
|
},
|
|
3021
2987
|
subvalueDefinitions: [],
|
|
@@ -3248,27 +3214,6 @@
|
|
|
3248
3214
|
return [input];
|
|
3249
3215
|
}
|
|
3250
3216
|
|
|
3251
|
-
/**
|
|
3252
|
-
* Just says that the variable is not used but should be kept
|
|
3253
|
-
* No side effects.
|
|
3254
|
-
*
|
|
3255
|
-
* Note: It can be usefull for:
|
|
3256
|
-
*
|
|
3257
|
-
* 1) Suppressing eager optimization of unused imports
|
|
3258
|
-
* 2) Suppressing eslint errors of unused variables in the tests
|
|
3259
|
-
* 3) Keeping the type of the variable for type testing
|
|
3260
|
-
*
|
|
3261
|
-
* @param value any values
|
|
3262
|
-
* @returns void
|
|
3263
|
-
* @private within the repository
|
|
3264
|
-
*/
|
|
3265
|
-
function keepUnused() {
|
|
3266
|
-
var valuesToKeep = [];
|
|
3267
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3268
|
-
valuesToKeep[_i] = arguments[_i];
|
|
3269
|
-
}
|
|
3270
|
-
}
|
|
3271
|
-
|
|
3272
3217
|
/**
|
|
3273
3218
|
* Replaces parameters in template with values from parameters object
|
|
3274
3219
|
*
|
|
@@ -4045,7 +3990,6 @@
|
|
|
4045
3990
|
$ongoingTemplateResult.$resultString = extractJsonBlock($ongoingTemplateResult.$resultString || '');
|
|
4046
3991
|
}
|
|
4047
3992
|
catch (error) {
|
|
4048
|
-
keepUnused(error);
|
|
4049
3993
|
throw new ExpectError(spaceTrim.spaceTrim(function (block) { return "\n Expected valid JSON string\n\n ".concat(block(
|
|
4050
3994
|
/*<- Note: No need for `pipelineIdentification`, it will be catched and added later */ ''), "\n "); }));
|
|
4051
3995
|
}
|
|
@@ -4223,7 +4167,6 @@
|
|
|
4223
4167
|
function getContextForTemplate(template) {
|
|
4224
4168
|
return __awaiter(this, void 0, void 0, function () {
|
|
4225
4169
|
return __generator(this, function (_a) {
|
|
4226
|
-
TODO_USE(template);
|
|
4227
4170
|
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [🏍] Implement */];
|
|
4228
4171
|
});
|
|
4229
4172
|
});
|
|
@@ -4236,11 +4179,9 @@
|
|
|
4236
4179
|
*/
|
|
4237
4180
|
function getKnowledgeForTemplate(options) {
|
|
4238
4181
|
return __awaiter(this, void 0, void 0, function () {
|
|
4239
|
-
var preparedPipeline
|
|
4182
|
+
var preparedPipeline;
|
|
4240
4183
|
return __generator(this, function (_a) {
|
|
4241
|
-
preparedPipeline = options.preparedPipeline,
|
|
4242
|
-
// TODO: [♨] Implement Better - use real index and keyword search from `template` and {examples}
|
|
4243
|
-
TODO_USE(template);
|
|
4184
|
+
preparedPipeline = options.preparedPipeline, options.template;
|
|
4244
4185
|
return [2 /*return*/, preparedPipeline.knowledgePieces.map(function (_a) {
|
|
4245
4186
|
var content = _a.content;
|
|
4246
4187
|
return "- ".concat(content);
|
|
@@ -4257,8 +4198,6 @@
|
|
|
4257
4198
|
function getExamplesForTemplate(template) {
|
|
4258
4199
|
return __awaiter(this, void 0, void 0, function () {
|
|
4259
4200
|
return __generator(this, function (_a) {
|
|
4260
|
-
// TODO: [♨] Implement Better - use real index and keyword search
|
|
4261
|
-
TODO_USE(template);
|
|
4262
4201
|
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [♨] Implement */];
|
|
4263
4202
|
});
|
|
4264
4203
|
});
|
|
@@ -4277,13 +4216,13 @@
|
|
|
4277
4216
|
switch (_b.label) {
|
|
4278
4217
|
case 0:
|
|
4279
4218
|
preparedPipeline = options.preparedPipeline, template = options.template, pipelineIdentification = options.pipelineIdentification;
|
|
4280
|
-
return [4 /*yield*/, getContextForTemplate(
|
|
4219
|
+
return [4 /*yield*/, getContextForTemplate()];
|
|
4281
4220
|
case 1:
|
|
4282
4221
|
context = _b.sent();
|
|
4283
4222
|
return [4 /*yield*/, getKnowledgeForTemplate({ preparedPipeline: preparedPipeline, template: template })];
|
|
4284
4223
|
case 2:
|
|
4285
4224
|
knowledge = _b.sent();
|
|
4286
|
-
return [4 /*yield*/, getExamplesForTemplate(
|
|
4225
|
+
return [4 /*yield*/, getExamplesForTemplate()];
|
|
4287
4226
|
case 3:
|
|
4288
4227
|
examples = _b.sent();
|
|
4289
4228
|
currentDate = new Date().toISOString();
|
|
@@ -4518,7 +4457,7 @@
|
|
|
4518
4457
|
executionReport = {
|
|
4519
4458
|
pipelineUrl: preparedPipeline.pipelineUrl,
|
|
4520
4459
|
title: preparedPipeline.title,
|
|
4521
|
-
promptbookUsedVersion:
|
|
4460
|
+
promptbookUsedVersion: PROMPTBOOK_ENGINE_VERSION,
|
|
4522
4461
|
promptbookRequestedVersion: preparedPipeline.promptbookVersion,
|
|
4523
4462
|
description: preparedPipeline.description,
|
|
4524
4463
|
promptExecutions: [],
|
|
@@ -5365,16 +5304,13 @@
|
|
|
5365
5304
|
function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
5366
5305
|
var _a;
|
|
5367
5306
|
return __awaiter(this, void 0, void 0, function () {
|
|
5368
|
-
var sourceContent, name, _b, _c, rootDirname,
|
|
5369
|
-
// <- TODO: process.cwd() if running in Node.js
|
|
5370
|
-
isVerbose, url, response_1, mimeType, filename_1, fileExtension, mimeType;
|
|
5307
|
+
var sourceContent, name, _b, _c, rootDirname, url, response_1, mimeType, filename_1, fileExtension, mimeType;
|
|
5371
5308
|
return __generator(this, function (_e) {
|
|
5372
5309
|
switch (_e.label) {
|
|
5373
5310
|
case 0:
|
|
5374
5311
|
sourceContent = knowledgeSource.sourceContent;
|
|
5375
5312
|
name = knowledgeSource.name;
|
|
5376
|
-
_b = options || {}, _c = _b.rootDirname, rootDirname = _c === void 0 ? null : _c,
|
|
5377
|
-
TODO_USE(isVerbose);
|
|
5313
|
+
_b = options || {}, _c = _b.rootDirname, rootDirname = _c === void 0 ? null : _c, _b.isVerbose;
|
|
5378
5314
|
if (!name) {
|
|
5379
5315
|
name = sourceContentToName(sourceContent);
|
|
5380
5316
|
}
|
|
@@ -5654,15 +5590,13 @@
|
|
|
5654
5590
|
*/
|
|
5655
5591
|
function prepareTemplates(pipeline, tools, options) {
|
|
5656
5592
|
return __awaiter(this, void 0, void 0, function () {
|
|
5657
|
-
var _a, maxParallelCount, templates,
|
|
5593
|
+
var _a, maxParallelCount, templates, knowledgePiecesCount, templatesPrepared;
|
|
5658
5594
|
var _this = this;
|
|
5659
5595
|
return __generator(this, function (_b) {
|
|
5660
5596
|
switch (_b.label) {
|
|
5661
5597
|
case 0:
|
|
5662
5598
|
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a;
|
|
5663
|
-
templates = pipeline.templates,
|
|
5664
|
-
// TODO: [main] !! Apply examples to each template (if missing and is for the template defined)
|
|
5665
|
-
TODO_USE(parameters);
|
|
5599
|
+
templates = pipeline.templates, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
|
|
5666
5600
|
templatesPrepared = new Array(templates.length);
|
|
5667
5601
|
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 () {
|
|
5668
5602
|
var dependentParameterNames, preparedContent, preparedTemplate;
|
|
@@ -5732,7 +5666,7 @@
|
|
|
5732
5666
|
currentPreparation = {
|
|
5733
5667
|
id: 1,
|
|
5734
5668
|
// TODO: [🍥]> date: $currentDate(),
|
|
5735
|
-
promptbookVersion:
|
|
5669
|
+
promptbookVersion: PROMPTBOOK_ENGINE_VERSION,
|
|
5736
5670
|
usage: ZERO_USAGE,
|
|
5737
5671
|
};
|
|
5738
5672
|
preparations = [
|
|
@@ -5872,7 +5806,6 @@
|
|
|
5872
5806
|
* Note: This is used in `pipelineJsonToString` utility
|
|
5873
5807
|
*/
|
|
5874
5808
|
stringify: function (command) {
|
|
5875
|
-
keepUnused(command);
|
|
5876
5809
|
return "---"; // <- TODO: [🛋] Implement
|
|
5877
5810
|
},
|
|
5878
5811
|
/**
|
|
@@ -5881,7 +5814,6 @@
|
|
|
5881
5814
|
* Note: This is used in `pipelineJsonToString` utility
|
|
5882
5815
|
*/
|
|
5883
5816
|
takeFromPipelineJson: function (pipelineJson) {
|
|
5884
|
-
keepUnused(pipelineJson);
|
|
5885
5817
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
5886
5818
|
},
|
|
5887
5819
|
};
|
|
@@ -6046,7 +5978,6 @@
|
|
|
6046
5978
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6047
5979
|
*/
|
|
6048
5980
|
stringify: function (command) {
|
|
6049
|
-
keepUnused(command);
|
|
6050
5981
|
return "---"; // <- TODO: [🛋] Implement
|
|
6051
5982
|
},
|
|
6052
5983
|
/**
|
|
@@ -6055,7 +5986,6 @@
|
|
|
6055
5986
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6056
5987
|
*/
|
|
6057
5988
|
takeFromTemplateJson: function ($templateJson) {
|
|
6058
|
-
keepUnused($templateJson);
|
|
6059
5989
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6060
5990
|
},
|
|
6061
5991
|
};
|
|
@@ -6287,7 +6217,6 @@
|
|
|
6287
6217
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6288
6218
|
*/
|
|
6289
6219
|
stringify: function (command) {
|
|
6290
|
-
keepUnused(command);
|
|
6291
6220
|
return "---"; // <- TODO: [🛋] Implement
|
|
6292
6221
|
},
|
|
6293
6222
|
/**
|
|
@@ -6296,7 +6225,6 @@
|
|
|
6296
6225
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6297
6226
|
*/
|
|
6298
6227
|
takeFromTemplateJson: function ($templateJson) {
|
|
6299
|
-
keepUnused($templateJson);
|
|
6300
6228
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6301
6229
|
},
|
|
6302
6230
|
};
|
|
@@ -6615,7 +6543,6 @@
|
|
|
6615
6543
|
inputSubparameterNames: inputSubparameterNames,
|
|
6616
6544
|
outputSubparameterName: outputSubparameterName,
|
|
6617
6545
|
};
|
|
6618
|
-
keepUnused($pipelineJson); // <- TODO: [🧠] Maybe register subparameter from foreach into parameters of the pipeline
|
|
6619
6546
|
// Note: [🍭] FOREACH apply has some sideeffects on different places in codebase
|
|
6620
6547
|
},
|
|
6621
6548
|
/**
|
|
@@ -6624,7 +6551,6 @@
|
|
|
6624
6551
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6625
6552
|
*/
|
|
6626
6553
|
stringify: function (command) {
|
|
6627
|
-
keepUnused(command);
|
|
6628
6554
|
return "---"; // <- TODO: [🛋] Implement
|
|
6629
6555
|
},
|
|
6630
6556
|
/**
|
|
@@ -6633,7 +6559,6 @@
|
|
|
6633
6559
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6634
6560
|
*/
|
|
6635
6561
|
takeFromTemplateJson: function ($templateJson) {
|
|
6636
|
-
keepUnused($templateJson);
|
|
6637
6562
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6638
6563
|
},
|
|
6639
6564
|
};
|
|
@@ -6701,7 +6626,6 @@
|
|
|
6701
6626
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6702
6627
|
*/
|
|
6703
6628
|
stringify: function (command) {
|
|
6704
|
-
keepUnused(command);
|
|
6705
6629
|
return "---"; // <- TODO: [🛋] Implement
|
|
6706
6630
|
},
|
|
6707
6631
|
/**
|
|
@@ -6710,7 +6634,6 @@
|
|
|
6710
6634
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6711
6635
|
*/
|
|
6712
6636
|
takeFromTemplateJson: function ($templateJson) {
|
|
6713
|
-
keepUnused($templateJson);
|
|
6714
6637
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6715
6638
|
},
|
|
6716
6639
|
};
|
|
@@ -6773,7 +6696,6 @@
|
|
|
6773
6696
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6774
6697
|
*/
|
|
6775
6698
|
stringify: function (command) {
|
|
6776
|
-
keepUnused(command);
|
|
6777
6699
|
return "---"; // <- TODO: [🛋] Implement
|
|
6778
6700
|
},
|
|
6779
6701
|
/**
|
|
@@ -6782,7 +6704,6 @@
|
|
|
6782
6704
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6783
6705
|
*/
|
|
6784
6706
|
takeFromTemplateJson: function ($templateJson) {
|
|
6785
|
-
keepUnused($templateJson);
|
|
6786
6707
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6787
6708
|
},
|
|
6788
6709
|
};
|
|
@@ -6918,7 +6839,6 @@
|
|
|
6918
6839
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6919
6840
|
*/
|
|
6920
6841
|
stringify: function (command) {
|
|
6921
|
-
keepUnused(command);
|
|
6922
6842
|
return "---"; // <- TODO: [🛋] Implement
|
|
6923
6843
|
},
|
|
6924
6844
|
/**
|
|
@@ -6927,7 +6847,6 @@
|
|
|
6927
6847
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6928
6848
|
*/
|
|
6929
6849
|
takeFromPipelineJson: function (pipelineJson) {
|
|
6930
|
-
keepUnused(pipelineJson);
|
|
6931
6850
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6932
6851
|
},
|
|
6933
6852
|
/**
|
|
@@ -6936,7 +6855,6 @@
|
|
|
6936
6855
|
* Note: This is used in `pipelineJsonToString` utility
|
|
6937
6856
|
*/
|
|
6938
6857
|
takeFromTemplateJson: function ($templateJson) {
|
|
6939
|
-
keepUnused($templateJson);
|
|
6940
6858
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6941
6859
|
},
|
|
6942
6860
|
};
|
|
@@ -7010,7 +6928,6 @@
|
|
|
7010
6928
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7011
6929
|
*/
|
|
7012
6930
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
7013
|
-
keepUnused(command, $pipelineJson);
|
|
7014
6931
|
// Note: [🍣] Do nothing, its application is implemented separately in `pipelineStringToJsonSync`
|
|
7015
6932
|
},
|
|
7016
6933
|
/**
|
|
@@ -7019,7 +6936,6 @@
|
|
|
7019
6936
|
* Note: `$` is used to indicate that this function mutates given `templateJson`
|
|
7020
6937
|
*/
|
|
7021
6938
|
$applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
|
|
7022
|
-
keepUnused(command, $templateJson, $pipelineJson);
|
|
7023
6939
|
// Note: [🍣] Do nothing, its application is implemented separately in `pipelineStringToJsonSync`
|
|
7024
6940
|
},
|
|
7025
6941
|
/**
|
|
@@ -7028,7 +6944,6 @@
|
|
|
7028
6944
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7029
6945
|
*/
|
|
7030
6946
|
stringify: function (command) {
|
|
7031
|
-
keepUnused(command);
|
|
7032
6947
|
return "---"; // <- TODO: [🛋] Implement
|
|
7033
6948
|
},
|
|
7034
6949
|
/**
|
|
@@ -7037,7 +6952,6 @@
|
|
|
7037
6952
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7038
6953
|
*/
|
|
7039
6954
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7040
|
-
keepUnused(pipelineJson);
|
|
7041
6955
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7042
6956
|
},
|
|
7043
6957
|
/**
|
|
@@ -7046,7 +6960,6 @@
|
|
|
7046
6960
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7047
6961
|
*/
|
|
7048
6962
|
takeFromTemplateJson: function ($templateJson) {
|
|
7049
|
-
keepUnused($templateJson);
|
|
7050
6963
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7051
6964
|
},
|
|
7052
6965
|
};
|
|
@@ -7118,7 +7031,6 @@
|
|
|
7118
7031
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7119
7032
|
*/
|
|
7120
7033
|
stringify: function (command) {
|
|
7121
|
-
keepUnused(command);
|
|
7122
7034
|
return "---"; // <- TODO: [🛋] Implement
|
|
7123
7035
|
},
|
|
7124
7036
|
/**
|
|
@@ -7127,7 +7039,6 @@
|
|
|
7127
7039
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7128
7040
|
*/
|
|
7129
7041
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7130
|
-
keepUnused(pipelineJson);
|
|
7131
7042
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7132
7043
|
},
|
|
7133
7044
|
/**
|
|
@@ -7136,7 +7047,6 @@
|
|
|
7136
7047
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7137
7048
|
*/
|
|
7138
7049
|
takeFromTemplateJson: function ($templateJson) {
|
|
7139
|
-
keepUnused($templateJson);
|
|
7140
7050
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7141
7051
|
},
|
|
7142
7052
|
};
|
|
@@ -7255,7 +7165,6 @@
|
|
|
7255
7165
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7256
7166
|
*/
|
|
7257
7167
|
stringify: function (command) {
|
|
7258
|
-
keepUnused(command);
|
|
7259
7168
|
return "---"; // <- TODO: [🛋] Implement
|
|
7260
7169
|
},
|
|
7261
7170
|
/**
|
|
@@ -7264,42 +7173,41 @@
|
|
|
7264
7173
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7265
7174
|
*/
|
|
7266
7175
|
takeFromTemplateJson: function ($templateJson) {
|
|
7267
|
-
keepUnused($templateJson);
|
|
7268
7176
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7269
7177
|
},
|
|
7270
7178
|
};
|
|
7271
7179
|
|
|
7272
7180
|
/**
|
|
7273
|
-
* Parses the
|
|
7181
|
+
* Parses the BOOK_VERSION command
|
|
7274
7182
|
*
|
|
7275
7183
|
* @see `documentationUrl` for more details
|
|
7276
7184
|
* @private within the commands folder
|
|
7277
7185
|
*/
|
|
7278
|
-
var
|
|
7186
|
+
var bookVersionCommandParser = {
|
|
7279
7187
|
/**
|
|
7280
7188
|
* Name of the command
|
|
7281
7189
|
*/
|
|
7282
|
-
name: '
|
|
7283
|
-
aliasNames: ['PTBK_VERSION', '
|
|
7190
|
+
name: 'BOOK_VERSION',
|
|
7191
|
+
aliasNames: ['PTBK_VERSION', 'PROMPTBOOK_VERSION', 'BOOK'],
|
|
7284
7192
|
/**
|
|
7285
7193
|
* BOILERPLATE command can be used in:
|
|
7286
7194
|
*/
|
|
7287
7195
|
isUsedInPipelineHead: true,
|
|
7288
7196
|
isUsedInPipelineTemplate: false,
|
|
7289
7197
|
/**
|
|
7290
|
-
* Description of the
|
|
7198
|
+
* Description of the BOOK_VERSION command
|
|
7291
7199
|
*/
|
|
7292
|
-
description: "Which version of the
|
|
7200
|
+
description: "Which version of the Book language is the .ptbk.md using",
|
|
7293
7201
|
/**
|
|
7294
7202
|
* Link to documentation
|
|
7295
7203
|
*/
|
|
7296
7204
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/69',
|
|
7297
7205
|
/**
|
|
7298
|
-
* Example usages of the
|
|
7206
|
+
* Example usages of the BOOK_VERSION command
|
|
7299
7207
|
*/
|
|
7300
|
-
examples: ["
|
|
7208
|
+
examples: ["BOOK VERSION ".concat(BOOK_LANGUAGE_VERSION), "BOOK ".concat(BOOK_LANGUAGE_VERSION)],
|
|
7301
7209
|
/**
|
|
7302
|
-
* Parses the
|
|
7210
|
+
* Parses the BOOK_VERSION command
|
|
7303
7211
|
*/
|
|
7304
7212
|
parse: function (input) {
|
|
7305
7213
|
var args = input.args;
|
|
@@ -7310,16 +7218,16 @@
|
|
|
7310
7218
|
if (!isValidPromptbookVersion(promptbookVersion)) {
|
|
7311
7219
|
throw new ParseError("Invalid Promptbook version \"".concat(promptbookVersion, "\""));
|
|
7312
7220
|
}
|
|
7313
|
-
if (args.length > 0) {
|
|
7221
|
+
if (args.length > 0 && !(((args.length === 1 && args[0]) || '').toUpperCase() === 'VERSION')) {
|
|
7314
7222
|
throw new ParseError("Can not have more than one Promptbook version");
|
|
7315
7223
|
}
|
|
7316
7224
|
return {
|
|
7317
|
-
type: '
|
|
7225
|
+
type: 'BOOK_VERSION',
|
|
7318
7226
|
promptbookVersion: promptbookVersion,
|
|
7319
7227
|
};
|
|
7320
7228
|
},
|
|
7321
7229
|
/**
|
|
7322
|
-
* Apply the
|
|
7230
|
+
* Apply the BOOK_VERSION command to the `pipelineJson`
|
|
7323
7231
|
*
|
|
7324
7232
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7325
7233
|
*/
|
|
@@ -7328,21 +7236,19 @@
|
|
|
7328
7236
|
$pipelineJson.promptbookVersion = command.promptbookVersion;
|
|
7329
7237
|
},
|
|
7330
7238
|
/**
|
|
7331
|
-
* Converts the
|
|
7239
|
+
* Converts the BOOK_VERSION command back to string
|
|
7332
7240
|
*
|
|
7333
7241
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7334
7242
|
*/
|
|
7335
7243
|
stringify: function (command) {
|
|
7336
|
-
keepUnused(command);
|
|
7337
7244
|
return "---"; // <- TODO: [🛋] Implement
|
|
7338
7245
|
},
|
|
7339
7246
|
/**
|
|
7340
|
-
* Reads the
|
|
7247
|
+
* Reads the BOOK_VERSION command from the `PipelineJson`
|
|
7341
7248
|
*
|
|
7342
7249
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7343
7250
|
*/
|
|
7344
7251
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7345
|
-
keepUnused(pipelineJson);
|
|
7346
7252
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7347
7253
|
},
|
|
7348
7254
|
};
|
|
@@ -7436,7 +7342,6 @@
|
|
|
7436
7342
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7437
7343
|
*/
|
|
7438
7344
|
stringify: function (command) {
|
|
7439
|
-
keepUnused(command);
|
|
7440
7345
|
return "---"; // <- TODO: [🛋] Implement
|
|
7441
7346
|
},
|
|
7442
7347
|
/**
|
|
@@ -7445,7 +7350,6 @@
|
|
|
7445
7350
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7446
7351
|
*/
|
|
7447
7352
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7448
|
-
keepUnused(pipelineJson);
|
|
7449
7353
|
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
7450
7354
|
},
|
|
7451
7355
|
};
|
|
@@ -7482,8 +7386,7 @@
|
|
|
7482
7386
|
* Parses the ACTION command
|
|
7483
7387
|
*/
|
|
7484
7388
|
parse: function (input) {
|
|
7485
|
-
|
|
7486
|
-
TODO_USE(args);
|
|
7389
|
+
input.args;
|
|
7487
7390
|
return {
|
|
7488
7391
|
type: 'ACTION',
|
|
7489
7392
|
};
|
|
@@ -7494,7 +7397,6 @@
|
|
|
7494
7397
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7495
7398
|
*/
|
|
7496
7399
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
7497
|
-
keepUnused(command, $pipelineJson);
|
|
7498
7400
|
console.error(new NotYetImplementedError('[🛠] Actions are not implemented yet'));
|
|
7499
7401
|
},
|
|
7500
7402
|
/**
|
|
@@ -7503,7 +7405,6 @@
|
|
|
7503
7405
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7504
7406
|
*/
|
|
7505
7407
|
stringify: function (command) {
|
|
7506
|
-
keepUnused(command);
|
|
7507
7408
|
throw new NotYetImplementedError('[🛠] Actions are not implemented yet');
|
|
7508
7409
|
},
|
|
7509
7410
|
/**
|
|
@@ -7512,7 +7413,6 @@
|
|
|
7512
7413
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7513
7414
|
*/
|
|
7514
7415
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7515
|
-
keepUnused(pipelineJson);
|
|
7516
7416
|
throw new NotYetImplementedError('[🛠] Actions are not implemented yet');
|
|
7517
7417
|
},
|
|
7518
7418
|
};
|
|
@@ -7552,9 +7452,7 @@
|
|
|
7552
7452
|
* Parses the INSTRUMENT command
|
|
7553
7453
|
*/
|
|
7554
7454
|
parse: function (input) {
|
|
7555
|
-
|
|
7556
|
-
// TODO: [🛠] Implement
|
|
7557
|
-
TODO_USE(args);
|
|
7455
|
+
input.args;
|
|
7558
7456
|
return {
|
|
7559
7457
|
type: 'INSTRUMENT',
|
|
7560
7458
|
};
|
|
@@ -7565,7 +7463,6 @@
|
|
|
7565
7463
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7566
7464
|
*/
|
|
7567
7465
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
7568
|
-
keepUnused(command, $pipelineJson);
|
|
7569
7466
|
console.error(new NotYetImplementedError('[🛠] Instruments are not implemented yet'));
|
|
7570
7467
|
},
|
|
7571
7468
|
/**
|
|
@@ -7574,7 +7471,6 @@
|
|
|
7574
7471
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7575
7472
|
*/
|
|
7576
7473
|
stringify: function (command) {
|
|
7577
|
-
keepUnused(command);
|
|
7578
7474
|
throw new NotYetImplementedError('[🛠] Instruments are not implemented yet');
|
|
7579
7475
|
},
|
|
7580
7476
|
/**
|
|
@@ -7583,7 +7479,6 @@
|
|
|
7583
7479
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7584
7480
|
*/
|
|
7585
7481
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7586
|
-
keepUnused(pipelineJson);
|
|
7587
7482
|
throw new NotYetImplementedError('[🛠] Instruments are not implemented yet');
|
|
7588
7483
|
},
|
|
7589
7484
|
};
|
|
@@ -7648,7 +7543,6 @@
|
|
|
7648
7543
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7649
7544
|
*/
|
|
7650
7545
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
7651
|
-
keepUnused(command, $pipelineJson);
|
|
7652
7546
|
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
|
|
7653
7547
|
},
|
|
7654
7548
|
/**
|
|
@@ -7657,7 +7551,6 @@
|
|
|
7657
7551
|
* Note: `$` is used to indicate that this function mutates given `templateJson`
|
|
7658
7552
|
*/
|
|
7659
7553
|
$applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
|
|
7660
|
-
keepUnused(command, $templateJson, $pipelineJson);
|
|
7661
7554
|
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
|
|
7662
7555
|
},
|
|
7663
7556
|
/**
|
|
@@ -7666,7 +7559,6 @@
|
|
|
7666
7559
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7667
7560
|
*/
|
|
7668
7561
|
stringify: function (command) {
|
|
7669
|
-
keepUnused(command);
|
|
7670
7562
|
return "---"; // <- TODO: [🛋] Implement
|
|
7671
7563
|
},
|
|
7672
7564
|
/**
|
|
@@ -7675,7 +7567,6 @@
|
|
|
7675
7567
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7676
7568
|
*/
|
|
7677
7569
|
takeFromPipelineJson: function (pipelineJson) {
|
|
7678
|
-
keepUnused(pipelineJson);
|
|
7679
7570
|
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
|
|
7680
7571
|
},
|
|
7681
7572
|
/**
|
|
@@ -7684,7 +7575,6 @@
|
|
|
7684
7575
|
* Note: This is used in `pipelineJsonToString` utility
|
|
7685
7576
|
*/
|
|
7686
7577
|
takeFromTemplateJson: function ($templateJson) {
|
|
7687
|
-
keepUnused($templateJson);
|
|
7688
7578
|
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
|
|
7689
7579
|
},
|
|
7690
7580
|
};
|
|
@@ -7702,7 +7592,7 @@
|
|
|
7702
7592
|
modelCommandParser,
|
|
7703
7593
|
parameterCommandParser,
|
|
7704
7594
|
postprocessCommandParser,
|
|
7705
|
-
|
|
7595
|
+
bookVersionCommandParser,
|
|
7706
7596
|
urlCommandParser,
|
|
7707
7597
|
knowledgeCommandParser,
|
|
7708
7598
|
actionCommandParser,
|
|
@@ -7854,9 +7744,7 @@
|
|
|
7854
7744
|
var _loop_1 = function (commandParser) {
|
|
7855
7745
|
// <- Note: [🦦] Its strange that this type assertion is needed
|
|
7856
7746
|
var name_1 = commandParser.name, isUsedInPipelineHead = commandParser.isUsedInPipelineHead, isUsedInPipelineTemplate = commandParser.isUsedInPipelineTemplate, aliasNames = commandParser.aliasNames, deprecatedNames = commandParser.deprecatedNames, parse = commandParser.parse;
|
|
7857
|
-
if (just(false))
|
|
7858
|
-
keepUnused( /* for better indentation */);
|
|
7859
|
-
}
|
|
7747
|
+
if (just(false)) ;
|
|
7860
7748
|
else if (usagePlace === 'PIPELINE_HEAD' && !isUsedInPipelineHead) {
|
|
7861
7749
|
return "continue";
|
|
7862
7750
|
}
|
|
@@ -9110,7 +8998,7 @@
|
|
|
9110
8998
|
case 10: throw new PipelineExecutionError("Unknown model variant \"".concat(prompt.modelRequirements.modelVariant, "\""));
|
|
9111
8999
|
case 11: return [4 /*yield*/, storage.setItem(key, {
|
|
9112
9000
|
date: $currentDate(),
|
|
9113
|
-
promptbookVersion:
|
|
9001
|
+
promptbookVersion: PROMPTBOOK_ENGINE_VERSION,
|
|
9114
9002
|
prompt: prompt,
|
|
9115
9003
|
promptResult: promptResult,
|
|
9116
9004
|
})];
|
|
@@ -9160,8 +9048,7 @@
|
|
|
9160
9048
|
function limitTotalUsage(llmTools, options) {
|
|
9161
9049
|
var _this = this;
|
|
9162
9050
|
if (options === void 0) { options = {}; }
|
|
9163
|
-
var _a = options.maxTotalUsage, maxTotalUsage = _a === void 0 ? ZERO_USAGE : _a, _b = options.storage
|
|
9164
|
-
TODO_USE(storage);
|
|
9051
|
+
var _a = options.maxTotalUsage, maxTotalUsage = _a === void 0 ? ZERO_USAGE : _a, _b = options.storage; _b === void 0 ? new MemoryStorage() : _b;
|
|
9165
9052
|
var proxyTools = countTotalUsage(llmTools);
|
|
9166
9053
|
if (maxTotalUsage.price.value !== 0) {
|
|
9167
9054
|
throw new NotYetImplementedError('`limitTotalUsage` is not yet implemented for non-zero price');
|
|
@@ -9170,7 +9057,6 @@
|
|
|
9170
9057
|
if (proxyTools.callChatModel !== undefined) {
|
|
9171
9058
|
proxyTools.callChatModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
9172
9059
|
return __generator(this, function (_a) {
|
|
9173
|
-
TODO_USE(prompt);
|
|
9174
9060
|
throw new LimitReachedError('Cannot call `callChatModel` because you are not allowed to spend any cost');
|
|
9175
9061
|
});
|
|
9176
9062
|
}); };
|
|
@@ -9178,7 +9064,6 @@
|
|
|
9178
9064
|
if (proxyTools.callCompletionModel !== undefined) {
|
|
9179
9065
|
proxyTools.callCompletionModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
9180
9066
|
return __generator(this, function (_a) {
|
|
9181
|
-
TODO_USE(prompt);
|
|
9182
9067
|
throw new LimitReachedError('Cannot call `callCompletionModel` because you are not allowed to spend any cost');
|
|
9183
9068
|
});
|
|
9184
9069
|
}); };
|
|
@@ -9186,7 +9071,6 @@
|
|
|
9186
9071
|
if (proxyTools.callEmbeddingModel !== undefined) {
|
|
9187
9072
|
proxyTools.callEmbeddingModel = function (prompt) { return __awaiter(_this, void 0, void 0, function () {
|
|
9188
9073
|
return __generator(this, function (_a) {
|
|
9189
|
-
TODO_USE(prompt);
|
|
9190
9074
|
throw new LimitReachedError('Cannot call `callEmbeddingModel` because you are not allowed to spend any cost');
|
|
9191
9075
|
});
|
|
9192
9076
|
}); };
|
|
@@ -9351,8 +9235,6 @@
|
|
|
9351
9235
|
};
|
|
9352
9236
|
},
|
|
9353
9237
|
createConfigurationFromEnv: function (env) {
|
|
9354
|
-
// TODO: Maybe auto-configure (multiple) assistants from env variables
|
|
9355
|
-
keepUnused(env);
|
|
9356
9238
|
return null;
|
|
9357
9239
|
/*
|
|
9358
9240
|
if (typeof env.OPENAI_API_KEY === 'string' || typeof env.OPENAI_XXX === 'string') {
|
|
@@ -9851,6 +9733,7 @@
|
|
|
9851
9733
|
exports.$scrapersMetadataRegister = $scrapersMetadataRegister;
|
|
9852
9734
|
exports.$scrapersRegister = $scrapersRegister;
|
|
9853
9735
|
exports.AbstractFormatError = AbstractFormatError;
|
|
9736
|
+
exports.BOOK_LANGUAGE_VERSION = BOOK_LANGUAGE_VERSION;
|
|
9854
9737
|
exports.CLAIM = CLAIM;
|
|
9855
9738
|
exports.CallbackInterfaceTools = CallbackInterfaceTools;
|
|
9856
9739
|
exports.CollectionError = CollectionError;
|
|
@@ -9884,7 +9767,7 @@
|
|
|
9884
9767
|
exports.MultipleLlmExecutionTools = MultipleLlmExecutionTools;
|
|
9885
9768
|
exports.NotFoundError = NotFoundError;
|
|
9886
9769
|
exports.NotYetImplementedError = NotYetImplementedError;
|
|
9887
|
-
exports.
|
|
9770
|
+
exports.PROMPTBOOK_ENGINE_VERSION = PROMPTBOOK_ENGINE_VERSION;
|
|
9888
9771
|
exports.ParseError = ParseError;
|
|
9889
9772
|
exports.PipelineExecutionError = PipelineExecutionError;
|
|
9890
9773
|
exports.PipelineLogicError = PipelineLogicError;
|