@promptbook/cli 0.61.0-25 → 0.61.0-27

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 (37) hide show
  1. package/esm/index.es.js +127 -123
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/utils.index.d.ts +4 -4
  4. package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +0 -1
  5. package/esm/typings/src/conversion/utils/{extractParametersFromPromptTemplate.d.ts → extractParameterNamesFromPromptTemplate.d.ts} +1 -1
  6. package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -1
  7. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +6 -6
  8. package/esm/typings/src/execution/PipelineExecutor.d.ts +1 -1
  9. package/esm/typings/src/execution/createPipelineExecutor.d.ts +3 -3
  10. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -1
  11. package/esm/typings/src/prepare/isPipelinePrepared.d.ts +3 -3
  12. package/esm/typings/src/prepare/preparePipeline.d.ts +1 -1
  13. package/esm/typings/src/prepare/prepareTemplates.d.ts +1 -1
  14. package/esm/typings/src/types/ModelRequirements.d.ts +1 -1
  15. package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -1
  16. package/esm/typings/src/utils/{extractParameters.d.ts → extractParameterNames.d.ts} +1 -4
  17. package/package.json +2 -2
  18. package/umd/index.umd.js +127 -123
  19. package/umd/index.umd.js.map +1 -1
  20. package/umd/typings/src/_packages/utils.index.d.ts +4 -4
  21. package/umd/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +0 -1
  22. package/umd/typings/src/conversion/utils/{extractParametersFromPromptTemplate.d.ts → extractParameterNamesFromPromptTemplate.d.ts} +1 -1
  23. package/umd/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -1
  24. package/umd/typings/src/conversion/validation/validatePipeline.d.ts +6 -6
  25. package/umd/typings/src/execution/PipelineExecutor.d.ts +1 -1
  26. package/umd/typings/src/execution/createPipelineExecutor.d.ts +3 -3
  27. package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -1
  28. package/umd/typings/src/prepare/isPipelinePrepared.d.ts +3 -3
  29. package/umd/typings/src/prepare/preparePipeline.d.ts +1 -1
  30. package/umd/typings/src/prepare/prepareTemplates.d.ts +1 -1
  31. package/umd/typings/src/types/ModelRequirements.d.ts +1 -1
  32. package/umd/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -1
  33. package/umd/typings/src/utils/{extractParameters.d.ts → extractParameterNames.d.ts} +1 -4
  34. /package/esm/typings/src/conversion/utils/{extractParametersFromPromptTemplate.test.d.ts → extractParameterNamesFromPromptTemplate.test.d.ts} +0 -0
  35. /package/esm/typings/src/utils/{extractParameters.test.d.ts → extractParameterNames.test.d.ts} +0 -0
  36. /package/umd/typings/src/conversion/utils/{extractParametersFromPromptTemplate.test.d.ts → extractParameterNamesFromPromptTemplate.test.d.ts} +0 -0
  37. /package/umd/typings/src/utils/{extractParameters.test.d.ts → extractParameterNames.test.d.ts} +0 -0
package/esm/index.es.js CHANGED
@@ -150,7 +150,7 @@ new Function("\n try {\n if (typeof WorkerGlobalScope !== 'undefined'
150
150
  /**
151
151
  * The version of the Promptbook library
152
152
  */
153
- var PROMPTBOOK_VERSION = '0.61.0-24';
153
+ var PROMPTBOOK_VERSION = '0.61.0-26';
154
154
  // TODO: !!!! List here all the versions and annotate + put into script
155
155
 
156
156
  /**
@@ -747,7 +747,7 @@ function forEachAsync(array, options, callbackfunction) {
747
747
  });
748
748
  }
749
749
 
750
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-24",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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}",dependentParameterNames:["knowledgeContent"],resultingParameterName:"knowledgePieces"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-24",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.61.0-24",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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}",dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-24",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.61.0-24",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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}",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-24",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.61.0-24",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}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",modelRequirements:{modelVariant:"CHAT",modelName:"gpt-4-turbo"},content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Sample\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### Option `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Option `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### Option `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}",expectFormat:"JSON",dependentParameterNames:["availableModelNames","personaDescription"],resultingParameterName:"modelRequirements"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-24",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
750
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-26",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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}",dependentParameterNames:["knowledgeContent"],resultingParameterName:"knowledgePieces"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-26",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.61.0-26",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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}",dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-26",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.61.0-26",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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}",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-26",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.61.0-26",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}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",modelRequirements:{modelVariant:"CHAT",modelName:"gpt-4-turbo"},content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Sample\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### Option `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Option `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### Option `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}",expectFormat:"JSON",dependentParameterNames:["availableModelNames","personaDescription"],resultingParameterName:"modelRequirements"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-26",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
751
751
 
752
752
  /**
753
753
  * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
@@ -825,7 +825,7 @@ function isValidPromptbookVersion(version) {
825
825
  if ( /* version === '1.0.0' || */version === '2.0.0' || version === '3.0.0') {
826
826
  return false;
827
827
  }
828
- // <- TODO: !!!! Check isValidPromptbookVersion against PROMPTBOOK_VERSIONS
828
+ // <- TODO: !!! Check isValidPromptbookVersion against PROMPTBOOK_VERSIONS
829
829
  return true;
