@promptbook/markdown-utils 0.75.0-2 → 0.75.1

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 (53) hide show
  1. package/README.md +46 -30
  2. package/esm/index.es.js +46 -46
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/core.index.d.ts +16 -4
  5. package/esm/typings/src/_packages/types.index.d.ts +8 -6
  6. package/esm/typings/src/_packages/utils.index.d.ts +2 -0
  7. package/esm/typings/src/commands/EXPECT/ExpectCommand.d.ts +1 -1
  8. package/esm/typings/src/commands/SECTION/SectionCommand.d.ts +1 -1
  9. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +0 -2
  10. package/esm/typings/src/config.d.ts +34 -2
  11. package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
  12. package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +2 -2
  13. package/esm/typings/src/conversion/utils/extractParameterNamesFromTask.d.ts +3 -3
  14. package/esm/typings/src/conversion/utils/renameParameter.d.ts +2 -2
  15. package/esm/typings/src/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +1 -1
  16. package/esm/typings/src/execution/ScriptExecutionTools.d.ts +1 -1
  17. package/esm/typings/src/formfactors/_boilerplate/BoilerplateFormfactorDefinition.d.ts +2 -2
  18. package/esm/typings/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +3 -0
  19. package/esm/typings/src/formfactors/chatbot/ChatbotFormfactorDefinition.d.ts +32 -2
  20. package/esm/typings/src/formfactors/generator/GeneratorFormfactorDefinition.d.ts +14 -0
  21. package/esm/typings/src/formfactors/generic/GenericFormfactorDefinition.d.ts +2 -2
  22. package/esm/typings/src/formfactors/index.d.ts +72 -10
  23. package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +2 -2
  24. package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +12 -2
  25. package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +12 -2
  26. package/esm/typings/src/pipeline/PipelineInterface/PipelineInterface.d.ts +5 -4
  27. package/esm/typings/src/pipeline/PipelineInterface/constants.d.ts +2 -2
  28. package/esm/typings/src/pipeline/PipelineJson/{TaskJsonCommon.d.ts → CommonTaskJson.d.ts} +13 -13
  29. package/esm/typings/src/pipeline/PipelineJson/DialogTaskJson.d.ts +2 -2
  30. package/esm/typings/src/pipeline/PipelineJson/ParameterJson.d.ts +2 -0
  31. package/esm/typings/src/pipeline/PipelineJson/PersonaJson.d.ts +1 -1
  32. package/esm/typings/src/pipeline/PipelineJson/PipelineJson.d.ts +2 -2
  33. package/esm/typings/src/pipeline/PipelineJson/PromptTaskJson.d.ts +2 -2
  34. package/esm/typings/src/pipeline/PipelineJson/ScriptTaskJson.d.ts +2 -2
  35. package/esm/typings/src/pipeline/PipelineJson/SimpleTaskJson.d.ts +2 -2
  36. package/esm/typings/src/pipeline/PipelineJson/TaskJson.d.ts +1 -1
  37. package/esm/typings/src/pipeline/PipelineString.d.ts +1 -1
  38. package/esm/typings/src/prepare/isPipelinePrepared.d.ts +1 -1
  39. package/esm/typings/src/prepare/prepareTasks.d.ts +5 -5
  40. package/esm/typings/src/types/Prompt.d.ts +3 -3
  41. package/esm/typings/src/types/SectionType.d.ts +21 -0
  42. package/esm/typings/src/types/TaskProgress.d.ts +1 -1
  43. package/esm/typings/src/types/TaskType.d.ts +15 -0
  44. package/esm/typings/src/types/typeAliases.d.ts +1 -1
  45. package/esm/typings/src/utils/organization/TODO_remove_as.d.ts +6 -0
  46. package/esm/typings/src/utils/organization/spaceTrim.d.ts +11 -0
  47. package/esm/typings/src/utils/parameters/extractParameterNames.d.ts +1 -1
  48. package/esm/typings/src/version.d.ts +1 -1
  49. package/package.json +1 -1
  50. package/umd/index.umd.js +46 -46
  51. package/umd/index.umd.js.map +1 -1
  52. package/esm/typings/src/commands/SECTION/SectionType.d.ts +0 -13
  53. /package/esm/typings/{promptbook-collection → books}/index.d.ts +0 -0
