@promptbook/cli 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 +49 -33
  2. package/esm/index.es.js +207 -127
  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 +207 -127
  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/esm/index.es.js CHANGED
@@ -37,7 +37,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
37
37
  *
38
38
  * @see https://github.com/webgptorg/promptbook
39
39
  */
40
- var PROMPTBOOK_ENGINE_VERSION = '0.75.0-1';
40
+ var PROMPTBOOK_ENGINE_VERSION = '0.75.0';
41
41
  /**
42
42
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
43
43
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -389,7 +389,6 @@ var GENERATOR_WARNING = "\u26A0\uFE0F WARNING: This code has been generated so t
389
389
  * @public exported from `@promptbook/core`
390
390
  */
391
391
  var CLAIM = "It's time for a paradigm shift. The future of software in plain English, French or Latin";
392
- // <- TODO: [🐊] Pick the best claim
393
392
  /**
394
393
  * When the title is not provided, the default title is used
395
394
  *
@@ -415,7 +414,7 @@ var LOOP_LIMIT = 1000;
415
414
  * @private within the repository - too low-level in comparison with other `MAX_...`
416
415
  */
417
416
  var CONNECTION_TIMEOUT_MS = 7 * 1000;
418
- // <- TODO: [⏳] Standartize timeouts, Make DEFAULT_TIMEOUT_MS as global constant
417
+ // <- TODO: [⏳] Standardize timeouts, Make DEFAULT_TIMEOUT_MS as global constant
419
418
  /**
420
419
  * How many times to retry the connections
421
420
  *
@@ -453,6 +452,13 @@ var DEFAULT_MAX_PARALLEL_COUNT = 5; // <- TODO: [🤹‍♂️]
453
452
  * @public exported from `@promptbook/core`
454
453
  */
455
454
  var DEFAULT_MAX_EXECUTION_ATTEMPTS = 3; // <- TODO: [🤹‍♂️]
455
+ /**
456
+ * Where to store your books
457
+ * This is kind of a "src" for your books
458
+ *
459
+ * @public exported from `@promptbook/core`
460
+ */
461
+ var DEFAULT_BOOKS_DIRNAME = './books';
456
462
  /**
457
463
  * Where to store the cache of executions for promptbook CLI
458
464
  *
@@ -460,7 +466,7 @@ var DEFAULT_MAX_EXECUTION_ATTEMPTS = 3; // <- TODO: [🤹‍♂️]
460
466
  *
461
467
  * @public exported from `@promptbook/core`
462
468
  */
463
- var DEFAULT_EXECUTIONS_CACHE_DIRNAME = '/.promptbook/executions-cache';
469
+ var DEFAULT_EXECUTIONS_CACHE_DIRNAME = './.promptbook/executions-cache';
464
470
  /**
465
471
  * Where to store the scrape cache
466
472
  *
@@ -468,7 +474,7 @@ var DEFAULT_EXECUTIONS_CACHE_DIRNAME = '/.promptbook/executions-cache';
468
474
  *
469
475
  * @public exported from `@promptbook/core`
470
476
  */
471
- var DEFAULT_SCRAPE_CACHE_DIRNAME = '/.promptbook/scrape-cache';
477
+ var DEFAULT_SCRAPE_CACHE_DIRNAME = './.promptbook/scrape-cache';
472
478
  /**
473
479
  * The name of the builded pipeline collection made by CLI `ptbk make` and for lookup in `createCollectionFromDirectory`
474
480
  *
@@ -748,7 +754,7 @@ function pipelineJsonToString(pipelineJson) {
748
754
  return isInput;
749
755
  })), _h = _g.next(); !_h.done; _h = _g.next()) {
750
756
  var parameter = _h.value;
751
- commands.push("INPUT PARAMETER ".concat(templateParameterJsonToString(parameter)));
757
+ commands.push("INPUT PARAMETER ".concat(taskParameterJsonToString(parameter)));
752
758
  }
753
759
  }
754
760
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -764,7 +770,7 @@ function pipelineJsonToString(pipelineJson) {
764
770
  return isOutput;
765
771
  })), _k = _j.next(); !_k.done; _k = _j.next()) {
766
772
  var parameter = _k.value;
767
- commands.push("OUTPUT PARAMETER ".concat(templateParameterJsonToString(parameter)));
773
+ commands.push("OUTPUT PARAMETER ".concat(taskParameterJsonToString(parameter)));
768
774
  }
769
775
  }
770
776
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -778,12 +784,12 @@ function pipelineJsonToString(pipelineJson) {
778
784
  pipelineString += commands.map(function (command) { return "- ".concat(command); }).join('\n');
779
785
  try {
780
786
  for (var tasks_1 = __values(tasks), tasks_1_1 = tasks_1.next(); !tasks_1_1.done; tasks_1_1 = tasks_1.next()) {
781
- var template = tasks_1_1.value;
787
+ var task = tasks_1_1.value;
782
788
  var
783
789
  /* Note: Not using:> name, */
784
- title_1 = template.title, description_1 = template.description,
790
+ title_1 = task.title, description_1 = task.description,
785
791
  /* Note: dependentParameterNames, */
786
- jokers = template.jokerParameterNames, taskType = template.taskType, content = template.content, postprocessing = template.postprocessingFunctionNames, expectations = template.expectations, format = template.format, resultingParameterName = template.resultingParameterName;
792
+ jokers = task.jokerParameterNames, taskType = task.taskType, content = task.content, postprocessing = task.postprocessingFunctionNames, expectations = task.expectations, format = task.format, resultingParameterName = task.resultingParameterName;
787
793
  pipelineString += '\n\n';
788
794
  pipelineString += "## ".concat(title_1);
