@promptbook/legacy-documents 0.75.0-0 → 0.75.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.
Files changed (158) hide show
  1. package/README.md +1 -0
  2. package/esm/index.es.js +282 -236
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/promptbook-collection/index.d.ts +6 -6
  5. package/esm/typings/src/_packages/core.index.d.ts +29 -19
  6. package/esm/typings/src/_packages/types.index.d.ts +58 -50
  7. package/esm/typings/src/_packages/utils.index.d.ts +4 -4
  8. package/esm/typings/src/cli/cli-commands/about.d.ts +1 -0
  9. package/esm/typings/src/cli/cli-commands/hello.d.ts +1 -0
  10. package/esm/typings/src/cli/cli-commands/make.d.ts +1 -0
  11. package/esm/typings/src/cli/cli-commands/prettify.d.ts +1 -0
  12. package/esm/typings/src/cli/cli-commands/run.d.ts +1 -0
  13. package/esm/typings/src/cli/cli-commands/test-command.d.ts +1 -0
  14. package/esm/typings/src/cli/main.d.ts +1 -0
  15. package/esm/typings/src/collection/PipelineCollection.d.ts +1 -1
  16. package/esm/typings/src/collection/SimplePipelineCollection.d.ts +1 -1
  17. package/esm/typings/src/collection/collectionToJson.d.ts +1 -1
  18. package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +1 -1
  19. package/esm/typings/src/collection/constructors/createCollectionFromPromise.d.ts +1 -1
  20. package/esm/typings/src/commands/EXPECT/ExpectCommand.d.ts +2 -2
  21. package/esm/typings/src/commands/EXPECT/expectCommandParser.d.ts +2 -2
  22. package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +2 -2
  23. package/esm/typings/src/commands/FORMAT/formatCommandParser.d.ts +2 -2
  24. package/esm/typings/src/commands/JOKER/jokerCommandParser.d.ts +2 -2
  25. package/esm/typings/src/commands/POSTPROCESS/postprocessCommandParser.d.ts +2 -2
  26. package/esm/typings/src/commands/SECTION/SectionCommand.d.ts +11 -0
  27. package/esm/typings/src/commands/SECTION/SectionType.d.ts +13 -0
  28. package/esm/typings/src/commands/{TEMPLATE/templateCommandParser.d.ts → SECTION/sectionCommandParser.d.ts} +6 -6
  29. package/esm/typings/src/commands/_common/types/Command.d.ts +1 -1
  30. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +17 -17
  31. package/esm/typings/src/commands/_common/types/CommandUsagePlaces.d.ts +1 -1
  32. package/esm/typings/src/commands/index.d.ts +4 -1
  33. package/esm/typings/src/config.d.ts +3 -1
  34. package/esm/typings/src/conversion/pipelineJsonToString.d.ts +2 -2
  35. package/esm/typings/src/conversion/pipelineStringToJson.d.ts +2 -2
  36. package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +3 -3
  37. package/esm/typings/src/conversion/prettify/prettifyPipelineString.d.ts +1 -1
  38. package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +3 -3
  39. package/esm/typings/src/conversion/utils/{extractParameterNamesFromTemplate.d.ts → extractParameterNamesFromTask.d.ts} +2 -2
  40. package/esm/typings/src/conversion/utils/renameParameter.d.ts +1 -1
  41. package/esm/typings/src/conversion/validation/_importPipeline.d.ts +3 -2
  42. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +1 -1
  43. package/esm/typings/src/errors/index.d.ts +3 -0
  44. package/esm/typings/src/execution/PipelineExecutorResult.d.ts +2 -2
  45. package/esm/typings/src/execution/PromptResultUsage.d.ts +1 -1
  46. package/esm/typings/src/execution/createPipelineExecutor/{$OngoingTemplateResult.d.ts → $OngoingTaskResult.d.ts} +1 -1
  47. package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorOptions.d.ts +1 -1
  48. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +1 -1
  49. package/esm/typings/src/execution/createPipelineExecutor/{20-executeTemplate.d.ts → 20-executeTask.d.ts} +7 -7
  50. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +5 -5
  51. package/esm/typings/src/execution/createPipelineExecutor/filterJustOutputParameters.d.ts +1 -1
  52. package/esm/typings/src/execution/createPipelineExecutor/{getContextForTemplate.d.ts → getContextForTask.d.ts} +2 -2
  53. package/esm/typings/src/execution/createPipelineExecutor/{getExamplesForTemplate.d.ts → getExamplesForTask.d.ts} +2 -2
  54. package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTask.d.ts +27 -0
  55. package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTask.d.ts +30 -0
  56. package/esm/typings/src/{types → execution}/execution-report/ExecutionPromptReportJson.d.ts +2 -2
  57. package/esm/typings/src/{types → execution}/execution-report/ExecutionReportJson.d.ts +4 -4
  58. package/esm/typings/src/{types → execution}/execution-report/ExecutionReportStringOptions.d.ts +1 -1
  59. package/esm/typings/src/execution/utils/checkExpectations.d.ts +1 -1
  60. package/esm/typings/src/execution/utils/usage-constants.d.ts +3 -0
  61. package/esm/typings/src/formats/index.d.ts +3 -0
  62. package/esm/typings/src/formfactors/_boilerplate/BoilerplateFormfactorDefinition.d.ts +14 -0
  63. package/esm/typings/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +9 -1
  64. package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +4 -1
  65. package/esm/typings/src/formfactors/chatbot/ChatbotFormfactorDefinition.d.ts +15 -0
  66. package/esm/typings/src/formfactors/generic/GenericFormfactorDefinition.d.ts +5 -1
  67. package/esm/typings/src/formfactors/index.d.ts +39 -3
  68. package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +14 -0
  69. package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +14 -0
  70. package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +14 -0
  71. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -0
  72. package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +3 -0
  73. package/esm/typings/src/llm-providers/anthropic-claude/register-constructor.d.ts +1 -0
  74. package/esm/typings/src/llm-providers/azure-openai/register-configuration.d.ts +3 -0
  75. package/esm/typings/src/llm-providers/azure-openai/register-constructor.d.ts +1 -0
  76. package/esm/typings/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +1 -1
  77. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -0
  78. package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +3 -0
  79. package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +1 -0
  80. package/esm/typings/src/personas/preparePersona.d.ts +1 -1
  81. package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/PipelineInterface.d.ts +5 -2
  82. package/esm/typings/src/pipeline/PipelineInterface/constants.d.ts +14 -0
  83. package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/getPipelineInterface.d.ts +3 -1
  84. package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/isPipelineImplementingInterface.d.ts +5 -1
  85. package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/isPipelineInterfacesEqual.d.ts +2 -0
  86. package/esm/typings/src/pipeline/PipelineJson/DialogTaskJson.d.ts +13 -0
  87. package/esm/typings/src/{types → pipeline}/PipelineJson/Expectations.d.ts +2 -2
  88. package/esm/typings/src/{types → pipeline}/PipelineJson/KnowledgePieceJson.d.ts +7 -6
  89. package/esm/typings/src/{types → pipeline}/PipelineJson/KnowledgeSourceJson.d.ts +3 -3
  90. package/esm/typings/src/pipeline/PipelineJson/ParameterJson.d.ts +96 -0
  91. package/esm/typings/src/{types → pipeline}/PipelineJson/PersonaJson.d.ts +4 -4
  92. package/esm/typings/src/{types → pipeline}/PipelineJson/PipelineJson.d.ts +10 -10
  93. package/esm/typings/src/{types → pipeline}/PipelineJson/PreparationJson.d.ts +1 -1
  94. package/esm/typings/src/{types/PipelineJson/PromptTemplateJson.d.ts → pipeline/PipelineJson/PromptTaskJson.d.ts} +8 -8
  95. package/esm/typings/src/pipeline/PipelineJson/ScriptTaskJson.d.ts +20 -0
  96. package/esm/typings/src/pipeline/PipelineJson/SimpleTaskJson.d.ts +13 -0
  97. package/esm/typings/src/pipeline/PipelineJson/TaskJson.d.ts +11 -0
  98. package/esm/typings/src/{types/PipelineJson/TemplateJsonCommon.d.ts → pipeline/PipelineJson/TaskJsonCommon.d.ts} +13 -13
  99. package/esm/typings/src/{types → pipeline}/PipelineString.d.ts +1 -1
  100. package/esm/typings/src/prepare/isPipelinePrepared.d.ts +2 -2
  101. package/esm/typings/src/prepare/preparePipeline.d.ts +1 -1
  102. package/esm/typings/src/prepare/{prepareTemplates.d.ts → prepareTasks.d.ts} +7 -7
  103. package/esm/typings/src/prepare/unpreparePipeline.d.ts +1 -1
  104. package/esm/typings/src/scrapers/_common/Scraper.d.ts +1 -1
  105. package/esm/typings/src/scrapers/_common/prepareKnowledgePieces.d.ts +2 -2
  106. package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +1 -1
  107. package/esm/typings/src/scrapers/document/DocumentScraper.d.ts +1 -1
  108. package/esm/typings/src/scrapers/document/register-constructor.d.ts +1 -0
  109. package/esm/typings/src/scrapers/document/register-metadata.d.ts +3 -0
  110. package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -1
  111. package/esm/typings/src/scrapers/document-legacy/register-constructor.d.ts +1 -0
  112. package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +3 -0
  113. package/esm/typings/src/scrapers/markdown/MarkdownScraper.d.ts +1 -1
  114. package/esm/typings/src/scrapers/markdown/register-constructor.d.ts +1 -0
  115. package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +3 -0
  116. package/esm/typings/src/scrapers/pdf/PdfScraper.d.ts +1 -1
  117. package/esm/typings/src/scrapers/pdf/register-constructor.d.ts +1 -0
  118. package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +3 -0
  119. package/esm/typings/src/scrapers/website/WebsiteScraper.d.ts +1 -1
  120. package/esm/typings/src/scrapers/website/register-constructor.d.ts +1 -0
  121. package/esm/typings/src/scrapers/website/register-metadata.d.ts +3 -0
  122. package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +1 -0
  123. package/esm/typings/src/types/Prompt.d.ts +1 -1
  124. package/esm/typings/src/types/TaskProgress.d.ts +2 -2
  125. package/esm/typings/src/types/typeAliasEmoji.d.ts +3 -0
  126. package/esm/typings/src/types/typeAliases.d.ts +1 -0
  127. package/esm/typings/src/utils/emojis.d.ts +1 -0
  128. package/esm/typings/src/utils/expectation-counters/{config.d.ts → constants.d.ts} +4 -0
  129. package/esm/typings/src/utils/expectation-counters/countCharacters.d.ts +1 -1
  130. package/esm/typings/src/utils/expectation-counters/countLines.d.ts +1 -1
  131. package/esm/typings/src/utils/expectation-counters/countPages.d.ts +1 -1
  132. package/esm/typings/src/utils/expectation-counters/countParagraphs.d.ts +1 -1
  133. package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +1 -1
  134. package/esm/typings/src/utils/expectation-counters/countWords.d.ts +1 -1
  135. package/esm/typings/src/utils/expectation-counters/index.d.ts +3 -2
  136. package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +3 -0
  137. package/esm/typings/src/utils/parameters/extractParameterNames.d.ts +2 -2
  138. package/esm/typings/src/utils/serialization/clonePipeline.d.ts +1 -1
  139. package/esm/typings/src/version.d.ts +2 -1
  140. package/package.json +5 -4
  141. package/umd/index.umd.js +282 -236
  142. package/umd/index.umd.js.map +1 -1
  143. package/esm/typings/src/commands/TEMPLATE/TemplateCommand.d.ts +0 -11
  144. package/esm/typings/src/commands/TEMPLATE/TemplateTypes.d.ts +0 -15
  145. package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTemplate.d.ts +0 -27
  146. package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTemplate.d.ts +0 -30
  147. package/esm/typings/src/formfactors/chat/ChatFormfactorDefinition.d.ts +0 -10
  148. package/esm/typings/src/types/PipelineJson/DialogTemplateJson.d.ts +0 -13
  149. package/esm/typings/src/types/PipelineJson/ParameterJson.d.ts +0 -39
  150. package/esm/typings/src/types/PipelineJson/ScriptTemplateJson.d.ts +0 -20
  151. package/esm/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +0 -13
  152. package/esm/typings/src/types/PipelineJson/TemplateJson.d.ts +0 -11
  153. /package/esm/typings/src/commands/{TEMPLATE/templateCommand.test.d.ts → SECTION/sectionCommand.test.d.ts} +0 -0
  154. /package/esm/typings/src/conversion/utils/{extractParameterNamesFromTemplate.test.d.ts → extractParameterNamesFromTask.test.d.ts} +0 -0
  155. /package/esm/typings/src/{types → execution}/execution-report/ExecutionReportString.d.ts +0 -0
  156. /package/esm/typings/src/{types → execution}/execution-report/countWorkingDuration.d.ts +0 -0
  157. /package/esm/typings/src/{types → execution}/execution-report/countWorkingDuration.test.d.ts +0 -0
  158. /package/esm/typings/src/{types → execution}/execution-report/executionReportJsonToString.d.ts +0 -0