package/umd/index.umd.js CHANGED
@@ -22,7 +22,7 @@
22
22
  *
23
23
  * @see https://github.com/webgptorg/promptbook
24
24
  */
25
- var PROMPTBOOK_ENGINE_VERSION = '0.75.0-1';
25
+ var PROMPTBOOK_ENGINE_VERSION = '0.75.0';
26
26
  /**
27
27
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
28
28
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -271,7 +271,7 @@
271
271
  function extractOneBlockFromMarkdown(markdown) {
272
272
  var codeBlocks = extractAllBlocksFromMarkdown(markdown);
273
273
  if (codeBlocks.length !== 1) {
274
- throw new ParseError(spaceTrim__default["default"](function (block) { return "\n There should be exactly 1 code block in template, found ".concat(codeBlocks.length, " code blocks\n\n ").concat(block(codeBlocks.map(function (block, i) { return "Block ".concat(i + 1, ":\n").concat(block.content); }).join('\n\n\n')), "\n "); }));
274
+ throw new ParseError(spaceTrim__default["default"](function (block) { return "\n There should be exactly 1 code block in task section, found ".concat(codeBlocks.length, " code blocks\n\n ").concat(block(codeBlocks.map(function (block, i) { return "Block ".concat(i + 1, ":\n").concat(block.content); }).join('\n\n\n')), "\n "); }));
275
275
  }
276
276
  return codeBlocks[0];
277
277
  }
@@ -358,7 +358,7 @@
358
358
  * TODO: [🏢] Make this logic part of `JsonFormatDefinition` or `isValidJsonString`
359
359
  */
360
360
 
361
- 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"}];
361
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./books/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./books/prepare-knowledge-keywords.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./books/prepare-knowledge-title.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",formfactorName:"GENERIC",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./books/prepare-persona.book.md"}];
362
362
 
363
363
  /**
364
364
  * Prettify the html code
@@ -424,7 +424,7 @@
424
424
  return isInput;
425
425
  })), _h = _g.next(); !_h.done; _h = _g.next()) {
426
426
  var parameter = _h.value;
427
- commands.push("INPUT PARAMETER ".concat(templateParameterJsonToString(parameter)));
427
+ commands.push("INPUT PARAMETER ".concat(taskParameterJsonToString(parameter)));
428
428
  }
429
429
  }
430
430
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -440,7 +440,7 @@
440
440
  return isOutput;
441
441
  })), _k = _j.next(); !_k.done; _k = _j.next()) {
442
442
  var parameter = _k.value;
443
- commands.push("OUTPUT PARAMETER ".concat(templateParameterJsonToString(parameter)));
443
+ commands.push("OUTPUT PARAMETER ".concat(taskParameterJsonToString(parameter)));
444
444
  }
445
445
  }
446
446
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -454,12 +454,12 @@
454
454
  pipelineString += commands.map(function (command) { return "- ".concat(command); }).join('\n');
455
455
  try {
456
456
  for (var tasks_1 = __values(tasks), tasks_1_1 = tasks_1.next(); !tasks_1_1.done; tasks_1_1 = tasks_1.next()) {
457
- var template = tasks_1_1.value;
457
+ var task = tasks_1_1.value;
458
458
  var
459
459
  /* Note: Not using:> name, */
460
- title_1 = template.title, description_1 = template.description,
460
+ title_1 = task.title, description_1 = task.description,
461
461
  /* Note: dependentParameterNames, */
462
- jokers = template.jokerParameterNames, taskType = template.taskType, content = template.content, postprocessing = template.postprocessingFunctionNames, expectations = template.expectations, format = template.format, resultingParameterName = template.resultingParameterName;
462
+ jokers = task.jokerParameterNames, taskType = task.taskType, content = task.content, postprocessing = task.postprocessingFunctionNames, expectations = task.expectations, format = task.format, resultingParameterName = task.resultingParameterName;
463
463
  pipelineString += '\n\n';
