@promptbook/cli 0.75.0-1 → 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 (156) hide show
  1. package/README.md +1 -0
  2. package/esm/index.es.js +589 -456
  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 +22 -20
  6. package/esm/typings/src/_packages/types.index.d.ts +58 -50
  7. package/esm/typings/src/_packages/utils.index.d.ts +2 -2
  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 +2 -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/_common/AbstractFormfactorDefinition.d.ts +4 -1
  63. package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +3 -0
  64. package/esm/typings/src/formfactors/{chat/ChatFormfactorDefinition.d.ts → chatbot/ChatbotFormfactorDefinition.d.ts} +2 -2
  65. package/esm/typings/src/formfactors/generic/GenericFormfactorDefinition.d.ts +1 -1
  66. package/esm/typings/src/formfactors/index.d.ts +15 -4
  67. package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +14 -0
  68. package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +1 -1
  69. package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +1 -1
  70. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -0
  71. package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +3 -0
  72. package/esm/typings/src/llm-providers/anthropic-claude/register-constructor.d.ts +1 -0
  73. package/esm/typings/src/llm-providers/azure-openai/register-configuration.d.ts +3 -0
  74. package/esm/typings/src/llm-providers/azure-openai/register-constructor.d.ts +1 -0
  75. package/esm/typings/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +1 -1
  76. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -0
  77. package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +3 -0
  78. package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +1 -0
  79. package/esm/typings/src/personas/preparePersona.d.ts +1 -1
  80. package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/PipelineInterface.d.ts +3 -0
  81. package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/constants.d.ts +5 -0
  82. package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/getPipelineInterface.d.ts +3 -1
  83. package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/isPipelineImplementingInterface.d.ts +5 -1
  84. package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/isPipelineInterfacesEqual.d.ts +2 -0
  85. package/esm/typings/src/pipeline/PipelineJson/DialogTaskJson.d.ts +13 -0
  86. package/esm/typings/src/{types → pipeline}/PipelineJson/Expectations.d.ts +2 -2
  87. package/esm/typings/src/{types → pipeline}/PipelineJson/KnowledgePieceJson.d.ts +7 -6
  88. package/esm/typings/src/{types → pipeline}/PipelineJson/KnowledgeSourceJson.d.ts +3 -3
  89. package/esm/typings/src/pipeline/PipelineJson/ParameterJson.d.ts +96 -0
  90. package/esm/typings/src/{types → pipeline}/PipelineJson/PersonaJson.d.ts +4 -4
  91. package/esm/typings/src/{types → pipeline}/PipelineJson/PipelineJson.d.ts +10 -10
  92. package/esm/typings/src/{types → pipeline}/PipelineJson/PreparationJson.d.ts +1 -1
  93. package/esm/typings/src/{types/PipelineJson/PromptTemplateJson.d.ts → pipeline/PipelineJson/PromptTaskJson.d.ts} +8 -8
  94. package/esm/typings/src/pipeline/PipelineJson/ScriptTaskJson.d.ts +20 -0
  95. package/esm/typings/src/pipeline/PipelineJson/SimpleTaskJson.d.ts +13 -0
  96. package/esm/typings/src/pipeline/PipelineJson/TaskJson.d.ts +11 -0
  97. package/esm/typings/src/{types/PipelineJson/TemplateJsonCommon.d.ts → pipeline/PipelineJson/TaskJsonCommon.d.ts} +13 -13
  98. package/esm/typings/src/{types → pipeline}/PipelineString.d.ts +1 -1
  99. package/esm/typings/src/prepare/isPipelinePrepared.d.ts +2 -2
  100. package/esm/typings/src/prepare/preparePipeline.d.ts +1 -1
  101. package/esm/typings/src/prepare/{prepareTemplates.d.ts → prepareTasks.d.ts} +7 -7
  102. package/esm/typings/src/prepare/unpreparePipeline.d.ts +1 -1
  103. package/esm/typings/src/scrapers/_common/Scraper.d.ts +1 -1
  104. package/esm/typings/src/scrapers/_common/prepareKnowledgePieces.d.ts +2 -2
  105. package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +1 -1
  106. package/esm/typings/src/scrapers/document/DocumentScraper.d.ts +1 -1
  107. package/esm/typings/src/scrapers/document/register-constructor.d.ts +1 -0
  108. package/esm/typings/src/scrapers/document/register-metadata.d.ts +3 -0
  109. package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -1
  110. package/esm/typings/src/scrapers/document-legacy/register-constructor.d.ts +1 -0
  111. package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +3 -0
  112. package/esm/typings/src/scrapers/markdown/MarkdownScraper.d.ts +1 -1
  113. package/esm/typings/src/scrapers/markdown/register-constructor.d.ts +1 -0
  114. package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +3 -0
  115. package/esm/typings/src/scrapers/pdf/PdfScraper.d.ts +1 -1
  116. package/esm/typings/src/scrapers/pdf/register-constructor.d.ts +1 -0
  117. package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +3 -0
  118. package/esm/typings/src/scrapers/website/WebsiteScraper.d.ts +1 -1
  119. package/esm/typings/src/scrapers/website/register-constructor.d.ts +1 -0
  120. package/esm/typings/src/scrapers/website/register-metadata.d.ts +3 -0
  121. package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +1 -0
  122. package/esm/typings/src/types/Prompt.d.ts +1 -1
  123. package/esm/typings/src/types/TaskProgress.d.ts +2 -2
  124. package/esm/typings/src/types/typeAliasEmoji.d.ts +3 -0
  125. package/esm/typings/src/types/typeAliases.d.ts +1 -0
  126. package/esm/typings/src/utils/emojis.d.ts +1 -0
  127. package/esm/typings/src/utils/expectation-counters/constants.d.ts +1 -0
  128. package/esm/typings/src/utils/expectation-counters/countCharacters.d.ts +1 -1
  129. package/esm/typings/src/utils/expectation-counters/countLines.d.ts +1 -1
  130. package/esm/typings/src/utils/expectation-counters/countPages.d.ts +1 -1
  131. package/esm/typings/src/utils/expectation-counters/countParagraphs.d.ts +1 -1
  132. package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +1 -1
  133. package/esm/typings/src/utils/expectation-counters/countWords.d.ts +1 -1
  134. package/esm/typings/src/utils/expectation-counters/index.d.ts +3 -2
  135. package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +3 -0
  136. package/esm/typings/src/utils/parameters/extractParameterNames.d.ts +2 -2
  137. package/esm/typings/src/utils/serialization/clonePipeline.d.ts +1 -1
  138. package/esm/typings/src/version.d.ts +2 -1
  139. package/package.json +4 -3
  140. package/umd/index.umd.js +589 -456
  141. package/umd/index.umd.js.map +1 -1
  142. package/esm/typings/src/commands/TEMPLATE/TemplateCommand.d.ts +0 -11
  143. package/esm/typings/src/commands/TEMPLATE/TemplateTypes.d.ts +0 -15
  144. package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTemplate.d.ts +0 -27
  145. package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTemplate.d.ts +0 -30
  146. package/esm/typings/src/types/PipelineJson/DialogTemplateJson.d.ts +0 -13
  147. package/esm/typings/src/types/PipelineJson/ParameterJson.d.ts +0 -39
  148. package/esm/typings/src/types/PipelineJson/ScriptTemplateJson.d.ts +0 -20
  149. package/esm/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +0 -13
  150. package/esm/typings/src/types/PipelineJson/TemplateJson.d.ts +0 -11
  151. /package/esm/typings/src/commands/{TEMPLATE/templateCommand.test.d.ts → SECTION/sectionCommand.test.d.ts} +0 -0
  152. /package/esm/typings/src/conversion/utils/{extractParameterNamesFromTemplate.test.d.ts → extractParameterNamesFromTask.test.d.ts} +0 -0
  153. /package/esm/typings/src/{types → execution}/execution-report/ExecutionReportString.d.ts +0 -0
  154. /package/esm/typings/src/{types → execution}/execution-report/countWorkingDuration.d.ts +0 -0
  155. /package/esm/typings/src/{types → execution}/execution-report/countWorkingDuration.test.d.ts +0 -0
  156. /package/esm/typings/src/{types → execution}/execution-report/executionReportJsonToString.d.ts +0 -0
package/umd/index.umd.js CHANGED
@@ -49,9 +49,10 @@
49
49
  *
50
50
  * @see https://github.com/webgptorg/promptbook
51
51
  */
52
- var PROMPTBOOK_ENGINE_VERSION = '0.75.0-0';
52
+ var PROMPTBOOK_ENGINE_VERSION = '0.75.0-1';
53
53
  /**
54
54
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
55
+ * Note: [💞] Ignore a discrepancy between file name and entity name
55
56
  */
56
57
 
57
58
  /*! *****************************************************************************
@@ -399,7 +400,7 @@
399
400
  *
400
401
  * @public exported from `@promptbook/core`
401
402
  */
402
- var CLAIM = "Build responsible, controlled and transparent applications on top of LLM models!";
403
+ var CLAIM = "It's time for a paradigm shift. The future of software in plain English, French or Latin";
403
404
  // <- TODO: [🐊] Pick the best claim
404
405
  /**
405
406
  * When the title is not provided, the default title is used
@@ -570,6 +571,7 @@
570
571
  true);
571
572
  /**
572
573
  * TODO: Extract `constants.ts` from `config.ts`
574
+ * Note: [💞] Ignore a discrepancy between file name and entity name
573
575
  * TODO: [🧠][🧜‍♂️] Maybe join remoteUrl and path into single value
574
576
  */
575
577
 
@@ -620,6 +622,7 @@
620
622
  }
621
623
  /**
622
624
  * TODO: [🗽] Unite branding and make single place for it
625
+ * Note: [💞] Ignore a discrepancy between file name and entity name
623
626
  * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
624
627
  */
625
628
 
@@ -653,6 +656,7 @@
653
656
  }
654
657
  /**
655
658
  * TODO: [🧠][🐣] Make here some easter egg with generated hello greeting via LLM models
659
+ * Note: [💞] Ignore a discrepancy between file name and entity name
656
660
  * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
657
661
  */
658
662
 
@@ -735,7 +739,7 @@
735
739
  */
