@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/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.83.0';
28
+ var PROMPTBOOK_ENGINE_VERSION = '0.84.0-9';
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
@@ -526,7 +526,7 @@ var NAME = "Promptbook";
526
526
  *
527
527
  * @public exported from `@promptbook/core`
528
528
  */
529
- var ADMIN_EMAIL = 'me@pavolhejny.com';
529
+ var ADMIN_EMAIL = 'pavol@ptbk.io';
530
530
  /**
531
531
  * Name of the responsible person for the Promptbook on GitHub
532
532
  *
@@ -1037,7 +1037,7 @@ var ORDER_OF_PIPELINE_JSON = [
1037
1037
  *
1038
1038
  * @private within the repository
1039
1039
  */
1040
- var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
1040
+ var REPLACING_NONCE = 'ptbkauk42kV2dzao34faw7FudQUHYPtW';
1041
1041
  /**
1042
1042
  * @@@
1043
1043
  *
@@ -2084,7 +2084,7 @@ var LimitReachedError = /** @class */ (function (_super) {
2084
2084
  var NotYetImplementedError = /** @class */ (function (_super) {
2085
2085
  __extends(NotYetImplementedError, _super);
2086
2086
  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 me@pavolhejny.com\n\n "); })) || this;
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 pavol@ptbk.io\n\n "); })) || this;
2088
2088
  _this.name = 'NotYetImplementedError';
2089
2089
  Object.setPrototypeOf(_this, NotYetImplementedError.prototype);
2090
2090
  return _this;
@@ -11072,9 +11072,59 @@ function isValidPipelineString(pipelineString) {
11072
11072
  * TODO: [🧠][🈴] Where is the best location for this file
11073
11073
  */
11074
11074
 
11075
+ /**
11076
+ * Tag function for notating a prompt as template literal
11077
+ *
11078
+ * Note: There are 2 similar functions:
11079
+ * 1) `prompt` for notating single prompt exported from `@promptbook/utils`
11080
+ * 1) `book` for notating and validating entire books exported from `@promptbook/utils`
11081
+ *
11082
+ * @param strings @@@
11083
+ * @param values @@@
11084
+ * @returns the pipeline string
11085
+ * @public exported from `@promptbook/utils`
11086
+ */
11087
+ function prompt(strings) {
11088
+ var values = [];
11089
+ for (var _i = 1; _i < arguments.length; _i++) {
11090
+ values[_i - 1] = arguments[_i];
11091
+ }
11092
+ if (values.length === 0) {
11093
+ return spaceTrim(strings.join(''));
11094
+ }
11095
+ var placeholderParameterNames = values.map(function (value, i) { return "".concat(REPLACING_NONCE).concat(i); });
11096
+ var parameters = Object.fromEntries(values.map(function (value, i) { return [placeholderParameterNames[i], value]; }));
11097
+ // Combine strings and values
11098
+ var pipelineString = strings.reduce(function (result, stringsItem, i) {
11099
+ return placeholderParameterNames[i] === undefined
11100
+ ? "".concat(result).concat(stringsItem)
11101
+ : "".concat(result).concat(stringsItem, "{").concat(placeholderParameterNames[i], "}");
11102
+ }, '');
11103
+ pipelineString = spaceTrim(pipelineString);
11104
+ try {
11105
+ pipelineString = templateParameters(pipelineString, parameters);
11106
+ }
11107
+ catch (error) {
11108
+ if (!(error instanceof PipelineExecutionError)) {
11109
+ throw error;
11110
+ }
11111
+ console.error({ pipelineString: pipelineString, parameters: parameters, placeholderParameterNames: placeholderParameterNames, error: error });
11112
+ 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 "); }));
11113
+ }
11114
+ return pipelineString;
11115
+ }
11116
+ /**
11117
+ * TODO: [🧠][🈴] Where is the best location for this file
11118
+ * Note: [💞] Ignore a discrepancy between file name and entity name
11119
+ */
11120
+
11075
11121
  /**
11076
11122
  * Tag function for notating a pipeline with a book\`...\ notation as template literal
11077
11123
  *
11124
+ * Note: There are 2 similar functions:
11125
+ * 1) `prompt` for notating single prompt exported from `@promptbook/utils`
11126
+ * 1) `book` for notating and validating entire books exported from `@promptbook/utils`
11127
+ *
11078
11128
  * @param strings @@@
11079
11129
  * @param values @@@
11080
11130
  * @returns the pipeline string
@@ -11085,11 +11135,7 @@ function book(strings) {
11085
11135
  for (var _i = 1; _i < arguments.length; _i++) {
11086
11136
  values[_i - 1] = arguments[_i];
11087
11137
  }
11088
- if (strings.length !== 1 && values.length !== 0) {
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);
11138
+ var pipelineString = prompt.apply(void 0, __spreadArray([strings], __read(values), false));
11093
11139
  if (!isValidPipelineString(pipelineString)) {
11094
11140
  // TODO: Make the CustomError for this
11095
11141
  throw new Error(spaceTrim("\n The string is not a valid pipeline string\n\n book`\n ".concat(pipelineString, "\n `\n ")));
@@ -11101,6 +11147,40 @@ function book(strings) {
11101
11147
  * Note: [💞] Ignore a discrepancy between file name and entity name
11102
11148
  */
11103
11149
 
11150
+ /**
11151
+ * Metadata of the scraper
11152
+ *
11153
+ * @private within the scraper directory
11154
+ */
11155
+ var boilerplateScraperMetadata = $deepFreeze({
11156
+ title: 'Boilerplate scraper',
11157
+ packageName: '@promptbook/boilerplate',
11158
+ className: 'BoilerplateScraper',
11159
+ mimeTypes: [
11160
+ '@@@/@@@',
11161
+ // <- TODO: @@@ Add compatible mime types with Boilerplate scraper
11162
+ ],
11163
+ documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@@',
11164
+ isAvilableInBrowser: false,
11165
+ // <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
11166
+ requiredExecutables: [
11167
+ /* @@@ 'Pandoc' */
11168
+ ],
11169
+ }); /* <- Note: [🤛] */
11170
+ /**
11171
+ * Registration of known scraper metadata
11172
+ *
11173
+ * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
11174
+ *
11175
+ * @public exported from `@promptbook/core`
11176
+ * @public exported from `@promptbook/wizzard`
11177
+ * @public exported from `@promptbook/cli`
11178
+ */
11179
+ var _BoilerplateScraperMetadataRegistration = $scrapersMetadataRegister.register(boilerplateScraperMetadata);
11180
+ /**
11181
+ * Note: [💞] Ignore a discrepancy between file name and entity name
11182
+ */
11183
+
11104
11184
  /**
11105
11185
  * Metadata of the scraper
11106
11186
  *
@@ -11192,6 +11272,40 @@ var _MarkdownScraperMetadataRegistration = $scrapersMetadataRegister.register(ma
11192
11272
  * Note: [💞] Ignore a discrepancy between file name and entity name
11193
11273
  */
11194
11274
 
11275
+ /**
11276
+ * Metadata of the scraper
11277
+ *
11278
+ * @private within the scraper directory
11279
+ */
11280
+ var markitdownScraperMetadata = $deepFreeze({
11281
+ title: 'Markitdown scraper',
11282
+ packageName: '@promptbook/markitdown',
11283
+ className: 'MarkitdownScraper',
11284
+ mimeTypes: [
11285
+ 'application/pdf',
11286
+ // TODO: Make priority for scrapers and than allow all mime types here:
11287
+ // 'text/html',
11288
+ // 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
11289
+ ],
11290
+ documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
11291
+ isAvilableInBrowser: false,
11292
+ // <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
11293
+ requiredExecutables: [],
11294
+ }); /* <- Note: [🤛] */
11295
+ /**
11296
+ * Registration of known scraper metadata
11297
+ *
11298
+ * Warning: This is not useful for the end user, it is just a side effect of the mechanism that handles all available known scrapers
11299
+ *
11300
+ * @public exported from `@promptbook/core`
11301
+ * @public exported from `@promptbook/wizzard`
11302
+ * @public exported from `@promptbook/cli`
11303
+ */
11304
+ var _MarkitdownScraperMetadataRegistration = $scrapersMetadataRegister.register(markitdownScraperMetadata);
11305
+ /**
11306
+ * Note: [💞] Ignore a discrepancy between file name and entity name
11307
+ */
11308
+
11195
11309
  /**
11196
11310
  * Metadata of the scraper
11197
11311
  *
@@ -11201,7 +11315,7 @@ var pdfScraperMetadata = $deepFreeze({
11201
11315
  title: 'Pdf scraper',
11202
11316
  packageName: '@promptbook/pdf',
11203
11317
  className: 'PdfScraper',
11204
- mimeTypes: ['application/pdf'],
11318
+ mimeTypes: ['application/pdf-DISABLED'],
11205
11319
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
11206
11320
  isAvilableInBrowser: false,
11207
11321
  // <- 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 +11445,5 @@ var PrefixStorage = /** @class */ (function () {
11331
11445
  return PrefixStorage;
11332
11446
  }());
11333
11447
 
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 };
11448
+ 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
11449
  //# sourceMappingURL=index.es.js.map