464
464
  pipelineString += "## ".concat(title_1);
465
465
  if (description_1) {
@@ -469,9 +469,10 @@
469
469
  var commands_1 = [];
470
470
  var contentLanguage = 'text';
471
471
  if (taskType === 'PROMPT_TASK') {
472
- var modelRequirements = template.modelRequirements;
472
+ var modelRequirements = task.modelRequirements;
473
473
  var _l = modelRequirements || {}, modelName = _l.modelName, modelVariant = _l.modelVariant;
474
- commands_1.push("EXECUTE PROMPT TEMPLATE");
474
+ // Note: Do nothing, it is default
475
+ // commands.push(`PROMPT`);
475
476
  if (modelVariant) {
476
477
  commands_1.push("MODEL VARIANT ".concat(capitalize(modelVariant)));
477
478
  }
@@ -484,16 +485,16 @@
484
485
  // Note: Nothing special here
485
486
  }
486
487
  else if (taskType === 'SCRIPT_TASK') {
487
- commands_1.push("SCRIPT TEMPLATE");
488
- if (template.contentLanguage) {
489
- contentLanguage = template.contentLanguage;
488
+ commands_1.push("SCRIPT");
489
+ if (task.contentLanguage) {
490
+ contentLanguage = task.contentLanguage;
490
491
  }
491
492
  else {
492
493
  contentLanguage = '';
493
494
  }
494
495
  }
495
496
  else if (taskType === 'DIALOG_TASK') {
496
- commands_1.push("DIALOG TEMPLATE");
497
+ commands_1.push("DIALOG");
497
498
  // Note: Nothing special here
498
499
  } // <- }else if([🅱]
499
500
  if (jokers) {
@@ -568,7 +569,7 @@
568
569
  pipelineString += '\n';
569
570
  pipelineString += '```';
570
571
  pipelineString += '\n\n';
571
- pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: [main] !!! If the parameter here has description, add it and use templateParameterJsonToString
572
+ pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: [main] !!! If the parameter here has description, add it and use taskParameterJsonToString
572
573
  }
573
574
  }
574
575
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
@@ -583,8 +584,8 @@
583
584
  /**
584
585
  * @private internal utility of `pipelineJsonToString`
585
586
  */
586
- function templateParameterJsonToString(templateParameterJson) {
587
- var name = templateParameterJson.name, description = templateParameterJson.description;
587
+ function taskParameterJsonToString(taskParameterJson) {
588
+ var name = taskParameterJson.name, description = taskParameterJson.description;
588
589
  var parameterString = "{".concat(name, "}");
589
590
  if (description) {
590
591
  parameterString = "".concat(parameterString, " ").concat(description);
@@ -592,7 +593,7 @@
592
593
  return parameterString;
593
594
  }
594
595
  /**
595
- * TODO: [🛋] Implement new features and commands into `pipelineJsonToString` + `templateParameterJsonToString` , use `stringifyCommand`
596
+ * TODO: [🛋] Implement new features and commands into `pipelineJsonToString` + `taskParameterJsonToString` , use `stringifyCommand`
596
597
  * TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
597
598
  * TODO: [🏛] Maybe make some markdown builder
598
599
  * TODO: [🏛] Escape all
@@ -818,7 +819,6 @@
818
819
  * @private within the repository
819
820
  */
820
821
  var GENERATOR_WARNING = "\u26A0\uFE0F WARNING: This code has been generated so that any manual changes will be overwritten";
821
- // <- TODO: [🐊] Pick the best claim
822
822
  /**
823
823
  * When the title is not provided, the default title is used
824
824
  *
@@ -1290,20 +1290,20 @@
1290
1290
  }
1291
1291
  finally { if (e_3) throw e_3.error; }
1292
1292
  }
1293
- var unresovedTemplates = __spreadArray([], __read(pipeline.tasks), false);
1293
+ var unresovedTasks = __spreadArray([], __read(pipeline.tasks), false);
1294
1294
  var loopLimit = LOOP_LIMIT;
1295
1295
  var _loop_3 = function () {
1296
1296
  if (loopLimit-- < 0) {
1297
1297
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
1298
1298
  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 "); }));
1299
1299
  }
1300
- var currentlyResovedTemplates = unresovedTemplates.filter(function (task) {
1300
+ var currentlyResovedTasks = unresovedTasks.filter(function (task) {
1301
1301
  return task.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
1302
1302
  });
1303
- if (currentlyResovedTemplates.length === 0) {
1303
+ if (currentlyResovedTasks.length === 0) {
1304
1304
  throw new PipelineLogicError(
1305
1305
  // TODO: [🐎] DRY
1306
- spaceTrim.spaceTrim(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTemplates
1306
+ spaceTrim.spaceTrim(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTasks
1307
1307
  .map(function (_a) {
1308
1308
  var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
1309
1309
  return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
@@ -1322,13 +1322,13 @@
1322
1322
  .map(function (name) { return "- Parameter `{".concat(name, "}`"); })
1323
1323
  .join('\n')), "\n\n\n "); }));
1324
1324
  }
1325
- resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTemplates.map(function (_a) {
1325
+ resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTasks.map(function (_a) {
1326
1326
  var resultingParameterName = _a.resultingParameterName;
1327
1327
  return resultingParameterName;
1328
1328
  })), false);
1329
- unresovedTemplates = unresovedTemplates.filter(function (task) { return !currentlyResovedTemplates.includes(task); });
1329
+ unresovedTasks = unresovedTasks.filter(function (task) { return !currentlyResovedTasks.includes(task); });
1330
1330
  };
1331
- while (unresovedTemplates.length > 0) {
1331
+ while (unresovedTasks.length > 0) {
1332
1332
  _loop_3();
1333
1333
  }
1334
1334
  // TODO: !!!!!! Test that pipeline interface implements declared formfactor interface
@@ -1390,7 +1390,7 @@
1390
1390
  /**
1391
1391
  * Parses the task and returns the list of all parameter names
1392
1392
  *
1393
- * @param template the task with parameters in {curly} braces
1393
+ * @param template the string template with parameters in {curly} braces
1394
1394
  * @returns the list of parameter names
1395
1395
  * @public exported from `@promptbook/utils`
1396
1396
  */
@@ -1424,13 +1424,13 @@
1424
1424
  var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources, tasks = pipeline.tasks;
1425
1425
  personas = personas.map(function (persona) { return (__assign(__assign({}, persona), { modelRequirements: undefined, preparationIds: undefined })); });
1426
1426
  knowledgeSources = knowledgeSources.map(function (knowledgeSource) { return (__assign(__assign({}, knowledgeSource), { preparationIds: undefined })); });
1427
- tasks = tasks.map(function (template) {
1428
- var dependentParameterNames = template.dependentParameterNames;
1429
- var parameterNames = extractParameterNames(template.preparedContent || '');
1427
+ tasks = tasks.map(function (task) {
1428
+ var dependentParameterNames = task.dependentParameterNames;
1429
+ var parameterNames = extractParameterNames(task.preparedContent || '');
1430
1430
  dependentParameterNames = dependentParameterNames.filter(function (dependentParameterName) { return !parameterNames.has(dependentParameterName); });
1431
- var templateUnprepared = __assign(__assign({}, template), { dependentParameterNames: dependentParameterNames });
1432
- delete templateUnprepared.preparedContent;
1433
- return templateUnprepared;
1431
+ var taskUnprepared = __assign(__assign({}, task), { dependentParameterNames: dependentParameterNames });
1432
+ delete taskUnprepared.preparedContent;
1433
+ return taskUnprepared;
1434
1434
  });
1435
1435
  return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), { tasks: tasks, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }));
1436
1436
  }
@@ -2144,7 +2144,7 @@
2144
2144
  * TODO: [🐠] Maybe base this on `makeValidator`
2145
2145
  * TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
2146
2146
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
2147
- * - [🏍] ? Is context in each template
2147
+ * - [🏍] ? Is context in each task
2148
2148
  * - [♨] Are examples prepared
2149
2149
  * - [♨] Are tasks prepared
2150
2150
  */
@@ -3518,10 +3518,10 @@
3518
3518
  _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a;
3519
3519
  tasks = pipeline.tasks, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
3520
3520
  tasksPrepared = new Array(tasks.length);
3521
- 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 () {
3522
- var dependentParameterNames, preparedContent, preparedTemplate;
3521
+ return [4 /*yield*/, forEachAsync(tasks, { maxParallelCount: maxParallelCount /* <- TODO: [🪂] When there are subtasks, this maximul limit can be broken */ }, function (task, index) { return __awaiter(_this, void 0, void 0, function () {
3522
+ var dependentParameterNames, preparedContent, preparedTask;
3523
3523
  return __generator(this, function (_a) {
3524
- dependentParameterNames = template.dependentParameterNames;
3524
+ dependentParameterNames = task.dependentParameterNames;
3525
3525
  preparedContent = undefined;
3526
3526
  if (knowledgePiecesCount > 0 && !dependentParameterNames.includes('knowledge')) {
3527
3527
  preparedContent = spaceTrim.spaceTrim("\n {content}\n\n ## Knowledge\n\n {knowledge}\n ");
@@ -3530,8 +3530,8 @@
3530
3530
  'knowledge',
3531
3531
  ], false);
3532
3532
  }
3533
- preparedTemplate = __assign(__assign({}, template), { dependentParameterNames: dependentParameterNames, preparedContent: preparedContent });
3534
- tasksPrepared[index] = preparedTemplate;
3533
+ preparedTask = __assign(__assign({}, task), { dependentParameterNames: dependentParameterNames, preparedContent: preparedContent });
3534
+ tasksPrepared[index] = preparedTask;
3535
3535
  return [2 /*return*/];
3536
3536
  });
3537
3537
  }); })];