package/esm/index.es.js CHANGED
@@ -23,9 +23,10 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
23
23
  *
24
24
  * @see https://github.com/webgptorg/promptbook
25
25
  */
26
- var PROMPTBOOK_ENGINE_VERSION = '0.74.0-13';
26
+ var PROMPTBOOK_ENGINE_VERSION = '0.75.0-1';
27
27
  /**
28
28
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
29
+ * Note: [💞] Ignore a discrepancy between file name and entity name
29
30
  */
30
31
 
31
32
  /*! *****************************************************************************
@@ -462,6 +463,8 @@ var IS_PIPELINE_LOGIC_VALIDATED = just(
462
463
  // Note: In normal situations, we check the pipeline logic:
463
464
  true);
464
465
  /**
466
+ * TODO: Extract `constants.ts` from `config.ts`
467
+ * Note: [💞] Ignore a discrepancy between file name and entity name
465
468
  * TODO: [🧠][🧜‍♂️] Maybe join remoteUrl and path into single value
466
469
  */
467
470
 
@@ -1078,6 +1081,9 @@ function normalizeToKebabCase(text) {
1078
1081
  normalizedName = normalizedName.replace(/-$/, '');
1079
1082
  return normalizedName;
1080
1083
  }
1084
+ /**
1085
+ * Note: [💞] Ignore a discrepancy between file name and entity name
1086
+ */
1081
1087
 
1082
1088
  /**
1083
1089
  * Removes emojis from a string and fix whitespaces
@@ -1225,7 +1231,7 @@ function getScraperIntermediateSource(source, options) {
1225
1231
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
1226
1232
  */
1227
1233
 
1228
- 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}],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.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}],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.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}],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.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}],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.book.md"}];
1234
+ 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:"./promptbook-collection/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:"./promptbook-collection/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:"./promptbook-collection/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:"./promptbook-collection/prepare-persona.book.md"}];
1229
1235
 
1230
1236
  /**
1231
1237
  * Prettify the html code
@@ -1279,7 +1285,7 @@ function capitalize(word) {
1279
1285
  */
