@promptbook/core 0.84.0-0 → 0.84.0-10

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.
Files changed (29) hide show
  1. package/README.md +1 -0
  2. package/esm/index.es.js +125 -11
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/cli.index.d.ts +8 -0
  5. package/esm/typings/src/_packages/core.index.d.ts +4 -0
  6. package/esm/typings/src/_packages/markitdown.index.d.ts +8 -0
  7. package/esm/typings/src/_packages/pdf.index.d.ts +6 -0
  8. package/esm/typings/src/_packages/utils.index.d.ts +2 -0
  9. package/esm/typings/src/_packages/wizzard.index.d.ts +8 -0
  10. package/esm/typings/src/constants.d.ts +1 -1
  11. package/esm/typings/src/executables/platforms/locateAppOnLinux.d.ts +1 -1
  12. package/esm/typings/src/executables/platforms/locateAppOnMacOs.d.ts +1 -1
  13. package/esm/typings/src/pipeline/book-notation.d.ts +4 -0
  14. package/esm/typings/src/pipeline/prompt-notation.d.ts +18 -0
  15. package/esm/typings/src/pipeline/prompt-notation.test.d.ts +4 -0
  16. package/esm/typings/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +43 -0
  17. package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +20 -0
  18. package/esm/typings/src/scrapers/_boilerplate/playground/boilerplate-scraper-playground.d.ts +5 -0
  19. package/esm/typings/src/scrapers/_boilerplate/register-constructor.d.ts +15 -0
  20. package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +28 -0
  21. package/esm/typings/src/scrapers/markitdown/MarkitdownScraper.d.ts +50 -0
  22. package/esm/typings/src/scrapers/markitdown/createMarkitdownScraper.d.ts +22 -0
  23. package/esm/typings/src/scrapers/markitdown/playground/markitdown-scraper-playground.d.ts +5 -0
  24. package/esm/typings/src/scrapers/markitdown/register-constructor.d.ts +17 -0
  25. package/esm/typings/src/scrapers/markitdown/register-metadata.d.ts +28 -0
  26. package/esm/typings/src/types/typeAliases.d.ts +1 -1
  27. package/package.json +2 -2
  28. package/umd/index.umd.js +126 -10
  29. package/umd/index.umd.js.map +1 -1
package/umd/index.umd.js CHANGED
@@ -27,7 +27,7 @@
27
27
  * @generated
28
28
  * @see https://github.com/webgptorg/promptbook
29
29
  */
30
- var PROMPTBOOK_ENGINE_VERSION = '0.83.0';
30
+ var PROMPTBOOK_ENGINE_VERSION = '0.84.0-9';
31
31
  /**
32
32
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
33
33
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -528,7 +528,7 @@
528
528
  *
529
529
  * @public exported from `@promptbook/core`
530
530
  */
531
- var ADMIN_EMAIL = 'me@pavolhejny.com';
531
+ var ADMIN_EMAIL = 'pavol@ptbk.io';
532
532
  /**
533
533
  * Name of the responsible person for the Promptbook on GitHub
534
534
  *
@@ -1039,7 +1039,7 @@
1039
1039
  *
1040
1040
  * @private within the repository
1041
1041
  */