@@ -3543,8 +3543,8 @@
3543
3543
  });
3544
3544
  }
3545
3545
  /**
3546
- * TODO: [🧠] Add context to each template (if missing)
3547
- * TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
3546
+ * TODO: [🧠] Add context to each task (if missing)
3547
+ * TODO: [🧠] What is better name `prepareTask` or `prepareTaskAndParameters`
3548
3548
  * TODO: [♨][main] !!! Prepare index the examples and maybe tasks
3549
3549
  * TODO: Write tests for `preparePipeline`
3550
3550
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
@@ -3630,7 +3630,7 @@
3630
3630
  })];
3631
3631
  case 3:
3632
3632
  tasksPrepared = (_c.sent()).tasksPrepared;
3633
- // ----- /Templates preparation -----
3633
+ // ----- /Tasks preparation -----
3634
3634
  // Note: Count total usage
3635
3635
  currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
3636
3636
  return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { tasks: __spreadArray([], __read(tasksPrepared), false),
@@ -3699,16 +3699,16 @@
3699
3699
  */
3700
3700
 
3701
3701
  /**
3702
- * Parses the template and returns the set of all used parameters
3702
+ * Parses the task and returns the set of all used parameters
3703
3703
  *
3704
- * @param template the template with used parameters
3704
+ * @param task the task with used parameters
3705
3705
  * @returns the set of parameter names
3706
3706
  * @throws {ParseError} if the script is invalid
3707
3707
  * @public exported from `@promptbook/utils`
3708
3708
  */
3709
- function extractParameterNamesFromTask(template) {
3709
+ function extractParameterNamesFromTask(task) {
3710
3710
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
3711
- var title = template.title, description = template.description, taskType = template.taskType, content = template.content, preparedContent = template.preparedContent, jokerParameterNames = template.jokerParameterNames, foreach = template.foreach;
3711
+ var title = task.title, description = task.description, taskType = task.taskType, content = task.content, preparedContent = task.preparedContent, jokerParameterNames = task.jokerParameterNames, foreach = task.foreach;
3712
3712
  var parameterNames = new Set();
3713
3713
  try {
3714
3714
  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()) {