789
795
  if (description_1) {
@@ -793,9 +799,10 @@ function pipelineJsonToString(pipelineJson) {
793
799
  var commands_1 = [];
794
800
  var contentLanguage = 'text';
795
801
  if (taskType === 'PROMPT_TASK') {
796
- var modelRequirements = template.modelRequirements;
802
+ var modelRequirements = task.modelRequirements;
797
803
  var _l = modelRequirements || {}, modelName = _l.modelName, modelVariant = _l.modelVariant;
798
- commands_1.push("EXECUTE PROMPT TEMPLATE");
804
+ // Note: Do nothing, it is default
805
+ // commands.push(`PROMPT`);
799
806
  if (modelVariant) {
800
807
  commands_1.push("MODEL VARIANT ".concat(capitalize(modelVariant)));
801
808
  }
@@ -808,16 +815,16 @@ function pipelineJsonToString(pipelineJson) {
808
815
  // Note: Nothing special here
809
816
  }
810
817
  else if (taskType === 'SCRIPT_TASK') {
811
- commands_1.push("SCRIPT TEMPLATE");
812
- if (template.contentLanguage) {
813
- contentLanguage = template.contentLanguage;
818
+ commands_1.push("SCRIPT");
819
+ if (task.contentLanguage) {
820
+ contentLanguage = task.contentLanguage;
814
821
  }
815
822
  else {
816
823
  contentLanguage = '';
817
824
  }
818
825
  }
819
826
  else if (taskType === 'DIALOG_TASK') {
820
- commands_1.push("DIALOG TEMPLATE");
827
+ commands_1.push("DIALOG");
821
828
  // Note: Nothing special here
822
829
  } // <- }else if([🅱]
823
830
  if (jokers) {
@@ -892,7 +899,7 @@ function pipelineJsonToString(pipelineJson) {
892
899
  pipelineString += '\n';
893
900
  pipelineString += '```';
894
901
  pipelineString += '\n\n';
895
- pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: [main] !!! If the parameter here has description, add it and use templateParameterJsonToString
902
+ pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: [main] !!! If the parameter here has description, add it and use taskParameterJsonToString
896
903
  }
897
904
  }
898
905
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
@@ -907,8 +914,8 @@ function pipelineJsonToString(pipelineJson) {
907
914
  /**
908
915
  * @private internal utility of `pipelineJsonToString`
909
916
  */
910
- function templateParameterJsonToString(templateParameterJson) {
911
- var name = templateParameterJson.name, description = templateParameterJson.description;
917
+ function taskParameterJsonToString(taskParameterJson) {
918
+ var name = taskParameterJson.name, description = taskParameterJson.description;
912
919
  var parameterString = "{".concat(name, "}");
913
920
  if (description) {
914
921
  parameterString = "".concat(parameterString, " ").concat(description);
@@ -916,7 +923,7 @@ function templateParameterJsonToString(templateParameterJson) {
916
923
  return parameterString;
917
924
  }
918
925
  /**
919
- * TODO: [🛋] Implement new features and commands into `pipelineJsonToString` + `templateParameterJsonToString` , use `stringifyCommand`
926
+ * TODO: [🛋] Implement new features and commands into `pipelineJsonToString` + `taskParameterJsonToString` , use `stringifyCommand`
920
927
  * TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
921
928
  * TODO: [🏛] Maybe make some markdown builder
922
929
  * TODO: [🏛] Escape all
@@ -1561,7 +1568,7 @@ function joinLlmExecutionTools() {
1561
1568
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
1562
1569
  */
1563
1570
 
1564
- 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"}];
1571
+ 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"}];
1565
1572
 
1566
1573
  /**
1567
1574
  * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
@@ -1954,20 +1961,20 @@ function validatePipelineCore(pipeline) {
1954
1961
  }
1955
1962
  finally { if (e_3) throw e_3.error; }
1956
1963
  }
1957
- var unresovedTemplates = __spreadArray([], __read(pipeline.tasks), false);
1964
+ var unresovedTasks = __spreadArray([], __read(pipeline.tasks), false);
1958
1965
  var loopLimit = LOOP_LIMIT;
1959
1966
  var _loop_3 = function () {
1960
1967
  if (loopLimit-- < 0) {
1961
1968
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
1962
1969
  throw new UnexpectedError(spaceTrim(function (block) { return "\n Loop limit reached during detection of circular dependencies in `validatePipeline`\n\n ".concat(block(pipelineIdentification), "\n "); }));
1963
1970
  }
1964
- var currentlyResovedTemplates = unresovedTemplates.filter(function (task) {
1971
+ var currentlyResovedTasks = unresovedTasks.filter(function (task) {
1965
1972
  return task.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
1966
1973
  });
1967
- if (currentlyResovedTemplates.length === 0) {
1974
+ if (currentlyResovedTasks.length === 0) {
1968
1975
  throw new PipelineLogicError(
1969
1976
  // TODO: [🐎] DRY
1970
- 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
1977
+ 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
1971
1978
  .map(function (_a) {
1972
1979
  var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
1973
1980
  return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
@@ -1986,13 +1993,13 @@ function validatePipelineCore(pipeline) {
1986
1993
  .map(function (name) { return "- Parameter `{".concat(name, "}`"); })
1987
1994
  .join('\n')), "\n\n\n "); }));
1988
1995
  }
1989
- resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTemplates.map(function (_a) {
1996
+ resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTasks.map(function (_a) {
1990
1997
  var resultingParameterName = _a.resultingParameterName;
1991
1998
  return resultingParameterName;
1992
1999
  })), false);
1993
- unresovedTemplates = unresovedTemplates.filter(function (task) { return !currentlyResovedTemplates.includes(task); });
2000
+ unresovedTasks = unresovedTasks.filter(function (task) { return !currentlyResovedTasks.includes(task); });
1994
2001
  };
1995
- while (unresovedTemplates.length > 0) {
2002
+ while (unresovedTasks.length > 0) {
1996
2003
  _loop_3();
1997
2004
  }
1998
2005
  // TODO: !!!!!! Test that pipeline interface implements declared formfactor interface
@@ -2054,7 +2061,7 @@ var PipelineUrlError = /** @class */ (function (_super) {
2054
2061
  /**
2055
2062
  * Parses the task and returns the list of all parameter names
2056
2063
  *
2057
- * @param template the task with parameters in {curly} braces
2064
+ * @param template the string template with parameters in {curly} braces
2058
2065
  * @returns the list of parameter names
2059
2066
  * @public exported from `@promptbook/utils`
2060
2067
  */
@@ -2088,13 +2095,13 @@ function unpreparePipeline(pipeline) {
2088
2095
  var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources, tasks = pipeline.tasks;
2089
2096
  personas = personas.map(function (persona) { return (__assign(__assign({}, persona), { modelRequirements: undefined, preparationIds: undefined })); });
2090
2097
  knowledgeSources = knowledgeSources.map(function (knowledgeSource) { return (__assign(__assign({}, knowledgeSource), { preparationIds: undefined })); });
2091
- tasks = tasks.map(function (template) {
2092
- var dependentParameterNames = template.dependentParameterNames;
2093
- var parameterNames = extractParameterNames(template.preparedContent || '');
2098
+ tasks = tasks.map(function (task) {
2099
+ var dependentParameterNames = task.dependentParameterNames;
2100
+ var parameterNames = extractParameterNames(task.preparedContent || '');
2094
2101
  dependentParameterNames = dependentParameterNames.filter(function (dependentParameterName) { return !parameterNames.has(dependentParameterName); });
2095
- var templateUnprepared = __assign(__assign({}, template), { dependentParameterNames: dependentParameterNames });
2096
- delete templateUnprepared.preparedContent;
2097
- return templateUnprepared;
2102
+ var taskUnprepared = __assign(__assign({}, task), { dependentParameterNames: dependentParameterNames });
2103
+ delete taskUnprepared.preparedContent;
2104
+ return taskUnprepared;
2098
2105
  });
2099
2106
  return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), { tasks: tasks, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }));
2100
2107
  }
@@ -2371,7 +2378,7 @@ function isPipelinePrepared(pipeline) {
2371
2378
  * TODO: [🐠] Maybe base this on `makeValidator`
2372
2379
  * TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
2373
2380
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
2374
- * - [🏍] ? Is context in each template
2381
+ * - [🏍] ? Is context in each task
2375
2382
  * - [♨] Are examples prepared
2376
2383
  * - [♨] Are tasks prepared
2377
2384
  */
@@ -2443,16 +2450,16 @@ function extractVariables(script) {
2443
2450
  */
2444
2451
 
2445
2452
  /**
2446
- * Parses the template and returns the set of all used parameters
2453
+ * Parses the task and returns the set of all used parameters
2447
2454
  *
2448
- * @param template the template with used parameters
2455
+ * @param task the task with used parameters
2449
2456
  * @returns the set of parameter names
2450
2457
  * @throws {ParseError} if the script is invalid
2451
2458
  * @public exported from `@promptbook/utils`
2452
2459
  */
2453
- function extractParameterNamesFromTask(template) {
2460
+ function extractParameterNamesFromTask(task) {
2454
2461
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
2455
- var title = template.title, description = template.description, taskType = template.taskType, content = template.content, preparedContent = template.preparedContent, jokerParameterNames = template.jokerParameterNames, foreach = template.foreach;
2462
+ var title = task.title, description = task.description, taskType = task.taskType, content = task.content, preparedContent = task.preparedContent, jokerParameterNames = task.jokerParameterNames, foreach = task.foreach;
2456
2463
  var parameterNames = new Set();
2457
2464
  try {
2458
2465
  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()) {
@@ -5510,10 +5517,10 @@ function prepareTasks(pipeline, tools, options) {
5510
5517
  _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a;
5511
5518
  tasks = pipeline.tasks, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
5512
5519
  tasksPrepared = new Array(tasks.length);
5513
- 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 () {
5514
- var dependentParameterNames, preparedContent, preparedTemplate;
5520
+ 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 () {
5521
+ var dependentParameterNames, preparedContent, preparedTask;
5515
5522
  return __generator(this, function (_a) {
5516
- dependentParameterNames = template.dependentParameterNames;
5523
+ dependentParameterNames = task.dependentParameterNames;
5517
5524
  preparedContent = undefined;
5518
5525
  if (knowledgePiecesCount > 0 && !dependentParameterNames.includes('knowledge')) {
5519
5526
  preparedContent = spaceTrim("\n {content}\n\n ## Knowledge\n\n {knowledge}\n ");
@@ -5522,8 +5529,8 @@ function prepareTasks(pipeline, tools, options) {
5522
5529
  'knowledge',
5523
5530
  ], false);
5524
5531
  }
5525
- preparedTemplate = __assign(__assign({}, template), { dependentParameterNames: dependentParameterNames, preparedContent: preparedContent });
5526
- tasksPrepared[index] = preparedTemplate;
5532
+ preparedTask = __assign(__assign({}, task), { dependentParameterNames: dependentParameterNames, preparedContent: preparedContent });
5533
+ tasksPrepared[index] = preparedTask;
5527
5534
  return [2 /*return*/];
5528
5535
  });
5529
5536
  }); })];
@@ -5535,8 +5542,8 @@ function prepareTasks(pipeline, tools, options) {
5535
5542
  });
5536
5543
  }
5537
5544
  /**
5538
- * TODO: [🧠] Add context to each template (if missing)
5539
- * TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
5545
+ * TODO: [🧠] Add context to each task (if missing)
5546
+ * TODO: [🧠] What is better name `prepareTask` or `prepareTaskAndParameters`
5540
5547
  * TODO: [♨][main] !!! Prepare index the examples and maybe tasks
5541
5548
  * TODO: Write tests for `preparePipeline`
5542
5549
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
@@ -5622,7 +5629,7 @@ function preparePipeline(pipeline, tools, options) {
5622
5629
  })];
5623
5630
  case 3:
5624
5631
  tasksPrepared = (_c.sent()).tasksPrepared;
5625
- // ----- /Templates preparation -----
5632
+ // ----- /Tasks preparation -----
5626
5633
  // Note: Count total usage
5627
5634
  currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
5628
5635
  return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { tasks: __spreadArray([], __read(tasksPrepared), false),
@@ -5641,6 +5648,40 @@ function preparePipeline(pipeline, tools, options) {
5641
5648
  * @see https://docs.anthropic.com/en/docs/test-and-evaluate/strengthen-guardrails/increase-consistency#specify-the-desired-output-format
5642
5649
  */
5643
5650
 
5651
+ /**
5652
+ * All available task types
5653
+ *
5654
+ * There is is distinction between task types and section types
5655
+ * - Every section in markdown has its SectionType
5656
+ * - Some sections are tasks but other can be non-task sections
5657
+ *
5658
+ * @public exported from `@promptbook/core`
5659
+ */
5660
+ var TaskTypes = [
5661
+ 'PROMPT',
5662
+ 'SIMPLE',
5663
+ 'SCRIPT',
5664
+ 'DIALOG',
5665
+ // <- [🅱]
5666
+ ];
5667
+
5668
+ /**
5669
+ * All available sections which are not tasks
5670
+ *
5671
+ * @public exported from `@promptbook/core`
5672
+ */
5673
+ var NonTaskSectionTypes = ['EXAMPLE', 'KNOWLEDGE', 'INSTRUMENT', 'ACTION'];
5674
+ /**
5675
+ * All available section types
5676
+ *
5677
+ * There is is distinction between task types and section types
5678
+ * - Every section in markdown has its SectionType
5679
+ * - Some sections are tasks but other can be non-task sections
5680
+ *
5681
+ * @public exported from `@promptbook/core`
5682
+ */
5683
+ var SectionTypes = __spreadArray(__spreadArray([], __read(TaskTypes.map(function (TaskType) { return "".concat(TaskType, "_TASK"); })), false), __read(NonTaskSectionTypes), false);
5684
+
5644
5685
  /**
5645
5686
  * Parses the knowledge command
5646
5687
  *
@@ -5733,24 +5774,6 @@ var knowledgeCommandParser = {
5733
5774
  * Note: [⛱] There are two types of KNOWLEDGE commands *...(read more in [⛱])*
5734
5775
  */
5735
5776
 
5736
- /**
5737
- * Section type describes the way how the section is sectiond
5738
- *
5739
- * @public exported from `@promptbook/core`
5740
- */
5741
- var SectionTypes = [
5742
- 'PROMPT_TASK',
5743
- 'SIMPLE_TASK',
5744
- 'SCRIPT_TASK',
5745
- 'DIALOG_TASK',
5746
- 'EXAMPLE',
5747
- 'KNOWLEDGE',
5748
- 'INSTRUMENT',
5749
- 'ACTION',
5750
- // <- [🅱]
5751
- ];
5752
- // <- TODO: !!!!!! Make alongside `SectionType` the `TaskType`, `TaskType` + [⛱] and ACRY
5753
-
5754
5777
  /**
5755
5778
  * Parses the section command
5756
5779
  *
@@ -5838,7 +5861,10 @@ var sectionCommandParser = {
5838
5861
  var normalized = input.normalized;
5839
5862
  normalized = normalized.split('SAMPLE').join('EXAMPLE');
5840
5863
  normalized = normalized.split('EXECUTE_').join('');
5841
- var taskTypes = SectionTypes.filter(function (taskType) { return normalized.includes(taskType.split('_TASK').join('')); });
5864
+ normalized = normalized.split('DIALOGUE').join('DIALOG');
5865
+ var taskTypes = SectionTypes.filter(function (sectionType) {
5866
+ return normalized.includes(sectionType.split('_TASK').join(''));
5867
+ });
5842
5868
  if (taskTypes.length !== 1) {
5843
5869
  throw new ParseError(spaceTrim$1(function (block) { return "\n Unknown section type \"".concat(normalized, "\"\n\n Supported section types are:\n ").concat(block(SectionTypes.join(', ')), "\n "); }));
5844
5870
  }
@@ -6197,7 +6223,7 @@ var expectCommandParser = {
6197
6223
  /**
6198
6224
  * Description of the FORMAT command
6199
6225
  */
6200
- description: spaceTrim$1("\n Expect command describes the desired output of the template (after post-processing)\n It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs or some other shape of the output.\n "),
6226
+ description: spaceTrim$1("\n Expect command describes the desired output of the task *(after post-processing)*\n It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs or some other shape of the output.\n "),
6201
6227
  /**
6202
6228
  * Link to documentation
6203
6229
  */
@@ -6683,7 +6709,7 @@ var formatCommandParser = {
6683
6709
  /**
6684
6710
  * Description of the FORMAT command
6685
6711
  */
6686
- description: spaceTrim$1("\n Format command describes the desired output of the template (after post-processing)\n It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs or some other shape of the output.\n "),
6712
+ description: spaceTrim$1("\n Format command describes the desired output of the task (after post-processing)\n It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs or some other shape of the output.\n "),
6687
6713
  /**
6688
6714
  * Link to documentation
6689
6715
  */
@@ -6747,19 +6773,45 @@ var ChatbotFormfactorDefinition = {
6747
6773
  description: "@@@",
6748
6774
  documentationUrl: "https://github.com/webgptorg/promptbook/discussions/174",
6749
6775
  pipelineInterface: {
6750
- inputParameterNames: ['previousTitle', 'previousConversationSummary', 'userMessage'],
6751
- outputParameterNames: ['title', 'conversationSummary', 'chatbotResponse'],
6752
- /*
6753
- <- TODO: !!!!!! Change to full interfaces
6754
-
6755
- - INPUT PARAMETER `{previousTitle}` Previous title of the conversation
6756
- - INPUT PARAMETER `{previousConversationSummary}` Previous conversation summary
6757
- - INPUT PARAMETER `{userMessage}` User message
6758
- - OUTPUT PARAMETER `{title}` Title of the conversation
6759
- - OUTPUT PARAMETER `{conversationSummary}` Summary of the conversation
6760
- - OUTPUT PARAMETER `{chatbotResponse}` Chatbot response
6776
+ inputParameters: [
6777
+ {
6778
+ name: 'previousTitle',
6779
+ description: "Previous title of the conversation",
6780
+ isInput: true,
6781
+ isOutput: false,
6782
+ },
6783
+ {
6784
+ name: 'previousConversationSummary',
6785
+ description: "Previous conversation summary",
6786
+ isInput: true,
6787
+ isOutput: false,
6788
+ },
6789
+ { name: 'userMessage', description: "User message", isInput: true, isOutput: false },
6790
+ ],
6791
+ outputParameters: [
6792
+ { name: 'title', description: "Title of the conversation", isInput: false, isOutput: true },
6793
+ { name: 'conversationSummary', description: "Summary of the conversation", isInput: false, isOutput: true },
6794
+ { name: 'chatbotResponse', description: "Chatbot response", isInput: false, isOutput: true },
6795
+ ],
6796
+ },
6797
+ };
6761
6798
 
6762
- */
6799
+ /**
6800
+ * Generator is form of app that @@@
6801
+ *
6802
+ * @public exported from `@promptbook/core`
6803
+ */
6804
+ var GeneratorFormfactorDefinition = {
6805
+ name: 'GENERATOR',
6806
+ description: "@@@",
6807
+ documentationUrl: "https://github.com/webgptorg/promptbook/discussions/184",
6808
+ pipelineInterface: {
6809
+ inputParameters: [
6810
+ /* @@@ */
6811
+ ],
6812
+ outputParameters: [
6813
+ /* @@@ */
6814
+ ],
6763
6815
  },
6764
6816
  };
6765
6817
 
@@ -6771,8 +6823,8 @@ var ChatbotFormfactorDefinition = {
6771
6823
  * @public exported from `@promptbook/core`
6772
6824
  */
6773
6825
  var GENERIC_PIPELINE_INTERFACE = {
6774
- inputParameterNames: [],
6775
- outputParameterNames: [],
6826
+ inputParameters: [],
6827
+ outputParameters: [],
6776
6828
  };
6777
6829
  /**
6778
6830
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -6800,10 +6852,10 @@ var MatcherFormfactorDefinition = {
6800
6852
  description: "@@@",
6801
6853
  documentationUrl: "https://github.com/webgptorg/promptbook/discussions/177",
6802
6854
  pipelineInterface: {
6803
- inputParameterNames: [
6855
+ inputParameters: [
6804
6856
  /* @@@ */
6805
6857
  ],
6806
- outputParameterNames: [
6858
+ outputParameters: [
6807
6859
  /* @@@ */
6808
6860
  ],
6809
6861
  },
@@ -6819,8 +6871,22 @@ var SheetsFormfactorDefinition = {
6819
6871
  description: "@@@",
6820
6872
  documentationUrl: "https://github.com/webgptorg/promptbook/discussions/176",
6821
6873
  pipelineInterface: {
6822
- inputParameterNames: ['inputSheet'],
6823
- outputParameterNames: ['outputSheet'],
6874
+ inputParameters: [
6875
+ {
6876
+ name: 'inputSheet',
6877
+ description: "Input sheet to be processed as csv",
6878
+ isInput: true,
6879
+ isOutput: false,
6880
+ },
6881
+ ],
6882
+ outputParameters: [
6883
+ {
6884
+ name: 'outputSheet',
6885
+ description: "Output sheet as csv",
6886
+ isInput: false,
6887
+ isOutput: true,
6888
+ },
6889
+ ],
6824
6890
  },
6825
6891
  };
6826
6892
 
@@ -6834,9 +6900,23 @@ var TranslatorFormfactorDefinition = {
6834
6900
  description: "@@@",
6835
6901
  documentationUrl: "https://github.com/webgptorg/promptbook/discussions/175",
6836
6902
  pipelineInterface: {
6837
- inputParameterNames: ['inputMessage'],
6838
- outputParameterNames: ['outputMessage'],
6839
- // <- TODO: !!!!!! Maybe add {summary}
6903
+ inputParameters: [
6904
+ {
6905
+ name: 'inputMessage',
6906
+ description: "Input message to be translated",
6907
+ isInput: true,
6908
+ isOutput: false,
6909
+ },
6910
+ ],
6911
+ outputParameters: [
6912
+ {
6913
+ name: 'outputMessage',
6914
+ description: "Translated output message",
6915
+ isInput: false,
6916
+ isOutput: true,
6917
+ },
6918
+ ],
6919
+ // <- TODO: [🤓] Maybe add {summary}
6840
6920
  // <- TODO: [🧠] maybe change to {inputText}, {inputText} / or make system for any name of first input and first outpur parameter
6841
6921
  },
6842
6922
  };
@@ -6852,6 +6932,7 @@ var FORMFACTOR_DEFINITIONS = [
6852
6932
  TranslatorFormfactorDefinition,
6853
6933
  SheetsFormfactorDefinition,
6854
6934
  MatcherFormfactorDefinition,
6935
+ GeneratorFormfactorDefinition,
6855
6936
  ];
6856
6937
  /**
6857
6938
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -6964,7 +7045,7 @@ var jokerCommandParser = {
6964
7045
  /**
6965
7046
  * Description of the JOKER command
6966
7047
  */
6967
- description: "Joker parameter is used instead of executing the template result if jokers value meets the expectations requirements",
7048
+ description: "Joker parameter is used instead of executing the task result if jokers value meets the expectations requirements",
6968
7049
  /**
6969
7050
  * Link to documentation
6970
7051
  */
@@ -7192,7 +7273,7 @@ var parameterCommandParser = {
7192
7273
  /**
7193
7274
  * Description of the PARAMETER command
7194
7275
  */
7195
- description: "Describes one parameter of the template",
7276
+ description: "Describes one parameter of the task",
7196
7277
  /**
7197
7278
  * Link to documentation
7198
7279
  */
@@ -7548,7 +7629,7 @@ var urlCommandParser = {
7548
7629
  spaceTrim(
7549
7630
  `
7550
7631
  URL must not contain hash
7551
- Hash is used for identification of the template in the pipeline
7632
+ Hash is used for identification of the section of the pipeline
7552
7633
  `,
7553
7634
  ),
7554
7635
  );
@@ -7604,7 +7685,7 @@ var actionCommandParser = {
7604
7685
  /**
7605
7686
  * Description of the ACTION command
7606
7687
  */
7607
- description: "Actions influences from the pipeline or template into external world. Like turning on a light, sending an email, etc.",
7688
+ description: "Actions influences from the pipeline or task into external world. Like turning on a light, sending an email, etc.",
7608
7689
  /**
7609
7690
  * Link to documentation
7610
7691
  */
@@ -7670,7 +7751,7 @@ var instrumentCommandParser = {
7670
7751
  /**
7671
7752
  * Description of the INSTRUMENT command
7672
7753
  */
7673
- description: "Instrument command is used to specify the instrument to be used in the pipeline or template like search, calculate, etc.",
7754
+ description: "Instrument command is used to specify the instrument to be used in the pipeline or task like search, calculate, etc.",
7674
7755
  /**
7675
7756
  * Link to documentation
7676
7757
  */
@@ -7804,7 +7885,6 @@ function parseCommand(raw, usagePlace) {
7804
7885
  normalized = normalized.split('(').join('');
7805
7886
  normalized = normalized.split(')').join('');
7806
7887
  normalized = normalizeTo_SCREAMING_CASE(normalized);
7807
- normalized = normalized.split('DIALOGUE').join('DIALOG'); // <- TODO: !!!!!! Move to sectionCommandParser
7808
7888
  var items = raw
7809
7889
  .trim()
7810
7890
  // Note: [🐡]
@@ -7992,7 +8072,7 @@ function extractAllListItemsFromMarkdown(markdown) {
7992
8072
  function extractOneBlockFromMarkdown(markdown) {
7993
8073
  var codeBlocks = extractAllBlocksFromMarkdown(markdown);
7994
8074
  if (codeBlocks.length !== 1) {
7995
- throw new ParseError(spaceTrim$1(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 "); }));
8075
+ throw new ParseError(spaceTrim$1(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 "); }));
7996
8076
  }
7997
8077
  return codeBlocks[0];
7998
8078
  }
@@ -8299,7 +8379,7 @@ function pipelineStringToJsonSync(pipelineString) {
8299
8379
  var command = parseCommand(listItem, 'PIPELINE_HEAD');
8300
8380
  var commandParser = getParserForCommand(command);
8301
8381
  if (commandParser.isUsedInPipelineHead !== true /* <- Note: [🦦][4] */) {
8302
- throw new ParseError(spaceTrim(function (block) { return "\n Command ".concat(command.type, " is not allowed in the head of the promptbook ONLY at the pipeline template\n\n ").concat(block(getPipelineIdentification()), "\n "); })); // <- TODO: [🚞]
8382
+ throw new ParseError(spaceTrim(function (block) { return "\n Command `".concat(command.type, "` is not allowed in the head of the pipeline ONLY at the pipeline task\n\n ").concat(block(getPipelineIdentification()), "\n "); })); // <- TODO: [🚞]
8303
8383
  }
8304
8384
  try {
8305
8385
  commandParser.$applyToPipelineJson(command, $pipelineJson);
@@ -8331,7 +8411,7 @@ function pipelineStringToJsonSync(pipelineString) {
8331
8411
  }
8332
8412
  var _loop_2 = function (section) {
8333
8413
  var e_5, _l, e_6, _m;
8334
- // TODO: Parse template description (the content out of the codeblock and lists)
8414
+ // TODO: Parse section's description (the content out of the codeblock and lists)
8335
8415
  var listItems_2 = extractAllListItemsFromMarkdown(section.content);
8336
8416
  var _o = extractOneBlockFromMarkdown(section.content), language = _o.language, content = _o.content;
8337
8417
  // TODO: [🎾][1] DRY description
@@ -8362,7 +8442,7 @@ function pipelineStringToJsonSync(pipelineString) {
8362
8442
  resultingParameterNameMatch.groups.resultingParamName !== undefined) {
8363
8443
  $taskJson.resultingParameterName = resultingParameterNameMatch.groups.resultingParamName;
8364
8444
  }
8365
- // TODO: [🥥] Maybe move this logic to `$parseAndApplyPipelineTemplateCommands`
8445
+ // TODO: [🥥] Maybe move this logic to `$parseAndApplyPipelineTaskCommands`
8366
8446
  var commands = listItems_2.map(function (listItem) { return ({
8367
8447
  listItem: listItem,
8368
8448
  command: parseCommand(listItem, 'PIPELINE_TASK'),
@@ -8377,7 +8457,7 @@ function pipelineStringToJsonSync(pipelineString) {
8377
8457
  var _loop_4 = function (listItem, command) {
8378
8458
  var commandParser = getParserForCommand(command);
8379
8459
  if (commandParser.isUsedInPipelineTask !== true /* <- Note: [🦦][4] */) {
8380
- throw new ParseError(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: [🚞]
8460
+ throw new ParseError(spaceTrim(function (block) { return "\n Command `".concat(command.type, "` is not allowed in the task of the promptbook ONLY at the pipeline head\n\n ").concat(block(getPipelineIdentification()), "\n "); })); // <- TODO: [🚞]
8381
8461
  }
8382
8462
  try {
8383
8463
  commandParser.$applyToTaskJson(
@@ -8388,7 +8468,7 @@ function pipelineStringToJsonSync(pipelineString) {
8388
8468
  if (!(error instanceof ParseError)) {
8389
8469
  throw error;
8390
8470
  }
8391
- throw new ParseError(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: [🚞]
8471
+ throw new ParseError(spaceTrim(function (block) { return "\n Command `".concat(command.type, "` failed to apply to the task\n\n The error:\n ").concat(block(error.message), "\n\n Current state of the task:\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: [🚞]
8392
8472
  }
8393
8473
  if (command.type === 'PARAMETER') {
8394
8474
  defineParam(command);
@@ -8409,10 +8489,10 @@ function pipelineStringToJsonSync(pipelineString) {
8409
8489
  }
8410
8490
  finally { if (e_5) throw e_5.error; }
8411
8491
  }
8412
- // TODO: [🍧] Should be done in TEMPLATE command
8492
+ // TODO: [🍧] Should be done in SECTION command
8413
8493
  if ($taskJson.taskType === 'SCRIPT_TASK') {
8414
8494
  if (!language) {
8415
- throw new ParseError(spaceTrim(function (block) { return "\n You must specify the language of the script in the SCRIPT TEMPLATE\n\n ".concat(block(getPipelineIdentification()), "\n "); }));
8495
+ throw new ParseError(spaceTrim(function (block) { return "\n You must specify the language of the script in the `SCRIPT` task\n\n ".concat(block(getPipelineIdentification()), "\n "); }));
8416
8496
  }
8417
8497
  if (!SUPPORTED_SCRIPT_LANGUAGES.includes(language)) {
8418
8498
  throw new ParseError(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 "); }));
@@ -8423,7 +8503,7 @@ function pipelineStringToJsonSync(pipelineString) {
8423
8503
  try {
8424
8504
  for (var _q = (e_6 = void 0, __values($taskJson.dependentParameterNames)), _r = _q.next(); !_r.done; _r = _q.next()) {
8425
8505
  var parameterName = _r.value;
8426
- // TODO: [🧠] This definition should be made first in the template
8506
+ // TODO: [🧠] This definition should be made first in the task
8427
8507
  defineParam({
8428
8508
  parameterName: parameterName,
8429
8509
  parameterDescription: null,
@@ -8448,7 +8528,7 @@ function pipelineStringToJsonSync(pipelineString) {
8448
8528
  (block) => `
8449
8529
  Model requirements are defined for the block type ${
8450
8530
  $taskJson.taskType
8451
- } which is not a PROMPT TEMPLATE
8531
+ } which is not a \`PROMPT\` task
8452
8532
 
8453
8533
  This should be avoided by the \`modelCommandParser\`
8454
8534
 
@@ -8467,7 +8547,7 @@ function pipelineStringToJsonSync(pipelineString) {
8467
8547
  };
8468
8548
  try {
8469
8549
  // =============================================================
8470
- // Note: 4️⃣ Process each template of the pipeline
8550
+ // Note: 4️⃣ Process each section of the pipeline
8471
8551
  for (var pipelineSections_1 = __values(pipelineSections), pipelineSections_1_1 = pipelineSections_1.next(); !pipelineSections_1_1.done; pipelineSections_1_1 = pipelineSections_1.next()) {
8472
8552
  var section = pipelineSections_1_1.value;
8473
8553
  _loop_2(section);
@@ -8484,7 +8564,7 @@ function pipelineStringToJsonSync(pipelineString) {
8484
8564
  // Note: 5️⃣ Mark parameters as INPUT if not explicitly set
8485
8565
  if ($pipelineJson.parameters.every(function (parameter) { return !parameter.isInput; })) {
8486
8566
  var _loop_3 = function (parameter) {
8487
- var isThisParameterResulting = $pipelineJson.tasks.some(function (template) { return template.resultingParameterName === parameter.name; });
8567
+ var isThisParameterResulting = $pipelineJson.tasks.some(function (task) { return task.resultingParameterName === parameter.name; });
8488
8568
  if (!isThisParameterResulting) {
8489
8569
  parameter.isInput = true;
8490
8570
  }
@@ -10565,7 +10645,7 @@ function initializeMakeCommand(program) {
10565
10645
  // TODO: [🧅] DRY command arguments
10566
10646
  makeCommand.argument('[path]',
10567
10647
  // <- TODO: [🧟‍♂️] Unite path to promptbook collection argument
10568
- 'Path to promptbook collection directory', './promptbook-collection');
10648
+ 'Path to promptbook collection directory', DEFAULT_BOOKS_DIRNAME);
10569
10649
  makeCommand.option('--project-name', "Name of the project for whom collection is", 'Untitled Promptbook project');
10570
10650
  makeCommand.option('-f, --format <format>', spaceTrim$1("\n Output format of builded collection \"javascript\", \"typescript\" or \"json\"\n\n Note: You can use multiple formats separated by comma\n "), 'javascript' /* <- Note: [🏳‍🌈] */);
10571
10651
  makeCommand.option('--no-validation', "Do not validate logic of pipelines in collection", true);
@@ -10793,8 +10873,8 @@ function addAutoGeneratedSection(content, options) {
10793
10873
  * @public exported from `@promptbook/utils`
10794
10874
  */
10795
10875
  function renderPromptbookMermaid(pipelineJson, options) {
10796
- var _a = (options || {}).linkTemplate, linkTemplate = _a === void 0 ? function () { return null; } : _a;
10797
- var parameterNameToTemplateName = function (parameterName) {
10876
+ var _a = (options || {}).linkTask, linkTask = _a === void 0 ? function () { return null; } : _a;
10877
+ var parameterNameToTaskName = function (parameterName) {
10798
10878
  var parameter = pipelineJson.parameters.find(function (parameter) { return parameter.name === parameterName; });
10799
10879
  if (!parameter) {
10800
10880
  throw new UnexpectedError("Could not find {".concat(parameterName, "}"));
@@ -10802,19 +10882,19 @@ function renderPromptbookMermaid(pipelineJson, options) {
10802
10882
  if (parameter.isInput) {
10803
10883
  return 'input';
10804
10884
  }
10805
- var template = pipelineJson.tasks.find(function (template) { return template.resultingParameterName === parameterName; });
10806
- if (!template) {
10807
- throw new Error("Could not find template for {".concat(parameterName, "}"));
10885
+ var task = pipelineJson.tasks.find(function (task) { return task.resultingParameterName === parameterName; });
10886
+ if (!task) {
10887
+ throw new Error("Could not find task for {".concat(parameterName, "}"));
10808
10888
  }
10809
- return normalizeTo_camelCase('template-' + titleToName(template.title));
10889
+ return normalizeTo_camelCase('task-' + titleToName(task.title));
10810
10890
  };
10811
10891
  var promptbookMermaid = 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
10812
10892
  .flatMap(function (_a) {
10813
10893
  var title = _a.title, dependentParameterNames = _a.dependentParameterNames, resultingParameterName = _a.resultingParameterName;
10814
10894
  return __spreadArray([
10815
- "".concat(parameterNameToTemplateName(resultingParameterName), "(\"").concat(title, "\")")
10895
+ "".concat(parameterNameToTaskName(resultingParameterName), "(\"").concat(title, "\")")
10816
10896
  ], __read(dependentParameterNames.map(function (dependentParameterName) {
10817
- return "".concat(parameterNameToTemplateName(dependentParameterName), "--\"{").concat(dependentParameterName, "}\"-->").concat(parameterNameToTemplateName(resultingParameterName));
10897
+ return "".concat(parameterNameToTaskName(dependentParameterName), "--\"{").concat(dependentParameterName, "}\"-->").concat(parameterNameToTaskName(resultingParameterName));
10818
10898
  })), false);
10819
10899
  })
10820
10900
  .join('\n')), "\n\n ").concat(block(pipelineJson.parameters
@@ -10824,17 +10904,17 @@ function renderPromptbookMermaid(pipelineJson, options) {
10824
10904
  })
10825
10905
  .map(function (_a) {
10826
10906
  var name = _a.name;
10827
- return "".concat(parameterNameToTemplateName(name), "--\"{").concat(name, "}\"-->output");
10907
+ return "".concat(parameterNameToTaskName(name), "--\"{").concat(name, "}\"-->output");
10828
10908
  })
10829
10909
  .join('\n')), "\n output((Output)):::output\n\n ").concat(block(pipelineJson.tasks
10830
- .map(function (template) {
10831
- var link = linkTemplate(template);
10910
+ .map(function (task) {
10911
+ var link = linkTask(task);
10832
10912
  if (link === null) {
10833
10913
  return '';
10834
10914
  }
10835
10915
  var href = link.href, title = link.title;
10836
- var templateName = parameterNameToTemplateName(template.resultingParameterName);
10837
- return "click ".concat(templateName, " href \"").concat(href, "\" \"").concat(title, "\";");
10916
+ var taskName = parameterNameToTaskName(task.resultingParameterName);
10917
+ return "click ".concat(taskName, " href \"").concat(href, "\" \"").concat(title, "\";");
10838
10918
  })
10839
10919
  .filter(function (line) { return line !== ''; })
10840
10920
  .join('\n')), "\n\n classDef input color: grey;\n classDef output color: grey;\n\n end;\n\n "); });
@@ -10865,7 +10945,7 @@ function prettifyPipelineString(pipelineString, options) {
10865
10945
  case 1:
10866
10946
  pipelineJson = _a.sent();
10867
10947
  promptbookMermaid_1 = renderPromptbookMermaid(pipelineJson, {
10868
- linkTemplate: function (task) {
10948
+ linkTask: function (task) {
10869
10949
  return { href: "#".concat(task.name), title: task.title };
10870
10950
  },
10871
10951
  });
@@ -11208,7 +11288,7 @@ function executionReportJsonToString(executionReportJson, options) {
11208
11288
  if (/^\s*\p{Extended_Pictographic}/u.test(promptExecution.prompt.title)) {
11209
11289
  hash = '-' + hash;
11210
11290
  }
11211
- // TODO: Make working hash link for the template in md + pdf
11291
+ // TODO: Make working hash link for the task in md + pdf
11212
11292
  return "- [".concat(promptExecution.prompt.title, "](#").concat(hash, ")");
11213
11293
  })
11214
11294
  .join('\n');
@@ -11217,7 +11297,7 @@ function executionReportJsonToString(executionReportJson, options) {
11217
11297
  '## ⌚ Time chart' +
11218
11298
  '\n\n' +
11219
11299
  createMarkdownChart({
11220
- nameHeader: 'Template',
11300
+ nameHeader: 'Task',
11221
11301
  valueHeader: 'Timeline',
11222
11302
  items: timingItems,
11223
11303
  width: chartsWidth,
@@ -11228,7 +11308,7 @@ function executionReportJsonToString(executionReportJson, options) {
11228
11308
  '## 💸 Cost chart' +
11229
11309
  '\n\n' +
11230
11310
  createMarkdownChart({
11231
- nameHeader: 'Template',
11311
+ nameHeader: 'Task',
11232
11312
  valueHeader: 'Cost',
11233
11313
  items: costItems,
11234
11314
  width: chartsWidth,
@@ -11527,7 +11607,7 @@ function initializeRunCommand(program) {
11527
11607
  return [4 /*yield*/, prompts(questions)];
11528
11608
  case 16:
11529
11609
  response = _m.sent();
11530
- // <- TODO: [🧠] Change behavior according to the formfactor
11610
+ // <- TODO: [🧠][🍼] Change behavior according to the formfactor
11531
11611
  inputParameters = __assign(__assign({}, inputParameters), response);
11532
11612
  // TODO: Maybe do some validation of the response (and --json argument which is passed)
11533
11613
  if (isVerbose) {