1042
- var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
1042
+ var REPLACING_NONCE = 'ptbkauk42kV2dzao34faw7FudQUHYPtW';
1043
1043
  /**
1044
1044
  * @@@
1045
1045
  *
@@ -2086,7 +2086,7 @@
2086
2086
  var NotYetImplementedError = /** @class */ (function (_super) {
2087
2087
  __extends(NotYetImplementedError, _super);
2088
2088
  function NotYetImplementedError(message) {
2089
- var _this = _super.call(this, spaceTrim.spaceTrim(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 me@pavolhejny.com\n\n "); })) || this;
2089
+ var _this = _super.call(this, spaceTrim.spaceTrim(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;
2090
2090
  _this.name = 'NotYetImplementedError';
2091
2091
  Object.setPrototypeOf(_this, NotYetImplementedError.prototype);
2092
2092
  return _this;
@@ -11074,9 +11074,59 @@
11074
11074
  * TODO: [🧠][🈴] Where is the best location for this file
11075
11075
  */
11076
11076
 
11077
+ /**
11078
+ * Tag function for notating a prompt as template literal
11079
+ *
11080
+ * Note: There are 2 similar functions:
11081
+ * 1) `prompt` for notating single prompt exported from `@promptbook/utils`
11082
+ * 1) `book` for notating and validating entire books exported from `@promptbook/utils`
11083
+ *
11084
+ * @param strings @@@
11085
+ * @param values @@@
11086
+ * @returns the pipeline string
11087
+ * @public exported from `@promptbook/utils`
11088
+ */
11089
+ function prompt(strings) {
11090
+ var values = [];
11091
+ for (var _i = 1; _i < arguments.length; _i++) {
11092
+ values[_i - 1] = arguments[_i];
11093
+ }
11094
+ if (values.length === 0) {
11095
+ return spaceTrim__default["default"](strings.join(''));
11096
+ }
11097
+ var placeholderParameterNames = values.map(function (value, i) { return "".concat(REPLACING_NONCE).concat(i); });
11098
+ var parameters = Object.fromEntries(values.map(function (value, i) { return [placeholderParameterNames[i], value]; }));
11099
+ // Combine strings and values
11100
+ var pipelineString = strings.reduce(function (result, stringsItem, i) {
11101
+ return placeholderParameterNames[i] === undefined
11102
+ ? "".concat(result).concat(stringsItem)
11103
+ : "".concat(result).concat(stringsItem, "{").concat(placeholderParameterNames[i], "}");
11104
+ }, '');
11105
+ pipelineString = spaceTrim__default["default"](pipelineString);
11106
+ try {
11107
+ pipelineString = templateParameters(pipelineString, parameters);
11108
+ }
11109
+ catch (error) {
11110
+ if (!(error instanceof PipelineExecutionError)) {
11111
+ throw error;
11112
+ }
11113
+ console.error({ pipelineString: pipelineString, parameters: parameters, placeholderParameterNames: placeholderParameterNames, error: error });
11114
+ throw new UnexpectedError(spaceTrim__default["default"](function (block) { return "\n Internal error in prompt template literal\n \n ".concat(block(JSON.stringify({ strings: strings, values: values }, null, 4)), "}\n \n "); }));
11115
+ }
11116
+ return pipelineString;
11117
+ }
11118
+ /**
11119
+ * TODO: [🧠][🈴] Where is the best location for this file
11120
+ * Note: [💞] Ignore a discrepancy between file name and entity name
11121
+ */
11122
+
11077
11123
  /**
11078
11124
  * Tag function for notating a pipeline with a book\`...\ notation as template literal
11079
11125
  *
11126
+ * Note: There are 2 similar functions:
11127
+ * 1) `prompt` for notating single prompt exported from `@promptbook/utils`
11128
+ * 1) `book` for notating and validating entire books exported from `@promptbook/utils`
11129
+ *
11080
11130
  * @param strings @@@
11081
11131
  * @param values @@@
11082
11132
  * @returns the pipeline string
@@ -11087,11 +11137,7 @@
11087
11137
  for (var _i = 1; _i < arguments.length; _i++) {
11088
11138
  values[_i - 1] = arguments[_i];
11089
11139
  }
11090
- if (strings.length !== 1 && values.length !== 0) {
11091
- throw new NotYetImplementedError("Only one string without interpolated value is supported for now in book`...` notation");
11092
- }
11093
- var pipelineString = strings[0];
11094
- pipelineString = spaceTrim__default["default"](pipelineString);
11140
+ var pipelineString = prompt.apply(void 0, __spreadArray([strings], __read(values), false));
11095
11141
  if (!isValidPipelineString(pipelineString)) {
11096
11142
  // TODO: Make the CustomError for this
11097
11143
  throw new Error(spaceTrim__default["default"]("\n The string is not a valid pipeline string\n\n book`\n ".concat(pipelineString, "\n `\n ")));
@@ -11103,6 +11149,40 @@
11103
11149
  * Note: [💞] Ignore a discrepancy between file name and entity name
11104
11150
  */
11105
11151
 
11152
+ /**
11153
+ * Metadata of the scraper
11154
+ *
11155
+ * @private within the scraper directory
11156
+ */
11157
+ var boilerplateScraperMetadata = $deepFreeze({
11158
+ title: 'Boilerplate scraper',
11159
+ packageName: '@promptbook/boilerplate',
11160
+ className: 'BoilerplateScraper',
11161
+ mimeTypes: [
11162
+ '@@@/@@@',
11163
+ // <- TODO: @@@ Add compatible mime types with Boilerplate scraper
11164
+ ],
11165
+ documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@@',
11166
+ isAvilableInBrowser: false,
11167
+ // <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
11168
+ requiredExecutables: [
11169
+ /* @@@ 'Pandoc' */
11170
+ ],
11171
+ }); /* <- Note: [🤛] */
11172
+ /**
11173
+ * Registration of known scraper metadata
11174
+ *
11175
+ * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
11176
+ *
11177
+ * @public exported from `@promptbook/core`
11178
+ * @public exported from `@promptbook/wizzard`
11179
+ * @public exported from `@promptbook/cli`
11180
+ */
11181
+ var _BoilerplateScraperMetadataRegistration = $scrapersMetadataRegister.register(boilerplateScraperMetadata);
11182
+ /**
11183
+ * Note: [💞] Ignore a discrepancy between file name and entity name
11184
+ */
11185
+
11106
11186
  /**
11107
11187
  * Metadata of the scraper
11108
11188
  *
@@ -11194,6 +11274,40 @@
11194
11274
  * Note: [💞] Ignore a discrepancy between file name and entity name
11195
11275
  */
11196
11276
 
11277
+ /**
11278
+ * Metadata of the scraper
11279
+ *
11280
+ * @private within the scraper directory
11281
+ */
11282
+ var markitdownScraperMetadata = $deepFreeze({
11283
+ title: 'Markitdown scraper',
11284
+ packageName: '@promptbook/markitdown',
11285
+ className: 'MarkitdownScraper',
11286
+ mimeTypes: [
11287
+ 'application/pdf',
11288
+ // TODO: Make priority for scrapers and than allow all mime types here:
11289
+ // 'text/html',
11290
+ // 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
11291
+ ],
11292
+ documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
11293
+ isAvilableInBrowser: false,
11294
+ // <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
11295
+ requiredExecutables: [],
11296
+ }); /* <- Note: [🤛] */
11297
+ /**
11298
+ * Registration of known scraper metadata
11299
+ *
11300
+ * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
11301
+ *
11302
+ * @public exported from `@promptbook/core`
11303
+ * @public exported from `@promptbook/wizzard`
11304
+ * @public exported from `@promptbook/cli`
11305
+ */
11306
+ var _MarkitdownScraperMetadataRegistration = $scrapersMetadataRegister.register(markitdownScraperMetadata);
11307
+ /**
11308
+ * Note: [💞] Ignore a discrepancy between file name and entity name
11309
+ */
11310
+
11197
11311
  /**
11198
11312
  * Metadata of the scraper
11199
11313
  *
@@ -11203,7 +11317,7 @@
11203
11317
  title: 'Pdf scraper',
11204
11318
  packageName: '@promptbook/pdf',
11205
11319
  className: 'PdfScraper',
11206
- mimeTypes: ['application/pdf'],
11320
+ mimeTypes: ['application/pdf-DISABLED'],
11207
11321
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
11208
11322
  isAvilableInBrowser: false,
11209
11323
  // <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
@@ -11410,10 +11524,12 @@
11410
11524
  exports.ZERO_USAGE = ZERO_USAGE;
11411
11525
  exports._AnthropicClaudeMetadataRegistration = _AnthropicClaudeMetadataRegistration;
11412
11526
  exports._AzureOpenAiMetadataRegistration = _AzureOpenAiMetadataRegistration;
11527
+ exports._BoilerplateScraperMetadataRegistration = _BoilerplateScraperMetadataRegistration;
11413
11528
  exports._DocumentScraperMetadataRegistration = _DocumentScraperMetadataRegistration;
11414
11529
  exports._GoogleMetadataRegistration = _GoogleMetadataRegistration;
11415
11530
  exports._LegacyDocumentScraperMetadataRegistration = _LegacyDocumentScraperMetadataRegistration;
11416
11531
  exports._MarkdownScraperMetadataRegistration = _MarkdownScraperMetadataRegistration;
11532
+ exports._MarkitdownScraperMetadataRegistration = _MarkitdownScraperMetadataRegistration;
11417
11533
  exports._OpenAiAssistantMetadataRegistration = _OpenAiAssistantMetadataRegistration;
11418
11534
  exports._OpenAiMetadataRegistration = _OpenAiMetadataRegistration;
11419
11535
  exports._PdfScraperMetadataRegistration = _PdfScraperMetadataRegistration;