830
830
  }
831
831
 
@@ -950,52 +950,63 @@ function isValidPipelineUrl(url) {
950
950
  */
951
951
  function validatePipeline(pipeline) {
952
952
  // TODO: [🧠] Maybe test if promptbook is a promise and make specific error case for that
953
- var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e;
953
+ var e_1, _a, e_2, _b, e_3, _c;
954
+ var pipelineIdentification = (function () {
955
+ // Note: This is a 😐 implementation of [🚞]
956
+ var _ = [];
957
+ if (pipeline.sourceFile !== undefined) {
958
+ _.push("File: ".concat(pipeline.sourceFile));
959
+ }
960
+ if (pipeline.pipelineUrl !== undefined) {
961
+ _.push("Url: ".concat(pipeline.pipelineUrl));
962
+ }
963
+ return _.join('\n');
964
+ })();
954
965
  if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
955
966
  // <- Note: [🚲]
956
- throw new PipelineLogicError("Invalid promptbook URL \"".concat(pipeline.pipelineUrl, "\""));
967
+ throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Invalid promptbook URL \"".concat(pipeline.pipelineUrl, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
957
968
  }
958
969
  if (!isValidPromptbookVersion(pipeline.promptbookVersion)) {
959
970
  // <- Note: [🚲]
960
- throw new PipelineLogicError("Invalid promptbook Version \"".concat(pipeline.pipelineUrl, "\""));
971
+ throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.promptbookVersion, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
961
972
  }
962
973
  // TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
963
974
  if (!Array.isArray(pipeline.parameters)) {
964
975
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
965
- throw new ParsingError(spaceTrim$1("\n Promptbook is valid JSON but with wrong structure\n\n promptbook.parameters expected to be an array, but got ".concat(typeof pipeline.parameters, "\n ")));
976
+ throw new ParsingError(spaceTrim$1(function (block) { return "\n Promptbook is valid JSON but with wrong structure\n\n `promptbook.parameters` expected to be an array, but got ".concat(typeof pipeline.parameters, "\n\n ").concat(block(pipelineIdentification), "\n "); }));
966
977
  }
967
978
  // TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
968
979
  if (!Array.isArray(pipeline.promptTemplates)) {
969
980
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
970
- throw new ParsingError(spaceTrim$1("\n Promptbook is valid JSON but with wrong structure\n\n promptbook.promptTemplates expected to be an array, but got ".concat(typeof pipeline.promptTemplates, "\n ")));
981
+ throw new ParsingError(spaceTrim$1(function (block) { return "\n Promptbook is valid JSON but with wrong structure\n\n `promptbook.promptTemplates` expected to be an array, but got ".concat(typeof pipeline.promptTemplates, "\n\n ").concat(block(pipelineIdentification), "\n "); }));
971
982
  }
972
983
  var _loop_1 = function (parameter) {
973
984
  if (parameter.isInput && parameter.isOutput) {
974
- throw new PipelineLogicError("Parameter {".concat(parameter.name, "} can not be both input and output"));
985
+ throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n\n Parameter {".concat(parameter.name, "} can not be both input and output\n\n ").concat(block(pipelineIdentification), "\n "); }));
975
986
  }
976
987
  // Note: Testing that parameter is either intermediate or output BUT not created and unused
977
988
  if (!parameter.isInput &&
978
989
  !parameter.isOutput &&
979
990
  !pipeline.promptTemplates.some(function (template) { return template.dependentParameterNames.includes(parameter.name); })) {
980
- throw new PipelineLogicError(spaceTrim$1("\n Parameter {".concat(parameter.name, "} is created but not used\n\n You can declare {").concat(parameter.name, "} as output parameter by adding in the header:\n - OUTPUT PARAMETER `{").concat(parameter.name, "}` ").concat(parameter.description || '', "\n\n ")));
991
+ throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter {".concat(parameter.name, "} is created but not used\n\n You can declare {").concat(parameter.name, "} as output parameter by adding in the header:\n - OUTPUT PARAMETER `{").concat(parameter.name, "}` ").concat(parameter.description || '', "\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
981
992
  }
982
993
  // Note: Testing that parameter is either input or result of some template
983
994
  if (!parameter.isInput &&
984
995
  !pipeline.promptTemplates.some(function (template) { return template.resultingParameterName === parameter.name; })) {
985
- throw new PipelineLogicError(spaceTrim$1("\n Parameter {".concat(parameter.name, "} is declared but not defined\n\n You can do one of these:\n - Remove declaration of {").concat(parameter.name, "}\n - Add prompt template that results in -> {").concat(parameter.name, "}\n\n ")));
996
+ throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter {".concat(parameter.name, "} is declared but not defined\n\n You can do one of these:\n - Remove declaration of {").concat(parameter.name, "}\n - Add prompt template that results in -> {").concat(parameter.name, "}\n\n ").concat(block(pipelineIdentification), "\n "); }));
986
997
  }
987
998
  };
988
999
  try {
989
1000
  // Note: Check each parameter individually
990
- for (var _f = __values(pipeline.parameters), _g = _f.next(); !_g.done; _g = _f.next()) {
991
- var parameter = _g.value;
1001
+ for (var _d = __values(pipeline.parameters), _e = _d.next(); !_e.done; _e = _d.next()) {
1002
+ var parameter = _e.value;
992
1003
  _loop_1(parameter);
993
1004
  }
994
1005
  }
995
1006
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
996
1007
  finally {
997
1008
  try {
998
- if (_g && !_g.done && (_a = _f.return)) _a.call(_f);
1009
+ if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
999
1010
  }
1000
1011
  finally { if (e_1) throw e_1.error; }
1001
1012
  }
@@ -1007,70 +1018,80 @@ function validatePipeline(pipeline) {
1007
1018
  var name = _a.name;
1008
1019
  return name;
1009
1020
  }));
1010
- try {
1011
- // Note: Checking each template individually
1012
- for (var _h = __values(pipeline.promptTemplates), _j = _h.next(); !_j.done; _j = _h.next()) {
1013
- var template = _j.value;
1014
- if (definedParameters.has(template.resultingParameterName)) {
1015
- throw new PipelineLogicError("Parameter {".concat(template.resultingParameterName, "} is defined multiple times"));
1021
+ var _loop_2 = function (template) {
1022
+ var e_4, _h, e_5, _j;
1023
+ if (definedParameters.has(template.resultingParameterName)) {
1024
+ throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter {".concat(template.resultingParameterName, "} is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
1025
+ }
1026
+ if (RESERVED_PARAMETER_NAMES.includes(template.resultingParameterName)) {
1027
+ throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter name {".concat(template.resultingParameterName, "} is reserved, please use different name\n\n ").concat(block(pipelineIdentification), "\n "); }));
1028
+ }
1029
+ definedParameters.add(template.resultingParameterName);
1030
+ if (template.blockType === 'PROMPT_TEMPLATE' && template.modelRequirements.modelVariant === undefined) {
1031
+ throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n\n You must specify MODEL VARIANT in the prompt template \"".concat(template.title, "\"\n\n For example:\n - MODEL VARIANT Chat\n - MODEL NAME `gpt-4-1106-preview`").concat(/* <- TODO: Dynamic listing of command examples */ '', "\n\n ").concat(block(pipelineIdentification), "\n "); }));
1032
+ }
1033
+ if (template.jokerParameterNames && template.jokerParameterNames.length > 0) {
1034
+ if (!template.expectFormat &&
1035
+ !template.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
1036
+ throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Joker parameters are used for {".concat(template.resultingParameterName, "} but no expectations are defined\n\n ").concat(block(pipelineIdentification), "\n "); }));
1016
1037
  }
1017
- if (RESERVED_PARAMETER_NAMES.includes(template.resultingParameterName)) {
1018
- throw new PipelineLogicError("Parameter name {".concat(template.resultingParameterName, "} is reserved, please use different name"));
1038
+ var _loop_4 = function (joker) {
1039
+ if (!template.dependentParameterNames.includes(joker)) {
1040
+ throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter {".concat(joker, "} is used for {").concat(template.resultingParameterName, "} as joker but not in `dependentParameterNames`\n\n ").concat(block(pipelineIdentification), "\n "); }));
1041
+ }
1042
+ };
1043
+ try {
1044
+ for (var _k = (e_4 = void 0, __values(template.jokerParameterNames)), _l = _k.next(); !_l.done; _l = _k.next()) {
1045
+ var joker = _l.value;
1046
+ _loop_4(joker);
1047
+ }
1019
1048
  }
1020
- definedParameters.add(template.resultingParameterName);
1021
- if (template.blockType === 'PROMPT_TEMPLATE' && template.modelRequirements.modelVariant === undefined) {
1022
- throw new PipelineLogicError(spaceTrim$1("\n\n You must specify MODEL VARIANT in the prompt template \"".concat(template.title, "\"\n\n For example:\n - MODEL VARIANT Chat\n - MODEL NAME `gpt-4-1106-preview`\n\n ")));
1049
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
1050
+ finally {
1051
+ try {
1052
+ if (_l && !_l.done && (_h = _k.return)) _h.call(_k);
1053
+ }
1054
+ finally { if (e_4) throw e_4.error; }
1023
1055
  }
1024
- if (template.jokerParameterNames && template.jokerParameterNames.length > 0) {
1025
- if (!template.expectFormat &&
1026
- !template.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
1027
- throw new PipelineLogicError("Joker parameters are used for {".concat(template.resultingParameterName, "} but no expectations are defined"));
1056
+ }
1057
+ if (template.expectations) {
1058
+ var _loop_5 = function (unit, min, max) {
1059
+ if (min !== undefined && max !== undefined && min > max) {
1060
+ throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Min expectation (=".concat(min, ") of ").concat(unit, " is higher than max expectation (=").concat(max, ")\n\n ").concat(block(pipelineIdentification), "\n "); }));
1028
1061
  }
1029
- try {
1030
- for (var _k = (e_3 = void 0, __values(template.jokerParameterNames)), _l = _k.next(); !_l.done; _l = _k.next()) {
1031
- var joker = _l.value;
1032
- if (!template.dependentParameterNames.includes(joker)) {
1033
- throw new PipelineLogicError("Parameter {".concat(joker, "} is used for {").concat(template.resultingParameterName, "} as joker but not in dependentParameterNames"));
1034
- }
1035
- }
1062
+ if (min !== undefined && min < 0) {
1063
+ throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Min expectation of ".concat(unit, " must be zero or positive\n\n ").concat(block(pipelineIdentification), "\n "); }));
1036
1064
  }
1037
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
1038
- finally {
1039
- try {
1040
- if (_l && !_l.done && (_c = _k.return)) _c.call(_k);
1041
- }
1042
- finally { if (e_3) throw e_3.error; }
1065
+ if (max !== undefined && max <= 0) {
1066
+ throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Max expectation of ".concat(unit, " must be positive\n\n ").concat(block(pipelineIdentification), "\n "); }));
1067
+ }
1068
+ };
1069
+ try {
1070
+ for (var _m = (e_5 = void 0, __values(Object.entries(template.expectations))), _o = _m.next(); !_o.done; _o = _m.next()) {
1071
+ var _p = __read(_o.value, 2), unit = _p[0], _q = _p[1], min = _q.min, max = _q.max;
1072
+ _loop_5(unit, min, max);
1043
1073
  }
1044
1074
  }
1045
- if (template.expectations) {
1075
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
1076
+ finally {
1046
1077
  try {
1047
- for (var _m = (e_4 = void 0, __values(Object.entries(template.expectations))), _o = _m.next(); !_o.done; _o = _m.next()) {
1048
- var _p = __read(_o.value, 2), unit = _p[0], _q = _p[1], min = _q.min, max = _q.max;
1049
- if (min !== undefined && max !== undefined && min > max) {
1050
- throw new PipelineLogicError("Min expectation (=".concat(min, ") of ").concat(unit, " is higher than max expectation (=").concat(max, ")"));
1051
- }
1052
- if (min !== undefined && min < 0) {
1053
- throw new PipelineLogicError("Min expectation of ".concat(unit, " must be zero or positive"));
1054
- }
1055
- if (max !== undefined && max <= 0) {
1056
- throw new PipelineLogicError("Max expectation of ".concat(unit, " must be positive"));
1057
- }
1058
- }
1059
- }
1060
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
1061
- finally {
1062
- try {
1063
- if (_o && !_o.done && (_d = _m.return)) _d.call(_m);
1064
- }
1065
- finally { if (e_4) throw e_4.error; }
1078
+ if (_o && !_o.done && (_j = _m.return)) _j.call(_m);
1066
1079
  }
1080
+ finally { if (e_5) throw e_5.error; }
1067
1081
  }
1068
1082
  }
1083
+ };
1084
+ try {
1085
+ // Note: Checking each template individually
1086
+ for (var _f = __values(pipeline.promptTemplates), _g = _f.next(); !_g.done; _g = _f.next()) {
1087
+ var template = _g.value;
1088
+ _loop_2(template);
1089
+ }
1069
1090
  }
1070
1091
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
1071
1092
  finally {
1072
1093
  try {
1073
- if (_j && !_j.done && (_b = _h.return)) _b.call(_h);
1094
+ if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
1074
1095
  }
1075
1096
  finally { if (e_2) throw e_2.error; }
1076
1097
  }
@@ -1091,20 +1112,20 @@ function validatePipeline(pipeline) {
1091
1112
  resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), [reservedParameterName], false);
1092
1113
  }
1093
1114
  }
1094
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
1115
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
1095
1116
  finally {
1096
1117
  try {
1097
- if (RESERVED_PARAMETER_NAMES_1_1 && !RESERVED_PARAMETER_NAMES_1_1.done && (_e = RESERVED_PARAMETER_NAMES_1.return)) _e.call(RESERVED_PARAMETER_NAMES_1);
1118
+ if (RESERVED_PARAMETER_NAMES_1_1 && !RESERVED_PARAMETER_NAMES_1_1.done && (_c = RESERVED_PARAMETER_NAMES_1.return)) _c.call(RESERVED_PARAMETER_NAMES_1);
1098
1119
  }
1099
- finally { if (e_5) throw e_5.error; }
1120
+ finally { if (e_3) throw e_3.error; }
1100
1121
  }
1101
1122
  var unresovedTemplates = __spreadArray([], __read(pipeline.promptTemplates), false);
1102
1123
  // <- TODO: [🧠][🥜]
1103
1124
  var loopLimit = LOOP_LIMIT;
1104
- var _loop_2 = function () {
1125
+ var _loop_3 = function () {
1105
1126
  if (loopLimit-- < 0) {
1106
1127
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
1107
- throw new UnexpectedError('Loop limit reached during detection of circular dependencies in `validatePipeline`');
1128
+ throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Loop limit reached during detection of circular dependencies in `validatePipeline`\n\n ".concat(block(pipelineIdentification), "\n "); }));
1108
1129
  }
1109
1130
  var currentlyResovedTemplates = unresovedTemplates.filter(function (template) {
1110
1131
  return template.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
@@ -1119,7 +1140,7 @@ function validatePipeline(pipeline) {
1119
1140
  .map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
1120
1141
  .join(' and '));
1121
1142
  })
1122
- .join('\n')), "\n\n Resolved:\n ").concat(block(resovedParameters.map(function (name) { return "- Parameter {".concat(name, "}"); }).join('\n')), "\n "); }));
1143
+ .join('\n')), "\n\n Resolved:\n ").concat(block(resovedParameters.map(function (name) { return "- Parameter {".concat(name, "}"); }).join('\n')), "\n\n ").concat(block(pipelineIdentification), "\n "); }));
1123
1144
  }