736
740
  function pipelineJsonToString(pipelineJson) {
737
741
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
738
- var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl, bookVersion = pipelineJson.bookVersion, description = pipelineJson.description, parameters = pipelineJson.parameters, templates = pipelineJson.templates;
742
+ var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl, bookVersion = pipelineJson.bookVersion, description = pipelineJson.description, parameters = pipelineJson.parameters, tasks = pipelineJson.tasks;
739
743
  var pipelineString = "# ".concat(title);
740
744
  if (description) {
741
745
  pipelineString += '\n\n';
@@ -785,13 +789,13 @@
785
789
  pipelineString += '\n\n';
786
790
  pipelineString += commands.map(function (command) { return "- ".concat(command); }).join('\n');
787
791
  try {
788
- for (var templates_1 = __values(templates), templates_1_1 = templates_1.next(); !templates_1_1.done; templates_1_1 = templates_1.next()) {
789
- var template = templates_1_1.value;
792
+ for (var tasks_1 = __values(tasks), tasks_1_1 = tasks_1.next(); !tasks_1_1.done; tasks_1_1 = tasks_1.next()) {
793
+ var template = tasks_1_1.value;
790
794
  var
791
795
  /* Note: Not using:> name, */
792
796
  title_1 = template.title, description_1 = template.description,
793
797
  /* Note: dependentParameterNames, */
794
- jokers = template.jokerParameterNames, templateType = template.templateType, content = template.content, postprocessing = template.postprocessingFunctionNames, expectations = template.expectations, format = template.format, resultingParameterName = template.resultingParameterName;
798
+ jokers = template.jokerParameterNames, taskType = template.taskType, content = template.content, postprocessing = template.postprocessingFunctionNames, expectations = template.expectations, format = template.format, resultingParameterName = template.resultingParameterName;
795
799
  pipelineString += '\n\n';
796
800
  pipelineString += "## ".concat(title_1);
797
801
  if (description_1) {
@@ -800,7 +804,7 @@
800
804
  }
801
805
  var commands_1 = [];
802
806
  var contentLanguage = 'text';
803
- if (templateType === 'PROMPT_TEMPLATE') {
807
+ if (taskType === 'PROMPT_TASK') {
804
808
  var modelRequirements = template.modelRequirements;
805
809
  var _l = modelRequirements || {}, modelName = _l.modelName, modelVariant = _l.modelVariant;
806
810
  commands_1.push("EXECUTE PROMPT TEMPLATE");
@@ -811,11 +815,11 @@
811
815
  commands_1.push("MODEL NAME `".concat(modelName, "`"));
812
816
  }
813
817
  }
814
- else if (templateType === 'SIMPLE_TEMPLATE') {
818
+ else if (taskType === 'SIMPLE_TASK') {
815
819
  commands_1.push("SIMPLE TEMPLATE");
816
820
  // Note: Nothing special here
817
821
  }
818
- else if (templateType === 'SCRIPT_TEMPLATE') {
822
+ else if (taskType === 'SCRIPT_TASK') {
819
823
  commands_1.push("SCRIPT TEMPLATE");
820
824
  if (template.contentLanguage) {
821
825
  contentLanguage = template.contentLanguage;
@@ -824,7 +828,7 @@
824
828
  contentLanguage = '';
825
829
  }
826
830
  }
827
- else if (templateType === 'DIALOG_TEMPLATE') {
831
+ else if (taskType === 'DIALOG_TASK') {
828
832
  commands_1.push("DIALOG TEMPLATE");
829
833
  // Note: Nothing special here
830
834
  } // <- }else if([🅱]
@@ -906,7 +910,7 @@
906
910
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
907
911
  finally {
908
912
  try {
909
- if (templates_1_1 && !templates_1_1.done && (_c = templates_1.return)) _c.call(templates_1);
913
+ if (tasks_1_1 && !tasks_1_1.done && (_c = tasks_1.return)) _c.call(tasks_1);
910
914
  }
911
915
  finally { if (e_3) throw e_3.error; }
912
916
  }
@@ -1075,6 +1079,9 @@
1075
1079
  pagesCount: { value: 0, isUncertain: true },
1076
1080
  },
1077
1081
  });
1082
+ /**
1083
+ * Note: [💞] Ignore a discrepancy between file name and entity name
1084
+ */
1078
1085
 
1079
1086
  /**
1080
1087
  * @@@
@@ -1566,7 +1573,7 @@
1566
1573
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
1567
1574
  */
1568
1575
 
1569
- 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"}];
1576
+ 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"}];
1570
1577
 
1571
1578
  /**
1572
1579
  * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
@@ -1820,9 +1827,9 @@
1820
1827
  throw new ParseError(spaceTrim.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 "); }));
1821
1828
  }
1822
1829
  // TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
1823
- if (!Array.isArray(pipeline.templates)) {
1830
+ if (!Array.isArray(pipeline.tasks)) {
1824
1831
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
1825
- throw new ParseError(spaceTrim.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 "); }));
1832
+ throw new ParseError(spaceTrim.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 "); }));
1826
1833
  }
1827
1834
  var _loop_1 = function (parameter) {
1828
1835
  if (parameter.isInput && parameter.isOutput) {
@@ -1831,13 +1838,12 @@
1831
1838
  // Note: Testing that parameter is either intermediate or output BUT not created and unused
1832
1839
  if (!parameter.isInput &&
1833
1840
  !parameter.isOutput &&
1834
- !pipeline.templates.some(function (template) { return template.dependentParameterNames.includes(parameter.name); })) {
1841
+ !pipeline.tasks.some(function (task) { return task.dependentParameterNames.includes(parameter.name); })) {
1835
1842
  throw new PipelineLogicError(spaceTrim.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 "); }));
1836
1843
  }
1837
- // Note: Testing that parameter is either input or result of some template
1838
- if (!parameter.isInput &&
1839
- !pipeline.templates.some(function (template) { return template.resultingParameterName === parameter.name; })) {
1840
- throw new PipelineLogicError(spaceTrim.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 "); }));
1844
+ // Note: Testing that parameter is either input or result of some task
1845
+ if (!parameter.isInput && !pipeline.tasks.some(function (task) { return task.resultingParameterName === parameter.name; })) {
1846
+ throw new PipelineLogicError(spaceTrim.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 "); }));
1841
1847
  }
1842
1848
  };
1843
1849
  try {
@@ -1854,7 +1860,7 @@
1854
1860
  }
1855
1861
  finally { if (e_1) throw e_1.error; }
1856
1862
  }
1857
- // Note: All input parameters are defined - so that they can be used as result of some template
1863
+ // Note: All input parameters are defined - so that they can be used as result of some task
1858
1864
  var definedParameters = new Set(pipeline.parameters.filter(function (_a) {
1859
1865
  var isInput = _a.isInput;
1860
1866
  return isInput;
@@ -1862,27 +1868,27 @@
1862
1868
  var name = _a.name;
1863
1869
  return name;
1864
1870
  }));
1865
- var _loop_2 = function (template) {
1871
+ var _loop_2 = function (task) {
1866
1872
  var e_4, _h, e_5, _j;
1867
- if (definedParameters.has(template.resultingParameterName)) {
1868
- throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(template.resultingParameterName, "}` is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
1873
+ if (definedParameters.has(task.resultingParameterName)) {
1874
+ throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(task.resultingParameterName, "}` is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
1869
1875
  }
1870
- if (RESERVED_PARAMETER_NAMES.includes(template.resultingParameterName)) {
1871
- throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter name {".concat(template.resultingParameterName, "} is reserved, please use different name\n\n ").concat(block(pipelineIdentification), "\n "); }));
1876
+ if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
1877
+ throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter name {".concat(task.resultingParameterName, "} is reserved, please use different name\n\n ").concat(block(pipelineIdentification), "\n "); }));
1872
1878
  }
1873
- definedParameters.add(template.resultingParameterName);
1874
- if (template.jokerParameterNames && template.jokerParameterNames.length > 0) {
1875
- if (!template.format &&
1876
- !template.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
1877
- throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Joker parameters are used for {".concat(template.resultingParameterName, "} but no expectations are defined\n\n ").concat(block(pipelineIdentification), "\n "); }));
1879
+ definedParameters.add(task.resultingParameterName);
1880
+ if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
1881
+ if (!task.format &&
1882
+ !task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
1883
+ throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Joker parameters are used for {".concat(task.resultingParameterName, "} but no expectations are defined\n\n ").concat(block(pipelineIdentification), "\n "); }));
1878
1884
  }
1879
1885
  var _loop_4 = function (joker) {
1880
- if (!template.dependentParameterNames.includes(joker)) {
1881
- throw new PipelineLogicError(spaceTrim.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 "); }));
1886
+ if (!task.dependentParameterNames.includes(joker)) {
1887
+ throw new PipelineLogicError(spaceTrim.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 "); }));
1882
1888
  }
1883
1889
  };
1884
1890
  try {
1885
- for (var _k = (e_4 = void 0, __values(template.jokerParameterNames)), _l = _k.next(); !_l.done; _l = _k.next()) {
1891
+ for (var _k = (e_4 = void 0, __values(task.jokerParameterNames)), _l = _k.next(); !_l.done; _l = _k.next()) {
1886
1892
  var joker = _l.value;
1887
1893
  _loop_4(joker);
1888
1894
  }
@@ -1895,7 +1901,7 @@
1895
1901
  finally { if (e_4) throw e_4.error; }
1896
1902
  }
1897
1903
  }
1898
- if (template.expectations) {
1904
+ if (task.expectations) {
1899
1905
  var _loop_5 = function (unit, min, max) {
1900
1906
  if (min !== undefined && max !== undefined && min > max) {
1901
1907
  throw new PipelineLogicError(spaceTrim.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 "); }));
@@ -1908,7 +1914,7 @@
1908
1914
  }
1909
1915
  };
1910
1916
  try {
1911
- for (var _m = (e_5 = void 0, __values(Object.entries(template.expectations))), _o = _m.next(); !_o.done; _o = _m.next()) {
1917
+ for (var _m = (e_5 = void 0, __values(Object.entries(task.expectations))), _o = _m.next(); !_o.done; _o = _m.next()) {
1912
1918
  var _p = __read(_o.value, 2), unit = _p[0], _q = _p[1], min = _q.min, max = _q.max;
1913
1919
  _loop_5(unit, min, max);
1914
1920
  }
@@ -1923,10 +1929,10 @@
1923
1929
  }
1924
1930
  };
1925
1931
  try {
1926
- // Note: Checking each template individually
1927
- for (var _f = __values(pipeline.templates), _g = _f.next(); !_g.done; _g = _f.next()) {
1928
- var template = _g.value;
1929
- _loop_2(template);
1932
+ // Note: Checking each task individually
1933
+ for (var _f = __values(pipeline.tasks), _g = _f.next(); !_g.done; _g = _f.next()) {
1934
+ var task = _g.value;
1935
+ _loop_2(task);
1930
1936
  }
1931
1937
  }
1932
1938
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -1960,15 +1966,15 @@
1960
1966
  }
1961
1967
  finally { if (e_3) throw e_3.error; }
1962
1968
  }
1963
- var unresovedTemplates = __spreadArray([], __read(pipeline.templates), false);
1969
+ var unresovedTemplates = __spreadArray([], __read(pipeline.tasks), false);
1964
1970
  var loopLimit = LOOP_LIMIT;
1965
1971
  var _loop_3 = function () {
1966
1972
  if (loopLimit-- < 0) {
1967
1973
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
1968
1974
  throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Loop limit reached during detection of circular dependencies in `validatePipeline`\n\n ".concat(block(pipelineIdentification), "\n "); }));
1969
1975
  }
1970
- var currentlyResovedTemplates = unresovedTemplates.filter(function (template) {
1971
- return template.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
1976
+ var currentlyResovedTemplates = unresovedTemplates.filter(function (task) {
1977
+ return task.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
1972
1978
  });
1973
1979
  if (currentlyResovedTemplates.length === 0) {
1974
1980
  throw new PipelineLogicError(
@@ -1996,7 +2002,7 @@
1996
2002
  var resultingParameterName = _a.resultingParameterName;
1997
2003
  return resultingParameterName;
1998
2004
  })), false);
1999
- unresovedTemplates = unresovedTemplates.filter(function (template) { return !currentlyResovedTemplates.includes(template); });
2005
+ unresovedTemplates = unresovedTemplates.filter(function (task) { return !currentlyResovedTemplates.includes(task); });
2000
2006
  };
2001
2007
  while (unresovedTemplates.length > 0) {
2002
2008
  _loop_3();
@@ -2058,9 +2064,9 @@
2058
2064
  }(Error));
2059
2065
 
2060
2066
  /**
2061
- * Parses the template and returns the list of all parameter names
2067
+ * Parses the task and returns the list of all parameter names
2062
2068
  *
2063
- * @param template the template with parameters in {curly} braces
2069
+ * @param template the task with parameters in {curly} braces
2064
2070
  * @returns the list of parameter names
2065
2071
  * @public exported from `@promptbook/utils`
2066
2072
  */
@@ -2091,10 +2097,10 @@
2091
2097
  * @public exported from `@promptbook/core`
2092
2098
  */
2093
2099
  function unpreparePipeline(pipeline) {
2094
- var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources, templates = pipeline.templates;
2100
+ var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources, tasks = pipeline.tasks;
2095
2101
  personas = personas.map(function (persona) { return (__assign(__assign({}, persona), { modelRequirements: undefined, preparationIds: undefined })); });
2096
2102
  knowledgeSources = knowledgeSources.map(function (knowledgeSource) { return (__assign(__assign({}, knowledgeSource), { preparationIds: undefined })); });
2097
- templates = templates.map(function (template) {
2103
+ tasks = tasks.map(function (template) {
2098
2104
  var dependentParameterNames = template.dependentParameterNames;
2099
2105
  var parameterNames = extractParameterNames(template.preparedContent || '');
2100
2106
  dependentParameterNames = dependentParameterNames.filter(function (dependentParameterName) { return !parameterNames.has(dependentParameterName); });
@@ -2102,7 +2108,7 @@
2102
2108
  delete templateUnprepared.preparedContent;
2103
2109
  return templateUnprepared;
2104
2110
  });
2105
- return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), { templates: templates, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }));
2111
+ return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), { tasks: tasks, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }));
2106
2112
  }
2107
2113
  /**
2108
2114
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
@@ -2301,6 +2307,9 @@
2301
2307
  UnexpectedError: UnexpectedError,
2302
2308
  // TODO: [🪑]> VersionMismatchError,
2303
2309
  };
2310
+ /**
2311
+ * Note: [💞] Ignore a discrepancy between file name and entity name
2312
+ */
2304
2313
 
2305
2314
  /**
2306
2315
  * Deserializes the error object
@@ -2362,8 +2371,8 @@
2362
2371
  return false;
2363
2372
  }
2364
2373
  /*
2365
- TODO: [🧠][🍫] `templates` can not be determined if they are fully prepared SO ignoring them
2366
- > if (!pipeline.templates.every(({ preparedContent }) => preparedContent === undefined)) {
2374
+ TODO: [🧠][🍫] `tasks` can not be determined if they are fully prepared SO ignoring them
2375
+ > if (!pipeline.tasks.every(({ preparedContent }) => preparedContent === undefined)) {
2367
2376
  > return false;
2368
2377
  > }
2369
2378
  */
@@ -2376,7 +2385,7 @@
2376
2385
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
2377
2386
  * - [🏍] ? Is context in each template
2378
2387
  * - [♨] Are examples prepared
2379
- * - [♨] Are templates prepared
2388
+ * - [♨] Are tasks prepared
2380
2389
  */
2381
2390
 
2382
2391
  /**
@@ -2453,9 +2462,9 @@
2453
2462
  * @throws {ParseError} if the script is invalid
2454
2463
  * @public exported from `@promptbook/utils`
2455
2464
  */
2456
- function extractParameterNamesFromTemplate(template) {
2465
+ function extractParameterNamesFromTask(template) {
2457
2466
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
2458
- var title = template.title, description = template.description, templateType = template.templateType, content = template.content, preparedContent = template.preparedContent, jokerParameterNames = template.jokerParameterNames, foreach = template.foreach;
2467
+ var title = template.title, description = template.description, taskType = template.taskType, content = template.content, preparedContent = template.preparedContent, jokerParameterNames = template.jokerParameterNames, foreach = template.foreach;
2459
2468
  var parameterNames = new Set();
2460
2469
  try {
2461
2470
  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()) {
@@ -2470,7 +2479,7 @@
2470
2479
  }
2471
2480
  finally { if (e_1) throw e_1.error; }
2472
2481
  }
2473
- if (templateType === 'SCRIPT_TEMPLATE') {
2482
+ if (taskType === 'SCRIPT_TASK') {
2474
2483
  try {
2475
2484
  for (var _g = __values(extractVariables(content)), _h = _g.next(); !_h.done; _h = _g.next()) {
2476
2485
  var parameterName = _h.value;
@@ -2914,6 +2923,9 @@
2914
2923
  TextFormatDefinition,
2915
2924
  CsvFormatDefinition,
2916
2925
  ];
2926
+ /**
2927
+ * Note: [💞] Ignore a discrepancy between file name and entity name
2928
+ */
2917
2929
 
2918
2930
  /**
2919
2931
  * Maps available parameters to expected parameters
@@ -3149,7 +3161,7 @@
3149
3161
  }
3150
3162
  finally { if (e_1) throw e_1.error; }
3151
3163
  }
3152
- var replacedTemplate = template;
3164
+ var replacedTemplates = template;
3153
3165
  var match;
3154
3166
  var loopLimit = LOOP_LIMIT;
3155
3167
  var _loop_1 = function () {
@@ -3178,24 +3190,24 @@
3178
3190
  .map(function (line, index) { return (index === 0 ? line : "".concat(precol).concat(line)); })
3179
3191
  .join('\n');
3180
3192
  }
3181
- replacedTemplate =
3182
- replacedTemplate.substring(0, match.index + precol.length) +
3193
+ replacedTemplates =
3194
+ replacedTemplates.substring(0, match.index + precol.length) +
3183
3195
  parameterValue +
3184
- replacedTemplate.substring(match.index + precol.length + parameterName.length + 2);
3196
+ replacedTemplates.substring(match.index + precol.length + parameterName.length + 2);
3185
3197
  };
3186
3198
  while ((match = /^(?<precol>.*){(?<parameterName>\w+)}(.*)/m /* <- Not global */
3187
- .exec(replacedTemplate))) {
3199
+ .exec(replacedTemplates))) {
3188
3200
  _loop_1();
3189
3201
  }
3190
3202
  // [💫] Check if there are parameters that are not closed properly
3191
- if (/{\w+$/.test(replacedTemplate)) {
3203
+ if (/{\w+$/.test(replacedTemplates)) {
3192
3204
  throw new PipelineExecutionError('Parameter is not closed');
3193
3205
  }
3194
3206
  // [💫] Check if there are parameters that are not opened properly
3195
- if (/^\w+}/.test(replacedTemplate)) {
3207
+ if (/^\w+}/.test(replacedTemplates)) {
3196
3208
  throw new PipelineExecutionError('Parameter is not opened');
3197
3209
  }
3198
- return replacedTemplate;
3210
+ return replacedTemplates;
3199
3211
  }
3200
3212
 
3201
3213
  /**
@@ -3227,6 +3239,7 @@
3227
3239
  var LINES_PER_STANDARD_PAGE = 44;
3228
3240
  /**
3229
3241
  * TODO: [🧠] Should be this `constants.ts` or `config.ts`?
3242
+ * Note: [💞] Ignore a discrepancy between file name and entity name
3230
3243
  */
3231
3244
 
3232
3245
  /**
@@ -3567,6 +3580,7 @@
3567
3580
  };
3568
3581
  /**
3569
3582
  * TODO: [🧠][🤠] This should be probbably as part of `TextFormatDefinition`
3583
+ * Note: [💞] Ignore a discrepancy between file name and entity name
3570
3584
  */
3571
3585
 
3572
3586
  /**
@@ -3615,12 +3629,12 @@
3615
3629
  */
3616
3630
  function executeAttempts(options) {
3617
3631
  return __awaiter(this, void 0, void 0, function () {
3618
- var jokerParameterNames, priority, maxAttempts, preparedContent, parameters, template, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, $ongoingTemplateResult, _llms, llmTools, _loop_1, attempt, state_1;
3632
+ var jokerParameterNames, priority, maxAttempts, preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, $ongoingTaskResult, _llms, llmTools, _loop_1, attempt, state_1;
3619
3633
  return __generator(this, function (_a) {
3620
3634
  switch (_a.label) {
3621
3635
  case 0:
3622
- 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;
3623
- $ongoingTemplateResult = {
3636
+ 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;
3637
+ $ongoingTaskResult = {
3624
3638
  $result: null,
3625
3639
  $resultString: null,
3626
3640
  $expectError: null,
@@ -3640,52 +3654,51 @@
3640
3654
  if (isJokerAttempt && !jokerParameterName) {
3641
3655
  throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Joker not found in attempt ".concat(attempt, "\n\n ").concat(block(pipelineIdentification), "\n "); }));
3642
3656
  }
3643
- $ongoingTemplateResult.$result = null;
3644
- $ongoingTemplateResult.$resultString = null;
3645
- $ongoingTemplateResult.$expectError = null;
3657
+ $ongoingTaskResult.$result = null;
3658
+ $ongoingTaskResult.$resultString = null;
3659
+ $ongoingTaskResult.$expectError = null;
3646
3660
  if (isJokerAttempt) {
3647
3661
  if (parameters[jokerParameterName] === undefined) {
3648
3662
  throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Joker parameter {".concat(jokerParameterName, "} not defined\n\n ").concat(block(pipelineIdentification), "\n "); }));
3649
3663
  // <- TODO: This is maybe `PipelineLogicError` which should be detected in `validatePipeline` and here just thrown as `UnexpectedError`
3650
3664
  }
3651
3665
  else {
3652
- $ongoingTemplateResult.$resultString = parameters[jokerParameterName];
3666
+ $ongoingTaskResult.$resultString = parameters[jokerParameterName];
3653
3667
  }
3654
3668
  }
3655
3669
  _t.label = 1;
3656
3670
  case 1:
3657
3671
  _t.trys.push([1, 43, 44, 45]);
3658
3672
  if (!!isJokerAttempt) return [3 /*break*/, 25];
3659
- _b = template.templateType;
3673
+ _b = task.taskType;
3660
3674
  switch (_b) {
3661
- case 'SIMPLE_TEMPLATE': return [3 /*break*/, 2];
3662
- case 'PROMPT_TEMPLATE': return [3 /*break*/, 3];
3663
- case 'SCRIPT_TEMPLATE': return [3 /*break*/, 11];
3664
- case 'DIALOG_TEMPLATE': return [3 /*break*/, 22];
3675
+ case 'SIMPLE_TASK': return [3 /*break*/, 2];
3676
+ case 'PROMPT_TASK': return [3 /*break*/, 3];
3677
+ case 'SCRIPT_TASK': return [3 /*break*/, 11];
3678
+ case 'DIALOG_TASK': return [3 /*break*/, 22];
3665
3679
  }
3666
3680
  return [3 /*break*/, 24];
3667
3681
  case 2:
3668
- $ongoingTemplateResult.$resultString = replaceParameters(preparedContent, parameters);
3682
+ $ongoingTaskResult.$resultString = replaceParameters(preparedContent, parameters);
3669
3683
  return [3 /*break*/, 25];
3670
3684
  case 3:
3671
- modelRequirements = __assign(__assign({ modelVariant: 'CHAT' }, (preparedPipeline.defaultModelRequirements || {})), (template.modelRequirements || {}));
3672
- $ongoingTemplateResult.$prompt = {
3673
- title: template.title,
3685
+ modelRequirements = __assign(__assign({ modelVariant: 'CHAT' }, (preparedPipeline.defaultModelRequirements || {})), (task.modelRequirements || {}));
3686
+ $ongoingTaskResult.$prompt = {
3687
+ title: task.title,
3674
3688
  pipelineUrl: "".concat(preparedPipeline.pipelineUrl
3675
3689
  ? preparedPipeline.pipelineUrl
3676
- : 'anonymous' /* <- TODO: [🧠] How to deal with anonymous pipelines, do here some auto-url like SHA-256 based ad-hoc identifier? */, "#").concat(template.name
3677
- // <- TODO: Here should be maybe also subformat index to distinguish between same template with different subformat values
3690
+ : 'anonymous' /* <- TODO: [🧠] How to deal with anonymous pipelines, do here some auto-url like SHA-256 based ad-hoc identifier? */, "#").concat(task.name
3691
+ // <- TODO: Here should be maybe also subformat index to distinguish between same task with different subformat values
3678
3692
  ),
3679
3693
  parameters: parameters,
3680
3694
  content: preparedContent,
3681
3695
  modelRequirements: modelRequirements,
3682
3696
  expectations: __assign(__assign({}, (preparedPipeline.personas.find(function (_a) {
3683
3697
  var name = _a.name;
3684
- return name === template.personaName;
3685
- }) ||
3686
- {})), template.expectations),
3687
- format: template.format,
3688
- postprocessingFunctionNames: template.postprocessingFunctionNames,
3698
+ return name === task.personaName;
3699
+ }) || {})), task.expectations),
3700
+ format: task.format,
3701
+ postprocessingFunctionNames: task.postprocessingFunctionNames,
3689
3702
  }; // <- TODO: Not very good type guard
3690
3703
  _c = modelRequirements.modelVariant;
3691
3704
  switch (_c) {
@@ -3695,36 +3708,35 @@
3695
3708
  }
3696
3709
  return [3 /*break*/, 9];
3697
3710
  case 4:
3698
- _d = $ongoingTemplateResult;
3711
+ _d = $ongoingTaskResult;
3699
3712
  return [4 /*yield*/, llmTools.callChatModel(
3700
3713
  // <- TODO: [🧁] Check that `callChatModel` is defined
3701
- $deepFreeze($ongoingTemplateResult.$prompt))];
3714
+ $deepFreeze($ongoingTaskResult.$prompt))];
3702
3715
  case 5:
3703
3716
  _d.$chatResult = _t.sent();
3704
3717
  // TODO: [🍬] Destroy chatThread
3705
- $ongoingTemplateResult.$result = $ongoingTemplateResult.$chatResult;
3706
- $ongoingTemplateResult.$resultString = $ongoingTemplateResult.$chatResult.content;
3718
+ $ongoingTaskResult.$result = $ongoingTaskResult.$chatResult;
3719
+ $ongoingTaskResult.$resultString = $ongoingTaskResult.$chatResult.content;
3707
3720
  return [3 /*break*/, 10];
3708
3721
  case 6:
3709
- _e = $ongoingTemplateResult;
3722
+ _e = $ongoingTaskResult;
3710
3723
  return [4 /*yield*/, llmTools.callCompletionModel(
3711
3724
  // <- TODO: [🧁] Check that `callCompletionModel` is defined
3712
- $deepFreeze($ongoingTemplateResult.$prompt))];
3725
+ $deepFreeze($ongoingTaskResult.$prompt))];
3713
3726
  case 7:
3714
3727
  _e.$completionResult = _t.sent();
3715
- $ongoingTemplateResult.$result = $ongoingTemplateResult.$completionResult;
3716
- $ongoingTemplateResult.$resultString =
3717
- $ongoingTemplateResult.$completionResult.content;
3728
+ $ongoingTaskResult.$result = $ongoingTaskResult.$completionResult;
3729
+ $ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
3718
3730
  return [3 /*break*/, 10];
3719
3731
  case 8: throw new PipelineExecutionError(spaceTrim.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 "); }));
3720
- case 9: throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Unknown model variant \"".concat(template.modelRequirements.modelVariant, "\"\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
3732
+ case 9: throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Unknown model variant \"".concat(task.modelRequirements.modelVariant, "\"\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
3721
3733
  case 10: return [3 /*break*/, 25];
3722
3734
  case 11:
3723
3735
  if (arrayableToArray(tools.script).length === 0) {
3724
3736
  throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n No script execution tools are available\n\n ".concat(block(pipelineIdentification), "\n "); }));
3725
3737
  }
3726
- if (!template.contentLanguage) {
3727
- throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Script language is not defined for SCRIPT TEMPLATE \"".concat(template.name, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
3738
+ if (!task.contentLanguage) {
3739
+ throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Script language is not defined for SCRIPT TASK \"".concat(task.name, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
3728
3740
  }
3729
3741
  _t.label = 12;
3730
3742
  case 12:
@@ -3737,9 +3749,9 @@
3737
3749
  _t.label = 14;
3738
3750
  case 14:
3739
3751
  _t.trys.push([14, 16, , 17]);
3740
- _h = $ongoingTemplateResult;
3752
+ _h = $ongoingTaskResult;
3741
3753
  return [4 /*yield*/, scriptTools.execute($deepFreeze({
3742
- scriptLanguage: template.contentLanguage,
3754
+ scriptLanguage: task.contentLanguage,
3743
3755
  script: preparedContent,
3744
3756
  parameters: parameters,
3745
3757
  }))];
@@ -3754,7 +3766,7 @@
3754
3766
  if (error_1 instanceof UnexpectedError) {
3755
3767
  throw error_1;
3756
3768
  }
3757
- $ongoingTemplateResult.$scriptPipelineExecutionErrors.push(error_1);
3769
+ $ongoingTaskResult.$scriptPipelineExecutionErrors.push(error_1);
3758
3770
  return [3 /*break*/, 17];
3759
3771
  case 17:
3760
3772
  _g = _f.next();
@@ -3771,14 +3783,14 @@
3771
3783
  finally { if (e_1) throw e_1.error; }
3772
3784
  return [7 /*endfinally*/];
3773
3785
  case 21:
3774
- if ($ongoingTemplateResult.$resultString !== null) {
3786
+ if ($ongoingTaskResult.$resultString !== null) {
3775
3787
  return [3 /*break*/, 25];
3776
3788
  }
3777
- if ($ongoingTemplateResult.$scriptPipelineExecutionErrors.length === 1) {
3778
- throw $ongoingTemplateResult.$scriptPipelineExecutionErrors[0];
3789
+ if ($ongoingTaskResult.$scriptPipelineExecutionErrors.length === 1) {
3790
+ throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
3779
3791
  }
3780
3792
  else {
3781
- throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Script execution failed ".concat($ongoingTemplateResult.$scriptPipelineExecutionErrors.length, "x\n\n ").concat(block(pipelineIdentification), "\n\n ").concat(block($ongoingTemplateResult.$scriptPipelineExecutionErrors
3793
+ throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Script execution failed ".concat($ongoingTaskResult.$scriptPipelineExecutionErrors.length, "x\n\n ").concat(block(pipelineIdentification), "\n\n ").concat(block($ongoingTaskResult.$scriptPipelineExecutionErrors
3782
3794
  .map(function (error) { return '- ' + error.message; })
3783
3795
  .join('\n\n')), "\n "); }));
3784
3796
  }
@@ -3786,27 +3798,27 @@
3786
3798
  if (tools.userInterface === undefined) {
3787
3799
  throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n User interface tools are not available\n\n ".concat(block(pipelineIdentification), "\n "); }));
3788
3800
  }
3789
- // TODO: [🌹] When making next attempt for `DIALOG TEMPLATE`, preserve the previous user input
3790
- _j = $ongoingTemplateResult;
3801
+ // TODO: [🌹] When making next attempt for `DIALOG TASK`, preserve the previous user input
3802
+ _j = $ongoingTaskResult;
3791
3803
  return [4 /*yield*/, tools.userInterface.promptDialog($deepFreeze({
3792
- promptTitle: template.title,
3793
- promptMessage: replaceParameters(template.description || '', parameters),
3804
+ promptTitle: task.title,
3805
+ promptMessage: replaceParameters(task.description || '', parameters),
3794
3806
  defaultValue: replaceParameters(preparedContent, parameters),
3795
3807
  // TODO: [🧠] !! Figure out how to define placeholder in .book.md file
3796
3808
  placeholder: undefined,
3797
3809
  priority: priority,
3798
3810
  }))];
3799
3811
  case 23:
3800
- // TODO: [🌹] When making next attempt for `DIALOG TEMPLATE`, preserve the previous user input
3812
+ // TODO: [🌹] When making next attempt for `DIALOG TASK`, preserve the previous user input
3801
3813
  _j.$resultString = _t.sent();
3802
3814
  return [3 /*break*/, 25];
3803
- case 24: throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Unknown execution type \"".concat(template.templateType, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
3815
+ case 24: throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Unknown execution type \"".concat(task.taskType, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
3804
3816
  case 25:
3805
- if (!(!isJokerAttempt && template.postprocessingFunctionNames)) return [3 /*break*/, 42];
3817
+ if (!(!isJokerAttempt && task.postprocessingFunctionNames)) return [3 /*break*/, 42];
3806
3818
  _t.label = 26;
3807
3819
  case 26:
3808
3820
  _t.trys.push([26, 40, 41, 42]);
3809
- _k = (e_3 = void 0, __values(template.postprocessingFunctionNames)), _l = _k.next();
3821
+ _k = (e_3 = void 0, __values(task.postprocessingFunctionNames)), _l = _k.next();
3810
3822
  _t.label = 27;
3811
3823
  case 27:
3812
3824
  if (!!_l.done) return [3 /*break*/, 39];
@@ -3823,13 +3835,13 @@
3823
3835
  _t.label = 30;
3824
3836
  case 30:
3825
3837
  _t.trys.push([30, 32, , 33]);
3826
- _p = $ongoingTemplateResult;
3838
+ _p = $ongoingTaskResult;
3827
3839
  return [4 /*yield*/, scriptTools.execute({
3828
3840
  scriptLanguage: "javascript" /* <- TODO: Try it in each languages; In future allow postprocessing with arbitrary combination of languages to combine */,
3829
3841
  script: "".concat(functionName, "(resultString)"),
3830
3842
  parameters: {
3831
- resultString: $ongoingTemplateResult.$resultString || '',
3832
- // Note: No ...parametersForTemplate, because working with result only
3843
+ resultString: $ongoingTaskResult.$resultString || '',
3844
+ // Note: No ...parametersForTask, because working with result only
3833
3845
  },
3834
3846
  })];
3835
3847
  case 31:
@@ -3845,7 +3857,7 @@
3845
3857
  throw error_2;
3846
3858
  }
3847
3859
  postprocessingError = error_2;
3848
- $ongoingTemplateResult.$scriptPipelineExecutionErrors.push(error_2);
3860
+ $ongoingTaskResult.$scriptPipelineExecutionErrors.push(error_2);
3849
3861
  return [3 /*break*/, 33];
3850
3862
  case 33:
3851
3863
  _o = _m.next();
@@ -3882,12 +3894,12 @@
3882
3894
  return [7 /*endfinally*/];
3883
3895
  case 42:
3884
3896
  // TODO: [💝] Unite object for expecting amount and format
3885
- if (template.format) {
3886
- if (template.format === 'JSON') {
3887
- if (!isValidJsonString($ongoingTemplateResult.$resultString || '')) {
3897
+ if (task.format) {
3898
+ if (task.format === 'JSON') {
3899
+ if (!isValidJsonString($ongoingTaskResult.$resultString || '')) {
3888
3900
  // TODO: [🏢] Do more universally via `FormatDefinition`
3889
3901
  try {
3890
- $ongoingTemplateResult.$resultString = extractJsonBlock($ongoingTemplateResult.$resultString || '');
3902
+ $ongoingTaskResult.$resultString = extractJsonBlock($ongoingTaskResult.$resultString || '');
3891
3903
  }
3892
3904
  catch (error) {
3893
3905
  throw new ExpectError(spaceTrim.spaceTrim(function (block) { return "\n Expected valid JSON string\n\n ".concat(block(
@@ -3896,12 +3908,12 @@
3896
3908
  }
3897
3909
  }
3898
3910
  else {
3899
- throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Unknown format \"".concat(template.format, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
3911
+ throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Unknown format \"".concat(task.format, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
3900
3912
  }
3901
3913
  }
3902
3914
  // TODO: [💝] Unite object for expecting amount and format
3903
- if (template.expectations) {
3904
- checkExpectations(template.expectations, $ongoingTemplateResult.$resultString || '');
3915
+ if (task.expectations) {
3916
+ checkExpectations(task.expectations, $ongoingTaskResult.$resultString || '');
3905
3917
  }
3906
3918
  return [2 /*return*/, "break-attempts"];
3907
3919
  case 43:
@@ -3909,38 +3921,38 @@
3909
3921
  if (!(error_3 instanceof ExpectError)) {
3910
3922
  throw error_3;
3911
3923
  }
3912
- $ongoingTemplateResult.$expectError = error_3;
3924
+ $ongoingTaskResult.$expectError = error_3;
3913
3925
  return [3 /*break*/, 45];
3914
3926
  case 44:
3915
3927
  if (!isJokerAttempt &&
3916
- template.templateType === 'PROMPT_TEMPLATE' &&
3917
- $ongoingTemplateResult.$prompt
3928
+ task.taskType === 'PROMPT_TASK' &&
3929
+ $ongoingTaskResult.$prompt
3918
3930
  // <- Note: [2] When some expected parameter is not defined, error will occur in replaceParameters
3919
3931
  // In that case we don’t want to make a report about it because it’s not a llm execution error
3920
3932
  ) {
3921
- // TODO: [🧠] Maybe put other templateTypes into report
3933
+ // TODO: [🧠] Maybe put other taskTypes into report
3922
3934
  $executionReport.promptExecutions.push({
3923
- prompt: __assign({}, $ongoingTemplateResult.$prompt),
3924
- result: $ongoingTemplateResult.$result || undefined,
3925
- error: $ongoingTemplateResult.$expectError === null
3935
+ prompt: __assign({}, $ongoingTaskResult.$prompt),
3936
+ result: $ongoingTaskResult.$result || undefined,
3937
+ error: $ongoingTaskResult.$expectError === null
3926
3938
  ? undefined
3927
- : serializeError($ongoingTemplateResult.$expectError),
3939
+ : serializeError($ongoingTaskResult.$expectError),
3928
3940
  });
3929
3941
  }
3930
3942
  return [7 /*endfinally*/];
3931
3943
  case 45:
3932
- if ($ongoingTemplateResult.$expectError !== null && attempt === maxAttempts - 1) {
3944
+ if ($ongoingTaskResult.$expectError !== null && attempt === maxAttempts - 1) {
3933
3945
  throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) {
3934
3946
  var _a, _b, _c;
3935
- 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) || '')
3947
+ 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) || '')
3936
3948
  .split('\n')
3937
3949
  .map(function (line) { return "> ".concat(line); })
3938
- .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) || '')
3950
+ .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) || '')
3939
3951
  .split('\n')
3940
3952
  .map(function (line) { return "> ".concat(line); })
3941
- .join('\n')), "\n\n Last result:\n ").concat(block($ongoingTemplateResult.$resultString === null
3953
+ .join('\n')), "\n\n Last result:\n ").concat(block($ongoingTaskResult.$resultString === null
3942
3954
  ? 'null'
3943
- : $ongoingTemplateResult.$resultString
3955
+ : $ongoingTaskResult.$resultString
3944
3956
  .split('\n')
3945
3957
  .map(function (line) { return "> ".concat(line); })
3946
3958
  .join('\n')), "\n ---\n ");
@@ -3965,10 +3977,10 @@
3965
3977
  attempt++;
3966
3978
  return [3 /*break*/, 1];
3967
3979
  case 4:
3968
- if ($ongoingTemplateResult.$resultString === null) {
3980
+ if ($ongoingTaskResult.$resultString === null) {
3969
3981
  throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Something went wrong and prompt result is null\n\n ".concat(block(pipelineIdentification), "\n "); }));
3970
3982
  }
3971
- return [2 /*return*/, $ongoingTemplateResult.$resultString];
3983
+ return [2 /*return*/, $ongoingTaskResult.$resultString];
3972
3984
  }
3973
3985
  });
3974
3986
  });
@@ -3984,36 +3996,36 @@
3984
3996
  */
3985
3997
  function executeFormatSubvalues(options) {
3986
3998
  return __awaiter(this, void 0, void 0, function () {
3987
- var template, jokerParameterNames, parameters, priority, csvSettings, pipelineIdentification, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
3999
+ var task, jokerParameterNames, parameters, priority, csvSettings, pipelineIdentification, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
3988
4000
  var _this = this;
3989
4001
  return __generator(this, function (_a) {
3990
4002
  switch (_a.label) {
3991
4003
  case 0:
3992
- template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, csvSettings = options.csvSettings, pipelineIdentification = options.pipelineIdentification;
3993
- if (template.foreach === undefined) {
4004
+ task = options.task, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, csvSettings = options.csvSettings, pipelineIdentification = options.pipelineIdentification;
4005
+ if (task.foreach === undefined) {
3994
4006
  return [2 /*return*/, /* not await */ executeAttempts(options)];
3995
4007
  }
3996
4008
  if (jokerParameterNames.length !== 0) {
3997
4009
  throw new UnexpectedError(spaceTrim__default["default"](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 "); }));
3998
4010
  }
3999
- parameterValue = parameters[template.foreach.parameterName] || '';
4011
+ parameterValue = parameters[task.foreach.parameterName] || '';
4000
4012
  formatDefinition = FORMAT_DEFINITIONS.find(function (formatDefinition) {
4001
- return __spreadArray([formatDefinition.formatName], __read((formatDefinition.aliases || [])), false).includes(template.foreach.formatName);
4013
+ return __spreadArray([formatDefinition.formatName], __read((formatDefinition.aliases || [])), false).includes(task.foreach.formatName);
4002
4014
  });
4003
4015
  if (formatDefinition === undefined) {
4004
4016
  throw new UnexpectedError(
4005
4017
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
4006
- spaceTrim__default["default"](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; })
4018
+ spaceTrim__default["default"](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; })
4007
4019
  .map(function (formatName) { return "- ".concat(formatName); })
4008
4020
  .join('\n')), "\n\n [\u26F7] This should never happen because format name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
4009
4021
  }
4010
4022
  subvalueDefinition = formatDefinition.subvalueDefinitions.find(function (subvalueDefinition) {
4011
- return __spreadArray([subvalueDefinition.subvalueName], __read((subvalueDefinition.aliases || [])), false).includes(template.foreach.subformatName);
4023
+ return __spreadArray([subvalueDefinition.subvalueName], __read((subvalueDefinition.aliases || [])), false).includes(task.foreach.subformatName);
4012
4024
  });
4013
4025
  if (subvalueDefinition === undefined) {
4014
4026
  throw new UnexpectedError(
4015
4027
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
4016
- spaceTrim__default["default"](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
4028
+ spaceTrim__default["default"](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
4017
4029
  .map(function (subvalueDefinition) { return subvalueDefinition.subvalueName; })
4018
4030
  .map(function (subvalueName) { return "- ".concat(subvalueName); })
4019
4031
  .join('\n')), "\n\n [\u26F7] This should never happen because subformat name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
@@ -4022,7 +4034,7 @@
4022
4034
  formatSettings = csvSettings;
4023
4035
  // <- TODO: [🤹‍♂️] More universal, make simmilar pattern for other formats for example \n vs \r\n in text
4024
4036
  }
4025
- return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, template.foreach.outputSubparameterName, formatSettings, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
4037
+ return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, task.foreach.outputSubparameterName, formatSettings, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
4026
4038
  var mappedParameters, allSubparameters, subresultString;
4027
4039
  return __generator(this, function (_a) {
4028
4040
  switch (_a.label) {
@@ -4031,7 +4043,7 @@
4031
4043
  // TODO: When done [🐚] Report progress also for each subvalue here
4032
4044
  try {
4033
4045
  mappedParameters = mapAvailableToExpectedParameters({
4034
- expectedParameters: Object.fromEntries(template.foreach.inputSubparameterNames.map(function (subparameterName) { return [subparameterName, null]; })),
4046
+ expectedParameters: Object.fromEntries(task.foreach.inputSubparameterNames.map(function (subparameterName) { return [subparameterName, null]; })),
4035
4047
  availableParameters: subparameters,
4036
4048
  });
4037
4049
  }
@@ -4064,7 +4076,7 @@
4064
4076
  *
4065
4077
  * @private internal utility of `createPipelineExecutor`
4066
4078
  */
4067
- function getContextForTemplate(template) {
4079
+ function getContextForTask(task) {
4068
4080
  return __awaiter(this, void 0, void 0, function () {
4069
4081
  return __generator(this, function (_a) {
4070
4082
  return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [🏍] Implement */];
@@ -4077,15 +4089,10 @@
4077
4089
  *
4078
4090
  * @private internal utility of `createPipelineExecutor`
4079
4091
  */
4080
- function getKnowledgeForTemplate(options) {
4092
+ function getExamplesForTask(task) {
4081
4093
  return __awaiter(this, void 0, void 0, function () {
4082
- var preparedPipeline;
4083
4094
  return __generator(this, function (_a) {
4084
- preparedPipeline = options.preparedPipeline, options.template;
4085
- return [2 /*return*/, preparedPipeline.knowledgePieces.map(function (_a) {
4086
- var content = _a.content;
4087
- return "- ".concat(content);
4088
- }).join('\n')];
4095
+ return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [♨] Implement */];
4089
4096
  });
4090
4097
  });
4091
4098
  }
@@ -4095,10 +4102,15 @@
4095
4102
  *
4096
4103
  * @private internal utility of `createPipelineExecutor`
4097
4104
  */
4098
- function getExamplesForTemplate(template) {
4105
+ function getKnowledgeForTask(options) {
4099
4106
  return __awaiter(this, void 0, void 0, function () {
4107
+ var preparedPipeline;
4100
4108
  return __generator(this, function (_a) {
4101
- return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [♨] Implement */];
4109
+ preparedPipeline = options.preparedPipeline, options.task;
4110
+ return [2 /*return*/, preparedPipeline.knowledgePieces.map(function (_a) {
4111
+ var content = _a.content;
4112
+ return "- ".concat(content);
4113
+ }).join('\n')];
4102
4114
  });
4103
4115
  });
4104
4116
  }
@@ -4108,21 +4120,21 @@
4108
4120
  *
4109
4121
  * @private internal utility of `createPipelineExecutor`
4110
4122
  */
4111
- function getReservedParametersForTemplate(options) {
4123
+ function getReservedParametersForTask(options) {
4112
4124
  return __awaiter(this, void 0, void 0, function () {
4113
- var preparedPipeline, template, pipelineIdentification, context, knowledge, examples, currentDate, modelName, reservedParameters, _loop_1, RESERVED_PARAMETER_NAMES_1, RESERVED_PARAMETER_NAMES_1_1, parameterName;
4125
+ var preparedPipeline, task, pipelineIdentification, context, knowledge, examples, currentDate, modelName, reservedParameters, _loop_1, RESERVED_PARAMETER_NAMES_1, RESERVED_PARAMETER_NAMES_1_1, parameterName;
4114
4126
  var e_1, _a;
4115
4127
  return __generator(this, function (_b) {
4116
4128
  switch (_b.label) {
4117
4129
  case 0:
4118
- preparedPipeline = options.preparedPipeline, template = options.template, pipelineIdentification = options.pipelineIdentification;
4119
- return [4 /*yield*/, getContextForTemplate()];
4130
+ preparedPipeline = options.preparedPipeline, task = options.task, pipelineIdentification = options.pipelineIdentification;
4131
+ return [4 /*yield*/, getContextForTask()];
4120
4132
  case 1:
4121
4133
  context = _b.sent();
4122
- return [4 /*yield*/, getKnowledgeForTemplate({ preparedPipeline: preparedPipeline, template: template })];
4134
+ return [4 /*yield*/, getKnowledgeForTask({ preparedPipeline: preparedPipeline, task: task })];
4123
4135
  case 2:
4124
4136
  knowledge = _b.sent();
4125
- return [4 /*yield*/, getExamplesForTemplate()];
4137
+ return [4 /*yield*/, getExamplesForTask()];
4126
4138
  case 3:
4127
4139
  examples = _b.sent();
4128
4140
  currentDate = new Date().toISOString();
@@ -4165,31 +4177,31 @@
4165
4177
  *
4166
4178
  * @private internal utility of `createPipelineExecutor`
4167
4179
  */
4168
- function executeTemplate(options) {
4180
+ function executeTask(options) {
4169
4181
  return __awaiter(this, void 0, void 0, function () {
4170
- 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;
4182
+ 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;
4171
4183
  var e_1, _g, _h;
4172
4184
  return __generator(this, function (_j) {
4173
4185
  switch (_j.label) {
4174
4186
  case 0:
4175
- 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;
4176
- name = "pipeline-executor-frame-".concat(currentTemplate.name);
4177
- title = currentTemplate.title;
4178
- priority = preparedPipeline.templates.length - preparedPipeline.templates.indexOf(currentTemplate);
4187
+ 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;
4188
+ name = "pipeline-executor-frame-".concat(currentTask.name);
4189
+ title = currentTask.title;
4190
+ priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
4179
4191
  return [4 /*yield*/, onProgress({
4180
4192
  name: name,
4181
4193
  title: title,
4182
4194
  isStarted: false,
4183
4195
  isDone: false,
4184
- templateType: currentTemplate.templateType,
4185
- parameterName: currentTemplate.resultingParameterName,
4196
+ taskType: currentTask.taskType,
4197
+ parameterName: currentTask.resultingParameterName,
4186
4198
  parameterValue: null,
4187
4199
  // <- [🍸]
4188
4200
  })];
4189
4201
  case 1:
4190
4202
  _j.sent();
4191
- usedParameterNames = extractParameterNamesFromTemplate(currentTemplate);
4192
- dependentParameterNames = new Set(currentTemplate.dependentParameterNames);
4203
+ usedParameterNames = extractParameterNamesFromTask(currentTask);
4204
+ dependentParameterNames = new Set(currentTask.dependentParameterNames);
4193
4205
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
4194
4206
  if (union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)).size !== 0) {
4195
4207
  throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Dependent parameters are not consistent with used parameters:\n\n Dependent parameters:\n ".concat(Array.from(dependentParameterNames)
@@ -4200,9 +4212,9 @@
4200
4212
  }
4201
4213
  _c = (_b = Object).freeze;
4202
4214
  _d = [{}];
4203
- return [4 /*yield*/, getReservedParametersForTemplate({
4215
+ return [4 /*yield*/, getReservedParametersForTask({
4204
4216
  preparedPipeline: preparedPipeline,
4205
- template: currentTemplate,
4217
+ task: currentTask,
4206
4218
  pipelineIdentification: pipelineIdentification,
4207
4219
  })];
4208
4220
  case 2:
@@ -4220,11 +4232,11 @@
4220
4232
  else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
4221
4233
  // Houston, we have a problem
4222
4234
  // Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
4223
- throw new UnexpectedError(spaceTrim.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 "); }));
4235
+ throw new UnexpectedError(spaceTrim.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 "); }));
4224
4236
  }
4225
4237
  };
4226
4238
  try {
4227
- // Note: [2] Check that all used parameters are defined and removing unused parameters for this template
4239
+ // Note: [2] Check that all used parameters are defined and removing unused parameters for this task
4228
4240
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
4229
4241
  for (_e = __values(Array.from(union(definedParameterNames, usedParameterNames, dependentParameterNames))), _f = _e.next(); !_f.done; _f = _e.next()) {
4230
4242
  parameterName = _f.value;
@@ -4240,18 +4252,16 @@
4240
4252
  }
4241
4253
  // 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
4242
4254
  Object.freeze(parameters);
4243
- maxAttempts = currentTemplate.templateType === 'DIALOG_TEMPLATE' ? Infinity : maxExecutionAttempts;
4244
- jokerParameterNames = currentTemplate.jokerParameterNames || [];
4245
- preparedContent = (currentTemplate.preparedContent || '{content}')
4246
- .split('{content}')
4247
- .join(currentTemplate.content);
4255
+ maxAttempts = currentTask.taskType === 'DIALOG_TASK' ? Infinity : maxExecutionAttempts;
4256
+ jokerParameterNames = currentTask.jokerParameterNames || [];
4257
+ preparedContent = (currentTask.preparedContent || '{content}').split('{content}').join(currentTask.content);
4248
4258
  return [4 /*yield*/, executeFormatSubvalues({
4249
4259
  jokerParameterNames: jokerParameterNames,
4250
4260
  priority: priority,
4251
4261
  maxAttempts: maxAttempts,
4252
4262
  preparedContent: preparedContent,
4253
4263
  parameters: parameters,
4254
- template: currentTemplate,
4264
+ task: currentTask,
4255
4265
  preparedPipeline: preparedPipeline,
4256
4266
  tools: tools,
4257
4267
  $executionReport: $executionReport,
@@ -4264,15 +4274,15 @@
4264
4274
  title: title,
4265
4275
  isStarted: true,
4266
4276
  isDone: true,
4267
- templateType: currentTemplate.templateType,
4268
- parameterName: currentTemplate.resultingParameterName,
4277
+ taskType: currentTask.taskType,
4278
+ parameterName: currentTask.resultingParameterName,
4269
4279
  parameterValue: resultString,
4270
4280
  // <- [🍸]
4271
4281
  })];
4272
4282
  case 4:
4273
4283
  _j.sent();
4274
4284
  return [2 /*return*/, Object.freeze((_h = {},
4275
- _h[currentTemplate.resultingParameterName] =
4285
+ _h[currentTask.resultingParameterName] =
4276
4286
  // <- Note: [👩‍👩‍👧] No need to detect parameter collision here because pipeline checks logic consistency during construction
4277
4287
  resultString,
4278
4288
  _h))];
@@ -4334,7 +4344,7 @@
4334
4344
  */
4335
4345
  function executePipeline(options) {
4336
4346
  return __awaiter(this, void 0, void 0, function () {
4337
- 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;
4347
+ 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;
4338
4348
  var e_1, _f, e_2, _g;
4339
4349
  return __generator(this, function (_h) {
4340
4350
  switch (_h.label) {
@@ -4488,11 +4498,11 @@
4488
4498
  var name = _a.name;
4489
4499
  return name;
4490
4500
  });
4491
- unresovedTemplates_1 = __spreadArray([], __read(preparedPipeline.templates), false);
4501
+ unresovedTasks_1 = __spreadArray([], __read(preparedPipeline.tasks), false);
4492
4502
  resolving_1 = [];
4493
4503
  loopLimit = LOOP_LIMIT;
4494
4504
  _loop_2 = function () {
4495
- var currentTemplate, work_1;
4505
+ var currentTask, work_1;
4496
4506
  return __generator(this, function (_k) {
4497
4507
  switch (_k.label) {
4498
4508
  case 0:
@@ -4500,15 +4510,15 @@
4500
4510
  // Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
4501
4511
  throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Loop limit reached during resolving parameters pipeline execution\n\n ".concat(block(pipelineIdentification), "\n "); }));
4502
4512
  }
4503
- currentTemplate = unresovedTemplates_1.find(function (template) {
4504
- return template.dependentParameterNames.every(function (name) {
4513
+ currentTask = unresovedTasks_1.find(function (task) {
4514
+ return task.dependentParameterNames.every(function (name) {
4505
4515
  return __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), __read(RESERVED_PARAMETER_NAMES), false).includes(name);
4506
4516
  });
4507
4517
  });
4508
- if (!(!currentTemplate && resolving_1.length === 0)) return [3 /*break*/, 1];
4518
+ if (!(!currentTask && resolving_1.length === 0)) return [3 /*break*/, 1];
4509
4519
  throw new UnexpectedError(
4510
4520
  // TODO: [🐎] DRY
4511
- spaceTrim.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
4521
+ spaceTrim.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
4512
4522
  .map(function (_a) {
4513
4523
  var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
4514
4524
  return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
@@ -4527,14 +4537,14 @@
4527
4537
  .map(function (name) { return "- Parameter `{".concat(name, "}`"); })
4528
4538
  .join('\n')), "\n\n *Note: This should be catched in `validatePipeline`*\n "); }));
4529
4539
  case 1:
4530
- if (!!currentTemplate) return [3 /*break*/, 3];
4540
+ if (!!currentTask) return [3 /*break*/, 3];
4531
4541
  /* [🤹‍♂️] */ return [4 /*yield*/, Promise.race(resolving_1)];
4532
4542
  case 2:
4533
4543
  /* [🤹‍♂️] */ _k.sent();
4534
4544
  return [3 /*break*/, 4];
4535
4545
  case 3:
4536
- unresovedTemplates_1 = unresovedTemplates_1.filter(function (template) { return template !== currentTemplate; });
4537
- work_1 = executeTemplate(__assign(__assign({}, options), { currentTemplate: currentTemplate, preparedPipeline: preparedPipeline, parametersToPass: parametersToPass, tools: tools, onProgress: function (progress) {
4546
+ unresovedTasks_1 = unresovedTasks_1.filter(function (task) { return task !== currentTask; });
4547
+ work_1 = executeTask(__assign(__assign({}, options), { currentTask: currentTask, preparedPipeline: preparedPipeline, parametersToPass: parametersToPass, tools: tools, onProgress: function (progress) {
4538
4548
  if (isReturned) {
4539
4549
  throw new UnexpectedError(spaceTrim.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)
4540
4550
  .split('\n')
@@ -4544,16 +4554,16 @@
4544
4554
  if (onProgress) {
4545
4555
  onProgress(progress);
4546
4556
  }
4547
- }, $executionReport: executionReport, pipelineIdentification: spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(pipelineIdentification), "\n Template name: ").concat(currentTemplate.name, "\n Template title: ").concat(currentTemplate.title, "\n "); }) }))
4557
+ }, $executionReport: executionReport, pipelineIdentification: spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(pipelineIdentification), "\n Task name: ").concat(currentTask.name, "\n Task title: ").concat(currentTask.title, "\n "); }) }))
4548
4558
  .then(function (newParametersToPass) {
4549
4559
  parametersToPass = __assign(__assign({}, newParametersToPass), parametersToPass);
4550
- resovedParameterNames_1 = __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), [currentTemplate.resultingParameterName], false);
4560
+ resovedParameterNames_1 = __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), [currentTask.resultingParameterName], false);
4551
4561
  })
4552
4562
  .then(function () {
4553
4563
  resolving_1 = resolving_1.filter(function (w) { return w !== work_1; });
4554
4564
  });
4555
4565
  // <- Note: Errors are catched here [3]
4556
- // 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
4566
+ // 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
4557
4567
  resolving_1.push(work_1);
4558
4568
  _k.label = 4;
4559
4569
  case 4: return [2 /*return*/];
@@ -4562,7 +4572,7 @@
4562
4572
  };
4563
4573
  _h.label = 21;
4564
4574
  case 21:
4565
- if (!(unresovedTemplates_1.length > 0)) return [3 /*break*/, 23];
4575
+ if (!(unresovedTasks_1.length > 0)) return [3 /*break*/, 23];
4566
4576
  return [5 /*yield**/, _loop_2()];
4567
4577
  case 22:
4568
4578
  _h.sent();
@@ -5103,6 +5113,9 @@
5103
5113
  normalizedName = normalizedName.replace(/-$/, '');
5104
5114
  return normalizedName;
5105
5115
  }
5116
+ /**
5117
+ * Note: [💞] Ignore a discrepancy between file name and entity name
5118
+ */
5106
5119
 
5107
5120
  /**
5108
5121
  * Creates unique name for the source
@@ -5474,7 +5487,7 @@
5474
5487
  */
5475
5488
  function clonePipeline(pipeline) {
5476
5489
  // Note: Not using spread operator (...) because @@@
5477
- 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;
5490
+ 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;
5478
5491
  return {
5479
5492
  pipelineUrl: pipelineUrl,
5480
5493
  sourceFile: sourceFile,
@@ -5483,7 +5496,7 @@
5483
5496
  description: description,
5484
5497
  formfactorName: formfactorName,
5485
5498
  parameters: parameters,
5486
- templates: templates,
5499
+ tasks: tasks,
5487
5500
  knowledgeSources: knowledgeSources,
5488
5501
  knowledgePieces: knowledgePieces,
5489
5502
  personas: personas,
@@ -5499,17 +5512,17 @@
5499
5512
  *
5500
5513
  * @public exported from `@promptbook/core`
5501
5514
  */
5502
- function prepareTemplates(pipeline, tools, options) {
5515
+ function prepareTasks(pipeline, tools, options) {
5503
5516
  return __awaiter(this, void 0, void 0, function () {
5504
- var _a, maxParallelCount, templates, knowledgePiecesCount, templatesPrepared;
5517
+ var _a, maxParallelCount, tasks, knowledgePiecesCount, tasksPrepared;
5505
5518
  var _this = this;
5506
5519
  return __generator(this, function (_b) {
5507
5520
  switch (_b.label) {
5508
5521
  case 0:
5509
5522
  _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a;
5510
- templates = pipeline.templates, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
5511
- templatesPrepared = new Array(templates.length);
5512
- 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 () {
5523
+ tasks = pipeline.tasks, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
5524
+ tasksPrepared = new Array(tasks.length);
5525
+ 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 () {
5513
5526
  var dependentParameterNames, preparedContent, preparedTemplate;
5514
5527
  return __generator(this, function (_a) {
5515
5528
  dependentParameterNames = template.dependentParameterNames;
@@ -5522,13 +5535,13 @@
5522
5535
  ], false);
5523
5536
  }
5524
5537
  preparedTemplate = __assign(__assign({}, template), { dependentParameterNames: dependentParameterNames, preparedContent: preparedContent });
5525
- templatesPrepared[index] = preparedTemplate;
5538
+ tasksPrepared[index] = preparedTemplate;
5526
5539
  return [2 /*return*/];
5527
5540
  });
5528
5541
  }); })];
5529
5542
  case 1:
5530
5543
  _b.sent();
5531
- return [2 /*return*/, { templatesPrepared: templatesPrepared }];
5544
+ return [2 /*return*/, { tasksPrepared: tasksPrepared }];
5532
5545
  }
5533
5546
  });
5534
5547
  });
@@ -5536,7 +5549,7 @@
5536
5549
  /**
5537
5550
  * TODO: [🧠] Add context to each template (if missing)
5538
5551
  * TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
5539
- * TODO: [♨][main] !!! Prepare index the examples and maybe templates
5552
+ * TODO: [♨][main] !!! Prepare index the examples and maybe tasks
5540
5553
  * TODO: Write tests for `preparePipeline`
5541
5554
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
5542
5555
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
@@ -5553,12 +5566,12 @@
5553
5566
  */
5554
5567
  function preparePipeline(pipeline, tools, options) {
5555
5568
  return __awaiter(this, void 0, void 0, function () {
5556
- var rootDirname, _a, maxParallelCount, _b, isVerbose, parameters, templates,
5569
+ var rootDirname, _a, maxParallelCount, _b, isVerbose, parameters, tasks,
5557
5570
  /*
5558
5571
  <- TODO: [🧠][🪑] `promptbookVersion` */
5559
5572
  knowledgeSources /*
5560
5573
  <- TODO: [🧊] `knowledgePieces` */, personas /*
5561
- <- TODO: [🧊] `preparations` */, _llms, llmTools, llmToolsWithUsage, currentPreparation, preparations, preparedPersonas, knowledgeSourcesPrepared, partialknowledgePiecesPrepared, knowledgePiecesPrepared, templatesPrepared /* TODO: parameters: parametersPrepared*/;
5574
+ <- TODO: [🧊] `preparations` */, _llms, llmTools, llmToolsWithUsage, currentPreparation, preparations, preparedPersonas, knowledgeSourcesPrepared, partialknowledgePiecesPrepared, knowledgePiecesPrepared, tasksPrepared /* TODO: parameters: parametersPrepared*/;
5562
5575
  var _this = this;
5563
5576
  return __generator(this, function (_c) {
5564
5577
  switch (_c.label) {
@@ -5567,7 +5580,7 @@
5567
5580
  return [2 /*return*/, pipeline];
5568
5581
  }
5569
5582
  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;
5570
- parameters = pipeline.parameters, templates = pipeline.templates, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
5583
+ parameters = pipeline.parameters, tasks = pipeline.tasks, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
5571
5584
  if (tools === undefined || tools.llm === undefined) {
5572
5585
  throw new MissingToolsError('LLM tools are required for preparing the pipeline');
5573
5586
  }
@@ -5610,9 +5623,9 @@
5610
5623
  case 2:
5611
5624
  partialknowledgePiecesPrepared = _c.sent();
5612
5625
  knowledgePiecesPrepared = partialknowledgePiecesPrepared.map(function (piece) { return (__assign(__assign({}, piece), { preparationIds: [/* TODO: [🧊] -> */ currentPreparation.id] })); });
5613
- return [4 /*yield*/, prepareTemplates({
5626
+ return [4 /*yield*/, prepareTasks({
5614
5627
  parameters: parameters,
5615
- templates: templates,
5628
+ tasks: tasks,
5616
5629
  knowledgePiecesCount: knowledgePiecesPrepared.length,
5617
5630
  }, __assign(__assign({}, tools), { llm: llmToolsWithUsage }), {
5618
5631
  rootDirname: rootDirname,
@@ -5620,12 +5633,12 @@
5620
5633
  isVerbose: isVerbose,
5621
5634
  })];
5622
5635
  case 3:
5623
- templatesPrepared = (_c.sent()).templatesPrepared;
5636
+ tasksPrepared = (_c.sent()).tasksPrepared;
5624
5637
  // ----- /Templates preparation -----
5625
5638
  // Note: Count total usage
5626
5639
  currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
5627
- return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { templates: __spreadArray([], __read(templatesPrepared), false),
5628
- // <- TODO: [🪓] Here should be no need for spreading new array, just ` templates: templatesPrepared`
5640
+ return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { tasks: __spreadArray([], __read(tasksPrepared), false),
5641
+ // <- TODO: [🪓] Here should be no need for spreading new array, just ` tasks: tasksPrepared`
5629
5642
  knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: __spreadArray([], __read(preparations), false) }))];
5630
5643
  }
5631
5644
  });
@@ -5655,7 +5668,7 @@
5655
5668
  * BOILERPLATE command can be used in:
5656
5669
  */
5657
5670
  isUsedInPipelineHead: true,
5658
- isUsedInPipelineTemplate: false,
5671
+ isUsedInPipelineTask: false,
5659
5672
  /**
5660
5673
  * Description of the KNOWLEDGE command
5661
5674
  */
@@ -5733,36 +5746,36 @@
5733
5746
  */
5734
5747
 
5735
5748
  /**
5736
- * Template type describes the way how the template is templated
5749
+ * Section type describes the way how the section is sectiond
5737
5750
  *
5738
- * @see https://github.com/webgptorg/promptbook#template-type
5739
5751
  * @public exported from `@promptbook/core`
5740
5752
  */
5741
- var TemplateTypes = [
5742
- 'PROMPT_TEMPLATE',
5743
- 'SIMPLE_TEMPLATE',
5744
- 'SCRIPT_TEMPLATE',
5745
- 'DIALOG_TEMPLATE',
5753
+ var SectionTypes = [
5754
+ 'PROMPT_TASK',
5755
+ 'SIMPLE_TASK',
5756
+ 'SCRIPT_TASK',
5757
+ 'DIALOG_TASK',
5746
5758
  'EXAMPLE',
5747
5759
  'KNOWLEDGE',
5748
5760
  'INSTRUMENT',
5749
5761
  'ACTION',
5750
5762
  // <- [🅱]
5751
5763
  ];
5764
+ // <- TODO: !!!!!! Make alongside `SectionType` the `TaskType`, `TaskType` + [⛱] and ACRY
5752
5765
 
5753
5766
  /**
5754
- * Parses the template command
5767
+ * Parses the section command
5755
5768
  *
5756
5769
  * @see `documentationUrl` for more details
5757
5770
  * @private within the commands folder
5758
5771
  */
5759
- var templateCommandParser = {
5772
+ var sectionCommandParser = {
5760
5773
  /**
5761
5774
  * Name of the command
5762
5775
  */
5763
- name: 'TEMPLATE',
5776
+ name: 'SECTION',
5764
5777
  /**
5765
- * Aliases for the TEMPLATE command
5778
+ * Aliases for the SECTION command
5766
5779
  */
5767
5780
  aliasNames: [
5768
5781
  'PROMPT',
@@ -5776,24 +5789,24 @@
5776
5789
  'ACTION', // <- Note: [⛱]
5777
5790
  ],
5778
5791
  /**
5779
- * Aliases for the TEMPLATE command
5792
+ * Aliases for the SECTION command
5780
5793
  */
5781
- deprecatedNames: ['BLOCK', 'EXECUTE'],
5794
+ deprecatedNames: ['TEMPLATE', 'BLOCK', 'EXECUTE'],
5782
5795
  /**
5783
5796
  * BOILERPLATE command can be used in:
5784
5797
  */
5785
5798
  isUsedInPipelineHead: false,
5786
- isUsedInPipelineTemplate: true,
5799
+ isUsedInPipelineTask: true,
5787
5800
  /**
5788
- * Description of the TEMPLATE command
5801
+ * Description of the SECTION command
5789
5802
  */
5790
- description: "What should the code template template do",
5803
+ description: "Defines the purpose of the markdown section - if its a task and which type or something else",
5791
5804
  /**
5792
5805
  * Link to documentation
5793
5806
  */
5794
5807
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/64',
5795
5808
  /**
5796
- * Example usages of the TEMPLATE command
5809
+ * Example usages of the SECTION command
5797
5810
  */
5798
5811
  examples: [
5799
5812
  // Short form:
@@ -5808,101 +5821,100 @@
5808
5821
  'ACTION',
5809
5822
  // -----------------
5810
5823
  // Recommended (reversed) form:
5811
- 'PROMPT TEMPLATE',
5812
- 'SIMPLE TEMPLATE',
5813
- 'SCRIPT TEMPLATE',
5814
- 'DIALOG TEMPLATE',
5824
+ 'PROMPT SECTION',
5825
+ 'SIMPLE SECTION',
5826
+ 'SCRIPT SECTION',
5827
+ 'DIALOG SECTION',
5815
5828
  // <- [🅱]
5816
- 'SAMPLE TEMPLATE',
5817
- 'KNOWLEDGE TEMPLATE',
5818
- 'INSTRUMENT TEMPLATE',
5819
- 'ACTION TEMPLATE',
5829
+ 'EXAMPLE SECTION',
5830
+ 'KNOWLEDGE SECTION',
5831
+ 'INSTRUMENT SECTION',
5832
+ 'ACTION SECTION',
5820
5833
  // -----------------
5821
5834
  // Standard form:
5822
- 'TEMPLATE PROMPT',
5823
- 'TEMPLATE SIMPLE',
5824
- 'TEMPLATE SCRIPT',
5825
- 'TEMPLATE DIALOG',
5835
+ 'SECTION PROMPT',
5836
+ 'SECTION SIMPLE',
5837
+ 'SECTION SCRIPT',
5838
+ 'SECTION DIALOG',
5826
5839
  // <- [🅱]
5827
- 'SAMPLE TEMPLATE',
5828
- 'KNOWLEDGE TEMPLATE',
5829
- 'INSTRUMENT TEMPLATE',
5830
- 'ACTION TEMPLATE',
5840
+ 'SECTION EXAMPLE',
5841
+ 'SECTION KNOWLEDGE',
5842
+ 'SECTION INSTRUMENT',
5843
+ 'SECTION ACTION',
5831
5844
  ],
5832
5845
  // TODO: [♓️] order: -10 /* <- Note: Putting before other commands */
5833
5846
  /**
5834
- * Parses the TEMPLATE command
5847
+ * Parses the SECTION command
5835
5848
  */
5836
5849
  parse: function (input) {
5837
5850
  var normalized = input.normalized;
5838
5851
  normalized = normalized.split('SAMPLE').join('EXAMPLE');
5839
- var templateTypes = TemplateTypes.filter(function (templateType) {
5840
- return normalized.includes(templateType.split('_TEMPLATE').join(''));
5841
- });
5842
- if (templateTypes.length !== 1) {
5843
- throw new ParseError(spaceTrim__default["default"](function (template) { return "\n Unknown template type in TEMPLATE command\n\n Supported template types are:\n ".concat(template(TemplateTypes.join(', ')), "\n "); }));
5852
+ normalized = normalized.split('EXECUTE_').join('');
5853
+ var taskTypes = SectionTypes.filter(function (taskType) { return normalized.includes(taskType.split('_TASK').join('')); });
5854
+ if (taskTypes.length !== 1) {
5855
+ throw new ParseError(spaceTrim__default["default"](function (block) { return "\n Unknown section type \"".concat(normalized, "\"\n\n Supported section types are:\n ").concat(block(SectionTypes.join(', ')), "\n "); }));
5844
5856
  }
5845
- var templateType = templateTypes[0];
5857
+ var taskType = taskTypes[0];
5846
5858
  return {
5847
- type: 'TEMPLATE',
5848
- templateType: templateType,
5859
+ type: 'SECTION',
5860
+ taskType: taskType,
5849
5861
  };
5850
5862
  },
5851
5863
  /**
5852
- * Apply the TEMPLATE command to the `pipelineJson`
5864
+ * Apply the SECTION command to the `pipelineJson`
5853
5865
  *
5854
- * Note: `$` is used to indicate that this function mutates given `templateJson`
5866
+ * Note: `$` is used to indicate that this function mutates given `taskJson`
5855
5867
  */
5856
- $applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
5857
- if ($templateJson.isTemplateTypeSet === true) {
5858
- throw new ParseError(spaceTrim__default["default"]("\n Template type is already defined in the template.\n It can be defined only once.\n "));
5868
+ $applyToTaskJson: function (command, $taskJson, $pipelineJson) {
5869
+ if ($taskJson.isSectionTypeSet === true) {
5870
+ throw new ParseError(spaceTrim__default["default"]("\n Section type is already defined in the section.\n It can be defined only once.\n "));
5859
5871
  }
5860
- $templateJson.isTemplateTypeSet = true;
5872
+ $taskJson.isSectionTypeSet = true;
5861
5873
  // TODO: [🍧] Rearrange better - but at bottom and unwrap from function
5862
5874
  var expectResultingParameterName = function () {
5863
- if ($templateJson.resultingParameterName) {
5875
+ if ($taskJson.resultingParameterName) {
5864
5876
  return;
5865
5877
  }
5866
- throw new ParseError(" Template section must end with -> {parameterName}");
5878
+ throw new ParseError("Task section and example section must end with return statement -> {parameterName}");
5867
5879
  };
5868
- if ($templateJson.content === undefined) {
5869
- throw new UnexpectedError("Content is missing in the templateJson - probbably commands are applied in wrong order");
5880
+ if ($taskJson.content === undefined) {
5881
+ throw new UnexpectedError("Content is missing in the taskJson - probbably commands are applied in wrong order");
5870
5882
  }
5871
- if (command.templateType === 'EXAMPLE') {
5883
+ if (command.taskType === 'EXAMPLE') {
5872
5884
  expectResultingParameterName();
5873
- var parameter = $pipelineJson.parameters.find(function (param) { return param.name === $templateJson.resultingParameterName; });
5885
+ var parameter = $pipelineJson.parameters.find(function (param) { return param.name === $taskJson.resultingParameterName; });
5874
5886
  if (parameter === undefined) {
5875
- throw new ParseError("Can not find parameter {".concat($templateJson.resultingParameterName, "} to assign example value on it"));
5887
+ throw new ParseError("Can not find parameter {".concat($taskJson.resultingParameterName, "} to assign example value on it"));
5876
5888
  }
5877
5889
  parameter.exampleValues = parameter.exampleValues || [];
5878
- parameter.exampleValues.push($templateJson.content);
5879
- $templateJson.isTemplate = false;
5890
+ parameter.exampleValues.push($taskJson.content);
5891
+ $taskJson.isTask = false;
5880
5892
  return;
5881
5893
  }
5882
- if (command.templateType === 'KNOWLEDGE') {
5894
+ if (command.taskType === 'KNOWLEDGE') {
5883
5895
  knowledgeCommandParser.$applyToPipelineJson({
5884
5896
  type: 'KNOWLEDGE',
5885
- sourceContent: $templateJson.content, // <- TODO: [🐝][main] !!! Work with KNOWLEDGE which not referring to the source file or website, but its content itself
5897
+ sourceContent: $taskJson.content, // <- TODO: [🐝][main] !!! Work with KNOWLEDGE which not referring to the source file or website, but its content itself
5886
5898
  }, $pipelineJson);
5887
- $templateJson.isTemplate = false;
5899
+ $taskJson.isTask = false;
5888
5900
  return;
5889
5901
  }
5890
- if (command.templateType === 'ACTION') {
5902
+ if (command.taskType === 'ACTION') {
5891
5903
  console.error(new NotYetImplementedError('Actions are not implemented yet'));
5892
- $templateJson.isTemplate = false;
5904
+ $taskJson.isTask = false;
5893
5905
  return;
5894
5906
  }
5895
- if (command.templateType === 'INSTRUMENT') {
5907
+ if (command.taskType === 'INSTRUMENT') {
5896
5908
  console.error(new NotYetImplementedError('Instruments are not implemented yet'));
5897
- $templateJson.isTemplate = false;
5909
+ $taskJson.isTask = false;
5898
5910
  return;
5899
5911
  }
5900
5912
  expectResultingParameterName();
5901
- $templateJson.templateType = command.templateType;
5902
- $templateJson.isTemplate = true;
5913
+ $taskJson.taskType = command.taskType;
5914
+ $taskJson.isTask = true;
5903
5915
  },
5904
5916
  /**
5905
- * Converts the TEMPLATE command back to string
5917
+ * Converts the SECTION command back to string
5906
5918
  *
5907
5919
  * Note: This is used in `pipelineJsonToString` utility
5908
5920
  */
@@ -5910,11 +5922,11 @@
5910
5922
  return "---"; // <- TODO: [🛋] Implement
5911
5923
  },
5912
5924
  /**
5913
- * Reads the TEMPLATE command from the `TemplateJson`
5925
+ * Reads the SECTION command from the `TaskJson`
5914
5926
  *
5915
5927
  * Note: This is used in `pipelineJsonToString` utility
5916
5928
  */
5917
- takeFromTemplateJson: function ($templateJson) {
5929
+ takeFromTaskJson: function ($taskJson) {
5918
5930
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
5919
5931
  },
5920
5932
  };
@@ -5922,8 +5934,8 @@
5922
5934
  * Note: [⛱] There are two types of KNOWLEDGE, ACTION and INSTRUMENT commands:
5923
5935
  * 1) There are commands `KNOWLEDGE`, `ACTION` and `INSTRUMENT` used in the pipeline head, they just define the knowledge, action or instrument as single line after the command
5924
5936
  * - KNOWLEDGE Look at https://en.wikipedia.org/wiki/Artificial_intelligence
5925
- * 2) `KNOWLEDGE TEMPLATE` which has short form `KNOWLEDGE` is used in the template, does not refer the line itself, but the content of the template
5926
- * - KNOWLEDGE TEMPLATE
5937
+ * 2) `KNOWLEDGE SECTION` which has short form `KNOWLEDGE` is used in the sectiom, does not refer the line itself, but the content of the section block
5938
+ * - KNOWLEDGE SECTION
5927
5939
  *
5928
5940
  * ```
5929
5941
  * Look at https://en.wikipedia.org/wiki/Artificial_intelligence
@@ -5951,7 +5963,7 @@
5951
5963
  * BOILERPLATE command can be used in:
5952
5964
  */
5953
5965
  isUsedInPipelineHead: true,
5954
- isUsedInPipelineTemplate: true,
5966
+ isUsedInPipelineTask: true,
5955
5967
  /**
5956
5968
  * Description of the BOILERPLATE command
5957
5969
  */
@@ -5992,9 +6004,9 @@
5992
6004
  /**
5993
6005
  * Apply the BOILERPLATE command to the `pipelineJson`
5994
6006
  *
5995
- * Note: `$` is used to indicate that this function mutates given `templateJson`
6007
+ * Note: `$` is used to indicate that this function mutates given `taskJson`
5996
6008
  */
5997
- $applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
6009
+ $applyToTaskJson: function (command, $taskJson, $pipelineJson) {
5998
6010
  throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
5999
6011
  },
6000
6012
  /**
@@ -6014,11 +6026,11 @@
6014
6026
  throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
6015
6027
  },
6016
6028
  /**
6017
- * Reads the BOILERPLATE command from the `TemplateJson`
6029
+ * Reads the BOILERPLATE command from the `TaskJson`
6018
6030
  *
6019
6031
  * Note: This is used in `pipelineJsonToString` utility
6020
6032
  */
6021
- takeFromTemplateJson: function ($templateJson) {
6033
+ takeFromTaskJson: function ($taskJson) {
6022
6034
  throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
6023
6035
  },
6024
6036
  };
@@ -6039,7 +6051,7 @@
6039
6051
  * BOILERPLATE command can be used in:
6040
6052
  */
6041
6053
  isUsedInPipelineHead: true,
6042
- isUsedInPipelineTemplate: false,
6054
+ isUsedInPipelineTask: false,
6043
6055
  /**
6044
6056
  * Description of the BOOK_VERSION command
6045
6057
  */
@@ -6193,7 +6205,7 @@
6193
6205
  * BOILERPLATE command can be used in:
6194
6206
  */
6195
6207
  isUsedInPipelineHead: false,
6196
- isUsedInPipelineTemplate: true,
6208
+ isUsedInPipelineTask: true,
6197
6209
  /**
6198
6210
  * Description of the FORMAT command
6199
6211
  */
@@ -6289,24 +6301,24 @@
6289
6301
  /**
6290
6302
  * Apply the FORMAT command to the `pipelineJson`
6291
6303
  *
6292
- * Note: `$` is used to indicate that this function mutates given `templateJson`
6304
+ * Note: `$` is used to indicate that this function mutates given `taskJson`
6293
6305
  */
6294
- $applyToTemplateJson: function (command, $templateJson) {
6306
+ $applyToTaskJson: function (command, $taskJson) {
6295
6307
  // eslint-disable-next-line no-case-declarations
6296
6308
  var unit = command.unit.toLowerCase();
6297
- $templateJson.expectations = $templateJson.expectations || {};
6298
- $templateJson.expectations[unit] = $templateJson.expectations[unit] || {};
6309
+ $taskJson.expectations = $taskJson.expectations || {};
6310
+ $taskJson.expectations[unit] = $taskJson.expectations[unit] || {};
6299
6311
  if (command.sign === 'MINIMUM' || command.sign === 'EXACTLY') {
6300
- if ($templateJson.expectations[unit].min !== undefined) {
6301
- throw new ParseError("Already defined minumum ".concat($templateJson.expectations[unit].min, " ").concat(command.unit.toLowerCase(), ", now trying to redefine it to ").concat(command.amount));
6312
+ if ($taskJson.expectations[unit].min !== undefined) {
6313
+ throw new ParseError("Already defined minumum ".concat($taskJson.expectations[unit].min, " ").concat(command.unit.toLowerCase(), ", now trying to redefine it to ").concat(command.amount));
6302
6314
  }
6303
- $templateJson.expectations[unit].min = command.amount;
6315
+ $taskJson.expectations[unit].min = command.amount;
6304
6316
  } /* not else */
6305
6317
  if (command.sign === 'MAXIMUM' || command.sign === 'EXACTLY') {
6306
- if ($templateJson.expectations[unit].max !== undefined) {
6307
- throw new ParseError("Already defined maximum ".concat($templateJson.expectations[unit].max, " ").concat(command.unit.toLowerCase(), ", now trying to redefine it to ").concat(command.amount));
6318
+ if ($taskJson.expectations[unit].max !== undefined) {
6319
+ throw new ParseError("Already defined maximum ".concat($taskJson.expectations[unit].max, " ").concat(command.unit.toLowerCase(), ", now trying to redefine it to ").concat(command.amount));
6308
6320
  }
6309
- $templateJson.expectations[unit].max = command.amount;
6321
+ $taskJson.expectations[unit].max = command.amount;
6310
6322
  }
6311
6323
  },
6312
6324
  /**
@@ -6318,11 +6330,11 @@
6318
6330
  return "---"; // <- TODO: [🛋] Implement
6319
6331
  },
6320
6332
  /**
6321
- * Reads the FORMAT command from the `TemplateJson`
6333
+ * Reads the FORMAT command from the `TaskJson`
6322
6334
  *
6323
6335
  * Note: This is used in `pipelineJsonToString` utility
6324
6336
  */
6325
- takeFromTemplateJson: function ($templateJson) {
6337
+ takeFromTaskJson: function ($taskJson) {
6326
6338
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
6327
6339
  },
6328
6340
  };
@@ -6529,7 +6541,7 @@
6529
6541
  * FOREACH command can be used in:
6530
6542
  */
6531
6543
  isUsedInPipelineHead: false,
6532
- isUsedInPipelineTemplate: true,
6544
+ isUsedInPipelineTask: true,
6533
6545
  /**
6534
6546
  * Description of the FOREACH command
6535
6547
  */
@@ -6628,13 +6640,13 @@
6628
6640
  /**
6629
6641
  * Apply the FOREACH command to the `pipelineJson`
6630
6642
  *
6631
- * Note: `$` is used to indicate that this function mutates given `templateJson`
6643
+ * Note: `$` is used to indicate that this function mutates given `taskJson`
6632
6644
  */
6633
- $applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
6645
+ $applyToTaskJson: function (command, $taskJson, $pipelineJson) {
6634
6646
  var formatName = command.formatName, subformatName = command.subformatName, parameterName = command.parameterName, inputSubparameterNames = command.inputSubparameterNames, outputSubparameterName = command.outputSubparameterName;
6635
6647
  // TODO: [🍭] Detect double use
6636
6648
  // TODO: [🍭] Detect usage with JOKER and don't allow it
6637
- $templateJson.foreach = {
6649
+ $taskJson.foreach = {
6638
6650
  formatName: formatName,
6639
6651
  subformatName: subformatName,
6640
6652
  parameterName: parameterName,
@@ -6652,11 +6664,11 @@
6652
6664
  return "---"; // <- TODO: [🛋] Implement
6653
6665
  },
6654
6666
  /**
6655
- * Reads the FOREACH command from the `TemplateJson`
6667
+ * Reads the FOREACH command from the `TaskJson`
6656
6668
  *
6657
6669
  * Note: This is used in `pipelineJsonToString` utility
6658
6670
  */
6659
- takeFromTemplateJson: function ($templateJson) {
6671
+ takeFromTaskJson: function ($taskJson) {
6660
6672
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
6661
6673
  },
6662
6674
  };
@@ -6679,7 +6691,7 @@
6679
6691
  * BOILERPLATE command can be used in:
6680
6692
  */
6681
6693
  isUsedInPipelineHead: false,
6682
- isUsedInPipelineTemplate: true,
6694
+ isUsedInPipelineTask: true,
6683
6695
  /**
6684
6696
  * Description of the FORMAT command
6685
6697
  */
@@ -6710,13 +6722,13 @@
6710
6722
  /**
6711
6723
  * Apply the FORMAT command to the `pipelineJson`
6712
6724
  *
6713
- * Note: `$` is used to indicate that this function mutates given `templateJson`
6725
+ * Note: `$` is used to indicate that this function mutates given `taskJson`
6714
6726
  */
6715
- $applyToTemplateJson: function (command, $templateJson) {
6716
- if ($templateJson.format !== undefined && command.format !== $templateJson.format) {
6717
- throw new ParseError("Format format is already defined to \"".concat($templateJson.format, "\".\n Now you try to redefine it by \"").concat(command.format, "\""));
6727
+ $applyToTaskJson: function (command, $taskJson) {
6728
+ if ($taskJson.format !== undefined && command.format !== $taskJson.format) {
6729
+ throw new ParseError("Format format is already defined to \"".concat($taskJson.format, "\".\n Now you try to redefine it by \"").concat(command.format, "\""));
6718
6730
  }
6719
- $templateJson.format = command.format;
6731
+ $taskJson.format = command.format;
6720
6732
  },
6721
6733
  /**
6722
6734
  * Converts the FORMAT command back to string
@@ -6727,11 +6739,11 @@
6727
6739
  return "---"; // <- TODO: [🛋] Implement
6728
6740
  },
6729
6741
  /**
6730
- * Reads the FORMAT command from the `TemplateJson`
6742
+ * Reads the FORMAT command from the `TaskJson`
6731
6743
  *
6732
6744
  * Note: This is used in `pipelineJsonToString` utility
6733
6745
  */
6734
- takeFromTemplateJson: function ($templateJson) {
6746
+ takeFromTaskJson: function ($taskJson) {
6735
6747
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
6736
6748
  },
6737
6749
  };
@@ -6741,16 +6753,16 @@
6741
6753
  *
6742
6754
  * @public exported from `@promptbook/core`
6743
6755
  */
6744
- var ChatFormfactorDefinition = {
6756
+ var ChatbotFormfactorDefinition = {
6745
6757
  name: 'CHATBOT',
6746
6758
  aliasNames: ['CHAT'],
6747
6759
  description: "@@@",
6748
- documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
6760
+ documentationUrl: "https://github.com/webgptorg/promptbook/discussions/174",
6749
6761
  pipelineInterface: {
6750
6762
  inputParameterNames: ['previousTitle', 'previousConversationSummary', 'userMessage'],
6751
6763
  outputParameterNames: ['title', 'conversationSummary', 'chatbotResponse'],
6752
6764
  /*
6753
- <- TODO: !!!!!! Change to
6765
+ <- TODO: !!!!!! Change to full interfaces
6754
6766
 
6755
6767
  - INPUT PARAMETER `{previousTitle}` Previous title of the conversation
6756
6768
  - INPUT PARAMETER `{previousConversationSummary}` Previous conversation summary
@@ -6766,12 +6778,17 @@
6766
6778
  /**
6767
6779
  * @@@
6768
6780
  *
6781
+ * @see https://github.com/webgptorg/promptbook/discussions/171
6782
+ *
6769
6783
  * @public exported from `@promptbook/core`
6770
6784
  */
6771
6785
  var GENERIC_PIPELINE_INTERFACE = {
6772
6786
  inputParameterNames: [],
6773
6787
  outputParameterNames: [],
6774
6788
  };
6789
+ /**
6790
+ * Note: [💞] Ignore a discrepancy between file name and entity name
6791
+ */
6775
6792
 
6776
6793
  /**
6777
6794
  * @@@
@@ -6781,10 +6798,29 @@
6781
6798
  var GenericFormfactorDefinition = {
6782
6799
  name: 'GENERIC',
6783
6800
  description: "@@@",
6784
- documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
6801
+ documentationUrl: "https://github.com/webgptorg/promptbook/discussions/173",
6785
6802
  pipelineInterface: GENERIC_PIPELINE_INTERFACE,
6786
6803
  };
6787
6804
 
6805
+ /**
6806
+ * Matcher is form of app that @@@
6807
+ *
6808
+ * @public exported from `@promptbook/core`
6809
+ */
6810
+ var MatcherFormfactorDefinition = {
6811
+ name: 'EXPERIMENTAL_MATCHER',
6812
+ description: "@@@",
6813
+ documentationUrl: "https://github.com/webgptorg/promptbook/discussions/177",
6814
+ pipelineInterface: {
6815
+ inputParameterNames: [
6816
+ /* @@@ */
6817
+ ],
6818
+ outputParameterNames: [
6819
+ /* @@@ */
6820
+ ],
6821
+ },
6822
+ };
6823
+
6788
6824
  /**
6789
6825
  * Sheets is form of app that @@@
6790
6826
  *
@@ -6793,7 +6829,7 @@
6793
6829
  var SheetsFormfactorDefinition = {
6794
6830
  name: 'SHEETS',
6795
6831
  description: "@@@",
6796
- documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
6832
+ documentationUrl: "https://github.com/webgptorg/promptbook/discussions/176",
6797
6833
  pipelineInterface: {
6798
6834
  inputParameterNames: ['inputSheet'],
6799
6835
  outputParameterNames: ['outputSheet'],
@@ -6808,10 +6844,12 @@
6808
6844
  var TranslatorFormfactorDefinition = {
6809
6845
  name: 'TRANSLATOR',
6810
6846
  description: "@@@",
6811
- documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
6847
+ documentationUrl: "https://github.com/webgptorg/promptbook/discussions/175",
6812
6848
  pipelineInterface: {
6813
6849
  inputParameterNames: ['inputMessage'],
6814
6850
  outputParameterNames: ['outputMessage'],
6851
+ // <- TODO: !!!!!! Maybe add {summary}
6852
+ // <- TODO: [🧠] maybe change to {inputText}, {inputText} / or make system for any name of first input and first outpur parameter
6815
6853
  },
6816
6854
  };
6817
6855
 
@@ -6822,10 +6860,14 @@
6822
6860
  */
6823
6861
  var FORMFACTOR_DEFINITIONS = [
6824
6862
  GenericFormfactorDefinition,
6825
- ChatFormfactorDefinition,
6863
+ ChatbotFormfactorDefinition,
6826
6864
  TranslatorFormfactorDefinition,
6827
6865
  SheetsFormfactorDefinition,
6866
+ MatcherFormfactorDefinition,
6828
6867
  ];
6868
+ /**
6869
+ * Note: [💞] Ignore a discrepancy between file name and entity name
6870
+ */
6829
6871
 
6830
6872
  /**
6831
6873
  * Parses the formfactor command
@@ -6848,7 +6890,7 @@
6848
6890
  * FORMFACTOR command can be used in:
6849
6891
  */
6850
6892
  isUsedInPipelineHead: true,
6851
- isUsedInPipelineTemplate: false,
6893
+ isUsedInPipelineTask: false,
6852
6894
  /**
6853
6895
  * Description of the FORMFACTOR command
6854
6896
  */
@@ -6930,7 +6972,7 @@
6930
6972
  * BOILERPLATE command can be used in:
6931
6973
  */
6932
6974
  isUsedInPipelineHead: false,
6933
- isUsedInPipelineTemplate: true,
6975
+ isUsedInPipelineTask: true,
6934
6976
  /**
6935
6977
  * Description of the JOKER command
6936
6978
  */
@@ -6961,11 +7003,11 @@
6961
7003
  /**
6962
7004
  * Apply the JOKER command to the `pipelineJson`
6963
7005
  *
6964
- * Note: `$` is used to indicate that this function mutates given `templateJson`
7006
+ * Note: `$` is used to indicate that this function mutates given `taskJson`
6965
7007
  */
6966
- $applyToTemplateJson: function (command, $templateJson) {
6967
- $templateJson.jokerParameterNames = $templateJson.jokerParameterNames || [];
6968
- $templateJson.jokerParameterNames.push(command.parameterName);
7008
+ $applyToTaskJson: function (command, $taskJson) {
7009
+ $taskJson.jokerParameterNames = $taskJson.jokerParameterNames || [];
7010
+ $taskJson.jokerParameterNames.push(command.parameterName);
6969
7011
  },
6970
7012
  /**
6971
7013
  * Converts the JOKER command back to string
@@ -6976,11 +7018,11 @@
6976
7018
  return "---"; // <- TODO: [🛋] Implement
6977
7019
  },
6978
7020
  /**
6979
- * Reads the JOKER command from the `TemplateJson`
7021
+ * Reads the JOKER command from the `TaskJson`
6980
7022
  *
6981
7023
  * Note: This is used in `pipelineJsonToString` utility
6982
7024
  */
6983
- takeFromTemplateJson: function ($templateJson) {
7025
+ takeFromTaskJson: function ($taskJson) {
6984
7026
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
6985
7027
  },
6986
7028
  };
@@ -7007,11 +7049,11 @@
7007
7049
  * BOILERPLATE command can be used in:
7008
7050
  */
7009
7051
  isUsedInPipelineHead: true,
7010
- isUsedInPipelineTemplate: true,
7052
+ isUsedInPipelineTask: true,
7011
7053
  /**
7012
7054
  * Description of the MODEL command
7013
7055
  */
7014
- description: "Tells which `modelRequirements` (for example which model) to use for the prompt template execution",
7056
+ description: "Tells which `modelRequirements` (for example which model) to use for the prompt task execution",
7015
7057
  /**
7016
7058
  * Link to documentation
7017
7059
  */
@@ -7085,30 +7127,30 @@
7085
7127
  /**
7086
7128
  * Apply the MODEL command to the `pipelineJson`
7087
7129
  *
7088
- * Note: `$` is used to indicate that this function mutates given `templateJson`
7130
+ * Note: `$` is used to indicate that this function mutates given `taskJson`
7089
7131
  */
7090
- $applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
7091
- if ($templateJson.templateType !== 'PROMPT_TEMPLATE') {
7092
- throw new ParseError("MODEL command can only be used in PROMPT_TEMPLATE block");
7132
+ $applyToTaskJson: function (command, $taskJson, $pipelineJson) {
7133
+ if ($taskJson.taskType !== 'PROMPT_TASK') {
7134
+ throw new ParseError("MODEL command can only be used in PROMPT_TASK block");
7093
7135
  }
7094
- $templateJson.modelRequirements = $templateJson.modelRequirements || {};
7136
+ $taskJson.modelRequirements = $taskJson.modelRequirements || {};
7095
7137
  // TODO: [🚜] DRY
7096
- if ($templateJson.modelRequirements[command.key] !== undefined) {
7097
- if ($templateJson.modelRequirements[command.key] === command.value) {
7138
+ if ($taskJson.modelRequirements[command.key] !== undefined) {
7139
+ if ($taskJson.modelRequirements[command.key] === command.value) {
7098
7140
  console.warn("Multiple commands `MODEL ".concat({
7099
7141
  modelName: 'NAME',
7100
7142
  modelVariant: 'VARIANT',
7101
7143
  maxTokens: '???',
7102
- }[command.key], " ").concat(command.value, "` in the template \"").concat($templateJson.title || $templateJson.name, "\""));
7144
+ }[command.key], " ").concat(command.value, "` in the task \"").concat($taskJson.title || $taskJson.name, "\""));
7103
7145
  }
7104
7146
  else {
7105
- throw new ParseError(spaceTrim__default["default"]("\n Redefinition of MODEL `".concat(command.key, "` in the template \"").concat($templateJson.title || $templateJson.name, "\"\n\n You have used:\n - MODEL ").concat(command.key, " ").concat($templateJson.modelRequirements[command.key], "\n - MODEL ").concat(command.key, " ").concat(command.value, "\n ")));
7147
+ throw new ParseError(spaceTrim__default["default"]("\n Redefinition of MODEL `".concat(command.key, "` in the task \"").concat($taskJson.title || $taskJson.name, "\"\n\n You have used:\n - MODEL ").concat(command.key, " ").concat($taskJson.modelRequirements[command.key], "\n - MODEL ").concat(command.key, " ").concat(command.value, "\n ")));
7106
7148
  }
7107
7149
  }
7108
7150
  if (command.value === ($pipelineJson.defaultModelRequirements || {})[command.key]) {
7109
- console.log(spaceTrim__default["default"]("\n Setting MODEL `".concat(command.key, "` in the template \"").concat($templateJson.title || $templateJson.name, "\" to the same value as in the pipeline head\n\n In pipeline head:\n - MODEL ").concat(command.key, " ").concat(($pipelineJson.defaultModelRequirements || {})[command.key], "\n\n But same value is used in the template:\n - MODEL ").concat(command.key, " ").concat(command.value, "\n ")));
7151
+ console.log(spaceTrim__default["default"]("\n Setting MODEL `".concat(command.key, "` in the task \"").concat($taskJson.title || $taskJson.name, "\" to the same value as in the pipeline head\n\n In pipeline head:\n - MODEL ").concat(command.key, " ").concat(($pipelineJson.defaultModelRequirements || {})[command.key], "\n\n But same value is used in the task:\n - MODEL ").concat(command.key, " ").concat(command.value, "\n ")));
7110
7152
  }
7111
- $templateJson.modelRequirements[command.key] = command.value;
7153
+ $taskJson.modelRequirements[command.key] = command.value;
7112
7154
  },
7113
7155
  /**
7114
7156
  * Converts the MODEL command back to string
@@ -7127,11 +7169,11 @@
7127
7169
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
7128
7170
  },
7129
7171
  /**
7130
- * Reads the MODEL command from the `TemplateJson`
7172
+ * Reads the MODEL command from the `TaskJson`
7131
7173
  *
7132
7174
  * Note: This is used in `pipelineJsonToString` utility
7133
7175
  */
7134
- takeFromTemplateJson: function ($templateJson) {
7176
+ takeFromTaskJson: function ($taskJson) {
7135
7177
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
7136
7178
  },
7137
7179
  };
@@ -7158,7 +7200,7 @@
7158
7200
  * BOILERPLATE command can be used in:
7159
7201
  */
7160
7202
  isUsedInPipelineHead: true,
7161
- isUsedInPipelineTemplate: true,
7203
+ isUsedInPipelineTask: true,
7162
7204
  /**
7163
7205
  * Description of the PARAMETER command
7164
7206
  */
@@ -7210,9 +7252,9 @@
7210
7252
  /**
7211
7253
  * Apply the PARAMETER command to the `pipelineJson`
7212
7254
  *
7213
- * Note: `$` is used to indicate that this function mutates given `templateJson`
7255
+ * Note: `$` is used to indicate that this function mutates given `taskJson`
7214
7256
  */
7215
- $applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
7257
+ $applyToTaskJson: function (command, $taskJson, $pipelineJson) {
7216
7258
  // Note: [🍣] Do nothing, its application is implemented separately in `pipelineStringToJsonSync`
7217
7259
  },
7218
7260
  /**
@@ -7232,11 +7274,11 @@
7232
7274
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
7233
7275
  },
7234
7276
  /**
7235
- * Reads the PARAMETER command from the `TemplateJson`
7277
+ * Reads the PARAMETER command from the `TaskJson`
7236
7278
  *
7237
7279
  * Note: This is used in `pipelineJsonToString` utility
7238
7280
  */
7239
- takeFromTemplateJson: function ($templateJson) {
7281
+ takeFromTaskJson: function ($taskJson) {
7240
7282
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
7241
7283
  },
7242
7284
  };
@@ -7260,7 +7302,7 @@
7260
7302
  * PERSONA command can be used in:
7261
7303
  */
7262
7304
  isUsedInPipelineHead: true,
7263
- isUsedInPipelineTemplate: true,
7305
+ isUsedInPipelineTask: true,
7264
7306
  /**
7265
7307
  * Description of the PERSONA command
7266
7308
  */
@@ -7299,9 +7341,9 @@
7299
7341
  * Note: `$` is used to indicate that this function mutates given `pipelineJson`
7300
7342
  */
7301
7343
  $applyToPipelineJson: function (command, $pipelineJson) {
7302
- $applyToTemplateJson(command, null, $pipelineJson);
7344
+ $applyToTaskJson(command, null, $pipelineJson);
7303
7345
  },
7304
- $applyToTemplateJson: $applyToTemplateJson,
7346
+ $applyToTaskJson: $applyToTaskJson,
7305
7347
  /**
7306
7348
  * Converts the PERSONA command back to string
7307
7349
  *
@@ -7319,26 +7361,26 @@
7319
7361
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
7320
7362
  },
7321
7363
  /**
7322
- * Reads the PERSONA command from the `TemplateJson`
7364
+ * Reads the PERSONA command from the `TaskJson`
7323
7365
  *
7324
7366
  * Note: This is used in `pipelineJsonToString` utility
7325
7367
  */
7326
- takeFromTemplateJson: function ($templateJson) {
7368
+ takeFromTaskJson: function ($taskJson) {
7327
7369
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
7328
7370
  },
7329
7371
  };
7330
7372
  /**
7331
7373
  * Apply the PERSONA command to the `pipelineJson`
7332
7374
  *
7333
- * Note: `$` is used to indicate that this function mutates given `templateJson`
7375
+ * Note: `$` is used to indicate that this function mutates given `taskJson`
7334
7376
  */
7335
- function $applyToTemplateJson(command, $templateJson, $pipelineJson) {
7377
+ function $applyToTaskJson(command, $taskJson, $pipelineJson) {
7336
7378
  var personaName = command.personaName, personaDescription = command.personaDescription;
7337
- if ($templateJson !== null) {
7338
- if ($templateJson.templateType !== 'PROMPT_TEMPLATE') {
7339
- throw new ParseError("PERSONA command can be used only in PROMPT_TEMPLATE block");
7379
+ if ($taskJson !== null) {
7380
+ if ($taskJson.taskType !== 'PROMPT_TASK') {
7381
+ throw new ParseError("PERSONA command can be used only in PROMPT_TASK block");
7340
7382
  }
7341
- $templateJson.personaName = personaName;
7383
+ $taskJson.personaName = personaName;
7342
7384
  }
7343
7385
  var persona = $pipelineJson.personas.find(function (persona) { return persona.name === personaName; });
7344
7386
  if (persona === undefined) {
@@ -7392,7 +7434,7 @@
7392
7434
  * BOILERPLATE command can be used in:
7393
7435
  */
7394
7436
  isUsedInPipelineHead: false,
7395
- isUsedInPipelineTemplate: true,
7437
+ isUsedInPipelineTask: true,
7396
7438
  /**
7397
7439
  * Description of the POSTPROCESS command
7398
7440
  */
@@ -7430,11 +7472,11 @@
7430
7472
  /**
7431
7473
  * Apply the POSTPROCESS command to the `pipelineJson`
7432
7474
  *
7433
- * Note: `$` is used to indicate that this function mutates given `templateJson`
7475
+ * Note: `$` is used to indicate that this function mutates given `taskJson`
7434
7476
  */
7435
- $applyToTemplateJson: function (command, $templateJson) {
7436
- $templateJson.postprocessingFunctionNames = $templateJson.postprocessingFunctionNames || [];
7437
- $templateJson.postprocessingFunctionNames.push(command.functionName);
7477
+ $applyToTaskJson: function (command, $taskJson) {
7478
+ $taskJson.postprocessingFunctionNames = $taskJson.postprocessingFunctionNames || [];
7479
+ $taskJson.postprocessingFunctionNames.push(command.functionName);
7438
7480
  },
7439
7481
  /**
7440
7482
  * Converts the POSTPROCESS command back to string
@@ -7445,11 +7487,11 @@
7445
7487
  return "---"; // <- TODO: [🛋] Implement
7446
7488
  },
7447
7489
  /**
7448
- * Reads the POSTPROCESS command from the `TemplateJson`
7490
+ * Reads the POSTPROCESS command from the `TaskJson`
7449
7491
  *
7450
7492
  * Note: This is used in `pipelineJsonToString` utility
7451
7493
  */
7452
- takeFromTemplateJson: function ($templateJson) {
7494
+ takeFromTaskJson: function ($taskJson) {
7453
7495
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
7454
7496
  },
7455
7497
  };
@@ -7474,7 +7516,7 @@
7474
7516
  * BOILERPLATE command can be used in:
7475
7517
  */
7476
7518
  isUsedInPipelineHead: true,
7477
- isUsedInPipelineTemplate: false,
7519
+ isUsedInPipelineTask: false,
7478
7520
  /**
7479
7521
  * Description of the URL command
7480
7522
  */
@@ -7570,7 +7612,7 @@
7570
7612
  * ACTION command can be used in:
7571
7613
  */
7572
7614
  isUsedInPipelineHead: true,
7573
- isUsedInPipelineTemplate: false,
7615
+ isUsedInPipelineTask: false,
7574
7616
  /**
7575
7617
  * Description of the ACTION command
7576
7618
  */
@@ -7636,7 +7678,7 @@
7636
7678
  * INSTRUMENT command can be used in:
7637
7679
  */
7638
7680
  isUsedInPipelineHead: true,
7639
- isUsedInPipelineTemplate: false,
7681
+ isUsedInPipelineTask: false,
7640
7682
  /**
7641
7683
  * Description of the INSTRUMENT command
7642
7684
  */
@@ -7693,7 +7735,7 @@
7693
7735
  * @private internal index of `parseCommand`
7694
7736
  */
7695
7737
  var COMMANDS = [
7696
- templateCommandParser,
7738
+ sectionCommandParser,
7697
7739
  expectCommandParser,
7698
7740
  formatCommandParser,
7699
7741
  jokerCommandParser,
@@ -7711,6 +7753,9 @@
7711
7753
  boilerplateCommandParser, // <- TODO: !! Only in development, remove in production
7712
7754
  // <- Note: [♓️] This is the order of the commands in the pipeline, BUT its not used in parsing and before usage maybe it should be done better
7713
7755
  ];
7756
+ /**
7757
+ * Note: [💞] Ignore a discrepancy between file name and entity name
7758
+ */
7714
7759
 
7715
7760
  /**
7716
7761
  * Gets the parser for the command
@@ -7771,7 +7816,7 @@
7771
7816
  normalized = normalized.split('(').join('');
7772
7817
  normalized = normalized.split(')').join('');
7773
7818
  normalized = normalizeTo_SCREAMING_CASE(normalized);
7774
- normalized = normalized.split('DIALOGUE').join('DIALOG');
7819
+ normalized = normalized.split('DIALOGUE').join('DIALOG'); // <- TODO: !!!!!! Move to sectionCommandParser
7775
7820
  var items = raw
7776
7821
  .trim()
7777
7822
  // Note: [🐡]
@@ -7852,12 +7897,12 @@
7852
7897
  var commandName = normalizeTo_SCREAMING_CASE(commandNameRaw);
7853
7898
  var _loop_1 = function (commandParser) {
7854
7899
  // <- Note: [🦦] Its strange that this type assertion is needed
7855
- var name_1 = commandParser.name, isUsedInPipelineHead = commandParser.isUsedInPipelineHead, isUsedInPipelineTemplate = commandParser.isUsedInPipelineTemplate, aliasNames = commandParser.aliasNames, deprecatedNames = commandParser.deprecatedNames, parse = commandParser.parse;
7900
+ var name_1 = commandParser.name, isUsedInPipelineHead = commandParser.isUsedInPipelineHead, isUsedInPipelineTask = commandParser.isUsedInPipelineTask, aliasNames = commandParser.aliasNames, deprecatedNames = commandParser.deprecatedNames, parse = commandParser.parse;
7856
7901
  if (just(false)) ;
7857
7902
  else if (usagePlace === 'PIPELINE_HEAD' && !isUsedInPipelineHead) {
7858
7903
  return "continue";
7859
7904
  }
7860
- else if (usagePlace === 'PIPELINE_TEMPLATE' && !isUsedInPipelineTemplate) {
7905
+ else if (usagePlace === 'PIPELINE_TASK' && !isUsedInPipelineTask) {
7861
7906
  return "continue";
7862
7907
  }
7863
7908
  var names = __spreadArray(__spreadArray([name_1], __read((aliasNames || [])), false), __read((deprecatedNames || [])), false);
@@ -8174,7 +8219,7 @@
8174
8219
  description: undefined /* <- Note: [🍙] Putting here placeholder to keep `description` on top at final JSON */,
8175
8220
  formfactorName: 'GENERIC',
8176
8221
  parameters: [],
8177
- templates: [],
8222
+ tasks: [],
8178
8223
  knowledgeSources: [],
8179
8224
  knowledgePieces: [],
8180
8225
  personas: [],
@@ -8312,10 +8357,10 @@
8312
8357
  if (description_1 === '') {
8313
8358
  description_1 = undefined;
8314
8359
  }
8315
- var $templateJson = {
8316
- isTemplateTypeSet: false,
8317
- isTemplate: true,
8318
- templateType: undefined /* <- Note: [🍙] Putting here placeholder to keep `templateType` on top at final JSON */,
8360
+ var $taskJson = {
8361
+ isSectionTypeSet: false,
8362
+ isTask: true,
8363
+ taskType: undefined /* <- Note: [🍙] Putting here placeholder to keep `taskType` on top at final JSON */,
8319
8364
  name: titleToName(section.title),
8320
8365
  title: section.title,
8321
8366
  description: description_1,
@@ -8327,35 +8372,35 @@
8327
8372
  if (resultingParameterNameMatch &&
8328
8373
  resultingParameterNameMatch.groups !== undefined &&
8329
8374
  resultingParameterNameMatch.groups.resultingParamName !== undefined) {
8330
- $templateJson.resultingParameterName = resultingParameterNameMatch.groups.resultingParamName;
8375
+ $taskJson.resultingParameterName = resultingParameterNameMatch.groups.resultingParamName;
8331
8376
  }
8332
8377
  // TODO: [🥥] Maybe move this logic to `$parseAndApplyPipelineTemplateCommands`
8333
8378
  var commands = listItems_2.map(function (listItem) { return ({
8334
8379
  listItem: listItem,
8335
- command: parseCommand(listItem, 'PIPELINE_TEMPLATE'),
8380
+ command: parseCommand(listItem, 'PIPELINE_TASK'),
8336
8381
  }); });
8337
- // Note: If block type is not set, set it to 'PROMPT_TEMPLATE'
8382
+ // Note: If block type is not set, set it to 'PROMPT_TASK'
8338
8383
  if (commands.some(function (_a) {
8339
8384
  var command = _a.command;
8340
- return command.type === 'TEMPLATE';
8385
+ return command.type === 'SECTION';
8341
8386
  }) === false) {
8342
- templateCommandParser.$applyToTemplateJson({ type: 'TEMPLATE', templateType: 'PROMPT_TEMPLATE' }, $templateJson, $pipelineJson);
8387
+ sectionCommandParser.$applyToTaskJson({ type: 'SECTION', taskType: 'PROMPT_TASK' }, $taskJson, $pipelineJson);
8343
8388
  }
8344
8389
  var _loop_4 = function (listItem, command) {
8345
8390
  var commandParser = getParserForCommand(command);
8346
- if (commandParser.isUsedInPipelineTemplate !== true /* <- Note: [🦦][4] */) {
8391
+ if (commandParser.isUsedInPipelineTask !== true /* <- Note: [🦦][4] */) {
8347
8392
  throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n Command ".concat(command.type, " is not allowed in the template of the promptbook ONLY at the pipeline head\n\n ").concat(block(getPipelineIdentification()), "\n "); })); // <- TODO: [🚞]
8348
8393
  }
8349
8394
  try {
8350
- commandParser.$applyToTemplateJson(
8395
+ commandParser.$applyToTaskJson(
8351
8396
  // <- Note: [🦦] Its strange that this assertion must be here, [🦦][4] should do this assertion implicitelly
8352
- command, $templateJson, $pipelineJson);
8397
+ command, $taskJson, $pipelineJson);
8353
8398
  }
8354
8399
  catch (error) {
8355
8400
  if (!(error instanceof ParseError)) {
8356
8401
  throw error;
8357
8402
  }
8358
- throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n Command ".concat(command.type, " failed to apply to the template\n\n The error:\n ").concat(block(error.message), "\n\n Current state of the template:\n ").concat(block(JSON.stringify($templateJson, null, 4)), "\n <- Maybe wrong order of commands?\n\n Raw command:\n - ").concat(listItem, "\n\n Usage of ").concat(command.type, ":\n ").concat(block(commandParser.examples.map(function (example) { return "- ".concat(example); }).join('\n')), "\n\n ").concat(block(getPipelineIdentification()), "\n "); })); // <- TODO: [🚞]
8403
+ throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n Command ".concat(command.type, " failed to apply to the template\n\n The error:\n ").concat(block(error.message), "\n\n Current state of the template:\n ").concat(block(JSON.stringify($taskJson, null, 4)), "\n <- Maybe wrong order of commands?\n\n Raw command:\n - ").concat(listItem, "\n\n Usage of ").concat(command.type, ":\n ").concat(block(commandParser.examples.map(function (example) { return "- ".concat(example); }).join('\n')), "\n\n ").concat(block(getPipelineIdentification()), "\n "); })); // <- TODO: [🚞]
8359
8404
  }
8360
8405
  if (command.type === 'PARAMETER') {
8361
8406
  defineParam(command);
@@ -8377,19 +8422,18 @@
8377
8422
  finally { if (e_5) throw e_5.error; }
8378
8423
  }
8379
8424
  // TODO: [🍧] Should be done in TEMPLATE command
8380
- if ($templateJson.templateType === 'SCRIPT_TEMPLATE') {
8425
+ if ($taskJson.taskType === 'SCRIPT_TASK') {
8381
8426
  if (!language) {
8382
8427
  throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n You must specify the language of the script in the SCRIPT TEMPLATE\n\n ".concat(block(getPipelineIdentification()), "\n "); }));
8383
8428
  }
8384
8429
  if (!SUPPORTED_SCRIPT_LANGUAGES.includes(language)) {
8385
8430
  throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n Script language ".concat(language, " is not supported.\n\n Supported languages are:\n ").concat(block(SUPPORTED_SCRIPT_LANGUAGES.join(', ')), "\n\n "); }));
8386
8431
  }
8387
- $templateJson.contentLanguage =
8388
- language;
8432
+ $taskJson.contentLanguage = language;
8389
8433
  }
8390
- $templateJson.dependentParameterNames = Array.from(extractParameterNamesFromTemplate($templateJson));
8434
+ $taskJson.dependentParameterNames = Array.from(extractParameterNamesFromTask($taskJson));
8391
8435
  try {
8392
- for (var _q = (e_6 = void 0, __values($templateJson.dependentParameterNames)), _r = _q.next(); !_r.done; _r = _q.next()) {
8436
+ for (var _q = (e_6 = void 0, __values($taskJson.dependentParameterNames)), _r = _q.next(); !_r.done; _r = _q.next()) {
8393
8437
  var parameterName = _r.value;
8394
8438
  // TODO: [🧠] This definition should be made first in the template
8395
8439
  defineParam({
@@ -8410,12 +8454,12 @@
8410
8454
  }
8411
8455
  /*
8412
8456
  // TODO: [🍧] This should be checked in `MODEL` command + better error message
8413
- if ($templateJson.templateType !== 'PROMPT_TEMPLATE' && $templateJson.modelRequirements !== undefined) {
8457
+ if ($taskJson.taskType !== 'PROMPT_TASK' && $taskJson.modelRequirements !== undefined) {
8414
8458
  throw new UnexpectedError(
8415
8459
  spaceTrim(
8416
8460
  (block) => `
8417
8461
  Model requirements are defined for the block type ${
8418
- $templateJson.templateType
8462
+ $taskJson.taskType
8419
8463
  } which is not a PROMPT TEMPLATE
8420
8464
 
8421
8465
  This should be avoided by the \`modelCommandParser\`
@@ -8426,11 +8470,11 @@
8426
8470
  );
8427
8471
  }
8428
8472
  */
8429
- if ($templateJson.isTemplate) {
8430
- delete $templateJson.isTemplateTypeSet;
8431
- delete $templateJson.isTemplate;
8432
- // TODO: [🍙] Maybe do reorder of `$templateJson` here
8433
- $pipelineJson.templates.push($templateJson);
8473
+ if ($taskJson.isTask) {
8474
+ delete $taskJson.isSectionTypeSet;
8475
+ delete $taskJson.isTask;
8476
+ // TODO: [🍙] Maybe do reorder of `$taskJson` here
8477
+ $pipelineJson.tasks.push($taskJson);
8434
8478
  }
8435
8479
  };
8436
8480
  try {
@@ -8452,7 +8496,7 @@
8452
8496
  // Note: 5️⃣ Mark parameters as INPUT if not explicitly set
8453
8497
  if ($pipelineJson.parameters.every(function (parameter) { return !parameter.isInput; })) {
8454
8498
  var _loop_3 = function (parameter) {
8455
- var isThisParameterResulting = $pipelineJson.templates.some(function (template) { return template.resultingParameterName === parameter.name; });
8499
+ var isThisParameterResulting = $pipelineJson.tasks.some(function (template) { return template.resultingParameterName === parameter.name; });
8456
8500
  if (!isThisParameterResulting) {
8457
8501
  parameter.isInput = true;
8458
8502
  }
@@ -8492,13 +8536,13 @@
8492
8536
  }
8493
8537
  // =============================================================
8494
8538
  // Note: 7️⃣ Cleanup of undefined values
8495
- $pipelineJson.templates.forEach(function (templates) {
8539
+ $pipelineJson.tasks.forEach(function (tasks) {
8496
8540
  var e_7, _a;
8497
8541
  try {
8498
- for (var _b = __values(Object.entries(templates)), _c = _b.next(); !_c.done; _c = _b.next()) {
8542
+ for (var _b = __values(Object.entries(tasks)), _c = _b.next(); !_c.done; _c = _b.next()) {
8499
8543
  var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
8500
8544
  if (value === undefined) {
8501
- delete templates[key];
8545
+ delete tasks[key];
8502
8546
  }
8503
8547
  }
8504
8548
  }
@@ -8538,7 +8582,7 @@
8538
8582
  * TODO: Use spaceTrim more effectively
8539
8583
  * TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
8540
8584
  * TODO: [🥞] Not optimal parsing because `splitMarkdownIntoSections` is executed twice with same string, once through `flattenMarkdown` and second directly here
8541
- * TODO: [♈] Probbably move expectations from templates to parameters
8585
+ * TODO: [♈] Probbably move expectations from tasks to parameters
8542
8586
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
8543
8587
  * TODO: [🍙] Make some standard order of json properties
8544
8588
  */
@@ -10721,6 +10765,7 @@
10721
10765
  /**
10722
10766
  * TODO: [🥃][main] !!! Allow `ptbk make` without configuring any llm tools
10723
10767
  * TODO: [0] DRY Javascript and typescript - Maybe make ONLY typescript and for javascript just remove types
10768
+ * Note: [💞] Ignore a discrepancy between file name and entity name
10724
10769
  * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
10725
10770
  * TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
10726
10771
  */
@@ -10769,13 +10814,13 @@
10769
10814
  if (parameter.isInput) {
10770
10815
  return 'input';
10771
10816
  }
10772
- var template = pipelineJson.templates.find(function (template) { return template.resultingParameterName === parameterName; });
10817
+ var template = pipelineJson.tasks.find(function (template) { return template.resultingParameterName === parameterName; });
10773
10818
  if (!template) {
10774
10819
  throw new Error("Could not find template for {".concat(parameterName, "}"));
10775
10820
  }
10776
10821
  return normalizeTo_camelCase('template-' + titleToName(template.title));
10777
10822
  };
10778
- var promptbookMermaid = spaceTrim.spaceTrim(function (block) { return "\n\n %% \uD83D\uDD2E Tip: Open this on GitHub or in the VSCode website to see the Mermaid graph visually\n\n flowchart LR\n subgraph \"".concat(pipelineJson.title, "\"\n\n direction TB\n\n input((Input)):::input\n ").concat(block(pipelineJson.templates
10823
+ var promptbookMermaid = spaceTrim.spaceTrim(function (block) { return "\n\n %% \uD83D\uDD2E Tip: Open this on GitHub or in the VSCode website to see the Mermaid graph visually\n\n flowchart LR\n subgraph \"".concat(pipelineJson.title, "\"\n\n direction TB\n\n input((Input)):::input\n ").concat(block(pipelineJson.tasks
10779
10824
  .flatMap(function (_a) {
10780
10825
  var title = _a.title, dependentParameterNames = _a.dependentParameterNames, resultingParameterName = _a.resultingParameterName;
10781
10826
  return __spreadArray([
@@ -10793,7 +10838,7 @@
10793
10838
  var name = _a.name;
10794
10839
  return "".concat(parameterNameToTemplateName(name), "--\"{").concat(name, "}\"-->output");
10795
10840
  })
10796
- .join('\n')), "\n output((Output)):::output\n\n ").concat(block(pipelineJson.templates
10841
+ .join('\n')), "\n output((Output)):::output\n\n ").concat(block(pipelineJson.tasks
10797
10842
  .map(function (template) {
10798
10843
  var link = linkTemplate(template);
10799
10844
  if (link === null) {
@@ -10832,8 +10877,8 @@
10832
10877
  case 1:
10833
10878
  pipelineJson = _a.sent();
10834
10879
  promptbookMermaid_1 = renderPromptbookMermaid(pipelineJson, {
10835
- linkTemplate: function (template) {
10836
- return { href: "#".concat(template.name), title: template.title };
10880
+ linkTemplate: function (task) {
10881
+ return { href: "#".concat(task.name), title: task.title };
10837
10882
  },
10838
10883
  });
10839
10884
  promptbookMermaidBlock = spaceTrim.spaceTrim(function (block) { return "\n ```mermaid\n ".concat(block(promptbookMermaid_1), "\n ```\n "); });
@@ -10945,20 +10990,11 @@
10945
10990
  }
10946
10991
  /**
10947
10992
  * TODO: [😶] Unite floder listing
10993
+ * Note: [💞] Ignore a discrepancy between file name and entity name
10948
10994
  * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
10949
10995
  * TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
10950
10996
  */
10951
10997
 
10952
- /**
10953
- * Pretty print an embedding vector for logging
10954
- *
10955
- * @public exported from `@promptbook/core`
10956
- */
10957
- function embeddingVectorToString(embeddingVector) {
10958
- var vectorLength = Math.pow(embeddingVector.reduce(function (acc, val) { return acc + Math.pow(val, 2); }, 0), 0.5);
10959
- return "[EmbeddingVector; ".concat(embeddingVector.length, " dimensions; length: ").concat(vectorLength.toFixed(2), "; ").concat(embeddingVector.slice(0, 3).join(', '), "...]");
10960
- }
10961
-
10962
10998
  /**
10963
10999
  * Format either small or big number
10964
11000
  *
@@ -11059,6 +11095,16 @@
11059
11095
  * TODO: [🏛] This can be part of markdown builder
11060
11096
  */
11061
11097
 
11098
+ /**
11099
+ * Pretty print an embedding vector for logging
11100
+ *
11101
+ * @public exported from `@promptbook/core`
11102
+ */
11103
+ function embeddingVectorToString(embeddingVector) {
11104
+ var vectorLength = Math.pow(embeddingVector.reduce(function (acc, val) { return acc + Math.pow(val, 2); }, 0), 0.5);
11105
+ return "[EmbeddingVector; ".concat(embeddingVector.length, " dimensions; length: ").concat(vectorLength.toFixed(2), "; ").concat(embeddingVector.slice(0, 3).join(', '), "...]");
11106
+ }
11107
+
11062
11108
  /**
11063
11109
  * Default options for generating an execution report string
11064
11110
  *
@@ -11206,22 +11252,22 @@
11206
11252
  }
11207
11253
  var _loop_1 = function (promptExecution) {
11208
11254
  executionReportString += '\n\n\n\n' + "## ".concat(promptExecution.prompt.title);
11209
- var templateList = [];
11255
+ var taskList = [];
11210
11256
  // TODO: What if startedAt OR/AND completedAt is not defined?
11211
11257
  var startedAt = moment__default["default"]((_c = (_b = promptExecution.result) === null || _b === void 0 ? void 0 : _b.timing) === null || _c === void 0 ? void 0 : _c.start);
11212
11258
  var completedAt = moment__default["default"]((_e = (_d = promptExecution.result) === null || _d === void 0 ? void 0 : _d.timing) === null || _e === void 0 ? void 0 : _e.complete);
11213
11259
  var duration = moment__default["default"].duration(completedAt.diff(startedAt));
11214
11260
  // Not need here:
11215
- // > templateList.push(`STARTED AT ${moment(startedAt).calendar()}`);
11216
- templateList.push("DURATION ".concat(duration.humanize(MOMENT_ARG_THRESHOLDS)));
11261
+ // > taskList.push(`STARTED AT ${moment(startedAt).calendar()}`);
11262
+ taskList.push("DURATION ".concat(duration.humanize(MOMENT_ARG_THRESHOLDS)));
11217
11263
  if (typeof ((_g = (_f = promptExecution.result) === null || _f === void 0 ? void 0 : _f.usage) === null || _g === void 0 ? void 0 : _g.price) === 'number') {
11218
- templateList.push("COST $".concat(formatNumber(promptExecution.result.usage.price * (1 + taxRate))) +
11264
+ taskList.push("COST $".concat(formatNumber(promptExecution.result.usage.price * (1 + taxRate))) +
11219
11265
  (taxRate !== 0 ? " *(with tax ".concat(taxRate * 100, "%)*") : ''));
11220
11266
  }
11221
11267
  else {
11222
- templateList.push("COST UNKNOWN");
11268
+ taskList.push("COST UNKNOWN");
11223
11269
  }
11224
- executionReportString += '\n\n' + templateList.map(function (header) { return "- ".concat(header); }).join('\n');
11270
+ executionReportString += '\n\n' + taskList.map(function (header) { return "- ".concat(header); }).join('\n');
11225
11271
  /*
11226
11272
  - MODEL VARIANT ${promptExecution.prompt.modelRequirements.modelVariant}
11227
11273
  - MODEL NAME \`${promptExecution.result?.model}\` (requested \`${
@@ -11291,21 +11337,25 @@
11291
11337
  'Path to book file');
11292
11338
  runCommand.option('-r, --reload', "Call LLM models even if same prompt with result is in the cache", false);
11293
11339
  runCommand.option('-v, --verbose', "Is output verbose", false);
11294
- runCommand.option('--no-interactive', "Input is not interactive", false);
11340
+ runCommand.option('--no-interactive', "Input is not interactive, if true you need to pass all the input parameters through --json");
11341
+ runCommand.option('-j, --json <json>', "Pass all or some input parameters as JSON record, if used the output is also returned as JSON");
11295
11342
  runCommand.option('-s, --save-report <path>', "Save report to file");
11296
- // TODO: !!!!!! Implement non-interactive mode - allow to pass input parameters as JSON
11297
- // TODO: !!!!!! JSON output
11298
11343
  runCommand.action(function (filePathRaw, options) { return __awaiter(_this, void 0, void 0, function () {
11299
- var isCacheReloaded, isVerbose, saveReport, prepareAndScrapeOptions, fs, filePath, filePathCandidates, filePathCandidates_1, filePathCandidates_1_1, filePathCandidate, e_1_1, llm, executables, tools, pipelineString, pipeline, error_1, pipelineExecutor, questions, response, inputParameters, result, isSuccessful, errors, warnings, outputParameters, executionReport, executionReportString, _a, _b, error, _c, _d, warning, _e, _f, key, value, separator;
11344
+ var isCacheReloaded, isInteractive, json, isVerbose, saveReport, inputParameters, prepareAndScrapeOptions, fs, filePath, filePathCandidates, filePathCandidates_1, filePathCandidates_1_1, filePathCandidate, e_1_1, llm, executables, tools, pipelineString, pipeline, error_1, pipelineExecutor, questions, response, result, isSuccessful, errors, warnings, outputParameters, executionReport, executionReportString, _a, _b, error, _c, _d, warning, _e, _f, key, value, separator;
11300
11345
  var e_1, _g, _h, e_2, _j, e_3, _k, e_4, _l;
11301
11346
  return __generator(this, function (_m) {
11302
11347
  switch (_m.label) {
11303
11348
  case 0:
11304
- isCacheReloaded = options.reload, options.interactive, isVerbose = options.verbose, saveReport = options.saveReport;
11349
+ isCacheReloaded = options.reload, isInteractive = options.interactive, json = options.json, isVerbose = options.verbose, saveReport = options.saveReport;
11305
11350
  if (saveReport && !saveReport.endsWith('.json') && !saveReport.endsWith('.md')) {
11306
11351
  console.error(colors__default["default"].red("Report file must be .json or .md"));
11307
11352
  return [2 /*return*/, process.exit(1)];
11308
11353
  }
11354
+ inputParameters = {};
11355
+ if (json) {
11356
+ inputParameters = JSON.parse(json);
11357
+ // <- TODO: Maybe check shape of passed JSON and if its valid parameters Record
11358
+ }
11309
11359
  prepareAndScrapeOptions = {
11310
11360
  isVerbose: isVerbose,
11311
11361
  isCacheReloaded: isCacheReloaded,
@@ -11409,7 +11459,7 @@
11409
11459
  if (isVerbose) {
11410
11460
  console.info(colors__default["default"].gray('--- Validating pipeline ---'));
11411
11461
  }
11412
- // TODO: !!!!!! Same try-catch for LogicError
11462
+ // TODO: Same try-catch for LogicError
11413
11463
  validatePipeline(pipeline);
11414
11464
  if (isVerbose) {
11415
11465
  console.info(colors__default["default"].gray('--- Creating executor ---'));
@@ -11429,6 +11479,10 @@
11429
11479
  .filter(function (_a) {
11430
11480
  var isInput = _a.isInput;
11431
11481
  return isInput;
11482
+ })
11483
+ .filter(function (_a) {
11484
+ var name = _a.name;
11485
+ return typeof inputParameters[name] !== 'string';
11432
11486
  })
11433
11487
  .map(function (_a) {
11434
11488
  var name = _a.name, exampleValues = _a.exampleValues;
@@ -11449,10 +11503,45 @@
11449
11503
  // TODO: Maybe use> validate: value => value < 18 ? `Forbidden` : true
11450
11504
  };
11451
11505
  });
11506
+ if (isInteractive === false && questions.length !== 0) {
11507
+ console.error(colors__default["default"].red(spaceTrim__default["default"](function (block) { return "\n When using --no-interactive you need to pass all the input parameters through --json\n\n You are missing:\n ".concat(block(pipeline.parameters
11508
+ .filter(function (_a) {
11509
+ var isInput = _a.isInput;
11510
+ return isInput;
11511
+ })
11512
+ .filter(function (_a) {
11513
+ var parameterName = _a.name;
11514
+ return !questions.some(function (_a) {
11515
+ var questionName = _a.name;
11516
+ return questionName === parameterName;
11517
+ });
11518
+ })
11519
+ .map(function (_a) {
11520
+ var name = _a.name, description = _a.description;
11521
+ return "- **".concat(name, "** ").concat(description);
11522
+ })
11523
+ .join('\n')), "\n\n Example:\n --json '").concat(JSON.stringify(Object.fromEntries(pipeline.parameters
11524
+ .filter(function (_a) {
11525
+ var isInput = _a.isInput;
11526
+ return isInput;
11527
+ })
11528
+ .map(function (_a) {
11529
+ var name = _a.name, exampleValues = _a.exampleValues;
11530
+ return [
11531
+ name,
11532
+ inputParameters[name] || (exampleValues || [])[0] || '...',
11533
+ ];
11534
+ })))
11535
+ .split("'")
11536
+ .join("\\'"), "'\n "); })));
11537
+ return [2 /*return*/, process.exit(1)];
11538
+ }
11452
11539
  return [4 /*yield*/, prompts__default["default"](questions)];
11453
11540
  case 16:
11454
11541
  response = _m.sent();
11455
- inputParameters = response;
11542
+ // <- TODO: [🧠] Change behavior according to the formfactor
11543
+ inputParameters = __assign(__assign({}, inputParameters), response);
11544
+ // TODO: Maybe do some validation of the response (and --json argument which is passed)
11456
11545
  if (isVerbose) {
11457
11546
  console.info(colors__default["default"].gray('--- Executing ---'));
11458
11547
  }
@@ -11489,7 +11578,9 @@
11489
11578
  console.info(colors__default["default"].gray('--- Usage ---'));
11490
11579
  console.info(colors__default["default"].cyan(usageToHuman(result.usage)));
11491
11580
  }
11492
- console.info(colors__default["default"].gray('--- Result ---'));
11581
+ if (json === undefined || isVerbose === true) {
11582
+ console.info(colors__default["default"].gray('--- Result ---'));
11583
+ }
11493
11584
  try {
11494
11585
  // TODO: [🧠] Should be errors or warnings shown first
11495
11586
  for (_a = __values(errors || []), _b = _a.next(); !_b.done; _b = _a.next()) {
@@ -11517,20 +11608,25 @@
11517
11608
  }
11518
11609
  finally { if (e_3) throw e_3.error; }
11519
11610
  }
11520
- try {
11521
- for (_e = __values(Object.keys(outputParameters)), _f = _e.next(); !_f.done; _f = _e.next()) {
11522
- key = _f.value;
11523
- value = outputParameters[key] || colors__default["default"].grey(colors__default["default"].italic('(nothing)'));
11524
- separator = countLines(value) > 1 || countWords(value) > 100 ? ':\n' : ': ';
11525
- console.info(colors__default["default"].green(colors__default["default"].bold(key) + separator + value));
11526
- }
11527
- }
11528
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
11529
- finally {
11611
+ if (json === undefined) {
11530
11612
  try {
11531
- if (_f && !_f.done && (_l = _e.return)) _l.call(_e);
11613
+ for (_e = __values(Object.keys(outputParameters)), _f = _e.next(); !_f.done; _f = _e.next()) {
11614
+ key = _f.value;
11615
+ value = outputParameters[key] || colors__default["default"].grey(colors__default["default"].italic('(nothing)'));
11616
+ separator = countLines(value) > 1 || countWords(value) > 100 ? ':\n' : ': ';
11617
+ console.info(colors__default["default"].green(colors__default["default"].bold(key) + separator + value));
11618
+ }
11619
+ }
11620
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
11621
+ finally {
11622
+ try {
11623
+ if (_f && !_f.done && (_l = _e.return)) _l.call(_e);
11624
+ }
11625
+ finally { if (e_4) throw e_4.error; }
11532
11626
  }
11533
- finally { if (e_4) throw e_4.error; }
11627
+ }
11628
+ else {
11629
+ console.info(JSON.stringify(outputParameters, null, 4));
11534
11630
  }
11535
11631
  return [2 /*return*/, process.exit(0)];
11536
11632
  }
@@ -11541,6 +11637,7 @@
11541
11637
  * TODO: !!!!! Catch and wrap all errors from CLI
11542
11638
  * TODO: [🧠] Pass `maxExecutionAttempts`, `csvSettings`
11543
11639
  * TODO: [🥃][main] !!! Allow `ptbk run` without configuring any llm tools
11640
+ * Note: [💞] Ignore a discrepancy between file name and entity name
11544
11641
  * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
11545
11642
  * TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
11546
11643
  */
@@ -11663,6 +11760,7 @@
11663
11760
  }
11664
11761
  /**
11665
11762
  * TODO: [😶] Unite floder listing
11763
+ * Note: [💞] Ignore a discrepancy between file name and entity name
11666
11764
  * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
11667
11765
  * TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
11668
11766
  * Note: This is named "test-command.ts" to avoid name collision with jest unit test files
@@ -11722,6 +11820,7 @@
11722
11820
  _initialize_promptbookCli: promptbookCli,
11723
11821
  };
11724
11822
  /**
11823
+ * Note: [💞] Ignore a discrepancy between file name and entity name
11725
11824
  * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
11726
11825
  */
11727
11826
 
@@ -11765,6 +11864,9 @@
11765
11864
  return null;
11766
11865
  },
11767
11866
  });
11867
+ /**
11868
+ * Note: [💞] Ignore a discrepancy between file name and entity name
11869
+ */
11768
11870
 
11769
11871
  /**
11770
11872
  * Remote server is a proxy server that uses its execution tools internally and exposes the executor interface externally.
@@ -12063,6 +12165,7 @@
12063
12165
  * TODO: [🧠] Some mechanism to propagate unsureness
12064
12166
  * TODO: [🧠][👮‍♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...
12065
12167
  * TODO: [🎰] Some mechanism to auto-update available models
12168
+ * Note: [💞] Ignore a discrepancy between file name and entity name
12066
12169
  */
12067
12170
 
12068
12171
  /**
@@ -12446,6 +12549,7 @@
12446
12549
  var _AnthropicClaudeRegistration = $llmToolsRegister.register(createAnthropicClaudeExecutionTools);
12447
12550
  /**
12448
12551
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
12552
+ * Note: [💞] Ignore a discrepancy between file name and entity name
12449
12553
  */
12450
12554
 
12451
12555
  /**
@@ -12494,6 +12598,9 @@
12494
12598
  return null;
12495
12599
  },
12496
12600
  });
12601
+ /**
12602
+ * Note: [💞] Ignore a discrepancy between file name and entity name
12603
+ */
12497
12604
 
12498
12605
  /**
12499
12606
  * List of available OpenAI models with pricing
@@ -12891,6 +12998,7 @@
12891
12998
  * TODO: [🍓] Make better
12892
12999
  * TODO: Change model titles to human eg: "gpt-4-turbo-2024-04-09" -> "GPT-4 Turbo (2024-04-09)"
12893
13000
  * TODO: [🚸] Not all models are compatible with JSON mode, add this information here and use it
13001
+ * Note: [💞] Ignore a discrepancy between file name and entity name
12894
13002
  */
12895
13003
 
12896
13004
  /**
@@ -13232,6 +13340,7 @@
13232
13340
  var _AzureOpenAiRegistration = $llmToolsRegister.register(createAzureOpenAiExecutionTools);
13233
13341
  /**
13234
13342
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
13343
+ * Note: [💞] Ignore a discrepancy between file name and entity name
13235
13344
  */
13236
13345
 
13237
13346
  /**
@@ -13313,6 +13422,9 @@
13313
13422
  */
13314
13423
  },
13315
13424
  });
13425
+ /**
13426
+ * Note: [💞] Ignore a discrepancy between file name and entity name
13427
+ */
13316
13428
 
13317
13429
  /**
13318
13430
  * Detects if the code is running in a browser environment in main thread (Not in a web worker)
@@ -13971,6 +14083,7 @@
13971
14083
  var _OpenAiAssistantRegistration = $llmToolsRegister.register(createOpenAiAssistantExecutionTools);
13972
14084
  /**
13973
14085
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
14086
+ * Note: [💞] Ignore a discrepancy between file name and entity name
13974
14087
  */
13975
14088
 
13976
14089
  /**
@@ -14229,6 +14342,9 @@
14229
14342
  * @public exported from `@promptbook/cli`
14230
14343
  */
14231
14344
  var _MarkdownScraperMetadataRegistration = $scrapersMetadataRegister.register(markdownScraperMetadata);
14345
+ /**
14346
+ * Note: [💞] Ignore a discrepancy between file name and entity name
14347
+ */
14232
14348
 
14233
14349
  /**
14234
14350
  * Scraper for markdown files
@@ -14423,6 +14539,9 @@
14423
14539
  * @public exported from `@promptbook/cli`
14424
14540
  */
14425
14541
  var _DocumentScraperMetadataRegistration = $scrapersMetadataRegister.register(documentScraperMetadata);
14542
+ /**
14543
+ * Note: [💞] Ignore a discrepancy between file name and entity name
14544
+ */
14426
14545
 
14427
14546
  /**
14428
14547
  * Scraper of .docx and .odt files
@@ -14587,6 +14706,9 @@
14587
14706
  * @public exported from `@promptbook/cli`
14588
14707
  */
14589
14708
  var _LegacyDocumentScraperMetadataRegistration = $scrapersMetadataRegister.register(legacyDocumentScraperMetadata);
14709
+ /**
14710
+ * Note: [💞] Ignore a discrepancy between file name and entity name
14711
+ */
14590
14712
 
14591
14713
  /**
14592
14714
  * Scraper for old document files (like .doc and .rtf)
@@ -14756,6 +14878,7 @@
14756
14878
  var _LegacyDocumentScraperRegistration = $scrapersRegister.register(createLegacyDocumentScraper);
14757
14879
  /**
14758
14880
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
14881
+ * Note: [💞] Ignore a discrepancy between file name and entity name
14759
14882
  */
14760
14883
 
14761
14884
  /**
@@ -14781,6 +14904,7 @@
14781
14904
  var _DocumentScraperRegistration = $scrapersRegister.register(createDocumentScraper);
14782
14905
  /**
14783
14906
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
14907
+ * Note: [💞] Ignore a discrepancy between file name and entity name
14784
14908
  */
14785
14909
 
14786
14910
  /**
@@ -14806,6 +14930,7 @@
14806
14930
  var _MarkdownScraperRegistration = $scrapersRegister.register(createMarkdownScraper);
14807
14931
  /**
14808
14932
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
14933
+ * Note: [💞] Ignore a discrepancy between file name and entity name
14809
14934
  */
14810
14935
 
14811
14936
  /**
@@ -14831,6 +14956,9 @@
14831
14956
  * @public exported from `@promptbook/cli`
14832
14957
  */
14833
14958
  var _PdfScraperMetadataRegistration = $scrapersMetadataRegister.register(pdfScraperMetadata);
14959
+ /**
14960
+ * Note: [💞] Ignore a discrepancy between file name and entity name
14961
+ */
14834
14962
 
14835
14963
  /**
14836
14964
  * Scraper for .pdf files
@@ -14914,6 +15042,7 @@
14914
15042
  var _PdfScraperRegistration = $scrapersRegister.register(createPdfScraper);
14915
15043
  /**
14916
15044
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
15045
+ * Note: [💞] Ignore a discrepancy between file name and entity name
14917
15046
  */
14918
15047
 
14919
15048
  /**
@@ -14939,6 +15068,9 @@
14939
15068
  * @public exported from `@promptbook/cli`
14940
15069
  */
14941
15070
  var _WebsiteScraperMetadataRegistration = $scrapersMetadataRegister.register(websiteScraperMetadata);
15071
+ /**
15072
+ * Note: [💞] Ignore a discrepancy between file name and entity name
15073
+ */
14942
15074
 
14943
15075
  /**
14944
15076
  * Create a new showdown converter instance
@@ -15111,6 +15243,7 @@
15111
15243
  var _WebsiteScraperRegistration = $scrapersRegister.register(createWebsiteScraper);
15112
15244
  /**
15113
15245
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
15246
+ * Note: [💞] Ignore a discrepancy between file name and entity name
15114
15247
  */
15115
15248
 
15116
15249
  exports.BOOK_LANGUAGE_VERSION = BOOK_LANGUAGE_VERSION;