1280
1286
  function pipelineJsonToString(pipelineJson) {
1281
1287
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
1282
- var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl, bookVersion = pipelineJson.bookVersion, description = pipelineJson.description, parameters = pipelineJson.parameters, templates = pipelineJson.templates;
1288
+ var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl, bookVersion = pipelineJson.bookVersion, description = pipelineJson.description, parameters = pipelineJson.parameters, tasks = pipelineJson.tasks;
1283
1289
  var pipelineString = "# ".concat(title);
1284
1290
  if (description) {
1285
1291
  pipelineString += '\n\n';
@@ -1329,13 +1335,13 @@ function pipelineJsonToString(pipelineJson) {
1329
1335
  pipelineString += '\n\n';
1330
1336
  pipelineString += commands.map(function (command) { return "- ".concat(command); }).join('\n');
1331
1337
  try {
1332
- for (var templates_1 = __values(templates), templates_1_1 = templates_1.next(); !templates_1_1.done; templates_1_1 = templates_1.next()) {
1333
- var template = templates_1_1.value;
1338
+ for (var tasks_1 = __values(tasks), tasks_1_1 = tasks_1.next(); !tasks_1_1.done; tasks_1_1 = tasks_1.next()) {
1339
+ var template = tasks_1_1.value;
1334
1340
  var
1335
1341
  /* Note: Not using:> name, */
1336
1342
  title_1 = template.title, description_1 = template.description,
1337
1343
  /* Note: dependentParameterNames, */
1338
- jokers = template.jokerParameterNames, templateType = template.templateType, content = template.content, postprocessing = template.postprocessingFunctionNames, expectations = template.expectations, format = template.format, resultingParameterName = template.resultingParameterName;
1344
+ jokers = template.jokerParameterNames, taskType = template.taskType, content = template.content, postprocessing = template.postprocessingFunctionNames, expectations = template.expectations, format = template.format, resultingParameterName = template.resultingParameterName;
1339
1345
  pipelineString += '\n\n';
1340
1346
  pipelineString += "## ".concat(title_1);
1341
1347
  if (description_1) {
@@ -1344,7 +1350,7 @@ function pipelineJsonToString(pipelineJson) {
1344
1350
  }
1345
1351
  var commands_1 = [];
1346
1352
  var contentLanguage = 'text';
1347
- if (templateType === 'PROMPT_TEMPLATE') {
1353
+ if (taskType === 'PROMPT_TASK') {
1348
1354
  var modelRequirements = template.modelRequirements;
1349
1355
  var _l = modelRequirements || {}, modelName = _l.modelName, modelVariant = _l.modelVariant;
1350
1356
  commands_1.push("EXECUTE PROMPT TEMPLATE");
@@ -1355,11 +1361,11 @@ function pipelineJsonToString(pipelineJson) {
1355
1361
  commands_1.push("MODEL NAME `".concat(modelName, "`"));
1356
1362
  }
1357
1363
  }
1358
- else if (templateType === 'SIMPLE_TEMPLATE') {
1364
+ else if (taskType === 'SIMPLE_TASK') {
1359
1365
  commands_1.push("SIMPLE TEMPLATE");
1360
1366
  // Note: Nothing special here
1361
1367
  }
1362
- else if (templateType === 'SCRIPT_TEMPLATE') {
1368
+ else if (taskType === 'SCRIPT_TASK') {
1363
1369
  commands_1.push("SCRIPT TEMPLATE");
1364
1370
  if (template.contentLanguage) {
1365
1371
  contentLanguage = template.contentLanguage;
@@ -1368,7 +1374,7 @@ function pipelineJsonToString(pipelineJson) {
1368
1374
  contentLanguage = '';
1369
1375
  }
1370
1376
  }
1371
- else if (templateType === 'DIALOG_TEMPLATE') {
1377
+ else if (taskType === 'DIALOG_TASK') {
1372
1378
  commands_1.push("DIALOG TEMPLATE");
1373
1379
  // Note: Nothing special here
1374
1380
  } // <- }else if([🅱]
@@ -1450,7 +1456,7 @@ function pipelineJsonToString(pipelineJson) {
1450
1456
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
1451
1457
  finally {
1452
1458
  try {
1453
- if (templates_1_1 && !templates_1_1.done && (_c = templates_1.return)) _c.call(templates_1);
1459
+ if (tasks_1_1 && !tasks_1_1.done && (_c = tasks_1.return)) _c.call(tasks_1);
1454
1460
  }
1455
1461
  finally { if (e_3) throw e_3.error; }
1456
1462
  }
@@ -1698,24 +1704,23 @@ function validatePipelineCore(pipeline) {
1698
1704
  throw new ParseError(spaceTrim(function (block) { return "\n Pipeline is valid JSON but with wrong structure\n\n `PipelineJson.parameters` expected to be an array, but got ".concat(typeof pipeline.parameters, "\n\n ").concat(block(pipelineIdentification), "\n "); }));
1699
1705
  }
1700
1706
  // TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
1701
- if (!Array.isArray(pipeline.templates)) {
1707
+ if (!Array.isArray(pipeline.tasks)) {
1702
1708
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
1703
- throw new ParseError(spaceTrim(function (block) { return "\n Pipeline is valid JSON but with wrong structure\n\n `PipelineJson.templates` expected to be an array, but got ".concat(typeof pipeline.templates, "\n\n ").concat(block(pipelineIdentification), "\n "); }));
1709
+ throw new ParseError(spaceTrim(function (block) { return "\n Pipeline is valid JSON but with wrong structure\n\n `PipelineJson.tasks` expected to be an array, but got ".concat(typeof pipeline.tasks, "\n\n ").concat(block(pipelineIdentification), "\n "); }));
1704
1710
  }
1705
1711
  var _loop_1 = function (parameter) {
1706
1712
  if (parameter.isInput && parameter.isOutput) {
1707
- throw new PipelineLogicError(spaceTrim(function (block) { return "\n\n Parameter {".concat(parameter.name, "} can not be both input and output\n\n ").concat(block(pipelineIdentification), "\n "); }));
1713
+ throw new PipelineLogicError(spaceTrim(function (block) { return "\n\n Parameter `{".concat(parameter.name, "}` can not be both input and output\n\n ").concat(block(pipelineIdentification), "\n "); }));
1708
1714
  }
1709
1715
  // Note: Testing that parameter is either intermediate or output BUT not created and unused
1710
1716
  if (!parameter.isInput &&
1711
1717
  !parameter.isOutput &&
1712
- !pipeline.templates.some(function (template) { return template.dependentParameterNames.includes(parameter.name); })) {
1713
- throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} is created but not used\n\n You can declare {").concat(parameter.name, "} as output parameter by adding in the header:\n - OUTPUT PARAMETER `{").concat(parameter.name, "}` ").concat(parameter.description || '', "\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
1718
+ !pipeline.tasks.some(function (task) { return task.dependentParameterNames.includes(parameter.name); })) {
1719
+ throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is created but not used\n\n You can declare {").concat(parameter.name, "} as output parameter by adding in the header:\n - OUTPUT PARAMETER `{").concat(parameter.name, "}` ").concat(parameter.description || '', "\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
1714
1720
  }
1715
- // Note: Testing that parameter is either input or result of some template
1716
- if (!parameter.isInput &&
1717
- !pipeline.templates.some(function (template) { return template.resultingParameterName === parameter.name; })) {
1718
- throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} is declared but not defined\n\n You can do one of these:\n 1) Remove declaration of {").concat(parameter.name, "}\n 2) Add template that results in -> {").concat(parameter.name, "}\n\n ").concat(block(pipelineIdentification), "\n "); }));
1721
+ // Note: Testing that parameter is either input or result of some task
1722
+ if (!parameter.isInput && !pipeline.tasks.some(function (task) { return task.resultingParameterName === parameter.name; })) {
1723
+ throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is declared but not defined\n\n You can do one of these:\n 1) Remove declaration of `{").concat(parameter.name, "}`\n 2) Add task that results in `-> {").concat(parameter.name, "}`\n\n ").concat(block(pipelineIdentification), "\n "); }));
1719
1724
  }
1720
1725
  };
1721
1726
  try {
@@ -1732,7 +1737,7 @@ function validatePipelineCore(pipeline) {
1732
1737
  }
1733
1738
  finally { if (e_1) throw e_1.error; }
1734
1739
  }
1735
- // Note: All input parameters are defined - so that they can be used as result of some template
1740
+ // Note: All input parameters are defined - so that they can be used as result of some task
1736
1741
  var definedParameters = new Set(pipeline.parameters.filter(function (_a) {
1737
1742
  var isInput = _a.isInput;
1738
1743
  return isInput;
@@ -1740,27 +1745,27 @@ function validatePipelineCore(pipeline) {
1740
1745
  var name = _a.name;
1741
1746
  return name;
1742
1747
  }));
1743
- var _loop_2 = function (template) {
1748
+ var _loop_2 = function (task) {
1744
1749
  var e_4, _h, e_5, _j;
1745
- if (definedParameters.has(template.resultingParameterName)) {
1746
- throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter {".concat(template.resultingParameterName, "} is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
1750
+ if (definedParameters.has(task.resultingParameterName)) {
1751
+ throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter `{".concat(task.resultingParameterName, "}` is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
1747
1752
  }
1748
- if (RESERVED_PARAMETER_NAMES.includes(template.resultingParameterName)) {
1749
- throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter name {".concat(template.resultingParameterName, "} is reserved, please use different name\n\n ").concat(block(pipelineIdentification), "\n "); }));
1753
+ if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
1754
+ throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter name {".concat(task.resultingParameterName, "} is reserved, please use different name\n\n ").concat(block(pipelineIdentification), "\n "); }));
1750
1755
  }
1751
- definedParameters.add(template.resultingParameterName);
1752
- if (template.jokerParameterNames && template.jokerParameterNames.length > 0) {
1753
- if (!template.format &&
1754
- !template.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
1755
- throw new PipelineLogicError(spaceTrim(function (block) { return "\n Joker parameters are used for {".concat(template.resultingParameterName, "} but no expectations are defined\n\n ").concat(block(pipelineIdentification), "\n "); }));
1756
+ definedParameters.add(task.resultingParameterName);
1757
+ if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
1758
+ if (!task.format &&
1759
+ !task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
1760
+ throw new PipelineLogicError(spaceTrim(function (block) { return "\n Joker parameters are used for {".concat(task.resultingParameterName, "} but no expectations are defined\n\n ").concat(block(pipelineIdentification), "\n "); }));
1756
1761
  }
1757
1762
  var _loop_4 = function (joker) {
1758
- if (!template.dependentParameterNames.includes(joker)) {
1759
- throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter {".concat(joker, "} is used for {").concat(template.resultingParameterName, "} as joker but not in `dependentParameterNames`\n\n ").concat(block(pipelineIdentification), "\n "); }));
1763
+ if (!task.dependentParameterNames.includes(joker)) {
1764
+ throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter `{".concat(joker, "}` is used for {").concat(task.resultingParameterName, "} as joker but not in `dependentParameterNames`\n\n ").concat(block(pipelineIdentification), "\n "); }));
1760
1765
  }
1761
1766
  };
1762
1767
  try {
1763
- for (var _k = (e_4 = void 0, __values(template.jokerParameterNames)), _l = _k.next(); !_l.done; _l = _k.next()) {
1768
+ for (var _k = (e_4 = void 0, __values(task.jokerParameterNames)), _l = _k.next(); !_l.done; _l = _k.next()) {
1764
1769
  var joker = _l.value;
1765
1770
  _loop_4(joker);
1766
1771
  }
@@ -1773,7 +1778,7 @@ function validatePipelineCore(pipeline) {
1773
1778
  finally { if (e_4) throw e_4.error; }
1774
1779
  }
1775
1780
  }
1776
- if (template.expectations) {
1781
+ if (task.expectations) {
1777
1782
  var _loop_5 = function (unit, min, max) {
1778
1783
  if (min !== undefined && max !== undefined && min > max) {
1779
1784
  throw new PipelineLogicError(spaceTrim(function (block) { return "\n Min expectation (=".concat(min, ") of ").concat(unit, " is higher than max expectation (=").concat(max, ")\n\n ").concat(block(pipelineIdentification), "\n "); }));
@@ -1786,7 +1791,7 @@ function validatePipelineCore(pipeline) {
1786
1791
  }
1787
1792
  };
1788
1793
  try {
1789
- for (var _m = (e_5 = void 0, __values(Object.entries(template.expectations))), _o = _m.next(); !_o.done; _o = _m.next()) {
1794
+ for (var _m = (e_5 = void 0, __values(Object.entries(task.expectations))), _o = _m.next(); !_o.done; _o = _m.next()) {
1790
1795
  var _p = __read(_o.value, 2), unit = _p[0], _q = _p[1], min = _q.min, max = _q.max;
1791
1796
  _loop_5(unit, min, max);
1792
1797
  }
@@ -1801,10 +1806,10 @@ function validatePipelineCore(pipeline) {
1801
1806
  }
1802
1807
  };
1803
1808
  try {
1804
- // Note: Checking each template individually
1805
- for (var _f = __values(pipeline.templates), _g = _f.next(); !_g.done; _g = _f.next()) {
1806
- var template = _g.value;
1807
- _loop_2(template);
1809
+ // Note: Checking each task individually
1810
+ for (var _f = __values(pipeline.tasks), _g = _f.next(); !_g.done; _g = _f.next()) {
1811
+ var task = _g.value;
1812
+ _loop_2(task);
1808
1813
  }
1809
1814
  }
1810
1815
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -1838,37 +1843,48 @@ function validatePipelineCore(pipeline) {
1838
1843
  }
1839
1844
  finally { if (e_3) throw e_3.error; }
1840
1845
  }
1841
- var unresovedTemplates = __spreadArray([], __read(pipeline.templates), false);
1846
+ var unresovedTemplates = __spreadArray([], __read(pipeline.tasks), false);
1842
1847
  var loopLimit = LOOP_LIMIT;
1843
1848
  var _loop_3 = function () {
1844
1849
  if (loopLimit-- < 0) {
1845
1850
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
1846
1851
  throw new UnexpectedError(spaceTrim(function (block) { return "\n Loop limit reached during detection of circular dependencies in `validatePipeline`\n\n ".concat(block(pipelineIdentification), "\n "); }));
1847
1852
  }
1848
- var currentlyResovedTemplates = unresovedTemplates.filter(function (template) {
1849
- return template.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
1853
+ var currentlyResovedTemplates = unresovedTemplates.filter(function (task) {
1854
+ return task.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
1850
1855
  });
1851
1856
  if (currentlyResovedTemplates.length === 0) {
1852
1857
  throw new PipelineLogicError(
1853
1858
  // TODO: [🐎] DRY
1854
- spaceTrim(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n ".concat(block(pipelineIdentification), "\n\n Can not resolve:\n ").concat(block(unresovedTemplates
1859
+ spaceTrim(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTemplates
1855
1860
  .map(function (_a) {
1856
1861
  var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
1857
- return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
1858
- .map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
1862
+ return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
1863
+ .map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
1859
1864
  .join(' and '));
1860
1865
  })
1861
- .join('\n')), "\n\n Resolved:\n ").concat(block(resovedParameters.map(function (name) { return "- Parameter {".concat(name, "}"); }).join('\n')), "\n\n\n "); }));
1866
+ .join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameters
1867
+ .filter(function (name) {
1868
+ return !RESERVED_PARAMETER_NAMES.includes(name);
1869
+ })
1870
+ .map(function (name) { return "- Parameter `{".concat(name, "}`"); })
1871
+ .join('\n')), "\n\n\n **Reserved (which are available):**\n ").concat(block(resovedParameters
1872
+ .filter(function (name) {
1873
+ return RESERVED_PARAMETER_NAMES.includes(name);
1874
+ })
1875
+ .map(function (name) { return "- Parameter `{".concat(name, "}`"); })
1876
+ .join('\n')), "\n\n\n "); }));
1862
1877
  }
1863
1878
  resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTemplates.map(function (_a) {
1864
1879
  var resultingParameterName = _a.resultingParameterName;
1865
1880
  return resultingParameterName;
1866
1881
  })), false);
1867
- unresovedTemplates = unresovedTemplates.filter(function (template) { return !currentlyResovedTemplates.includes(template); });
1882
+ unresovedTemplates = unresovedTemplates.filter(function (task) { return !currentlyResovedTemplates.includes(task); });
1868
1883
  };
1869
1884
  while (unresovedTemplates.length > 0) {
1870
1885
  _loop_3();
1871
1886
  }
1887
+ // TODO: !!!!!! Test that pipeline interface implements declared formfactor interface
1872
1888
  }
1873
1889
  /**
1874
1890
  * TODO: !! [🧞‍♀️] Do not allow joker + foreach
@@ -1925,9 +1941,9 @@ var PipelineUrlError = /** @class */ (function (_super) {
1925
1941
  }(Error));
1926
1942
 
1927
1943
  /**
1928
- * Parses the template and returns the list of all parameter names
1944
+ * Parses the task and returns the list of all parameter names
1929
1945
  *
1930
- * @param template the template with parameters in {curly} braces
1946
+ * @param template the task with parameters in {curly} braces
1931
1947
  * @returns the list of parameter names
1932
1948
  * @public exported from `@promptbook/utils`
1933
1949
  */
@@ -1958,10 +1974,10 @@ function extractParameterNames(template) {
1958
1974
  * @public exported from `@promptbook/core`
1959
1975
  */
1960
1976
  function unpreparePipeline(pipeline) {
1961
- var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources, templates = pipeline.templates;
1977
+ var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources, tasks = pipeline.tasks;
1962
1978
  personas = personas.map(function (persona) { return (__assign(__assign({}, persona), { modelRequirements: undefined, preparationIds: undefined })); });
1963
1979
  knowledgeSources = knowledgeSources.map(function (knowledgeSource) { return (__assign(__assign({}, knowledgeSource), { preparationIds: undefined })); });
1964
- templates = templates.map(function (template) {
1980
+ tasks = tasks.map(function (template) {
1965
1981
  var dependentParameterNames = template.dependentParameterNames;
1966
1982
  var parameterNames = extractParameterNames(template.preparedContent || '');
1967
1983
  dependentParameterNames = dependentParameterNames.filter(function (dependentParameterName) { return !parameterNames.has(dependentParameterName); });
@@ -1969,7 +1985,7 @@ function unpreparePipeline(pipeline) {
1969
1985
  delete templateUnprepared.preparedContent;
1970
1986
  return templateUnprepared;
1971
1987
  });
1972
- return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), { templates: templates, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }));
1988
+ return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), { tasks: tasks, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }));
1973
1989
  }
1974
1990
  /**
1975
1991
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
@@ -2184,6 +2200,9 @@ var ERRORS = {
2184
2200
  UnexpectedError: UnexpectedError,
2185
2201
  // TODO: [🪑]> VersionMismatchError,
2186
2202
  };
2203
+ /**
2204
+ * Note: [💞] Ignore a discrepancy between file name and entity name
2205
+ */
2187
2206
 
2188
2207
  /**
2189
2208
  * Deserializes the error object
@@ -2245,8 +2264,8 @@ function isPipelinePrepared(pipeline) {
2245
2264
  return false;
2246
2265
  }
2247
2266
  /*
2248
- TODO: [🧠][🍫] `templates` can not be determined if they are fully prepared SO ignoring them
2249
- > if (!pipeline.templates.every(({ preparedContent }) => preparedContent === undefined)) {
2267
+ TODO: [🧠][🍫] `tasks` can not be determined if they are fully prepared SO ignoring them
2268
+ > if (!pipeline.tasks.every(({ preparedContent }) => preparedContent === undefined)) {
2250
2269
  > return false;
2251
2270
  > }
2252
2271
  */
@@ -2259,7 +2278,7 @@ function isPipelinePrepared(pipeline) {
2259
2278
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
2260
2279
  * - [🏍] ? Is context in each template
2261
2280
  * - [♨] Are examples prepared
2262
- * - [♨] Are templates prepared
2281
+ * - [♨] Are tasks prepared
2263
2282
  */
2264
2283
 
2265
2284
  /**
@@ -2407,6 +2426,9 @@ $deepFreeze({
2407
2426
  pagesCount: { value: 0, isUncertain: true },
2408
2427
  },
2409
2428
  });
2429
+ /**
2430
+ * Note: [💞] Ignore a discrepancy between file name and entity name
2431
+ */
2410
2432
 
2411
2433
  /**
2412
2434
  * @@@
@@ -2806,8 +2828,8 @@ var MultipleLlmExecutionTools = /** @class */ (function () {
2806
2828
  else if (errors.length > 1) {
2807
2829
  throw new PipelineExecutionError(
2808
2830
  // TODO: Tell which execution tools failed like
2809
- // 1) OpenAI throw PipelineExecutionError: Parameter {knowledge} is not defined
2810
- // 2) AnthropicClaude throw PipelineExecutionError: Parameter {knowledge} is not defined
2831
+ // 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
2832
+ // 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
2811
2833
  // 3) ...
2812
2834
  spaceTrim$1(function (block) { return "\n All execution tools failed:\n\n ".concat(block(errors
2813
2835
  .map(function (error, i) { return "".concat(i + 1, ") **").concat(error.name || 'Error', ":** ").concat(error.message); })
@@ -3531,7 +3553,7 @@ TODO: [🧊] This is how it can look in future
3531
3553
  */
3532
3554
  function clonePipeline(pipeline) {
3533
3555
  // Note: Not using spread operator (...) because @@@
3534
- var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title, bookVersion = pipeline.bookVersion, description = pipeline.description, formfactorName = pipeline.formfactorName, parameters = pipeline.parameters, templates = pipeline.templates, knowledgeSources = pipeline.knowledgeSources, knowledgePieces = pipeline.knowledgePieces, personas = pipeline.personas, preparations = pipeline.preparations;
3556
+ var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title, bookVersion = pipeline.bookVersion, description = pipeline.description, formfactorName = pipeline.formfactorName, parameters = pipeline.parameters, tasks = pipeline.tasks, knowledgeSources = pipeline.knowledgeSources, knowledgePieces = pipeline.knowledgePieces, personas = pipeline.personas, preparations = pipeline.preparations;
3535
3557
  return {
3536
3558
  pipelineUrl: pipelineUrl,
3537
3559
  sourceFile: sourceFile,
@@ -3540,7 +3562,7 @@ function clonePipeline(pipeline) {
3540
3562
  description: description,
3541
3563
  formfactorName: formfactorName,
3542
3564
  parameters: parameters,
3543
- templates: templates,
3565
+ tasks: tasks,
3544
3566
  knowledgeSources: knowledgeSources,
3545
3567
  knowledgePieces: knowledgePieces,
3546
3568
  personas: personas,
@@ -3556,17 +3578,17 @@ function clonePipeline(pipeline) {
3556
3578
  *
3557
3579
  * @public exported from `@promptbook/core`
3558
3580
  */
3559
- function prepareTemplates(pipeline, tools, options) {
3581
+ function prepareTasks(pipeline, tools, options) {
3560
3582
  return __awaiter(this, void 0, void 0, function () {
3561
- var _a, maxParallelCount, templates, knowledgePiecesCount, templatesPrepared;
3583
+ var _a, maxParallelCount, tasks, knowledgePiecesCount, tasksPrepared;
3562
3584
  var _this = this;
3563
3585
  return __generator(this, function (_b) {
3564
3586
  switch (_b.label) {
3565
3587
  case 0:
3566
3588
  _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a;
3567
- templates = pipeline.templates, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
3568
- templatesPrepared = new Array(templates.length);
3569
- 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 () {
3589
+ tasks = pipeline.tasks, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
3590
+ tasksPrepared = new Array(tasks.length);
3591
+ return [4 /*yield*/, forEachAsync(tasks, { maxParallelCount: maxParallelCount /* <- TODO: [🪂] When there are subtasks, this maximul limit can be broken */ }, function (template, index) { return __awaiter(_this, void 0, void 0, function () {
3570
3592
  var dependentParameterNames, preparedContent, preparedTemplate;
3571
3593
  return __generator(this, function (_a) {
3572
3594
  dependentParameterNames = template.dependentParameterNames;
@@ -3579,13 +3601,13 @@ function prepareTemplates(pipeline, tools, options) {
3579
3601
  ], false);
3580
3602
  }
3581
3603
  preparedTemplate = __assign(__assign({}, template), { dependentParameterNames: dependentParameterNames, preparedContent: preparedContent });
3582
- templatesPrepared[index] = preparedTemplate;
3604
+ tasksPrepared[index] = preparedTemplate;
3583
3605
  return [2 /*return*/];
3584
3606
  });
3585
3607
  }); })];
3586
3608
  case 1:
3587
3609
  _b.sent();
3588
- return [2 /*return*/, { templatesPrepared: templatesPrepared }];
3610
+ return [2 /*return*/, { tasksPrepared: tasksPrepared }];
3589
3611
  }
3590
3612
  });
3591
3613
  });
@@ -3593,7 +3615,7 @@ function prepareTemplates(pipeline, tools, options) {
3593
3615
  /**
3594
3616
  * TODO: [🧠] Add context to each template (if missing)
3595
3617
  * TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
3596
- * TODO: [♨][main] !!! Prepare index the examples and maybe templates
3618
+ * TODO: [♨][main] !!! Prepare index the examples and maybe tasks
3597
3619
  * TODO: Write tests for `preparePipeline`
3598
3620
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
3599
3621
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
@@ -3610,12 +3632,12 @@ function prepareTemplates(pipeline, tools, options) {
3610
3632
  */
3611
3633
  function preparePipeline(pipeline, tools, options) {
3612
3634
  return __awaiter(this, void 0, void 0, function () {
3613
- var rootDirname, _a, maxParallelCount, _b, isVerbose, parameters, templates,
3635
+ var rootDirname, _a, maxParallelCount, _b, isVerbose, parameters, tasks,
3614
3636
  /*
3615
3637
  <- TODO: [🧠][🪑] `promptbookVersion` */
3616
3638
  knowledgeSources /*
3617
3639
  <- TODO: [🧊] `knowledgePieces` */, personas /*
3618
- <- TODO: [🧊] `preparations` */, _llms, llmTools, llmToolsWithUsage, currentPreparation, preparations, preparedPersonas, knowledgeSourcesPrepared, partialknowledgePiecesPrepared, knowledgePiecesPrepared, templatesPrepared /* TODO: parameters: parametersPrepared*/;
3640
+ <- TODO: [🧊] `preparations` */, _llms, llmTools, llmToolsWithUsage, currentPreparation, preparations, preparedPersonas, knowledgeSourcesPrepared, partialknowledgePiecesPrepared, knowledgePiecesPrepared, tasksPrepared /* TODO: parameters: parametersPrepared*/;
3619
3641
  var _this = this;
3620
3642
  return __generator(this, function (_c) {
3621
3643
  switch (_c.label) {
@@ -3624,7 +3646,7 @@ function preparePipeline(pipeline, tools, options) {
3624
3646
  return [2 /*return*/, pipeline];
3625
3647
  }
3626
3648
  rootDirname = options.rootDirname, _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a, _b = options.isVerbose, isVerbose = _b === void 0 ? DEFAULT_IS_VERBOSE : _b;
3627
- parameters = pipeline.parameters, templates = pipeline.templates, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
3649
+ parameters = pipeline.parameters, tasks = pipeline.tasks, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
3628
3650
  if (tools === undefined || tools.llm === undefined) {
3629
3651
  throw new MissingToolsError('LLM tools are required for preparing the pipeline');
3630
3652
  }
@@ -3667,9 +3689,9 @@ function preparePipeline(pipeline, tools, options) {
3667
3689
  case 2:
3668
3690
  partialknowledgePiecesPrepared = _c.sent();
3669
3691
  knowledgePiecesPrepared = partialknowledgePiecesPrepared.map(function (piece) { return (__assign(__assign({}, piece), { preparationIds: [/* TODO: [🧊] -> */ currentPreparation.id] })); });
3670
- return [4 /*yield*/, prepareTemplates({
3692
+ return [4 /*yield*/, prepareTasks({
3671
3693
  parameters: parameters,
3672
- templates: templates,
3694
+ tasks: tasks,
3673
3695
  knowledgePiecesCount: knowledgePiecesPrepared.length,
3674
3696
  }, __assign(__assign({}, tools), { llm: llmToolsWithUsage }), {
3675
3697
  rootDirname: rootDirname,
@@ -3677,12 +3699,12 @@ function preparePipeline(pipeline, tools, options) {
3677
3699
  isVerbose: isVerbose,
3678
3700
  })];
3679
3701
  case 3:
3680
- templatesPrepared = (_c.sent()).templatesPrepared;
3702
+ tasksPrepared = (_c.sent()).tasksPrepared;
3681
3703
  // ----- /Templates preparation -----
3682
3704
  // Note: Count total usage
3683
3705
  currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
3684
- return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { templates: __spreadArray([], __read(templatesPrepared), false),
3685
- // <- TODO: [🪓] Here should be no need for spreading new array, just ` templates: templatesPrepared`
3706
+ return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { tasks: __spreadArray([], __read(tasksPrepared), false),
3707
+ // <- TODO: [🪓] Here should be no need for spreading new array, just ` tasks: tasksPrepared`
3686
3708
  knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: __spreadArray([], __read(preparations), false) }))];
3687
3709
  }
3688
3710
  });
@@ -3754,9 +3776,9 @@ function extractVariables(script) {
3754
3776
  * @throws {ParseError} if the script is invalid
3755
3777
  * @public exported from `@promptbook/utils`
3756
3778
  */
3757
- function extractParameterNamesFromTemplate(template) {
3779
+ function extractParameterNamesFromTask(template) {
3758
3780
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
3759
- var title = template.title, description = template.description, templateType = template.templateType, content = template.content, preparedContent = template.preparedContent, jokerParameterNames = template.jokerParameterNames, foreach = template.foreach;
3781
+ var title = template.title, description = template.description, taskType = template.taskType, content = template.content, preparedContent = template.preparedContent, jokerParameterNames = template.jokerParameterNames, foreach = template.foreach;
3760
3782
  var parameterNames = new Set();
3761
3783
  try {
3762
3784
  for (var _e = __values(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(extractParameterNames(title)), false), __read(extractParameterNames(description || '')), false), __read(extractParameterNames(content)), false), __read(extractParameterNames(preparedContent || '')), false)), _f = _e.next(); !_f.done; _f = _e.next()) {
@@ -3771,7 +3793,7 @@ function extractParameterNamesFromTemplate(template) {
3771
3793
  }
3772
3794
  finally { if (e_1) throw e_1.error; }
3773
3795
  }
3774
- if (templateType === 'SCRIPT_TEMPLATE') {
3796
+ if (taskType === 'SCRIPT_TASK') {
3775
3797
  try {
3776
3798
  for (var _g = __values(extractVariables(content)), _h = _g.next(); !_h.done; _h = _g.next()) {
3777
3799
  var parameterName = _h.value;
@@ -4202,6 +4224,9 @@ var FORMAT_DEFINITIONS = [
4202
4224
  TextFormatDefinition,
4203
4225
  CsvFormatDefinition,
4204
4226
  ];
4227
+ /**
4228
+ * Note: [💞] Ignore a discrepancy between file name and entity name
4229
+ */
4205
4230
 
4206
4231
  /**
4207
4232
  * Maps available parameters to expected parameters
@@ -4403,11 +4428,11 @@ function replaceParameters(template, parameters) {
4403
4428
  for (var _b = __values(Object.entries(parameters)), _c = _b.next(); !_c.done; _c = _b.next()) {
4404
4429
  var _d = __read(_c.value, 2), parameterName = _d[0], parameterValue = _d[1];
4405
4430
  if (parameterValue === RESERVED_PARAMETER_MISSING_VALUE) {
4406
- throw new UnexpectedError("Parameter {".concat(parameterName, "} has missing value"));
4431
+ throw new UnexpectedError("Parameter `{".concat(parameterName, "}` has missing value"));
4407
4432
  }
4408
4433
  else if (parameterValue === RESERVED_PARAMETER_RESTRICTED) {
4409
4434
  // TODO: [🍵]
4410
- throw new UnexpectedError("Parameter {".concat(parameterName, "} is restricted to use"));
4435
+ throw new UnexpectedError("Parameter `{".concat(parameterName, "}` is restricted to use"));
4411
4436
  }
4412
4437
  }
4413
4438
  }
@@ -4418,7 +4443,7 @@ function replaceParameters(template, parameters) {
4418
4443
  }
4419
4444
  finally { if (e_1) throw e_1.error; }
4420
4445
  }
4421
- var replacedTemplate = template;
4446
+ var replacedTemplates = template;
4422
4447
  var match;
4423
4448
  var loopLimit = LOOP_LIMIT;
4424
4449
  var _loop_1 = function () {
@@ -4434,11 +4459,11 @@ function replaceParameters(template, parameters) {
4434
4459
  throw new PipelineExecutionError('Parameter is already opened or not closed');
4435
4460
  }
4436
4461
  if (parameters[parameterName] === undefined) {
4437
- throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
4462
+ throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
4438
4463
  }
4439
4464
  var parameterValue = parameters[parameterName];
4440
4465
  if (parameterValue === undefined) {
4441
- throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
4466
+ throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
4442
4467
  }
4443
4468
  parameterValue = parameterValue.toString();
4444
4469
  if (parameterValue.includes('\n') && /^\s*\W{0,3}\s*$/.test(precol)) {
@@ -4447,24 +4472,24 @@ function replaceParameters(template, parameters) {
4447
4472
  .map(function (line, index) { return (index === 0 ? line : "".concat(precol).concat(line)); })
4448
4473
  .join('\n');
4449
4474
  }
4450
- replacedTemplate =
4451
- replacedTemplate.substring(0, match.index + precol.length) +
4475
+ replacedTemplates =
4476
+ replacedTemplates.substring(0, match.index + precol.length) +
4452
4477
  parameterValue +
4453
- replacedTemplate.substring(match.index + precol.length + parameterName.length + 2);
4478
+ replacedTemplates.substring(match.index + precol.length + parameterName.length + 2);
4454
4479
  };
4455
4480
  while ((match = /^(?<precol>.*){(?<parameterName>\w+)}(.*)/m /* <- Not global */
4456
- .exec(replacedTemplate))) {
4481
+ .exec(replacedTemplates))) {
4457
4482
  _loop_1();
4458
4483
  }
4459
4484
  // [💫] Check if there are parameters that are not closed properly
4460
- if (/{\w+$/.test(replacedTemplate)) {
4485
+ if (/{\w+$/.test(replacedTemplates)) {
4461
4486
  throw new PipelineExecutionError('Parameter is not closed');
4462
4487
  }
4463
4488
  // [💫] Check if there are parameters that are not opened properly
4464
- if (/^\w+}/.test(replacedTemplate)) {
4489
+ if (/^\w+}/.test(replacedTemplates)) {
4465
4490
  throw new PipelineExecutionError('Parameter is not opened');
4466
4491
  }
4467
- return replacedTemplate;
4492
+ return replacedTemplates;
4468
4493
  }
4469
4494
 
4470
4495
  /**
@@ -4494,6 +4519,10 @@ var CHARACTERS_PER_STANDARD_LINE = 63;
4494
4519
  * @public exported from `@promptbook/utils`
4495
4520
  */
4496
4521
  var LINES_PER_STANDARD_PAGE = 44;
4522
+ /**
4523
+ * TODO: [🧠] Should be this `constants.ts` or `config.ts`?
4524
+ * Note: [💞] Ignore a discrepancy between file name and entity name
4525
+ */
4497
4526
 
4498
4527
  /**
4499
4528
  * Counts number of lines in the text
@@ -4572,6 +4601,7 @@ var CountUtils = {
4572
4601
  };
4573
4602
  /**
4574
4603
  * TODO: [🧠][🤠] This should be probbably as part of `TextFormatDefinition`
4604
+ * Note: [💞] Ignore a discrepancy between file name and entity name
4575
4605
  */
4576
4606
 
4577
4607
  /**
@@ -4620,12 +4650,12 @@ function checkExpectations(expectations, value) {
4620
4650
  */
4621
4651
  function executeAttempts(options) {
4622
4652
  return __awaiter(this, void 0, void 0, function () {
4623
- var jokerParameterNames, priority, maxAttempts, preparedContent, parameters, template, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, $ongoingTemplateResult, _llms, llmTools, _loop_1, attempt, state_1;
4653
+ var jokerParameterNames, priority, maxAttempts, preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, $ongoingTaskResult, _llms, llmTools, _loop_1, attempt, state_1;
4624
4654
  return __generator(this, function (_a) {
4625
4655
  switch (_a.label) {
4626
4656
  case 0:
4627
- jokerParameterNames = options.jokerParameterNames, priority = options.priority, maxAttempts = options.maxAttempts, preparedContent = options.preparedContent, parameters = options.parameters, template = options.template, preparedPipeline = options.preparedPipeline, tools = options.tools, $executionReport = options.$executionReport, pipelineIdentification = options.pipelineIdentification, maxExecutionAttempts = options.maxExecutionAttempts;
4628
- $ongoingTemplateResult = {
4657
+ jokerParameterNames = options.jokerParameterNames, priority = options.priority, maxAttempts = options.maxAttempts, preparedContent = options.preparedContent, parameters = options.parameters, task = options.task, preparedPipeline = options.preparedPipeline, tools = options.tools, $executionReport = options.$executionReport, pipelineIdentification = options.pipelineIdentification, maxExecutionAttempts = options.maxExecutionAttempts;
4658
+ $ongoingTaskResult = {
4629
4659
  $result: null,
4630
4660
  $resultString: null,
4631
4661
  $expectError: null,
@@ -4645,52 +4675,51 @@ function executeAttempts(options) {
4645
4675
  if (isJokerAttempt && !jokerParameterName) {
4646
4676
  throw new UnexpectedError(spaceTrim(function (block) { return "\n Joker not found in attempt ".concat(attempt, "\n\n ").concat(block(pipelineIdentification), "\n "); }));
4647
4677
  }
4648
- $ongoingTemplateResult.$result = null;
4649
- $ongoingTemplateResult.$resultString = null;
4650
- $ongoingTemplateResult.$expectError = null;
4678
+ $ongoingTaskResult.$result = null;
4679
+ $ongoingTaskResult.$resultString = null;
4680
+ $ongoingTaskResult.$expectError = null;
4651
4681
  if (isJokerAttempt) {
4652
4682
  if (parameters[jokerParameterName] === undefined) {
4653
4683
  throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Joker parameter {".concat(jokerParameterName, "} not defined\n\n ").concat(block(pipelineIdentification), "\n "); }));
4654
4684
  // <- TODO: This is maybe `PipelineLogicError` which should be detected in `validatePipeline` and here just thrown as `UnexpectedError`
4655
4685
  }
4656
4686
  else {
4657
- $ongoingTemplateResult.$resultString = parameters[jokerParameterName];
4687
+ $ongoingTaskResult.$resultString = parameters[jokerParameterName];
4658
4688
  }
4659
4689
  }
4660
4690
  _t.label = 1;
4661
4691
  case 1:
4662
4692
  _t.trys.push([1, 43, 44, 45]);
4663
4693
  if (!!isJokerAttempt) return [3 /*break*/, 25];
4664
- _b = template.templateType;
4694
+ _b = task.taskType;
4665
4695
  switch (_b) {
4666
- case 'SIMPLE_TEMPLATE': return [3 /*break*/, 2];
4667
- case 'PROMPT_TEMPLATE': return [3 /*break*/, 3];
4668
- case 'SCRIPT_TEMPLATE': return [3 /*break*/, 11];
4669
- case 'DIALOG_TEMPLATE': return [3 /*break*/, 22];
4696
+ case 'SIMPLE_TASK': return [3 /*break*/, 2];
4697
+ case 'PROMPT_TASK': return [3 /*break*/, 3];
4698
+ case 'SCRIPT_TASK': return [3 /*break*/, 11];
4699
+ case 'DIALOG_TASK': return [3 /*break*/, 22];
4670
4700
  }
4671
4701
  return [3 /*break*/, 24];
4672
4702
  case 2:
4673
- $ongoingTemplateResult.$resultString = replaceParameters(preparedContent, parameters);
4703
+ $ongoingTaskResult.$resultString = replaceParameters(preparedContent, parameters);
4674
4704
  return [3 /*break*/, 25];
4675
4705
  case 3:
4676
- modelRequirements = __assign(__assign({ modelVariant: 'CHAT' }, (preparedPipeline.defaultModelRequirements || {})), (template.modelRequirements || {}));
4677
- $ongoingTemplateResult.$prompt = {
4678
- title: template.title,
4706
+ modelRequirements = __assign(__assign({ modelVariant: 'CHAT' }, (preparedPipeline.defaultModelRequirements || {})), (task.modelRequirements || {}));
4707
+ $ongoingTaskResult.$prompt = {
4708
+ title: task.title,
4679
4709
  pipelineUrl: "".concat(preparedPipeline.pipelineUrl
4680
4710
  ? preparedPipeline.pipelineUrl
4681
- : 'anonymous' /* <- TODO: [🧠] How to deal with anonymous pipelines, do here some auto-url like SHA-256 based ad-hoc identifier? */, "#").concat(template.name
4682
- // <- TODO: Here should be maybe also subformat index to distinguish between same template with different subformat values
4711
+ : 'anonymous' /* <- TODO: [🧠] How to deal with anonymous pipelines, do here some auto-url like SHA-256 based ad-hoc identifier? */, "#").concat(task.name
4712
+ // <- TODO: Here should be maybe also subformat index to distinguish between same task with different subformat values
4683
4713
  ),
4684
4714
  parameters: parameters,
4685
4715
  content: preparedContent,
4686
4716
  modelRequirements: modelRequirements,
4687
4717
  expectations: __assign(__assign({}, (preparedPipeline.personas.find(function (_a) {
4688
4718
  var name = _a.name;
4689
- return name === template.personaName;
4690
- }) ||
4691
- {})), template.expectations),
4692
- format: template.format,
4693
- postprocessingFunctionNames: template.postprocessingFunctionNames,
4719
+ return name === task.personaName;
4720
+ }) || {})), task.expectations),
4721
+ format: task.format,
4722
+ postprocessingFunctionNames: task.postprocessingFunctionNames,
4694
4723
  }; // <- TODO: Not very good type guard
4695
4724
  _c = modelRequirements.modelVariant;
4696
4725
  switch (_c) {
@@ -4700,36 +4729,35 @@ function executeAttempts(options) {
4700
4729
  }
4701
4730
  return [3 /*break*/, 9];
4702
4731
  case 4:
4703
- _d = $ongoingTemplateResult;
4732
+ _d = $ongoingTaskResult;
4704
4733
  return [4 /*yield*/, llmTools.callChatModel(
4705
4734
  // <- TODO: [🧁] Check that `callChatModel` is defined
4706
- $deepFreeze($ongoingTemplateResult.$prompt))];
4735
+ $deepFreeze($ongoingTaskResult.$prompt))];
4707
4736
  case 5:
4708
4737
  _d.$chatResult = _t.sent();
4709
4738
  // TODO: [🍬] Destroy chatThread
4710
- $ongoingTemplateResult.$result = $ongoingTemplateResult.$chatResult;
4711
- $ongoingTemplateResult.$resultString = $ongoingTemplateResult.$chatResult.content;
4739
+ $ongoingTaskResult.$result = $ongoingTaskResult.$chatResult;
4740
+ $ongoingTaskResult.$resultString = $ongoingTaskResult.$chatResult.content;
4712
4741
  return [3 /*break*/, 10];
4713
4742
  case 6:
4714
- _e = $ongoingTemplateResult;
4743
+ _e = $ongoingTaskResult;
4715
4744
  return [4 /*yield*/, llmTools.callCompletionModel(
4716
4745
  // <- TODO: [🧁] Check that `callCompletionModel` is defined
4717
- $deepFreeze($ongoingTemplateResult.$prompt))];
4746
+ $deepFreeze($ongoingTaskResult.$prompt))];
4718
4747
  case 7:
4719
4748
  _e.$completionResult = _t.sent();
4720
- $ongoingTemplateResult.$result = $ongoingTemplateResult.$completionResult;
4721
- $ongoingTemplateResult.$resultString =
4722
- $ongoingTemplateResult.$completionResult.content;
4749
+ $ongoingTaskResult.$result = $ongoingTaskResult.$completionResult;
4750
+ $ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
4723
4751
  return [3 /*break*/, 10];
4724
4752
  case 8: throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Embedding model can not be used in pipeline\n\n This should be catched during parsing\n\n ".concat(block(pipelineIdentification), "\n\n "); }));
4725
- case 9: throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Unknown model variant \"".concat(template.modelRequirements.modelVariant, "\"\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
4753
+ case 9: throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Unknown model variant \"".concat(task.modelRequirements.modelVariant, "\"\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
4726
4754
  case 10: return [3 /*break*/, 25];
4727
4755
  case 11:
4728
4756
  if (arrayableToArray(tools.script).length === 0) {
4729
4757
  throw new PipelineExecutionError(spaceTrim(function (block) { return "\n No script execution tools are available\n\n ".concat(block(pipelineIdentification), "\n "); }));
4730
4758
  }
4731
- if (!template.contentLanguage) {
4732
- throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Script language is not defined for SCRIPT TEMPLATE \"".concat(template.name, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
4759
+ if (!task.contentLanguage) {
4760
+ throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Script language is not defined for SCRIPT TASK \"".concat(task.name, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
4733
4761
  }
4734
4762
  _t.label = 12;
4735
4763
  case 12:
@@ -4742,9 +4770,9 @@ function executeAttempts(options) {
4742
4770
  _t.label = 14;
4743
4771
  case 14:
4744
4772
  _t.trys.push([14, 16, , 17]);
4745
- _h = $ongoingTemplateResult;
4773
+ _h = $ongoingTaskResult;
4746
4774
  return [4 /*yield*/, scriptTools.execute($deepFreeze({
4747
- scriptLanguage: template.contentLanguage,
4775
+ scriptLanguage: task.contentLanguage,
4748
4776
  script: preparedContent,
4749
4777
  parameters: parameters,
4750
4778
  }))];
@@ -4759,7 +4787,7 @@ function executeAttempts(options) {
4759
4787
  if (error_1 instanceof UnexpectedError) {
4760
4788
  throw error_1;
4761
4789
  }
4762
- $ongoingTemplateResult.$scriptPipelineExecutionErrors.push(error_1);
4790
+ $ongoingTaskResult.$scriptPipelineExecutionErrors.push(error_1);
4763
4791
  return [3 /*break*/, 17];
4764
4792
  case 17:
4765
4793
  _g = _f.next();
@@ -4776,14 +4804,14 @@ function executeAttempts(options) {
4776
4804
  finally { if (e_1) throw e_1.error; }
4777
4805
  return [7 /*endfinally*/];
4778
4806
  case 21:
4779
- if ($ongoingTemplateResult.$resultString !== null) {
4807
+ if ($ongoingTaskResult.$resultString !== null) {
4780
4808
  return [3 /*break*/, 25];
4781
4809
  }
4782
- if ($ongoingTemplateResult.$scriptPipelineExecutionErrors.length === 1) {
4783
- throw $ongoingTemplateResult.$scriptPipelineExecutionErrors[0];
4810
+ if ($ongoingTaskResult.$scriptPipelineExecutionErrors.length === 1) {
4811
+ throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
4784
4812
  }
4785
4813
  else {
4786
- throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Script execution failed ".concat($ongoingTemplateResult.$scriptPipelineExecutionErrors.length, "x\n\n ").concat(block(pipelineIdentification), "\n\n ").concat(block($ongoingTemplateResult.$scriptPipelineExecutionErrors
4814
+ throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Script execution failed ".concat($ongoingTaskResult.$scriptPipelineExecutionErrors.length, "x\n\n ").concat(block(pipelineIdentification), "\n\n ").concat(block($ongoingTaskResult.$scriptPipelineExecutionErrors
4787
4815
  .map(function (error) { return '- ' + error.message; })
4788
4816
  .join('\n\n')), "\n "); }));
4789
4817
  }
@@ -4791,27 +4819,27 @@ function executeAttempts(options) {
4791
4819
  if (tools.userInterface === undefined) {
4792
4820
  throw new PipelineExecutionError(spaceTrim(function (block) { return "\n User interface tools are not available\n\n ".concat(block(pipelineIdentification), "\n "); }));
4793
4821
  }
4794
- // TODO: [🌹] When making next attempt for `DIALOG TEMPLATE`, preserve the previous user input
4795
- _j = $ongoingTemplateResult;
4822
+ // TODO: [🌹] When making next attempt for `DIALOG TASK`, preserve the previous user input
4823
+ _j = $ongoingTaskResult;
4796
4824
  return [4 /*yield*/, tools.userInterface.promptDialog($deepFreeze({
4797
- promptTitle: template.title,
4798
- promptMessage: replaceParameters(template.description || '', parameters),
4825
+ promptTitle: task.title,
4826
+ promptMessage: replaceParameters(task.description || '', parameters),
4799
4827
  defaultValue: replaceParameters(preparedContent, parameters),
4800
4828
  // TODO: [🧠] !! Figure out how to define placeholder in .book.md file
4801
4829
  placeholder: undefined,
4802
4830
  priority: priority,
4803
4831
  }))];
4804
4832
  case 23:
4805
- // TODO: [🌹] When making next attempt for `DIALOG TEMPLATE`, preserve the previous user input
4833
+ // TODO: [🌹] When making next attempt for `DIALOG TASK`, preserve the previous user input
4806
4834
  _j.$resultString = _t.sent();
4807
4835
  return [3 /*break*/, 25];
4808
- case 24: throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Unknown execution type \"".concat(template.templateType, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
4836
+ case 24: throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Unknown execution type \"".concat(task.taskType, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
4809
4837
  case 25:
4810
- if (!(!isJokerAttempt && template.postprocessingFunctionNames)) return [3 /*break*/, 42];
4838
+ if (!(!isJokerAttempt && task.postprocessingFunctionNames)) return [3 /*break*/, 42];
4811
4839
  _t.label = 26;
4812
4840
  case 26:
4813
4841
  _t.trys.push([26, 40, 41, 42]);
4814
- _k = (e_3 = void 0, __values(template.postprocessingFunctionNames)), _l = _k.next();
4842
+ _k = (e_3 = void 0, __values(task.postprocessingFunctionNames)), _l = _k.next();
4815
4843
  _t.label = 27;
4816
4844
  case 27:
4817
4845
  if (!!_l.done) return [3 /*break*/, 39];
@@ -4828,13 +4856,13 @@ function executeAttempts(options) {
4828
4856
  _t.label = 30;
4829
4857
  case 30:
4830
4858
  _t.trys.push([30, 32, , 33]);
4831
- _p = $ongoingTemplateResult;
4859
+ _p = $ongoingTaskResult;
4832
4860
  return [4 /*yield*/, scriptTools.execute({
4833
4861
  scriptLanguage: "javascript" /* <- TODO: Try it in each languages; In future allow postprocessing with arbitrary combination of languages to combine */,
4834
4862
  script: "".concat(functionName, "(resultString)"),
4835
4863
  parameters: {
4836
- resultString: $ongoingTemplateResult.$resultString || '',
4837
- // Note: No ...parametersForTemplate, because working with result only
4864
+ resultString: $ongoingTaskResult.$resultString || '',
4865
+ // Note: No ...parametersForTask, because working with result only
4838
4866
  },
4839
4867
  })];
4840
4868
  case 31:
@@ -4850,7 +4878,7 @@ function executeAttempts(options) {
4850
4878
  throw error_2;
4851
4879
  }
4852
4880
  postprocessingError = error_2;
4853
- $ongoingTemplateResult.$scriptPipelineExecutionErrors.push(error_2);
4881
+ $ongoingTaskResult.$scriptPipelineExecutionErrors.push(error_2);
4854
4882
  return [3 /*break*/, 33];
4855
4883
  case 33:
4856
4884
  _o = _m.next();
@@ -4887,12 +4915,12 @@ function executeAttempts(options) {
4887
4915
  return [7 /*endfinally*/];
4888
4916
  case 42:
4889
4917
  // TODO: [💝] Unite object for expecting amount and format
4890
- if (template.format) {
4891
- if (template.format === 'JSON') {
4892
- if (!isValidJsonString($ongoingTemplateResult.$resultString || '')) {
4918
+ if (task.format) {
4919
+ if (task.format === 'JSON') {
4920
+ if (!isValidJsonString($ongoingTaskResult.$resultString || '')) {
4893
4921
  // TODO: [🏢] Do more universally via `FormatDefinition`
4894
4922
  try {
4895
- $ongoingTemplateResult.$resultString = extractJsonBlock($ongoingTemplateResult.$resultString || '');
4923
+ $ongoingTaskResult.$resultString = extractJsonBlock($ongoingTaskResult.$resultString || '');
4896
4924
  }
4897
4925
  catch (error) {
4898
4926
  throw new ExpectError(spaceTrim(function (block) { return "\n Expected valid JSON string\n\n ".concat(block(
@@ -4901,12 +4929,12 @@ function executeAttempts(options) {
4901
4929
  }
4902
4930
  }
4903
4931
  else {
4904
- throw new UnexpectedError(spaceTrim(function (block) { return "\n Unknown format \"".concat(template.format, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
4932
+ throw new UnexpectedError(spaceTrim(function (block) { return "\n Unknown format \"".concat(task.format, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
4905
4933
  }
4906
4934
  }
4907
4935
  // TODO: [💝] Unite object for expecting amount and format
4908
- if (template.expectations) {
4909
- checkExpectations(template.expectations, $ongoingTemplateResult.$resultString || '');
4936
+ if (task.expectations) {
4937
+ checkExpectations(task.expectations, $ongoingTaskResult.$resultString || '');
4910
4938
  }
4911
4939
  return [2 /*return*/, "break-attempts"];
4912
4940
  case 43:
@@ -4914,38 +4942,38 @@ function executeAttempts(options) {
4914
4942
  if (!(error_3 instanceof ExpectError)) {
4915
4943
  throw error_3;
4916
4944
  }
4917
- $ongoingTemplateResult.$expectError = error_3;
4945
+ $ongoingTaskResult.$expectError = error_3;
4918
4946
  return [3 /*break*/, 45];
4919
4947
  case 44:
4920
4948
  if (!isJokerAttempt &&
4921
- template.templateType === 'PROMPT_TEMPLATE' &&
4922
- $ongoingTemplateResult.$prompt
4949
+ task.taskType === 'PROMPT_TASK' &&
4950
+ $ongoingTaskResult.$prompt
4923
4951
  // <- Note: [2] When some expected parameter is not defined, error will occur in replaceParameters
4924
4952
  // In that case we don’t want to make a report about it because it’s not a llm execution error
4925
4953
  ) {
4926
- // TODO: [🧠] Maybe put other templateTypes into report
4954
+ // TODO: [🧠] Maybe put other taskTypes into report
4927
4955
  $executionReport.promptExecutions.push({
4928
- prompt: __assign({}, $ongoingTemplateResult.$prompt),
4929
- result: $ongoingTemplateResult.$result || undefined,
4930
- error: $ongoingTemplateResult.$expectError === null
4956
+ prompt: __assign({}, $ongoingTaskResult.$prompt),
4957
+ result: $ongoingTaskResult.$result || undefined,
4958
+ error: $ongoingTaskResult.$expectError === null
4931
4959
  ? undefined
4932
- : serializeError($ongoingTemplateResult.$expectError),
4960
+ : serializeError($ongoingTaskResult.$expectError),
4933
4961
  });
4934
4962
  }
4935
4963
  return [7 /*endfinally*/];
4936
4964
  case 45:
4937
- if ($ongoingTemplateResult.$expectError !== null && attempt === maxAttempts - 1) {
4965
+ if ($ongoingTaskResult.$expectError !== null && attempt === maxAttempts - 1) {
4938
4966
  throw new PipelineExecutionError(spaceTrim(function (block) {
4939
4967
  var _a, _b, _c;
4940
- return "\n LLM execution failed ".concat(maxExecutionAttempts, "x\n\n ").concat(block(pipelineIdentification), "\n\n ---\n The Prompt:\n ").concat(block((((_a = $ongoingTemplateResult.$prompt) === null || _a === void 0 ? void 0 : _a.content) || '')
4968
+ return "\n LLM execution failed ".concat(maxExecutionAttempts, "x\n\n ").concat(block(pipelineIdentification), "\n\n ---\n The Prompt:\n ").concat(block((((_a = $ongoingTaskResult.$prompt) === null || _a === void 0 ? void 0 : _a.content) || '')
4941
4969
  .split('\n')
4942
4970
  .map(function (line) { return "> ".concat(line); })
4943
- .join('\n')), "\n\n Last error ").concat(((_b = $ongoingTemplateResult.$expectError) === null || _b === void 0 ? void 0 : _b.name) || '', ":\n ").concat(block((((_c = $ongoingTemplateResult.$expectError) === null || _c === void 0 ? void 0 : _c.message) || '')
4971
+ .join('\n')), "\n\n Last error ").concat(((_b = $ongoingTaskResult.$expectError) === null || _b === void 0 ? void 0 : _b.name) || '', ":\n ").concat(block((((_c = $ongoingTaskResult.$expectError) === null || _c === void 0 ? void 0 : _c.message) || '')
4944
4972
  .split('\n')
4945
4973
  .map(function (line) { return "> ".concat(line); })
4946
- .join('\n')), "\n\n Last result:\n ").concat(block($ongoingTemplateResult.$resultString === null
4974
+ .join('\n')), "\n\n Last result:\n ").concat(block($ongoingTaskResult.$resultString === null
4947
4975
  ? 'null'
4948
- : $ongoingTemplateResult.$resultString
4976
+ : $ongoingTaskResult.$resultString
4949
4977
  .split('\n')
4950
4978
  .map(function (line) { return "> ".concat(line); })
4951
4979
  .join('\n')), "\n ---\n ");
@@ -4970,10 +4998,10 @@ function executeAttempts(options) {
4970
4998
  attempt++;
4971
4999
  return [3 /*break*/, 1];
4972
5000
  case 4:
4973
- if ($ongoingTemplateResult.$resultString === null) {
5001
+ if ($ongoingTaskResult.$resultString === null) {
4974
5002
  throw new UnexpectedError(spaceTrim(function (block) { return "\n Something went wrong and prompt result is null\n\n ".concat(block(pipelineIdentification), "\n "); }));
4975
5003
  }
4976
- return [2 /*return*/, $ongoingTemplateResult.$resultString];
5004
+ return [2 /*return*/, $ongoingTaskResult.$resultString];
4977
5005
  }
4978
5006
  });
4979
5007
  });
@@ -4989,36 +5017,36 @@ function executeAttempts(options) {
4989
5017
  */
4990
5018
  function executeFormatSubvalues(options) {
4991
5019
  return __awaiter(this, void 0, void 0, function () {
4992
- var template, jokerParameterNames, parameters, priority, csvSettings, pipelineIdentification, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
5020
+ var task, jokerParameterNames, parameters, priority, csvSettings, pipelineIdentification, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
4993
5021
  var _this = this;
4994
5022
  return __generator(this, function (_a) {
4995
5023
  switch (_a.label) {
4996
5024
  case 0:
4997
- template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, csvSettings = options.csvSettings, pipelineIdentification = options.pipelineIdentification;
4998
- if (template.foreach === undefined) {
5025
+ task = options.task, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, csvSettings = options.csvSettings, pipelineIdentification = options.pipelineIdentification;
5026
+ if (task.foreach === undefined) {
4999
5027
  return [2 /*return*/, /* not await */ executeAttempts(options)];
5000
5028
  }
5001
5029
  if (jokerParameterNames.length !== 0) {
5002
5030
  throw new UnexpectedError(spaceTrim$1(function (block) { return "\n JOKER parameters are not supported together with FOREACH command\n\n [\uD83E\uDDDE\u200D\u2640\uFE0F] This should be prevented in `validatePipeline`\n\n ".concat(block(pipelineIdentification), "\n "); }));
5003
5031
  }
5004
- parameterValue = parameters[template.foreach.parameterName] || '';
5032
+ parameterValue = parameters[task.foreach.parameterName] || '';
5005
5033
  formatDefinition = FORMAT_DEFINITIONS.find(function (formatDefinition) {
5006
- return __spreadArray([formatDefinition.formatName], __read((formatDefinition.aliases || [])), false).includes(template.foreach.formatName);
5034
+ return __spreadArray([formatDefinition.formatName], __read((formatDefinition.aliases || [])), false).includes(task.foreach.formatName);
5007
5035
  });
5008
5036
  if (formatDefinition === undefined) {
5009
5037
  throw new UnexpectedError(
5010
5038
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
5011
- spaceTrim$1(function (block) { return "\n Unsupported format \"".concat(template.foreach.formatName, "\"\n\n Available formats:\n ").concat(block(FORMAT_DEFINITIONS.map(function (formatDefinition) { return formatDefinition.formatName; })
5039
+ spaceTrim$1(function (block) { return "\n Unsupported format \"".concat(task.foreach.formatName, "\"\n\n Available formats:\n ").concat(block(FORMAT_DEFINITIONS.map(function (formatDefinition) { return formatDefinition.formatName; })
5012
5040
  .map(function (formatName) { return "- ".concat(formatName); })
5013
5041
  .join('\n')), "\n\n [\u26F7] This should never happen because format name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
5014
5042
  }
5015
5043
  subvalueDefinition = formatDefinition.subvalueDefinitions.find(function (subvalueDefinition) {
5016
- return __spreadArray([subvalueDefinition.subvalueName], __read((subvalueDefinition.aliases || [])), false).includes(template.foreach.subformatName);
5044
+ return __spreadArray([subvalueDefinition.subvalueName], __read((subvalueDefinition.aliases || [])), false).includes(task.foreach.subformatName);
5017
5045
  });
5018
5046
  if (subvalueDefinition === undefined) {
5019
5047
  throw new UnexpectedError(
5020
5048
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
5021
- spaceTrim$1(function (block) { return "\n Unsupported subformat name \"".concat(template.foreach.subformatName, "\" for format \"").concat(template.foreach.formatName, "\"\n\n Available subformat names for format \"").concat(formatDefinition.formatName, "\":\n ").concat(block(formatDefinition.subvalueDefinitions
5049
+ spaceTrim$1(function (block) { return "\n Unsupported subformat name \"".concat(task.foreach.subformatName, "\" for format \"").concat(task.foreach.formatName, "\"\n\n Available subformat names for format \"").concat(formatDefinition.formatName, "\":\n ").concat(block(formatDefinition.subvalueDefinitions
5022
5050
  .map(function (subvalueDefinition) { return subvalueDefinition.subvalueName; })
5023
5051
  .map(function (subvalueName) { return "- ".concat(subvalueName); })
5024
5052
  .join('\n')), "\n\n [\u26F7] This should never happen because subformat name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
@@ -5027,7 +5055,7 @@ function executeFormatSubvalues(options) {
5027
5055
  formatSettings = csvSettings;
5028
5056
  // <- TODO: [🤹‍♂️] More universal, make simmilar pattern for other formats for example \n vs \r\n in text
5029
5057
  }
5030
- return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, template.foreach.outputSubparameterName, formatSettings, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
5058
+ return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, task.foreach.outputSubparameterName, formatSettings, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
5031
5059
  var mappedParameters, allSubparameters, subresultString;
5032
5060
  return __generator(this, function (_a) {
5033
5061
  switch (_a.label) {
@@ -5036,7 +5064,7 @@ function executeFormatSubvalues(options) {
5036
5064
  // TODO: When done [🐚] Report progress also for each subvalue here
5037
5065
  try {
5038
5066
  mappedParameters = mapAvailableToExpectedParameters({
5039
- expectedParameters: Object.fromEntries(template.foreach.inputSubparameterNames.map(function (subparameterName) { return [subparameterName, null]; })),
5067
+ expectedParameters: Object.fromEntries(task.foreach.inputSubparameterNames.map(function (subparameterName) { return [subparameterName, null]; })),
5040
5068
  availableParameters: subparameters,
5041
5069
  });
5042
5070
  }
@@ -5069,7 +5097,7 @@ function executeFormatSubvalues(options) {
5069
5097
  *
5070
5098
  * @private internal utility of `createPipelineExecutor`
5071
5099
  */
5072
- function getContextForTemplate(template) {
5100
+ function getContextForTask(task) {
5073
5101
  return __awaiter(this, void 0, void 0, function () {
5074
5102
  return __generator(this, function (_a) {
5075
5103
  return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [🏍] Implement */];
@@ -5082,15 +5110,10 @@ function getContextForTemplate(template) {
5082
5110
  *
5083
5111
  * @private internal utility of `createPipelineExecutor`
5084
5112
  */
5085
- function getKnowledgeForTemplate(options) {
5113
+ function getExamplesForTask(task) {
5086
5114
  return __awaiter(this, void 0, void 0, function () {
5087
- var preparedPipeline;
5088
5115
  return __generator(this, function (_a) {
5089
- preparedPipeline = options.preparedPipeline, options.template;
5090
- return [2 /*return*/, preparedPipeline.knowledgePieces.map(function (_a) {
5091
- var content = _a.content;
5092
- return "- ".concat(content);
5093
- }).join('\n')];
5116
+ return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [♨] Implement */];
5094
5117
  });
5095
5118
  });
5096
5119
  }
@@ -5100,10 +5123,15 @@ function getKnowledgeForTemplate(options) {
5100
5123
  *
5101
5124
  * @private internal utility of `createPipelineExecutor`
5102
5125
  */
5103
- function getExamplesForTemplate(template) {
5126
+ function getKnowledgeForTask(options) {
5104
5127
  return __awaiter(this, void 0, void 0, function () {
5128
+ var preparedPipeline;
5105
5129
  return __generator(this, function (_a) {
5106
- return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [♨] Implement */];
5130
+ preparedPipeline = options.preparedPipeline, options.task;
5131
+ return [2 /*return*/, preparedPipeline.knowledgePieces.map(function (_a) {
5132
+ var content = _a.content;
5133
+ return "- ".concat(content);
5134
+ }).join('\n')];
5107
5135
  });
5108
5136
  });
5109
5137
  }
@@ -5113,21 +5141,21 @@ function getExamplesForTemplate(template) {
5113
5141
  *
5114
5142
  * @private internal utility of `createPipelineExecutor`
5115
5143
  */
5116
- function getReservedParametersForTemplate(options) {
5144
+ function getReservedParametersForTask(options) {
5117
5145
  return __awaiter(this, void 0, void 0, function () {
5118
- var preparedPipeline, template, pipelineIdentification, context, knowledge, examples, currentDate, modelName, reservedParameters, _loop_1, RESERVED_PARAMETER_NAMES_1, RESERVED_PARAMETER_NAMES_1_1, parameterName;
5146
+ var preparedPipeline, task, pipelineIdentification, context, knowledge, examples, currentDate, modelName, reservedParameters, _loop_1, RESERVED_PARAMETER_NAMES_1, RESERVED_PARAMETER_NAMES_1_1, parameterName;
5119
5147
  var e_1, _a;
5120
5148
  return __generator(this, function (_b) {
5121
5149
  switch (_b.label) {
5122
5150
  case 0:
5123
- preparedPipeline = options.preparedPipeline, template = options.template, pipelineIdentification = options.pipelineIdentification;
5124
- return [4 /*yield*/, getContextForTemplate()];
5151
+ preparedPipeline = options.preparedPipeline, task = options.task, pipelineIdentification = options.pipelineIdentification;
5152
+ return [4 /*yield*/, getContextForTask()];
5125
5153
  case 1:
5126
5154
  context = _b.sent();
5127
- return [4 /*yield*/, getKnowledgeForTemplate({ preparedPipeline: preparedPipeline, template: template })];
5155
+ return [4 /*yield*/, getKnowledgeForTask({ preparedPipeline: preparedPipeline, task: task })];
5128
5156
  case 2:
5129
5157
  knowledge = _b.sent();
5130
- return [4 /*yield*/, getExamplesForTemplate()];
5158
+ return [4 /*yield*/, getExamplesForTask()];
5131
5159
  case 3:
5132
5160
  examples = _b.sent();
5133
5161
  currentDate = new Date().toISOString();
@@ -5170,31 +5198,31 @@ function getReservedParametersForTemplate(options) {
5170
5198
  *
5171
5199
  * @private internal utility of `createPipelineExecutor`
5172
5200
  */
5173
- function executeTemplate(options) {
5201
+ function executeTask(options) {
5174
5202
  return __awaiter(this, void 0, void 0, function () {
5175
- var currentTemplate, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, _a, maxExecutionAttempts, name, title, priority, usedParameterNames, dependentParameterNames, definedParameters, _b, _c, _d, definedParameterNames, parameters, _loop_1, _e, _f, parameterName, maxAttempts, jokerParameterNames, preparedContent, resultString;
5203
+ var currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, _a, maxExecutionAttempts, name, title, priority, usedParameterNames, dependentParameterNames, definedParameters, _b, _c, _d, definedParameterNames, parameters, _loop_1, _e, _f, parameterName, maxAttempts, jokerParameterNames, preparedContent, resultString;
5176
5204
  var e_1, _g, _h;
5177
5205
  return __generator(this, function (_j) {
5178
5206
  switch (_j.label) {
5179
5207
  case 0:
5180
- currentTemplate = options.currentTemplate, preparedPipeline = options.preparedPipeline, parametersToPass = options.parametersToPass, tools = options.tools, onProgress = options.onProgress, $executionReport = options.$executionReport, pipelineIdentification = options.pipelineIdentification, _a = options.maxExecutionAttempts, maxExecutionAttempts = _a === void 0 ? DEFAULT_MAX_EXECUTION_ATTEMPTS : _a;
5181
- name = "pipeline-executor-frame-".concat(currentTemplate.name);
5182
- title = currentTemplate.title;
5183
- priority = preparedPipeline.templates.length - preparedPipeline.templates.indexOf(currentTemplate);
5208
+ currentTask = options.currentTask, preparedPipeline = options.preparedPipeline, parametersToPass = options.parametersToPass, tools = options.tools, onProgress = options.onProgress, $executionReport = options.$executionReport, pipelineIdentification = options.pipelineIdentification, _a = options.maxExecutionAttempts, maxExecutionAttempts = _a === void 0 ? DEFAULT_MAX_EXECUTION_ATTEMPTS : _a;
5209
+ name = "pipeline-executor-frame-".concat(currentTask.name);
5210
+ title = currentTask.title;
5211
+ priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
5184
5212
  return [4 /*yield*/, onProgress({
5185
5213
  name: name,
5186
5214
  title: title,
5187
5215
  isStarted: false,
5188
5216
  isDone: false,
5189
- templateType: currentTemplate.templateType,
5190
- parameterName: currentTemplate.resultingParameterName,
5217
+ taskType: currentTask.taskType,
5218
+ parameterName: currentTask.resultingParameterName,
5191
5219
  parameterValue: null,
5192
5220
  // <- [🍸]
5193
5221
  })];
5194
5222
  case 1:
5195
5223
  _j.sent();
5196
- usedParameterNames = extractParameterNamesFromTemplate(currentTemplate);
5197
- dependentParameterNames = new Set(currentTemplate.dependentParameterNames);
5224
+ usedParameterNames = extractParameterNamesFromTask(currentTask);
5225
+ dependentParameterNames = new Set(currentTask.dependentParameterNames);
5198
5226
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
5199
5227
  if (union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)).size !== 0) {
5200
5228
  throw new UnexpectedError(spaceTrim(function (block) { return "\n Dependent parameters are not consistent with used parameters:\n\n Dependent parameters:\n ".concat(Array.from(dependentParameterNames)
@@ -5205,9 +5233,9 @@ function executeTemplate(options) {
5205
5233
  }
5206
5234
  _c = (_b = Object).freeze;
5207
5235
  _d = [{}];
5208
- return [4 /*yield*/, getReservedParametersForTemplate({
5236
+ return [4 /*yield*/, getReservedParametersForTask({
5209
5237
  preparedPipeline: preparedPipeline,
5210
- template: currentTemplate,
5238
+ task: currentTask,
5211
5239
  pipelineIdentification: pipelineIdentification,
5212
5240
  })];
5213
5241
  case 2:
@@ -5225,11 +5253,11 @@ function executeTemplate(options) {
5225
5253
  else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
5226
5254
  // Houston, we have a problem
5227
5255
  // Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
5228
- throw new UnexpectedError(spaceTrim(function (block) { return "\n Parameter {".concat(parameterName, "} is NOT defined\n BUT used in template \"").concat(currentTemplate.title || currentTemplate.name, "\"\n\n This should be catched in `validatePipeline`\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
5256
+ throw new UnexpectedError(spaceTrim(function (block) { return "\n Parameter `{".concat(parameterName, "}` is NOT defined\n BUT used in task \"").concat(currentTask.title || currentTask.name, "\"\n\n This should be catched in `validatePipeline`\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
5229
5257
  }
5230
5258
  };
5231
5259
  try {
5232
- // Note: [2] Check that all used parameters are defined and removing unused parameters for this template
5260
+ // Note: [2] Check that all used parameters are defined and removing unused parameters for this task
5233
5261
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
5234
5262
  for (_e = __values(Array.from(union(definedParameterNames, usedParameterNames, dependentParameterNames))), _f = _e.next(); !_f.done; _f = _e.next()) {
5235
5263
  parameterName = _f.value;
@@ -5245,18 +5273,16 @@ function executeTemplate(options) {
5245
5273
  }
5246
5274
  // Note: [👨‍👨‍👧] Now we can freeze `parameters` because we are sure that all and only used parameters are defined and are not going to be changed
5247
5275
  Object.freeze(parameters);
5248
- maxAttempts = currentTemplate.templateType === 'DIALOG_TEMPLATE' ? Infinity : maxExecutionAttempts;
5249
- jokerParameterNames = currentTemplate.jokerParameterNames || [];
5250
- preparedContent = (currentTemplate.preparedContent || '{content}')
5251
- .split('{content}')
5252
- .join(currentTemplate.content);
5276
+ maxAttempts = currentTask.taskType === 'DIALOG_TASK' ? Infinity : maxExecutionAttempts;
5277
+ jokerParameterNames = currentTask.jokerParameterNames || [];
5278
+ preparedContent = (currentTask.preparedContent || '{content}').split('{content}').join(currentTask.content);
5253
5279
  return [4 /*yield*/, executeFormatSubvalues({
5254
5280
  jokerParameterNames: jokerParameterNames,
5255
5281
  priority: priority,
5256
5282
  maxAttempts: maxAttempts,
5257
5283
  preparedContent: preparedContent,
5258
5284
  parameters: parameters,
5259
- template: currentTemplate,
5285
+ task: currentTask,
5260
5286
  preparedPipeline: preparedPipeline,
5261
5287
  tools: tools,
5262
5288
  $executionReport: $executionReport,
@@ -5269,15 +5295,15 @@ function executeTemplate(options) {
5269
5295
  title: title,
5270
5296
  isStarted: true,
5271
5297
  isDone: true,
5272
- templateType: currentTemplate.templateType,
5273
- parameterName: currentTemplate.resultingParameterName,
5298
+ taskType: currentTask.taskType,
5299
+ parameterName: currentTask.resultingParameterName,
5274
5300
  parameterValue: resultString,
5275
5301
  // <- [🍸]
5276
5302
  })];
5277
5303
  case 4:
5278
5304
  _j.sent();
5279
5305
  return [2 /*return*/, Object.freeze((_h = {},
5280
- _h[currentTemplate.resultingParameterName] =
5306
+ _h[currentTask.resultingParameterName] =
5281
5307
  // <- Note: [👩‍👩‍👧] No need to detect parameter collision here because pipeline checks logic consistency during construction
5282
5308
  resultString,
5283
5309
  _h))];
@@ -5304,7 +5330,7 @@ function filterJustOutputParameters(options) {
5304
5330
  var _loop_1 = function (parameter) {
5305
5331
  if (parametersToPass[parameter.name] === undefined) {
5306
5332
  // [4]
5307
- $warnings.push(new PipelineExecutionError(spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} should be an output parameter, but it was not generated during pipeline execution\n\n ").concat(block(pipelineIdentification), "\n "); })));
5333
+ $warnings.push(new PipelineExecutionError(spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` should be an output parameter, but it was not generated during pipeline execution\n\n ").concat(block(pipelineIdentification), "\n "); })));
5308
5334
  return "continue";
5309
5335
  }
5310
5336
  outputParameters[parameter.name] = parametersToPass[parameter.name] || '';
@@ -5339,7 +5365,7 @@ function filterJustOutputParameters(options) {
5339
5365
  */
5340
5366
  function executePipeline(options) {
5341
5367
  return __awaiter(this, void 0, void 0, function () {
5342
- var inputParameters, tools, onProgress, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, _a, isVerbose, preparedPipeline, errors, warnings, executionReport, isReturned, _b, _c, parameter, e_1_1, _loop_1, _d, _e, parameterName, state_1, e_2_1, parametersToPass, resovedParameterNames_1, unresovedTemplates_1, resolving_1, loopLimit, _loop_2, error_1, usage_1, outputParameters_1, usage, outputParameters;
5368
+ var inputParameters, tools, onProgress, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, _a, isVerbose, preparedPipeline, errors, warnings, executionReport, isReturned, _b, _c, parameter, e_1_1, _loop_1, _d, _e, parameterName, state_1, e_2_1, parametersToPass, resovedParameterNames_1, unresovedTasks_1, resolving_1, loopLimit, _loop_2, error_1, usage_1, outputParameters_1, usage, outputParameters;
5343
5369
  var e_1, _f, e_2, _g;
5344
5370
  return __generator(this, function (_h) {
5345
5371
  switch (_h.label) {
@@ -5391,7 +5417,7 @@ function executePipeline(options) {
5391
5417
  case 6: return [2 /*return*/, $asDeeplyFrozenSerializableJson("Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"), {
5392
5418
  isSuccessful: false,
5393
5419
  errors: __spreadArray([
5394
- new PipelineExecutionError("Parameter {".concat(parameter.name, "} is required as an input parameter"))
5420
+ new PipelineExecutionError("Parameter `{".concat(parameter.name, "}` is required as an input parameter"))
5395
5421
  ], __read(errors), false).map(serializeError),
5396
5422
  warnings: [],
5397
5423
  executionReport: executionReport,
@@ -5439,7 +5465,7 @@ function executePipeline(options) {
5439
5465
  case 3: return [2 /*return*/, { value: $asDeeplyFrozenSerializableJson(spaceTrim(function (block) { return "\n Unuccessful PipelineExecutorResult (with extra parameter {".concat(parameter.name, "}) PipelineExecutorResult\n\n ").concat(block(pipelineIdentification), "\n "); }), {
5440
5466
  isSuccessful: false,
5441
5467
  errors: __spreadArray([
5442
- new PipelineExecutionError(spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
5468
+ new PipelineExecutionError(spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
5443
5469
  ], __read(errors), false).map(serializeError),
5444
5470
  warnings: warnings.map(serializeError),
5445
5471
  executionReport: executionReport,
@@ -5493,11 +5519,11 @@ function executePipeline(options) {
5493
5519
  var name = _a.name;
5494
5520
  return name;
5495
5521
  });
5496
- unresovedTemplates_1 = __spreadArray([], __read(preparedPipeline.templates), false);
5522
+ unresovedTasks_1 = __spreadArray([], __read(preparedPipeline.tasks), false);
5497
5523
  resolving_1 = [];
5498
5524
  loopLimit = LOOP_LIMIT;
5499
5525
  _loop_2 = function () {
5500
- var currentTemplate, work_1;
5526
+ var currentTask, work_1;
5501
5527
  return __generator(this, function (_k) {
5502
5528
  switch (_k.label) {
5503
5529
  case 0:
@@ -5505,31 +5531,41 @@ function executePipeline(options) {
5505
5531
  // Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
5506
5532
  throw new UnexpectedError(spaceTrim(function (block) { return "\n Loop limit reached during resolving parameters pipeline execution\n\n ".concat(block(pipelineIdentification), "\n "); }));
5507
5533
  }
5508
- currentTemplate = unresovedTemplates_1.find(function (template) {
5509
- return template.dependentParameterNames.every(function (name) {
5534
+ currentTask = unresovedTasks_1.find(function (task) {
5535
+ return task.dependentParameterNames.every(function (name) {
5510
5536
  return __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), __read(RESERVED_PARAMETER_NAMES), false).includes(name);
5511
5537
  });
5512
5538
  });
5513
- if (!(!currentTemplate && resolving_1.length === 0)) return [3 /*break*/, 1];
5539
+ if (!(!currentTask && resolving_1.length === 0)) return [3 /*break*/, 1];
5514
5540
  throw new UnexpectedError(
5515
5541
  // TODO: [🐎] DRY
5516
- spaceTrim(function (block) { return "\n Can not resolve some parameters:\n\n ".concat(block(pipelineIdentification), "\n\n Can not resolve:\n ").concat(block(unresovedTemplates_1
5542
+ spaceTrim(function (block) { return "\n Can not resolve some parameters:\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTasks_1
5517
5543
  .map(function (_a) {
5518
5544
  var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
5519
- return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
5520
- .map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
5545
+ return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
5546
+ .map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
5521
5547
  .join(' and '));
5522
5548
  })
5523
- .join('\n')), "\n\n Resolved:\n ").concat(block(resovedParameterNames_1.map(function (name) { return "- Parameter {".concat(name, "}"); }).join('\n')), "\n\n Note: This should be catched in `validatePipeline`\n "); }));
5549
+ .join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameterNames_1
5550
+ .filter(function (name) {
5551
+ return !RESERVED_PARAMETER_NAMES.includes(name);
5552
+ })
5553
+ .map(function (name) { return "- Parameter `{".concat(name, "}`"); })
5554
+ .join('\n')), "\n\n **Reserved (which are available):**\n ").concat(block(resovedParameterNames_1
5555
+ .filter(function (name) {
5556
+ return RESERVED_PARAMETER_NAMES.includes(name);
5557
+ })
5558
+ .map(function (name) { return "- Parameter `{".concat(name, "}`"); })
5559
+ .join('\n')), "\n\n *Note: This should be catched in `validatePipeline`*\n "); }));
5524
5560
  case 1:
5525
- if (!!currentTemplate) return [3 /*break*/, 3];
5561
+ if (!!currentTask) return [3 /*break*/, 3];
5526
5562
  /* [🤹‍♂️] */ return [4 /*yield*/, Promise.race(resolving_1)];
5527
5563
  case 2:
5528
5564
  /* [🤹‍♂️] */ _k.sent();
5529
5565
  return [3 /*break*/, 4];
5530
5566
  case 3:
5531
- unresovedTemplates_1 = unresovedTemplates_1.filter(function (template) { return template !== currentTemplate; });
5532
- work_1 = executeTemplate(__assign(__assign({}, options), { currentTemplate: currentTemplate, preparedPipeline: preparedPipeline, parametersToPass: parametersToPass, tools: tools, onProgress: function (progress) {
5567
+ unresovedTasks_1 = unresovedTasks_1.filter(function (task) { return task !== currentTask; });
5568
+ work_1 = executeTask(__assign(__assign({}, options), { currentTask: currentTask, preparedPipeline: preparedPipeline, parametersToPass: parametersToPass, tools: tools, onProgress: function (progress) {
5533
5569
  if (isReturned) {
5534
5570
  throw new UnexpectedError(spaceTrim(function (block) { return "\n Can not call `onProgress` after pipeline execution is finished\n\n ".concat(block(pipelineIdentification), "\n\n ").concat(block(JSON.stringify(progress, null, 4)
5535
5571
  .split('\n')
@@ -5539,16 +5575,16 @@ function executePipeline(options) {
5539
5575
  if (onProgress) {
5540
5576
  onProgress(progress);
5541
5577
  }
5542
- }, $executionReport: executionReport, pipelineIdentification: spaceTrim(function (block) { return "\n ".concat(block(pipelineIdentification), "\n Template name: ").concat(currentTemplate.name, "\n Template title: ").concat(currentTemplate.title, "\n "); }) }))
5578
+ }, $executionReport: executionReport, pipelineIdentification: spaceTrim(function (block) { return "\n ".concat(block(pipelineIdentification), "\n Task name: ").concat(currentTask.name, "\n Task title: ").concat(currentTask.title, "\n "); }) }))
5543
5579
  .then(function (newParametersToPass) {
5544
5580
  parametersToPass = __assign(__assign({}, newParametersToPass), parametersToPass);
5545
- resovedParameterNames_1 = __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), [currentTemplate.resultingParameterName], false);
5581
+ resovedParameterNames_1 = __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), [currentTask.resultingParameterName], false);
5546
5582
  })
5547
5583
  .then(function () {
5548
5584
  resolving_1 = resolving_1.filter(function (w) { return w !== work_1; });
5549
5585
  });
5550
5586
  // <- Note: Errors are catched here [3]
5551
- // TODO: BUT if in multiple templates are errors, only the first one is catched so maybe we should catch errors here and save them to errors array here
5587
+ // TODO: BUT if in multiple tasks are errors, only the first one is catched so maybe we should catch errors here and save them to errors array here
5552
5588
  resolving_1.push(work_1);
5553
5589
  _k.label = 4;
5554
5590
  case 4: return [2 /*return*/];
@@ -5557,7 +5593,7 @@ function executePipeline(options) {
5557
5593
  };
5558
5594
  _h.label = 21;
5559
5595
  case 21:
5560
- if (!(unresovedTemplates_1.length > 0)) return [3 /*break*/, 23];
5596
+ if (!(unresovedTasks_1.length > 0)) return [3 /*break*/, 23];
5561
5597
  return [5 /*yield**/, _loop_2()];
5562
5598
  case 22:
5563
5599
  _h.sent();
@@ -5715,6 +5751,9 @@ var markdownScraperMetadata = $deepFreeze({
5715
5751
  * @public exported from `@promptbook/cli`
5716
5752
  */
5717
5753
  $scrapersMetadataRegister.register(markdownScraperMetadata);
5754
+ /**
5755
+ * Note: [💞] Ignore a discrepancy between file name and entity name
5756
+ */
5718
5757
 
5719
5758
  /**
5720
5759
  * Scraper for markdown files
@@ -5909,6 +5948,9 @@ var documentScraperMetadata = $deepFreeze({
5909
5948
  * @public exported from `@promptbook/cli`
5910
5949
  */
5911
5950
  $scrapersMetadataRegister.register(documentScraperMetadata);
5951
+ /**
5952
+ * Note: [💞] Ignore a discrepancy between file name and entity name
5953
+ */
5912
5954
 
5913
5955
  /**
5914
5956
  * Scraper of .docx and .odt files
@@ -6073,6 +6115,9 @@ var legacyDocumentScraperMetadata = $deepFreeze({
6073
6115
  * @public exported from `@promptbook/cli`
6074
6116
  */
6075
6117
  $scrapersMetadataRegister.register(legacyDocumentScraperMetadata);
6118
+ /**
6119
+ * Note: [💞] Ignore a discrepancy between file name and entity name
6120
+ */
6076
6121
 
6077
6122
  /**
6078
6123
  * Scraper for old document files (like .doc and .rtf)
@@ -6242,6 +6287,7 @@ var createLegacyDocumentScraper = Object.assign(function (tools, options) {
6242
6287
  var _LegacyDocumentScraperRegistration = $scrapersRegister.register(createLegacyDocumentScraper);
6243
6288
  /**
6244
6289
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
6290
+ * Note: [💞] Ignore a discrepancy between file name and entity name
6245
6291
  */
6246
6292
 
6247
6293
  export { BOOK_LANGUAGE_VERSION, LegacyDocumentScraper, PROMPTBOOK_ENGINE_VERSION, _LegacyDocumentScraperRegistration, createLegacyDocumentScraper };