1124
1145
  resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTemplates.map(function (_a) {
1125
1146
  var resultingParameterName = _a.resultingParameterName;
@@ -1128,7 +1149,7 @@ function validatePipeline(pipeline) {
1128
1149
  unresovedTemplates = unresovedTemplates.filter(function (template) { return !currentlyResovedTemplates.includes(template); });
1129
1150
  };
1130
1151
  while (unresovedTemplates.length > 0) {
1131
- _loop_2();
1152
+ _loop_3();
1132
1153
  }
1133
1154
  return pipeline;
1134
1155
  }
@@ -1144,12 +1165,12 @@ function validatePipeline(pipeline) {
1144
1165
  * > ex port function validatePipeline(promptbook: really_unknown): asserts promptbook is PipelineJson {
1145
1166
  */
1146
1167
  /**
1147
- * TODO: [🧠][🐣] !!!! Validate that all samples match expectations
1148
- * TODO: [🧠][🐣] !!!! Validate that knowledge is valid (non-void)
1149
- * TODO: [🧠][🐣] !!!! Validate that persona can be used only with CHAT variant
1150
- * TODO: !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
1151
- * TODO: !!!! Validate that reserved parameter is not used as joker
1152
- * TODO: [🧠] !!! Validationg not only logic itself but imports around - files and websites and rerefenced pipelines exists
1168
+ * TODO: [🐣] !!!! Validate that all samples match expectations
1169
+ * TODO: [🐣][🐝] !!!! Validate that knowledge is valid (non-void)
1170
+ * TODO: [🐣] !!!! Validate that persona can be used only with CHAT variant
1171
+ * TODO: [🐣] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
1172
+ * TODO: [🐣] !!!! Validate that reserved parameter is not used as joker
1173
+ * TODO: [🧠] Validation not only logic itself but imports around - files and websites and rerefenced pipelines exists
1153
1174
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
1154
1175
  */
1155
1176
 
@@ -1187,7 +1208,7 @@ var ReferenceError$1 = /** @class */ (function (_super) {
1187
1208
  * @param template the template with parameters in {curly} braces
1188
1209
  * @returns the list of parameter names
1189
1210
  */
1190
- function extractParameters(template) {
1211
+ function extractParameterNames(template) {
1191
1212
  var e_1, _a;
1192
1213
  var matches = template.matchAll(/{\w+}/g);
1193
1214
  var parameterNames = new Set();
@@ -1207,9 +1228,6 @@ function extractParameters(template) {
1207
1228
  }
1208
1229
  return parameterNames;
1209
1230
  }
1210
- /**
1211
- * TODO: !!!!! Rename to extractParameterNames
1212
- */
1213
1231
 
1214
1232
  /**
1215
1233
  * Unprepare just strips the preparation data of the pipeline
@@ -1220,7 +1238,7 @@ function unpreparePipeline(pipeline) {
1220
1238
  knowledgeSources = knowledgeSources.map(function (knowledgeSource) { return (__assign(__assign({}, knowledgeSource), { preparationIds: undefined })); });
1221
1239
  promptTemplates = promptTemplates.map(function (promptTemplate) {
1222
1240
  var dependentParameterNames = promptTemplate.dependentParameterNames;
1223
- var parameterNames = extractParameters(promptTemplate.preparedContent || '');
1241
+ var parameterNames = extractParameterNames(promptTemplate.preparedContent || '');
1224
1242
  dependentParameterNames = dependentParameterNames.filter(function (dependentParameterName) { return !parameterNames.has(dependentParameterName); });
1225
1243
  var promptTemplateUnprepared = __assign(__assign({}, promptTemplate), { dependentParameterNames: dependentParameterNames });
1226
1244
  delete promptTemplateUnprepared.preparedContent;
@@ -1777,12 +1795,12 @@ function extractVariables(script) {
1777
1795
  * @returns the set of parameter names
1778
1796
  * @throws {ParsingError} if the script is invalid
1779
1797
  */
1780
- function extractParametersFromPromptTemplate(promptTemplate) {
1798
+ function extractParameterNamesFromPromptTemplate(promptTemplate) {
1781
1799
  var e_1, _a, e_2, _b, e_3, _c;
1782
1800
  var title = promptTemplate.title, description = promptTemplate.description, blockType = promptTemplate.blockType, content = promptTemplate.content, preparedContent = promptTemplate.preparedContent, jokerParameterNames = promptTemplate.jokerParameterNames;
1783
1801
  var parameterNames = new Set();
1784
1802
  try {
1785
- for (var _d = __values(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(extractParameters(title)), false), __read(extractParameters(description || '')), false), __read(extractParameters(content)), false), __read(extractParameters(preparedContent || '')), false)), _e = _d.next(); !_e.done; _e = _d.next()) {
1803
+ for (var _d = __values(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(extractParameterNames(title)), false), __read(extractParameterNames(description || '')), false), __read(extractParameterNames(content)), false), __read(extractParameterNames(preparedContent || '')), false)), _e = _d.next(); !_e.done; _e = _d.next()) {
1786
1804
  var parameterName = _e.value;
1787
1805
  parameterNames.add(parameterName);
1788
1806
  }
@@ -1850,7 +1868,7 @@ var ExpectError = /** @class */ (function (_super) {
1850
1868
  /**
1851
1869
  * Function isValidJsonString will tell you if the string is valid JSON or not
1852
1870
  */
1853
- function isValidJsonString(value /* <-[👨‍⚖️] */) {
1871
+ function isValidJsonString(value /* <- [👨‍⚖️] */) {
1854
1872
  try {
1855
1873
  JSON.parse(value);
1856
1874
  return true;
@@ -2134,9 +2152,9 @@ function isPipelinePrepared(pipeline) {
2134
2152
  * TODO: [🔼] Export via core or utils
2135
2153
  * TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
2136
2154
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
2137
- * - Is context in each template
2138
- * - Are samples prepared
2139
- * - Are templates prepared
2155
+ * - [🏍] ? Is context in each template
2156
+ * - [♨] Are samples prepared
2157
+ * - [♨] Are templates prepared
2140
2158
  */
2141
2159
 
2142
2160
  /**
@@ -2467,7 +2485,7 @@ function createPipelineExecutor(options) {
2467
2485
  pipeline = rawPipeline;
2468
2486
  }
2469
2487
  else {
2470
- // TODO: !!!! This should be maybe warning in report
2488
+ // TODO: !!!!! This should be maybe warning in report
2471
2489
  console.warn(spaceTrim$1("\n Pipeline ".concat(rawPipeline.pipelineUrl || rawPipeline.sourceFile || rawPipeline.title, " is not prepared\n\n ").concat(rawPipeline.sourceFile, "\n\n It will be prepared ad-hoc before the first execution\n But it is recommended to prepare the pipeline during collection preparation\n\n @see more at https://ptbk.io/prepare-pipeline\n ")));
2472
2490
  }
2473
2491
  var pipelineExecutor = function (inputParameters, onProgress) { return __awaiter(_this, void 0, void 0, function () {
@@ -2477,7 +2495,7 @@ function createPipelineExecutor(options) {
2477
2495
  return __awaiter(this, void 0, void 0, function () {
2478
2496
  return __generator(this, function (_a) {
2479
2497
  TODO_USE(template);
2480
- return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: !!!! Implement */];
2498
+ return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [🏍] Implement */];
2481
2499
  });
2482
2500
  });
2483
2501
  }
@@ -2485,7 +2503,7 @@ function createPipelineExecutor(options) {
2485
2503
  template) {
2486
2504
  return __awaiter(this, void 0, void 0, function () {
2487
2505
  return __generator(this, function (_a) {
2488
- // TODO: !!!! Implement Better - use real index and keyword search
2506
+ // TODO: [♨] Implement Better - use real index and keyword search
2489
2507
  TODO_USE(template);
2490
2508
  return [2 /*return*/, pipeline.knowledgePieces.map(function (_a) {
2491
2509
  var content = _a.content;
@@ -2498,9 +2516,9 @@ function createPipelineExecutor(options) {
2498
2516
  template) {
2499
2517
  return __awaiter(this, void 0, void 0, function () {
2500
2518
  return __generator(this, function (_a) {
2501
- // TODO: !!!! Implement Better - use real index and keyword search
2519
+ // TODO: [♨] Implement Better - use real index and keyword search
2502
2520
  TODO_USE(template);
2503
- return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: !!!! Implement */];
2521
+ return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [♨] Implement */];
2504
2522
  });
2505
2523
  });
2506
2524
  }
@@ -2576,7 +2594,7 @@ function createPipelineExecutor(options) {
2576
2594
  _u.sent();
2577
2595
  _u.label = 2;
2578
2596
  case 2:
2579
- usedParameterNames = extractParametersFromPromptTemplate(currentTemplate);
2597
+ usedParameterNames = extractParameterNamesFromPromptTemplate(currentTemplate);
2580
2598
  dependentParameterNames = new Set(currentTemplate.dependentParameterNames);
2581
2599
  if (union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)).size !== 0) {
2582
2600
  throw new UnexpectedError(spaceTrim$1("\n Dependent parameters are not consistent used parameters:\n\n Dependent parameters:\n ".concat(Array.from(dependentParameterNames).join(', '), "\n\n Used parameters:\n ").concat(Array.from(usedParameterNames).join(', '), "\n\n ")));
@@ -2962,14 +2980,7 @@ function createPipelineExecutor(options) {
2962
2980
  ) {
2963
2981
  // TODO: [🧠] Maybe put other blockTypes into report
2964
2982
  executionReport.promptExecutions.push({
2965
- prompt: {
2966
- title: currentTemplate.title /* <- Note: If title in pipeline contains emojis, pass it innto report */,
2967
- content: prompt.content,
2968
- modelRequirements: prompt.modelRequirements,
2969
- expectations: prompt.expectations,
2970
- expectFormat: prompt.expectFormat,
2971
- // <- Note: Do want to pass ONLY wanted information to the report
2972
- },
2983
+ prompt: __assign(__assign({ '!!! All information': null }, prompt), { '!!! Wanted information': null, title: currentTemplate.title /* <- Note: If title in pipeline contains emojis, pass it innto report */, content: prompt.content, modelRequirements: prompt.modelRequirements, expectations: prompt.expectations, expectFormat: prompt.expectFormat }),
2973
2984
  result: result || undefined,
2974
2985
  error: expectError || undefined,
2975
2986
  });
@@ -3233,8 +3244,8 @@ function createPipelineExecutor(options) {
3233
3244
  return pipelineExecutor;
3234
3245
  }
3235
3246
  /**
3236
- * TODO: !!!! return `preparedPipeline` from execution
3237
- * TODO: !!!! `isNotPreparedWarningSupressed`
3247
+ * TODO: !!!!! return `preparedPipeline` from execution
3248
+ * TODO: !!!!! `isNotPreparedWarningSupressed`
3238
3249
  * TODO: Use isVerbose here (not only pass to `preparePipeline`)
3239
3250
  * TODO: [🪂] Use maxParallelCount here (not only pass to `preparePipeline`)
3240
3251
  * TODO: [♈] Probbably move expectations from templates to parameters
@@ -3243,7 +3254,7 @@ function createPipelineExecutor(options) {
3243
3254
  * Note: CreatePipelineExecutorOptions are just connected to PipelineExecutor so do not extract to types folder
3244
3255
  * TODO: [🧠][3] transparent = (report intermediate parameters) / opaque execution = (report only output parameters) progress reporting mode
3245
3256
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
3246
- * TODO: [💷] !!!! `assertsExecutionSuccessful` should be the method of `PipelineExecutor` result
3257
+ * TODO: [🧠][💷] `assertsExecutionSuccessful` should be the method of `PipelineExecutor` result BUT maybe NOT to preserve pure JSON object
3247
3258
  */
3248
3259
 
3249
3260
  /**
@@ -3519,7 +3530,7 @@ function prepareTemplates(pipeline, options) {
3519
3530
  case 0:
3520
3531
  _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a;
3521
3532
  promptTemplates = pipeline.promptTemplates, parameters = pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
3522
- // TODO: !!!! Apply samples to each template (if missing and is for the template defined)
3533
+ // TODO: !!!!!! Apply samples to each template (if missing and is for the template defined)
3523
3534
  TODO_USE(parameters);
3524
3535
  promptTemplatesPrepared = new Array(promptTemplates.length);
3525
3536
  return [4 /*yield*/, forEachAsync(promptTemplates, { maxParallelCount: maxParallelCount /* <- TODO: [🪂] When there are subtasks, this maximul limit can be broken */ }, function (template, index) { return __awaiter(_this, void 0, void 0, function () {
@@ -3549,7 +3560,7 @@ function prepareTemplates(pipeline, options) {
3549
3560
  /**
3550
3561
  * TODO: [🧠] Add context to each template (if missing)
3551
3562
  * TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
3552
- * TODO: !!!!! Index the samples and maybe templates
3563
+ * TODO: [♨] !!! Prepare index the samples and maybe templates
3553
3564
  * TODO: [🔼] !!! Export via `@promptbook/core`
3554
3565
  * TODO: Write tests for `preparePipeline`
3555
3566
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
@@ -3628,7 +3639,7 @@ function preparePipeline(pipeline, options) {
3628
3639
  * TODO: Write tests for `preparePipeline`
3629
3640
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
3630
3641
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
3631
- * TODO: [🎐] !!!! Use here countTotalUsage
3642
+ * TODO: [🎐] !!!!!! Use here countTotalUsage
3632
3643
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
3633
3644
  */
3634
3645
 
@@ -4449,11 +4460,8 @@ var promptbookVersionCommandParser = {
4449
4460
  /**
4450
4461
  * Name of the command
4451
4462
  */
4452
- name: 'VERSION',
4453
- /*
4454
- Note: [📇] No need to put here "PROMPTBOOK" alias here
4455
- aliasNames: ['PROMPTBOOK_VERSION'],
4456
- */
4463
+ name: 'PROMPTBOOK_VERSION',
4464
+ aliasNames: ['PTBK_VERSION', 'PTBK_V', 'PTBKV'],
4457
4465
  /**
4458
4466
  * BOILERPLATE command can be used in:
4459
4467
  */
@@ -4469,7 +4477,7 @@ var promptbookVersionCommandParser = {
4469
4477
  /**
4470
4478
  * Example usages of the PROMPTBOOK_VERSION command
4471
4479
  */
4472
- examples: ["PROMPTBOOK VERSION ".concat(PROMPTBOOK_VERSION), "VERSION ".concat(PROMPTBOOK_VERSION)],
4480
+ examples: ["PROMPTBOOK VERSION ".concat(PROMPTBOOK_VERSION), "PTBKV ".concat(PROMPTBOOK_VERSION)],
4473
4481
  /**
4474
4482
  * Parses the PROMPTBOOK_VERSION command
4475
4483
  */
@@ -4503,8 +4511,9 @@ var urlCommandParser = {
4503
4511
  * Name of the command
4504
4512
  */
4505
4513
  name: 'URL',
4514
+ aliasNames: ['PIPELINE_URL'],
4506
4515
  /*
4507
- Note: [🛵] No need for alias name because it is already preprocessed
4516
+ Note: [🛵] No need for this alias name because it is already preprocessed
4508
4517
  aliasNames: ['HTTPS'],
4509
4518
  */
4510
4519
  /**
@@ -4523,6 +4532,7 @@ var urlCommandParser = {
4523
4532
  * Example usages of the URL command
4524
4533
  */
4525
4534
  examples: [
4535
+ 'PIPELINE URL https://promptbook.studio/library/write-cv.ptbk.md',
4526
4536
  'URL https://promptbook.studio/library/write-cv.ptbk.md',
4527
4537
  'https://promptbook.studio/library/write-cv.ptbk.md',
4528
4538
  ],
@@ -4761,10 +4771,6 @@ function parseCommand(raw, usagePlace) {
4761
4771
  .split(' ')
4762
4772
  .map(function (part) { return part.trim(); })
4763
4773
  .filter(function (item) { return item !== ''; })
4764
- // Note: [📇]:
4765
- .filter(function (item) { return !/^PTBK$/i.test(item); })
4766
- .filter(function (item) { return !/^PIPELINE$/i.test(item); })
4767
- .filter(function (item) { return !/^PROMPTBOOK$/i.test(item); })
4768
4774
  .map(removeMarkdownFormatting)
4769
4775
  .map(function (item) { return item.trim(); });
4770
4776
  if (items.length === 0 || items[0] === '') {
@@ -5479,7 +5485,7 @@ function pipelineStringToJsonSync(pipelineString) {
5479
5485
  if (templateModelRequirements.modelVariant === undefined) {
5480
5486
  templateModelRequirements.modelVariant = 'CHAT';
5481
5487
  }
5482
- templateJson.dependentParameterNames = Array.from(extractParametersFromPromptTemplate(templateJson));
5488
+ templateJson.dependentParameterNames = Array.from(extractParameterNamesFromPromptTemplate(templateJson));
5483
5489
  // TODO: [🍧][❔] Remove this condition - modelRequirements should be put here via BLOCK command not removed when PROMPT_TEMPLATE
5484
5490
  if (templateJson.blockType !== 'PROMPT_TEMPLATE') {
5485
5491
  delete templateJson.modelRequirements;
@@ -5946,7 +5952,6 @@ function listAllFiles(path, isRecursive) {
5946
5952
  });
5947
5953
  }
5948
5954
  /**
5949
- * TODO: !!!! [🧠] Library precompilation and do not mix markdown and json pipelines
5950
5955
  * Note: [🟢] This code should never be published outside of `@pipeline/node`
5951
5956
  */
5952
5957
 
@@ -6402,7 +6407,7 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
6402
6407
  return AnthropicClaudeExecutionTools;
6403
6408
  }());
6404
6409
  /**
6405
- * TODO: !!!! [🍆] JSON mode
6410
+ * TODO: [🍆] JSON mode
6406
6411
  * TODO: [🧠] Maybe handle errors via transformAnthropicError (like transformAzureError)
6407
6412
  * TODO: Maybe Create some common util for callChatModel and callCompletionModel
6408
6413
  * TODO: Maybe make custom OpenaiError
@@ -6993,7 +6998,6 @@ var OpenAiExecutionTools = /** @class */ (function () {
6993
6998
  rawRequest = {
6994
6999
  input: replaceParameters(content, __assign(__assign({}, parameters), { modelName: modelName })),
6995
7000
  model: modelName,
6996
- // TODO: !!!! Test model 3 and dimensions
6997
7001
  };
6998
7002
  start = getCurrentIsoDate();
6999
7003
  if (this.options.isVerbose) {
@@ -7334,7 +7338,7 @@ function stringifyPipelineJson(pipeline) {
7334
7338
  return pipelineJsonStringified;
7335
7339
  }
7336
7340
  /**
7337
- * TODO: !!!! Not Working propperly @see https://promptbook.studio/samples/mixed-knowledge.ptbk.md
7341
+ * TODO: [🐝] Not Working propperly @see https://promptbook.studio/samples/mixed-knowledge.ptbk.md
7338
7342
  * TODO: [🧠][0] Maybe rename to `stringifyPipelineJson`, `stringifyIndexedJson`,...
7339
7343
  * TODO: [🧠] Maybe more elegant solution than replacing via regex
7340
7344
  * TODO: [🍙] Make some standart order of json properties