@promptbook/core 0.75.4 → 0.75.5

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/esm/index.es.js CHANGED
@@ -22,7 +22,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
22
22
  *
23
23
  * @see https://github.com/webgptorg/promptbook
24
24
  */
25
- var PROMPTBOOK_ENGINE_VERSION = '0.75.3';
25
+ var PROMPTBOOK_ENGINE_VERSION = '0.75.4';
26
26
  /**
27
27
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
28
28
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -2353,6 +2353,42 @@ function joinLlmExecutionTools() {
2353
2353
 
2354
2354
  var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",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:"./books/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",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:"./books/prepare-knowledge-keywords.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",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:"./books/prepare-knowledge-title.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",formfactorName:"GENERIC",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}],tasks:[{taskType:"PROMPT_TASK",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:"./books/prepare-persona.book.md"}];
2355
2355
 
2356
+ /**
2357
+ * This error indicates problems parsing the format value
2358
+ *
2359
+ * For example, when the format value is not a valid JSON or CSV
2360
+ * This is not thrown directly but in extended classes
2361
+ *
2362
+ * @public exported from `@promptbook/core`
2363
+ */
2364
+ var AbstractFormatError = /** @class */ (function (_super) {
2365
+ __extends(AbstractFormatError, _super);
2366
+ // Note: To allow instanceof do not put here error `name`
2367
+ // public readonly name = 'AbstractFormatError';
2368
+ function AbstractFormatError(message) {
2369
+ var _this = _super.call(this, message) || this;
2370
+ Object.setPrototypeOf(_this, AbstractFormatError.prototype);
2371
+ return _this;
2372
+ }
2373
+ return AbstractFormatError;
2374
+ }(Error));
2375
+
2376
+ /**
2377
+ * This error indicates problem with parsing of CSV
2378
+ *
2379
+ * @public exported from `@promptbook/core`
2380
+ */
2381
+ var CsvFormatError = /** @class */ (function (_super) {
2382
+ __extends(CsvFormatError, _super);
2383
+ function CsvFormatError(message) {
2384
+ var _this = _super.call(this, message) || this;
2385
+ _this.name = 'CsvFormatError';
2386
+ Object.setPrototypeOf(_this, CsvFormatError.prototype);
2387
+ return _this;
2388
+ }
2389
+ return CsvFormatError;
2390
+ }(AbstractFormatError));
2391
+
2356
2392
  /**
2357
2393
  * This error indicates that the pipeline collection cannot be propperly loaded
2358
2394
  *
@@ -2404,6 +2440,22 @@ var ExpectError = /** @class */ (function (_super) {
2404
2440
  return ExpectError;
2405
2441
  }(Error));
2406
2442
 
