@promptbook/core 0.84.0-0 → 0.84.0-11
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 +1 -0
- package/esm/index.es.js +264 -98
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/cli.index.d.ts +8 -0
- package/esm/typings/src/_packages/core.index.d.ts +4 -0
- package/esm/typings/src/_packages/markitdown.index.d.ts +8 -0
- package/esm/typings/src/_packages/pdf.index.d.ts +6 -0
- package/esm/typings/src/_packages/utils.index.d.ts +4 -0
- package/esm/typings/src/_packages/wizzard.index.d.ts +8 -0
- package/esm/typings/src/constants.d.ts +1 -1
- package/esm/typings/src/executables/platforms/locateAppOnLinux.d.ts +1 -1
- package/esm/typings/src/executables/platforms/locateAppOnMacOs.d.ts +1 -1
- package/esm/typings/src/execution/assertsExecutionSuccessful.d.ts +3 -1
- package/esm/typings/src/pipeline/book-notation.d.ts +5 -0
- package/esm/typings/src/pipeline/prompt-notation.d.ts +31 -0
- package/esm/typings/src/pipeline/prompt-notation.test.d.ts +4 -0
- package/esm/typings/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +43 -0
- package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +20 -0
- package/esm/typings/src/scrapers/_boilerplate/playground/boilerplate-scraper-playground.d.ts +5 -0
- package/esm/typings/src/scrapers/_boilerplate/register-constructor.d.ts +15 -0
- package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +28 -0
- package/esm/typings/src/scrapers/markitdown/MarkitdownScraper.d.ts +50 -0
- package/esm/typings/src/scrapers/markitdown/createMarkitdownScraper.d.ts +22 -0
- package/esm/typings/src/scrapers/markitdown/playground/markitdown-scraper-playground.d.ts +5 -0
- package/esm/typings/src/scrapers/markitdown/register-constructor.d.ts +17 -0
- package/esm/typings/src/scrapers/markitdown/register-metadata.d.ts +28 -0
- package/esm/typings/src/types/typeAliases.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +265 -97
- package/umd/index.umd.js.map +1 -1
package/README.md
CHANGED
|
@@ -273,6 +273,7 @@ Or you can install them separately:
|
|
|
273
273
|
- **[@promptbook/remote-client](https://www.npmjs.com/package/@promptbook/remote-client)** - Remote client for remote execution of promptbooks
|
|
274
274
|
- **[@promptbook/remote-server](https://www.npmjs.com/package/@promptbook/remote-server)** - Remote server for remote execution of promptbooks
|
|
275
275
|
- **[@promptbook/pdf](https://www.npmjs.com/package/@promptbook/pdf)** - Read knowledge from `.pdf` documents
|
|
276
|
+
- **[@promptbook/documents](https://www.npmjs.com/package/@promptbook/markitdown)** - Integration of [Markitdown by Microsoft](https://github.com/microsoft/markitdown)
|
|
276
277
|
- **[@promptbook/documents](https://www.npmjs.com/package/@promptbook/documents)** - Read knowledge from documents like `.docx`, `.odt`,…
|
|
277
278
|
- **[@promptbook/legacy-documents](https://www.npmjs.com/package/@promptbook/legacy-documents)** - Read knowledge from legacy documents like `.doc`, `.rtf`,…
|
|
278
279
|
- **[@promptbook/website-crawler](https://www.npmjs.com/package/@promptbook/website-crawler)** - Crawl knowledge from the web
|
package/esm/index.es.js
CHANGED
|
@@ -25,7 +25,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
25
25
|
* @generated
|
|
26
26
|
* @see https://github.com/webgptorg/promptbook
|
|
27
27
|
*/
|
|
28
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
28
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.84.0-10';
|
|
29
29
|
/**
|
|
30
30
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
31
31
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -178,22 +178,94 @@ function collectionToJson(collection) {
|
|
|
178
178
|
*/
|
|
179
179
|
|
|
180
180
|
/**
|
|
181
|
-
*
|
|
181
|
+
* Checks if value is valid email
|
|
182
182
|
*
|
|
183
183
|
* @public exported from `@promptbook/utils`
|
|
184
184
|
*/
|
|
185
|
-
function
|
|
186
|
-
|
|
187
|
-
|
|
185
|
+
function isValidEmail(email) {
|
|
186
|
+
if (typeof email !== 'string') {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
if (email.split('\n').length > 1) {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
return /^.+@.+\..+$/.test(email);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Tests if given string is valid URL.
|
|
197
|
+
*
|
|
198
|
+
* Note: This does not check if the file exists only if the path is valid
|
|
199
|
+
* @public exported from `@promptbook/utils`
|
|
200
|
+
*/
|
|
201
|
+
function isValidFilePath(filename) {
|
|
202
|
+
if (typeof filename !== 'string') {
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
if (filename.split('\n').length > 1) {
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
if (filename.split(' ').length >
|
|
209
|
+
5 /* <- TODO: [🧠][🈷] Make some better non-arbitrary way how to distinct filenames from informational texts */) {
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
var filenameSlashes = filename.split('\\').join('/');
|
|
213
|
+
// Absolute Unix path: /hello.txt
|
|
214
|
+
if (/^(\/)/i.test(filenameSlashes)) {
|
|
215
|
+
// console.log(filename, 'Absolute Unix path: /hello.txt');
|
|
188
216
|
return true;
|
|
189
217
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
218
|
+
// Absolute Windows path: /hello.txt
|
|
219
|
+
if (/^([A-Z]{1,2}:\/?)\//i.test(filenameSlashes)) {
|
|
220
|
+
// console.log(filename, 'Absolute Windows path: /hello.txt');
|
|
221
|
+
return true;
|
|
222
|
+
}
|
|
223
|
+
// Relative path: ./hello.txt
|
|
224
|
+
if (/^(\.\.?\/)+/i.test(filenameSlashes)) {
|
|
225
|
+
// console.log(filename, 'Relative path: ./hello.txt');
|
|
226
|
+
return true;
|
|
227
|
+
}
|
|
228
|
+
// Allow paths like foo/hello
|
|
229
|
+
if (/^[^/]+\/[^/]+/i.test(filenameSlashes)) {
|
|
230
|
+
// console.log(filename, 'Allow paths like foo/hello');
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
// Allow paths like hello.book
|
|
234
|
+
if (/^[^/]+\.[^/]+$/i.test(filenameSlashes)) {
|
|
235
|
+
// console.log(filename, 'Allow paths like hello.book');
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* TODO: [🍏] Implement for MacOs
|
|
242
|
+
*/
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Tests if given string is valid URL.
|
|
246
|
+
*
|
|
247
|
+
* Note: Dataurl are considered perfectly valid.
|
|
248
|
+
* Note: There are two simmilar functions:
|
|
249
|
+
* - `isValidUrl` which tests any URL
|
|
250
|
+
* - `isValidPipelineUrl` *(this one)* which tests just promptbook URL
|
|
251
|
+
*
|
|
252
|
+
* @public exported from `@promptbook/utils`
|
|
253
|
+
*/
|
|
254
|
+
function isValidUrl(url) {
|
|
255
|
+
if (typeof url !== 'string') {
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
try {
|
|
259
|
+
if (url.startsWith('blob:')) {
|
|
260
|
+
url = url.replace(/^blob:/, '');
|
|
193
261
|
}
|
|
194
|
-
|
|
262
|
+
var urlObject = new URL(url /* because fail is handled */);
|
|
263
|
+
if (!['http:', 'https:', 'data:'].includes(urlObject.protocol)) {
|
|
195
264
|
return false;
|
|
196
265
|
}
|
|
266
|
+
return true;
|
|
267
|
+
}
|
|
268
|
+
catch (error) {
|
|
197
269
|
return false;
|
|
198
270
|
}
|
|
199
271
|
}
|
|
@@ -217,6 +289,27 @@ var ParseError = /** @class */ (function (_super) {
|
|
|
217
289
|
* TODO: Maybe split `ParseError` and `ApplyError`
|
|
218
290
|
*/
|
|
219
291
|
|
|
292
|
+
/**
|
|
293
|
+
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
294
|
+
*
|
|
295
|
+
* @public exported from `@promptbook/utils`
|
|
296
|
+
*/
|
|
297
|
+
function isValidJsonString(value /* <- [👨⚖️] */) {
|
|
298
|
+
try {
|
|
299
|
+
JSON.parse(value);
|
|
300
|
+
return true;
|
|
301
|
+
}
|
|
302
|
+
catch (error) {
|
|
303
|
+
if (!(error instanceof Error)) {
|
|
304
|
+
throw error;
|
|
305
|
+
}
|
|
306
|
+
if (error.message.includes('Unexpected token')) {
|
|
307
|
+
return false;
|
|
308
|
+
}
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
220
313
|
/**
|
|
221
314
|
* Function `validatePipelineString` will validate the if the string is a valid pipeline string
|
|
222
315
|
* It does not check if the string is fully logically correct, but if it is a string that can be a pipeline string or the string looks completely different.
|
|
@@ -230,6 +323,15 @@ function validatePipelineString(pipelineString) {
|
|
|
230
323
|
if (isValidJsonString(pipelineString)) {
|
|
231
324
|
throw new ParseError('Expected a book, but got a JSON string');
|
|
232
325
|
}
|
|
326
|
+
else if (isValidUrl(pipelineString)) {
|
|
327
|
+
throw new ParseError("Expected a book, but got just the URL \"".concat(pipelineString, "\""));
|
|
328
|
+
}
|
|
329
|
+
else if (isValidFilePath(pipelineString)) {
|
|
330
|
+
throw new ParseError("Expected a book, but got just the file path \"".concat(pipelineString, "\""));
|
|
331
|
+
}
|
|
332
|
+
else if (isValidEmail(pipelineString)) {
|
|
333
|
+
throw new ParseError("Expected a book, but got just the email \"".concat(pipelineString, "\""));
|
|
334
|
+
}
|
|
233
335
|
// <- TODO: Implement the validation + add tests when the pipeline logic considered as invalid
|
|
234
336
|
return pipelineString;
|
|
235
337
|
}
|
|
@@ -526,7 +628,7 @@ var NAME = "Promptbook";
|
|
|
526
628
|
*
|
|
527
629
|
* @public exported from `@promptbook/core`
|
|
528
630
|
*/
|
|
529
|
-
var ADMIN_EMAIL = '
|
|
631
|
+
var ADMIN_EMAIL = 'pavol@ptbk.io';
|
|
530
632
|
/**
|
|
531
633
|
* Name of the responsible person for the Promptbook on GitHub
|
|
532
634
|
*
|
|
@@ -1037,7 +1139,7 @@ var ORDER_OF_PIPELINE_JSON = [
|
|
|
1037
1139
|
*
|
|
1038
1140
|
* @private within the repository
|
|
1039
1141
|
*/
|
|
1040
|
-
var REPLACING_NONCE = '
|
|
1142
|
+
var REPLACING_NONCE = 'ptbkauk42kV2dzao34faw7FudQUHYPtW';
|
|
1041
1143
|
/**
|
|
1042
1144
|
* @@@
|
|
1043
1145
|
*
|
|
@@ -1183,35 +1285,6 @@ function isUrlOnPrivateNetwork(url) {
|
|
|
1183
1285
|
return isHostnameOnPrivateNetwork(url.hostname);
|
|
1184
1286
|
}
|
|
1185
1287
|
|
|
1186
|
-
/**
|
|
1187
|
-
* Tests if given string is valid URL.
|
|
1188
|
-
*
|
|
1189
|
-
* Note: Dataurl are considered perfectly valid.
|
|
1190
|
-
* Note: There are two simmilar functions:
|
|
1191
|
-
* - `isValidUrl` which tests any URL
|
|
1192
|
-
* - `isValidPipelineUrl` *(this one)* which tests just promptbook URL
|
|
1193
|
-
*
|
|
1194
|
-
* @public exported from `@promptbook/utils`
|
|
1195
|
-
*/
|
|
1196
|
-
function isValidUrl(url) {
|
|
1197
|
-
if (typeof url !== 'string') {
|
|
1198
|
-
return false;
|
|
1199
|
-
}
|
|
1200
|
-
try {
|
|
1201
|
-
if (url.startsWith('blob:')) {
|
|
1202
|
-
url = url.replace(/^blob:/, '');
|
|
1203
|
-
}
|
|
1204
|
-
var urlObject = new URL(url /* because fail is handled */);
|
|
1205
|
-
if (!['http:', 'https:', 'data:'].includes(urlObject.protocol)) {
|
|
1206
|
-
return false;
|
|
1207
|
-
}
|
|
1208
|
-
return true;
|
|
1209
|
-
}
|
|
1210
|
-
catch (error) {
|
|
1211
|
-
return false;
|
|
1212
|
-
}
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
1288
|
/**
|
|
1216
1289
|
* Tests if given string is valid pipeline URL URL.
|
|
1217
1290
|
*
|
|
@@ -2084,7 +2157,7 @@ var LimitReachedError = /** @class */ (function (_super) {
|
|
|
2084
2157
|
var NotYetImplementedError = /** @class */ (function (_super) {
|
|
2085
2158
|
__extends(NotYetImplementedError, _super);
|
|
2086
2159
|
function NotYetImplementedError(message) {
|
|
2087
|
-
var _this = _super.call(this, spaceTrim$1(function (block) { return "\n ".concat(block(message), "\n\n Note: This feature is not implemented yet but it will be soon.\n\n If you want speed up the implementation or just read more, look here:\n https://github.com/webgptorg/promptbook\n\n Or contact us on
|
|
2160
|
+
var _this = _super.call(this, spaceTrim$1(function (block) { return "\n ".concat(block(message), "\n\n Note: This feature is not implemented yet but it will be soon.\n\n If you want speed up the implementation or just read more, look here:\n https://github.com/webgptorg/promptbook\n\n Or contact us on pavol@ptbk.io\n\n "); })) || this;
|
|
2088
2161
|
_this.name = 'NotYetImplementedError';
|
|
2089
2162
|
Object.setPrototypeOf(_this, NotYetImplementedError.prototype);
|
|
2090
2163
|
return _this;
|
|
@@ -2170,12 +2243,28 @@ function deserializeError(error) {
|
|
|
2170
2243
|
/**
|
|
2171
2244
|
* Asserts that the execution of a Promptbook is successful
|
|
2172
2245
|
*
|
|
2246
|
+
* Note: If there are only warnings, the execution is still successful but the warnings are logged in the console
|
|
2247
|
+
*
|
|
2173
2248
|
* @param executionResult - The partial result of the Promptbook execution
|
|
2174
2249
|
* @throws {PipelineExecutionError} If the execution is not successful or if multiple errors occurred
|
|
2175
2250
|
* @public exported from `@promptbook/core`
|
|
2176
2251
|
*/
|
|
2177
2252
|
function assertsExecutionSuccessful(executionResult) {
|
|
2178
|
-
var
|
|
2253
|
+
var e_1, _a;
|
|
2254
|
+
var isSuccessful = executionResult.isSuccessful, errors = executionResult.errors, warnings = executionResult.warnings;
|
|
2255
|
+
try {
|
|
2256
|
+
for (var warnings_1 = __values(warnings), warnings_1_1 = warnings_1.next(); !warnings_1_1.done; warnings_1_1 = warnings_1.next()) {
|
|
2257
|
+
var warning = warnings_1_1.value;
|
|
2258
|
+
console.warn(warning.message);
|
|
2259
|
+
}
|
|
2260
|
+
}
|
|
2261
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2262
|
+
finally {
|
|
2263
|
+
try {
|
|
2264
|
+
if (warnings_1_1 && !warnings_1_1.done && (_a = warnings_1.return)) _a.call(warnings_1);
|
|
2265
|
+
}
|
|
2266
|
+
finally { if (e_1) throw e_1.error; }
|
|
2267
|
+
}
|
|
2179
2268
|
if (isSuccessful === true) {
|
|
2180
2269
|
return;
|
|
2181
2270
|
}
|
|
@@ -5715,55 +5804,6 @@ function isFileExisting(filename, fs) {
|
|
|
5715
5804
|
* TODO: [🖇] What about symlinks?
|
|
5716
5805
|
*/
|
|
5717
5806
|
|
|
5718
|
-
/**
|
|
5719
|
-
* Tests if given string is valid URL.
|
|
5720
|
-
*
|
|
5721
|
-
* Note: This does not check if the file exists only if the path is valid
|
|
5722
|
-
* @public exported from `@promptbook/utils`
|
|
5723
|
-
*/
|
|
5724
|
-
function isValidFilePath(filename) {
|
|
5725
|
-
if (typeof filename !== 'string') {
|
|
5726
|
-
return false;
|
|
5727
|
-
}
|
|
5728
|
-
if (filename.split('\n').length > 1) {
|
|
5729
|
-
return false;
|
|
5730
|
-
}
|
|
5731
|
-
if (filename.split(' ').length >
|
|
5732
|
-
5 /* <- TODO: [🧠][🈷] Make some better non-arbitrary way how to distinct filenames from informational texts */) {
|
|
5733
|
-
return false;
|
|
5734
|
-
}
|
|
5735
|
-
var filenameSlashes = filename.split('\\').join('/');
|
|
5736
|
-
// Absolute Unix path: /hello.txt
|
|
5737
|
-
if (/^(\/)/i.test(filenameSlashes)) {
|
|
5738
|
-
// console.log(filename, 'Absolute Unix path: /hello.txt');
|
|
5739
|
-
return true;
|
|
5740
|
-
}
|
|
5741
|
-
// Absolute Windows path: /hello.txt
|
|
5742
|
-
if (/^([A-Z]{1,2}:\/?)\//i.test(filenameSlashes)) {
|
|
5743
|
-
// console.log(filename, 'Absolute Windows path: /hello.txt');
|
|
5744
|
-
return true;
|
|
5745
|
-
}
|
|
5746
|
-
// Relative path: ./hello.txt
|
|
5747
|
-
if (/^(\.\.?\/)+/i.test(filenameSlashes)) {
|
|
5748
|
-
// console.log(filename, 'Relative path: ./hello.txt');
|
|
5749
|
-
return true;
|
|
5750
|
-
}
|
|
5751
|
-
// Allow paths like foo/hello
|
|
5752
|
-
if (/^[^/]+\/[^/]+/i.test(filenameSlashes)) {
|
|
5753
|
-
// console.log(filename, 'Allow paths like foo/hello');
|
|
5754
|
-
return true;
|
|
5755
|
-
}
|
|
5756
|
-
// Allow paths like hello.book
|
|
5757
|
-
if (/^[^/]+\.[^/]+$/i.test(filenameSlashes)) {
|
|
5758
|
-
// console.log(filename, 'Allow paths like hello.book');
|
|
5759
|
-
return true;
|
|
5760
|
-
}
|
|
5761
|
-
return false;
|
|
5762
|
-
}
|
|
5763
|
-
/**
|
|
5764
|
-
* TODO: [🍏] Implement for MacOs
|
|
5765
|
-
*/
|
|
5766
|
-
|
|
5767
5807
|
/**
|
|
5768
5808
|
* The built-in `fetch' function with a lightweight error handling wrapper as default fetch function used in Promptbook scrapers
|
|
5769
5809
|
*
|
|
@@ -11072,9 +11112,71 @@ function isValidPipelineString(pipelineString) {
|
|
|
11072
11112
|
* TODO: [🧠][🈴] Where is the best location for this file
|
|
11073
11113
|
*/
|
|
11074
11114
|
|
|
11115
|
+
/**
|
|
11116
|
+
* Tag function for notating a prompt as template literal
|
|
11117
|
+
*
|
|
11118
|
+
* Note: There are 3 similar functions:
|
|
11119
|
+
* 1) `prompt` for notating single prompt exported from `@promptbook/utils`
|
|
11120
|
+
* 2) `promptTemplate` alias for `prompt`
|
|
11121
|
+
* 3) `book` for notating and validating entire books exported from `@promptbook/utils`
|
|
11122
|
+
*
|
|
11123
|
+
* @param strings
|
|
11124
|
+
* @param values
|
|
11125
|
+
* @returns the prompt string
|
|
11126
|
+
* @public exported from `@promptbook/utils`
|
|
11127
|
+
*/
|
|
11128
|
+
function prompt(strings) {
|
|
11129
|
+
var values = [];
|
|
11130
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
11131
|
+
values[_i - 1] = arguments[_i];
|
|
11132
|
+
}
|
|
11133
|
+
if (values.length === 0) {
|
|
11134
|
+
return spaceTrim(strings.join(''));
|
|
11135
|
+
}
|
|
11136
|
+
var stringsWithHiddenParameters = strings.map(function (stringsItem) {
|
|
11137
|
+
// TODO: [0] DRY
|
|
11138
|
+
return stringsItem.split('{').join("".concat(REPLACING_NONCE, "beginbracket")).split('}').join("".concat(REPLACING_NONCE, "endbracket"));
|
|
11139
|
+
});
|
|
11140
|
+
var placeholderParameterNames = values.map(function (value, i) { return "".concat(REPLACING_NONCE).concat(i); });
|
|
11141
|
+
var parameters = Object.fromEntries(values.map(function (value, i) { return [placeholderParameterNames[i], value]; }));
|
|
11142
|
+
// Combine strings and values
|
|
11143
|
+
var pipelineString = stringsWithHiddenParameters.reduce(function (result, stringsItem, i) {
|
|
11144
|
+
return placeholderParameterNames[i] === undefined
|
|
11145
|
+
? "".concat(result).concat(stringsItem)
|
|
11146
|
+
: "".concat(result).concat(stringsItem, "{").concat(placeholderParameterNames[i], "}");
|
|
11147
|
+
}, '');
|
|
11148
|
+
pipelineString = spaceTrim(pipelineString);
|
|
11149
|
+
try {
|
|
11150
|
+
pipelineString = templateParameters(pipelineString, parameters);
|
|
11151
|
+
}
|
|
11152
|
+
catch (error) {
|
|
11153
|
+
if (!(error instanceof PipelineExecutionError)) {
|
|
11154
|
+
throw error;
|
|
11155
|
+
}
|
|
11156
|
+
console.error({ pipelineString: pipelineString, parameters: parameters, placeholderParameterNames: placeholderParameterNames, error: error });
|
|
11157
|
+
throw new UnexpectedError(spaceTrim(function (block) { return "\n Internal error in prompt template literal\n \n ".concat(block(JSON.stringify({ strings: strings, values: values }, null, 4)), "}\n \n "); }));
|
|
11158
|
+
}
|
|
11159
|
+
// TODO: [0] DRY
|
|
11160
|
+
pipelineString = pipelineString
|
|
11161
|
+
.split("".concat(REPLACING_NONCE, "beginbracket"))
|
|
11162
|
+
.join('{')
|
|
11163
|
+
.split("".concat(REPLACING_NONCE, "endbracket"))
|
|
11164
|
+
.join('}');
|
|
11165
|
+
return pipelineString;
|
|
11166
|
+
}
|
|
11167
|
+
/**
|
|
11168
|
+
* TODO: [🧠][🈴] Where is the best location for this file
|
|
11169
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
11170
|
+
*/
|
|
11171
|
+
|
|
11075
11172
|
/**
|
|
11076
11173
|
* Tag function for notating a pipeline with a book\`...\ notation as template literal
|
|
11077
11174
|
*
|
|
11175
|
+
* Note: There are 3 similar functions:
|
|
11176
|
+
* 1) `prompt` for notating single prompt exported from `@promptbook/utils`
|
|
11177
|
+
* 2) `promptTemplate` alias for `prompt`
|
|
11178
|
+
* 3) `book` for notating and validating entire books exported from `@promptbook/utils`
|
|
11179
|
+
*
|
|
11078
11180
|
* @param strings @@@
|
|
11079
11181
|
* @param values @@@
|
|
11080
11182
|
* @returns the pipeline string
|
|
@@ -11085,11 +11187,7 @@ function book(strings) {
|
|
|
11085
11187
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
11086
11188
|
values[_i - 1] = arguments[_i];
|
|
11087
11189
|
}
|
|
11088
|
-
|
|
11089
|
-
throw new NotYetImplementedError("Only one string without interpolated value is supported for now in book`...` notation");
|
|
11090
|
-
}
|
|
11091
|
-
var pipelineString = strings[0];
|
|
11092
|
-
pipelineString = spaceTrim(pipelineString);
|
|
11190
|
+
var pipelineString = prompt.apply(void 0, __spreadArray([strings], __read(values), false));
|
|
11093
11191
|
if (!isValidPipelineString(pipelineString)) {
|
|
11094
11192
|
// TODO: Make the CustomError for this
|
|
11095
11193
|
throw new Error(spaceTrim("\n The string is not a valid pipeline string\n\n book`\n ".concat(pipelineString, "\n `\n ")));
|
|
@@ -11101,6 +11199,40 @@ function book(strings) {
|
|
|
11101
11199
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
11102
11200
|
*/
|
|
11103
11201
|
|
|
11202
|
+
/**
|
|
11203
|
+
* Metadata of the scraper
|
|
11204
|
+
*
|
|
11205
|
+
* @private within the scraper directory
|
|
11206
|
+
*/
|
|
11207
|
+
var boilerplateScraperMetadata = $deepFreeze({
|
|
11208
|
+
title: 'Boilerplate scraper',
|
|
11209
|
+
packageName: '@promptbook/boilerplate',
|
|
11210
|
+
className: 'BoilerplateScraper',
|
|
11211
|
+
mimeTypes: [
|
|
11212
|
+
'@@@/@@@',
|
|
11213
|
+
// <- TODO: @@@ Add compatible mime types with Boilerplate scraper
|
|
11214
|
+
],
|
|
11215
|
+
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@@',
|
|
11216
|
+
isAvilableInBrowser: false,
|
|
11217
|
+
// <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
|
|
11218
|
+
requiredExecutables: [
|
|
11219
|
+
/* @@@ 'Pandoc' */
|
|
11220
|
+
],
|
|
11221
|
+
}); /* <- Note: [🤛] */
|
|
11222
|
+
/**
|
|
11223
|
+
* Registration of known scraper metadata
|
|
11224
|
+
*
|
|
11225
|
+
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
11226
|
+
*
|
|
11227
|
+
* @public exported from `@promptbook/core`
|
|
11228
|
+
* @public exported from `@promptbook/wizzard`
|
|
11229
|
+
* @public exported from `@promptbook/cli`
|
|
11230
|
+
*/
|
|
11231
|
+
var _BoilerplateScraperMetadataRegistration = $scrapersMetadataRegister.register(boilerplateScraperMetadata);
|
|
11232
|
+
/**
|
|
11233
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
11234
|
+
*/
|
|
11235
|
+
|
|
11104
11236
|
/**
|
|
11105
11237
|
* Metadata of the scraper
|
|
11106
11238
|
*
|
|
@@ -11192,6 +11324,40 @@ var _MarkdownScraperMetadataRegistration = $scrapersMetadataRegister.register(ma
|
|
|
11192
11324
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
11193
11325
|
*/
|
|
11194
11326
|
|
|
11327
|
+
/**
|
|
11328
|
+
* Metadata of the scraper
|
|
11329
|
+
*
|
|
11330
|
+
* @private within the scraper directory
|
|
11331
|
+
*/
|
|
11332
|
+
var markitdownScraperMetadata = $deepFreeze({
|
|
11333
|
+
title: 'Markitdown scraper',
|
|
11334
|
+
packageName: '@promptbook/markitdown',
|
|
11335
|
+
className: 'MarkitdownScraper',
|
|
11336
|
+
mimeTypes: [
|
|
11337
|
+
'application/pdf',
|
|
11338
|
+
// TODO: Make priority for scrapers and than allow all mime types here:
|
|
11339
|
+
// 'text/html',
|
|
11340
|
+
// 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
11341
|
+
],
|
|
11342
|
+
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
11343
|
+
isAvilableInBrowser: false,
|
|
11344
|
+
// <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
|
|
11345
|
+
requiredExecutables: [],
|
|
11346
|
+
}); /* <- Note: [🤛] */
|
|
11347
|
+
/**
|
|
11348
|
+
* Registration of known scraper metadata
|
|
11349
|
+
*
|
|
11350
|
+
* Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
|
|
11351
|
+
*
|
|
11352
|
+
* @public exported from `@promptbook/core`
|
|
11353
|
+
* @public exported from `@promptbook/wizzard`
|
|
11354
|
+
* @public exported from `@promptbook/cli`
|
|
11355
|
+
*/
|
|
11356
|
+
var _MarkitdownScraperMetadataRegistration = $scrapersMetadataRegister.register(markitdownScraperMetadata);
|
|
11357
|
+
/**
|
|
11358
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
11359
|
+
*/
|
|
11360
|
+
|
|
11195
11361
|
/**
|
|
11196
11362
|
* Metadata of the scraper
|
|
11197
11363
|
*
|
|
@@ -11201,7 +11367,7 @@ var pdfScraperMetadata = $deepFreeze({
|
|
|
11201
11367
|
title: 'Pdf scraper',
|
|
11202
11368
|
packageName: '@promptbook/pdf',
|
|
11203
11369
|
className: 'PdfScraper',
|
|
11204
|
-
mimeTypes: ['application/pdf'],
|
|
11370
|
+
mimeTypes: ['application/pdf-DISABLED'],
|
|
11205
11371
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
11206
11372
|
isAvilableInBrowser: false,
|
|
11207
11373
|
// <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
|
|
@@ -11331,5 +11497,5 @@ var PrefixStorage = /** @class */ (function () {
|
|
|
11331
11497
|
return PrefixStorage;
|
|
11332
11498
|
}());
|
|
11333
11499
|
|
|
11334
|
-
export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, ADMIN_EMAIL, ADMIN_GITHUB_NAME, AbstractFormatError, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateError, BoilerplateFormfactorDefinition, CLAIM, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CsvFormatDefinition, CsvFormatError, DEFAULT_BOOKS_DIRNAME, DEFAULT_BOOK_TITLE, DEFAULT_CSV_SETTINGS, DEFAULT_EXECUTIONS_CACHE_DIRNAME, DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_REMOTE_URL, DEFAULT_REMOTE_URL_PATH, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TASK_TITLE, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FORMFACTOR_DEFINITIONS, GENERIC_PIPELINE_INTERFACE, GeneratorFormfactorDefinition, GenericFormfactorDefinition, ImageGeneratorFormfactorDefinition, KnowledgeScrapeError, LOGO_DARK_SRC, LOGO_LIGHT_SRC, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_VARIANTS, MatcherFormfactorDefinition, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NAME, NonTaskSectionTypes, NotFoundError, NotYetImplementedError, ORDER_OF_PIPELINE_JSON, PROMPTBOOK_ENGINE_VERSION, PROMPTBOOK_ERRORS, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, RESERVED_PARAMETER_NAMES, SET_IS_VERBOSE, SectionTypes, SheetsFormfactorDefinition, TaskTypes, TextFormatDefinition, TranslatorFormfactorDefinition, UNCERTAIN_USAGE, UnexpectedError, ZERO_USAGE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _DocumentScraperMetadataRegistration, _GoogleMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, addUsage, assertsExecutionSuccessful, book, cacheLlmTools, collectionToJson, compilePipeline, countTotalUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, extractParameterNamesFromTask, getPipelineInterface, isPassingExpectations, isPipelineImplementingInterface, isPipelineInterfacesEqual, isPipelinePrepared, isValidPipelineString, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, parsePipeline, pipelineJsonToString, prepareKnowledgePieces, preparePersona, preparePipeline, prepareTasks, prettifyPipelineString, unpreparePipeline, usageToHuman, usageToWorktime, validatePipeline, validatePipelineString };
|
|
11500
|
+
export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, ADMIN_EMAIL, ADMIN_GITHUB_NAME, AbstractFormatError, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateError, BoilerplateFormfactorDefinition, CLAIM, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CsvFormatDefinition, CsvFormatError, DEFAULT_BOOKS_DIRNAME, DEFAULT_BOOK_TITLE, DEFAULT_CSV_SETTINGS, DEFAULT_EXECUTIONS_CACHE_DIRNAME, DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_REMOTE_URL, DEFAULT_REMOTE_URL_PATH, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TASK_TITLE, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FORMFACTOR_DEFINITIONS, GENERIC_PIPELINE_INTERFACE, GeneratorFormfactorDefinition, GenericFormfactorDefinition, ImageGeneratorFormfactorDefinition, KnowledgeScrapeError, LOGO_DARK_SRC, LOGO_LIGHT_SRC, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_VARIANTS, MatcherFormfactorDefinition, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NAME, NonTaskSectionTypes, NotFoundError, NotYetImplementedError, ORDER_OF_PIPELINE_JSON, PROMPTBOOK_ENGINE_VERSION, PROMPTBOOK_ERRORS, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, RESERVED_PARAMETER_NAMES, SET_IS_VERBOSE, SectionTypes, SheetsFormfactorDefinition, TaskTypes, TextFormatDefinition, TranslatorFormfactorDefinition, UNCERTAIN_USAGE, UnexpectedError, ZERO_USAGE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _BoilerplateScraperMetadataRegistration, _DocumentScraperMetadataRegistration, _GoogleMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _MarkitdownScraperMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, addUsage, assertsExecutionSuccessful, book, cacheLlmTools, collectionToJson, compilePipeline, countTotalUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, extractParameterNamesFromTask, getPipelineInterface, isPassingExpectations, isPipelineImplementingInterface, isPipelineInterfacesEqual, isPipelinePrepared, isValidPipelineString, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, parsePipeline, pipelineJsonToString, prepareKnowledgePieces, preparePersona, preparePipeline, prepareTasks, prettifyPipelineString, unpreparePipeline, usageToHuman, usageToWorktime, validatePipeline, validatePipelineString };
|
|
11335
11501
|
//# sourceMappingURL=index.es.js.map
|