2443
+ /**
2444
+ * This error indicates that the promptbook can not retrieve knowledge from external sources
2445
+ *
2446
+ * @public exported from `@promptbook/core`
2447
+ */
2448
+ var KnowledgeScrapeError = /** @class */ (function (_super) {
2449
+ __extends(KnowledgeScrapeError, _super);
2450
+ function KnowledgeScrapeError(message) {
2451
+ var _this = _super.call(this, message) || this;
2452
+ _this.name = 'KnowledgeScrapeError';
2453
+ Object.setPrototypeOf(_this, KnowledgeScrapeError.prototype);
2454
+ return _this;
2455
+ }
2456
+ return KnowledgeScrapeError;
2457
+ }(Error));
2458
+
2407
2459
  /**
2408
2460
  * This error type indicates that some limit was reached
2409
2461
  *
@@ -2442,10 +2494,14 @@ var NotYetImplementedError = /** @class */ (function (_super) {
2442
2494
  * @public exported from `@promptbook/core`
2443
2495
  */
2444
2496
  var ERRORS = {
2445
- ExpectError: ExpectError,
2497
+ AbstractFormatError: AbstractFormatError,
2498
+ CsvFormatError: CsvFormatError,
2446
2499
  CollectionError: CollectionError,
2447
2500
  EnvironmentMismatchError: EnvironmentMismatchError,
2501
+ ExpectError: ExpectError,
2502
+ KnowledgeScrapeError: KnowledgeScrapeError,
2448
2503
  LimitReachedError: LimitReachedError,
2504
+ MissingToolsError: MissingToolsError,
2449
2505
  NotFoundError: NotFoundError,
2450
2506
  NotYetImplementedError: NotYetImplementedError,
2451
2507
  ParseError: ParseError,
@@ -2758,42 +2814,6 @@ function union() {
2758
2814
  return union;
2759
2815
  }
2760
2816
 
2761
- /**
2762
- * This error indicates problems parsing the format value
2763
- *
2764
- * For example, when the format value is not a valid JSON or CSV
2765
- * This is not thrown directly but in extended classes
2766
- *
2767
- * @public exported from `@promptbook/core`
2768
- */
2769
- var AbstractFormatError = /** @class */ (function (_super) {
2770
- __extends(AbstractFormatError, _super);
2771
- // Note: To allow instanceof do not put here error `name`
2772
- // public readonly name = 'AbstractFormatError';
2773
- function AbstractFormatError(message) {
2774
- var _this = _super.call(this, message) || this;
2775
- Object.setPrototypeOf(_this, AbstractFormatError.prototype);
2776
- return _this;
2777
- }
2778
- return AbstractFormatError;
2779
- }(Error));
2780
-
2781
- /**
2782
- * This error indicates problem with parsing of CSV
2783
- *
2784
- * @public exported from `@promptbook/core`
2785
- */
2786
- var CsvFormatError = /** @class */ (function (_super) {
2787
- __extends(CsvFormatError, _super);
2788
- function CsvFormatError(message) {
2789
- var _this = _super.call(this, message) || this;
2790
- _this.name = 'CsvFormatError';
2791
- Object.setPrototypeOf(_this, CsvFormatError.prototype);
2792
- return _this;
2793
- }
2794
- return CsvFormatError;
2795
- }(AbstractFormatError));
2796
-
2797
2817
  /**
2798
2818
  * @@@
2799
2819
  *
@@ -2834,7 +2854,7 @@ var CsvFormatDefinition = {
2834
2854
  case 0:
2835
2855
  csv = parse(value, __assign(__assign({}, settings), MANDATORY_CSV_SETTINGS));
2836
2856
  if (csv.errors.length !== 0) {
2837
- throw new CsvFormatError(spaceTrim(function (block) { return "\n CSV parsing error\n\n ".concat(block(csv.errors.map(function (error) { return error.message; }).join('\n\n')), "\n "); }));
2857
+ throw new CsvFormatError(spaceTrim(function (block) { return "\n CSV parsing error\n\n Error(s) from CSV parsing:\n ".concat(block(csv.errors.map(function (error) { return error.message; }).join('\n\n')), "\n\n The CSV data:\n ").concat(block(value), "\n "); }));
2838
2858
  }
2839
2859
  return [4 /*yield*/, Promise.all(csv.data.map(function (row, index) { return __awaiter(_this, void 0, void 0, function () {
2840
2860
  var _a, _b;
@@ -2872,7 +2892,7 @@ var CsvFormatDefinition = {
2872
2892
  case 0:
2873
2893
  csv = parse(value, __assign(__assign({}, settings), MANDATORY_CSV_SETTINGS));
2874
2894
  if (csv.errors.length !== 0) {
2875
- throw new CsvFormatError(spaceTrim(function (block) { return "\n CSV parsing error\n\n ".concat(block(csv.errors.map(function (error) { return error.message; }).join('\n\n')), "\n "); }));
2895
+ throw new CsvFormatError(spaceTrim(function (block) { return "\n CSV parsing error\n\n Error(s) from CSV parsing:\n ".concat(block(csv.errors.map(function (error) { return error.message; }).join('\n\n')), "\n\n The CSV data:\n ").concat(block(value), "\n "); }));
2876
2896
  }
2877
2897
  return [4 /*yield*/, Promise.all(csv.data.map(function (row, rowIndex) { return __awaiter(_this, void 0, void 0, function () {
2878
2898
  var _this = this;
@@ -4932,22 +4952,6 @@ function preparePersona(personaDescription, tools, options) {
4932
4952
  * TODO: [🏢] !! Check validity of `temperature` in pipeline
4933
4953
  */
4934
4954
 
4935
- /**
4936
- * This error indicates that the promptbook can not retrieve knowledge from external sources
4937
- *
4938
- * @public exported from `@promptbook/core`
4939
- */
4940
- var KnowledgeScrapeError = /** @class */ (function (_super) {
4941
- __extends(KnowledgeScrapeError, _super);
4942
- function KnowledgeScrapeError(message) {
4943
- var _this = _super.call(this, message) || this;
4944
- _this.name = 'KnowledgeScrapeError';
4945
- Object.setPrototypeOf(_this, KnowledgeScrapeError.prototype);
4946
- return _this;
4947
- }
4948
- return KnowledgeScrapeError;
4949
- }(Error));
4950
-
4951
4955
  /**
4952
4956
  * @@@
4953
4957
  *
@@ -9131,6 +9135,25 @@ var CallbackInterfaceTools = /** @class */ (function () {
9131
9135
  return CallbackInterfaceTools;
9132
9136
  }());
9133
9137
 
9138
+ /**
9139
+ * This error indicates @@@
9140
+ *
9141
+ * @public exported from `@promptbook/core`
9142
+ */
9143
+ var BoilerplateError = /** @class */ (function (_super) {
9144
+ __extends(BoilerplateError, _super);
9145
+ function BoilerplateError(message) {
9146
+ var _this = _super.call(this, message) || this;
9147
+ _this.name = 'BoilerplateError';
9148
+ Object.setPrototypeOf(_this, BoilerplateError.prototype);
9149
+ return _this;
9150
+ }
9151
+ return BoilerplateError;
9152
+ }(Error));
9153
+ /**
9154
+ * TODO: @@@ Do not forget to add the error into `0-index.ts` ERRORS
9155
+ */
9156
+
9134
9157
  /**
9135
9158
  * Pretty print an embedding vector for logging
9136
9159
  *
@@ -10454,5 +10477,5 @@ var PrefixStorage = /** @class */ (function () {
10454
10477
  return PrefixStorage;
10455
10478
  }());
10456
10479
 
10457
- export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, AbstractFormatError, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateFormfactorDefinition, CLAIM, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CsvFormatDefinition, CsvFormatError, DEFAULT_BOOKS_DIRNAME, DEFAULT_CSV_SETTINGS, DEFAULT_EXECUTIONS_CACHE_DIRNAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_REMOTE_URL, DEFAULT_REMOTE_URL_PATH, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TITLE, ERRORS, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FORMFACTOR_DEFINITIONS, GENERIC_PIPELINE_INTERFACE, GeneratorFormfactorDefinition, GenericFormfactorDefinition, KnowledgeScrapeError, LOGO_DARK_SRC, LOGO_LIGHT_SRC, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_VARIANTS, MatcherFormfactorDefinition, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NAME, NonTaskSectionTypes, NotFoundError, NotYetImplementedError, PROMPTBOOK_ENGINE_VERSION, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, RESERVED_PARAMETER_NAMES, SET_IS_VERBOSE, SectionTypes, SheetsFormfactorDefinition, TaskTypes, TextFormatDefinition, TranslatorFormfactorDefinition, UNCERTAIN_USAGE, UnexpectedError, ZERO_USAGE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _DocumentScraperMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, addUsage, assertsExecutionSuccessful, cacheLlmTools, collectionToJson, countTotalUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, getPipelineInterface, isPassingExpectations, isPipelineImplementingInterface, isPipelineInterfacesEqual, isPipelinePrepared, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, pipelineJsonToString, pipelineStringToJson, pipelineStringToJsonSync, prepareKnowledgePieces, preparePersona, preparePipeline, prepareTasks, prettifyPipelineString, stringifyPipelineJson, unpreparePipeline, usageToHuman, usageToWorktime, validatePipeline };
10480
+ export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, AbstractFormatError, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateError, BoilerplateFormfactorDefinition, CLAIM, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CsvFormatDefinition, CsvFormatError, DEFAULT_BOOKS_DIRNAME, DEFAULT_CSV_SETTINGS, DEFAULT_EXECUTIONS_CACHE_DIRNAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_REMOTE_URL, DEFAULT_REMOTE_URL_PATH, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TITLE, ERRORS, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FORMFACTOR_DEFINITIONS, GENERIC_PIPELINE_INTERFACE, GeneratorFormfactorDefinition, GenericFormfactorDefinition, KnowledgeScrapeError, LOGO_DARK_SRC, LOGO_LIGHT_SRC, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_VARIANTS, MatcherFormfactorDefinition, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NAME, NonTaskSectionTypes, NotFoundError, NotYetImplementedError, PROMPTBOOK_ENGINE_VERSION, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, RESERVED_PARAMETER_NAMES, SET_IS_VERBOSE, SectionTypes, SheetsFormfactorDefinition, TaskTypes, TextFormatDefinition, TranslatorFormfactorDefinition, UNCERTAIN_USAGE, UnexpectedError, ZERO_USAGE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _DocumentScraperMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, addUsage, assertsExecutionSuccessful, cacheLlmTools, collectionToJson, countTotalUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, getPipelineInterface, isPassingExpectations, isPipelineImplementingInterface, isPipelineInterfacesEqual, isPipelinePrepared, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, pipelineJsonToString, pipelineStringToJson, pipelineStringToJsonSync, prepareKnowledgePieces, preparePersona, preparePipeline, prepareTasks, prettifyPipelineString, stringifyPipelineJson, unpreparePipeline, usageToHuman, usageToWorktime, validatePipeline };
10458
10481
  //# sourceMappingURL=index.es.js.map