@promptbook/node 0.61.0-25 → 0.61.0-26

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.
package/esm/index.es.js CHANGED
@@ -654,7 +654,7 @@ function forEachAsync(array, options, callbackfunction) {
654
654
  });
655
655
  }
656
656
 
657
- 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"}];
657
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-25",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-25",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-25",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-25",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-25",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-25",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-25",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-25",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"}];
658
658
 
659
659
  /**
660
660
  * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
@@ -857,52 +857,63 @@ function isValidPipelineUrl(url) {
857
857
  */
858
858
  function validatePipeline(pipeline) {
859
859
  // TODO: [🧠] Maybe test if promptbook is a promise and make specific error case for that
860
- var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e;
860
+ var e_1, _a, e_2, _b, e_3, _c;
861
+ var pipelineIdentification = (function () {
862
+ // Note: This is a 😐 implementation of [🚞]
863
+ var _ = [];
864
+ if (pipeline.sourceFile !== undefined) {
865
+ _.push("File: ".concat(pipeline.sourceFile));
866
+ }
867
+ if (pipeline.pipelineUrl !== undefined) {
868
+ _.push("Url: ".concat(pipeline.pipelineUrl));
869
+ }
870
+ return _.join('\n');
871
+ })();
861
872
  if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
862
873
  // <- Note: [🚲]
863
- throw new PipelineLogicError("Invalid promptbook URL \"".concat(pipeline.pipelineUrl, "\""));
874
+ throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Invalid promptbook URL \"".concat(pipeline.pipelineUrl, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
864
875
  }
865
876
  if (!isValidPromptbookVersion(pipeline.promptbookVersion)) {
866
877
  // <- Note: [🚲]
867
- throw new PipelineLogicError("Invalid promptbook Version \"".concat(pipeline.pipelineUrl, "\""));
878
+ throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.promptbookVersion, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
868
879
  }
869
880
  // TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
870
881
  if (!Array.isArray(pipeline.parameters)) {
871
882
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
872
- 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 ")));
883
+ 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 "); }));
873
884
  }
874
885
  // TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
875
886
  if (!Array.isArray(pipeline.promptTemplates)) {
876
887
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
877
- 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 ")));
888
+ 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 "); }));
878
889
  }
879
890
  var _loop_1 = function (parameter) {
880
891
  if (parameter.isInput && parameter.isOutput) {
881
- throw new PipelineLogicError("Parameter {".concat(parameter.name, "} can not be both input and output"));
892
+ 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 "); }));
882
893
  }
883
894
  // Note: Testing that parameter is either intermediate or output BUT not created and unused
884
895
  if (!parameter.isInput &&
885
896
  !parameter.isOutput &&
886
897
  !pipeline.promptTemplates.some(function (template) { return template.dependentParameterNames.includes(parameter.name); })) {
887
- 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 ")));
898
+ 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 "); }));
888
899
  }
889
900
  // Note: Testing that parameter is either input or result of some template
890
901
  if (!parameter.isInput &&
891
902
  !pipeline.promptTemplates.some(function (template) { return template.resultingParameterName === parameter.name; })) {
892
- 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 ")));
903
+ 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 "); }));
893
904
  }
894
905
  };
895
906
  try {
896
907
  // Note: Check each parameter individually
897
- for (var _f = __values(pipeline.parameters), _g = _f.next(); !_g.done; _g = _f.next()) {
898
- var parameter = _g.value;
908
+ for (var _d = __values(pipeline.parameters), _e = _d.next(); !_e.done; _e = _d.next()) {
909
+ var parameter = _e.value;
899
910
  _loop_1(parameter);
900
911
  }
901
912
  }
902
913
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
903
914
  finally {
904
915
  try {
905
- if (_g && !_g.done && (_a = _f.return)) _a.call(_f);
916
+ if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
906
917
  }
907
918
  finally { if (e_1) throw e_1.error; }
908
919
  }
@@ -914,70 +925,80 @@ function validatePipeline(pipeline) {
914
925
  var name = _a.name;
915
926
  return name;
916
927
  }));
917
- try {
918
- // Note: Checking each template individually
919
- for (var _h = __values(pipeline.promptTemplates), _j = _h.next(); !_j.done; _j = _h.next()) {
920
- var template = _j.value;
921
- if (definedParameters.has(template.resultingParameterName)) {
922
- throw new PipelineLogicError("Parameter {".concat(template.resultingParameterName, "} is defined multiple times"));
928
+ var _loop_2 = function (template) {
929
+ var e_4, _h, e_5, _j;
930
+ if (definedParameters.has(template.resultingParameterName)) {
931
+ throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter {".concat(template.resultingParameterName, "} is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
932
+ }
933
+ if (RESERVED_PARAMETER_NAMES.includes(template.resultingParameterName)) {
934
+ 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 "); }));
935
+ }
936
+ definedParameters.add(template.resultingParameterName);
937
+ if (template.blockType === 'PROMPT_TEMPLATE' && template.modelRequirements.modelVariant === undefined) {
938
+ 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 "); }));
939
+ }
940
+ if (template.jokerParameterNames && template.jokerParameterNames.length > 0) {
941
+ if (!template.expectFormat &&
942
+ !template.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
943
+ 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 "); }));
923
944
  }
924
- if (RESERVED_PARAMETER_NAMES.includes(template.resultingParameterName)) {
925
- throw new PipelineLogicError("Parameter name {".concat(template.resultingParameterName, "} is reserved, please use different name"));
945
+ var _loop_4 = function (joker) {
946
+ if (!template.dependentParameterNames.includes(joker)) {
947
+ 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 "); }));
948
+ }
949
+ };
950
+ try {
951
+ for (var _k = (e_4 = void 0, __values(template.jokerParameterNames)), _l = _k.next(); !_l.done; _l = _k.next()) {
952
+ var joker = _l.value;
953
+ _loop_4(joker);
954
+ }
926
955
  }
927
- definedParameters.add(template.resultingParameterName);
928
- if (template.blockType === 'PROMPT_TEMPLATE' && template.modelRequirements.modelVariant === undefined) {
929
- 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 ")));
956
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
957
+ finally {
958
+ try {
959
+ if (_l && !_l.done && (_h = _k.return)) _h.call(_k);
960
+ }
961
+ finally { if (e_4) throw e_4.error; }
930
962
  }
931
- if (template.jokerParameterNames && template.jokerParameterNames.length > 0) {
932
- if (!template.expectFormat &&
933
- !template.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
934
- throw new PipelineLogicError("Joker parameters are used for {".concat(template.resultingParameterName, "} but no expectations are defined"));
963
+ }
964
+ if (template.expectations) {
965
+ var _loop_5 = function (unit, min, max) {
966
+ if (min !== undefined && max !== undefined && min > max) {
967
+ 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 "); }));
935
968
  }
936
- try {
937
- for (var _k = (e_3 = void 0, __values(template.jokerParameterNames)), _l = _k.next(); !_l.done; _l = _k.next()) {
938
- var joker = _l.value;
939
- if (!template.dependentParameterNames.includes(joker)) {
940
- throw new PipelineLogicError("Parameter {".concat(joker, "} is used for {").concat(template.resultingParameterName, "} as joker but not in dependentParameterNames"));
941
- }
942
- }
969
+ if (min !== undefined && min < 0) {
970
+ 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 "); }));
943
971
  }
944
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
945
- finally {
946
- try {
947
- if (_l && !_l.done && (_c = _k.return)) _c.call(_k);
948
- }
949
- finally { if (e_3) throw e_3.error; }
972
+ if (max !== undefined && max <= 0) {
973
+ throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Max expectation of ".concat(unit, " must be positive\n\n ").concat(block(pipelineIdentification), "\n "); }));
974
+ }
975
+ };
976
+ try {
977
+ for (var _m = (e_5 = void 0, __values(Object.entries(template.expectations))), _o = _m.next(); !_o.done; _o = _m.next()) {
978
+ var _p = __read(_o.value, 2), unit = _p[0], _q = _p[1], min = _q.min, max = _q.max;
979
+ _loop_5(unit, min, max);
950
980
  }
951
981
  }
952
- if (template.expectations) {
982
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
983
+ finally {
953
984
  try {
954
- for (var _m = (e_4 = void 0, __values(Object.entries(template.expectations))), _o = _m.next(); !_o.done; _o = _m.next()) {
955
- var _p = __read(_o.value, 2), unit = _p[0], _q = _p[1], min = _q.min, max = _q.max;
956
- if (min !== undefined && max !== undefined && min > max) {
957
- throw new PipelineLogicError("Min expectation (=".concat(min, ") of ").concat(unit, " is higher than max expectation (=").concat(max, ")"));
958
- }
959
- if (min !== undefined && min < 0) {
960
- throw new PipelineLogicError("Min expectation of ".concat(unit, " must be zero or positive"));
961
- }
962
- if (max !== undefined && max <= 0) {
963
- throw new PipelineLogicError("Max expectation of ".concat(unit, " must be positive"));
964
- }
965
- }
966
- }
967
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
968
- finally {
969
- try {
970
- if (_o && !_o.done && (_d = _m.return)) _d.call(_m);
971
- }
972
- finally { if (e_4) throw e_4.error; }
985
+ if (_o && !_o.done && (_j = _m.return)) _j.call(_m);
973
986
  }
987
+ finally { if (e_5) throw e_5.error; }
974
988
  }
975
989
  }
990
+ };
991
+ try {
992
+ // Note: Checking each template individually
993
+ for (var _f = __values(pipeline.promptTemplates), _g = _f.next(); !_g.done; _g = _f.next()) {
994
+ var template = _g.value;
995
+ _loop_2(template);
996
+ }
976
997
  }
977
998
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
978
999
  finally {
979
1000
  try {
980
- if (_j && !_j.done && (_b = _h.return)) _b.call(_h);
1001
+ if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
981
1002
  }
982
1003
  finally { if (e_2) throw e_2.error; }
983
1004
  }
@@ -998,20 +1019,20 @@ function validatePipeline(pipeline) {
998
1019
  resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), [reservedParameterName], false);
999
1020
  }
1000
1021
  }
1001
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
1022
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
1002
1023
  finally {
1003
1024
  try {
1004
- if (RESERVED_PARAMETER_NAMES_1_1 && !RESERVED_PARAMETER_NAMES_1_1.done && (_e = RESERVED_PARAMETER_NAMES_1.return)) _e.call(RESERVED_PARAMETER_NAMES_1);
1025
+ if (RESERVED_PARAMETER_NAMES_1_1 && !RESERVED_PARAMETER_NAMES_1_1.done && (_c = RESERVED_PARAMETER_NAMES_1.return)) _c.call(RESERVED_PARAMETER_NAMES_1);
1005
1026
  }
1006
- finally { if (e_5) throw e_5.error; }
1027
+ finally { if (e_3) throw e_3.error; }
1007
1028
  }
1008
1029
  var unresovedTemplates = __spreadArray([], __read(pipeline.promptTemplates), false);
1009
1030
  // <- TODO: [🧠][🥜]
1010
1031
  var loopLimit = LOOP_LIMIT;
1011
- var _loop_2 = function () {
1032
+ var _loop_3 = function () {
1012
1033
  if (loopLimit-- < 0) {
1013
1034
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
1014
- throw new UnexpectedError('Loop limit reached during detection of circular dependencies in `validatePipeline`');
1035
+ 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 "); }));
1015
1036
  }
1016
1037
  var currentlyResovedTemplates = unresovedTemplates.filter(function (template) {
1017
1038
  return template.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
@@ -1026,7 +1047,7 @@ function validatePipeline(pipeline) {
1026
1047
  .map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
1027
1048
  .join(' and '));
1028
1049
  })
1029
- .join('\n')), "\n\n Resolved:\n ").concat(block(resovedParameters.map(function (name) { return "- Parameter {".concat(name, "}"); }).join('\n')), "\n "); }));
1050
+ .join('\n')), "\n\n Resolved:\n ").concat(block(resovedParameters.map(function (name) { return "- Parameter {".concat(name, "}"); }).join('\n')), "\n\n ").concat(block(pipelineIdentification), "\n "); }));
1030
1051
  }
1031
1052
  resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTemplates.map(function (_a) {
1032
1053
  var resultingParameterName = _a.resultingParameterName;
@@ -1035,7 +1056,7 @@ function validatePipeline(pipeline) {
1035
1056
  unresovedTemplates = unresovedTemplates.filter(function (template) { return !currentlyResovedTemplates.includes(template); });
1036
1057
  };
1037
1058
  while (unresovedTemplates.length > 0) {
1038
- _loop_2();
1059
+ _loop_3();
1039
1060
  }
1040
1061
  return pipeline;
1041
1062
  }
@@ -1094,7 +1115,7 @@ var ReferenceError$1 = /** @class */ (function (_super) {
1094
1115
  * @param template the template with parameters in {curly} braces
1095
1116
  * @returns the list of parameter names
1096
1117
  */
1097
- function extractParameters(template) {
1118
+ function extractParameterNames(template) {
1098
1119
  var e_1, _a;
1099
1120
  var matches = template.matchAll(/{\w+}/g);
1100
1121
  var parameterNames = new Set();
@@ -1127,7 +1148,7 @@ function unpreparePipeline(pipeline) {
1127
1148
  knowledgeSources = knowledgeSources.map(function (knowledgeSource) { return (__assign(__assign({}, knowledgeSource), { preparationIds: undefined })); });
1128
1149
  promptTemplates = promptTemplates.map(function (promptTemplate) {
1129
1150
  var dependentParameterNames = promptTemplate.dependentParameterNames;
1130
- var parameterNames = extractParameters(promptTemplate.preparedContent || '');
1151
+ var parameterNames = extractParameterNames(promptTemplate.preparedContent || '');
1131
1152
  dependentParameterNames = dependentParameterNames.filter(function (dependentParameterName) { return !parameterNames.has(dependentParameterName); });
1132
1153
  var promptTemplateUnprepared = __assign(__assign({}, promptTemplate), { dependentParameterNames: dependentParameterNames });
1133
1154
  delete promptTemplateUnprepared.preparedContent;
@@ -1684,12 +1705,12 @@ function extractVariables(script) {
1684
1705
  * @returns the set of parameter names
1685
1706
  * @throws {ParsingError} if the script is invalid
1686
1707
  */
1687
- function extractParametersFromPromptTemplate(promptTemplate) {
1708
+ function extractParameterNamesFromPromptTemplate(promptTemplate) {
1688
1709
  var e_1, _a, e_2, _b, e_3, _c;
1689
1710
  var title = promptTemplate.title, description = promptTemplate.description, blockType = promptTemplate.blockType, content = promptTemplate.content, preparedContent = promptTemplate.preparedContent, jokerParameterNames = promptTemplate.jokerParameterNames;
1690
1711
  var parameterNames = new Set();
1691
1712
  try {
1692
- 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()) {
1713
+ 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()) {
1693
1714
  var parameterName = _e.value;
1694
1715
  parameterNames.add(parameterName);
1695
1716
  }
@@ -2250,7 +2271,7 @@ function union() {
2250
2271
  /**
2251
2272
  * The version of the Promptbook library
2252
2273
  */
2253
- var PROMPTBOOK_VERSION = '0.61.0-24';
2274
+ var PROMPTBOOK_VERSION = '0.61.0-25';
2254
2275
  // TODO: !!!! List here all the versions and annotate + put into script
2255
2276
 
2256
2277
  /**
@@ -2489,7 +2510,7 @@ function createPipelineExecutor(options) {
2489
2510
  _u.sent();
2490
2511
  _u.label = 2;
2491
2512
  case 2:
2492
- usedParameterNames = extractParametersFromPromptTemplate(currentTemplate);
2513
+ usedParameterNames = extractParameterNamesFromPromptTemplate(currentTemplate);
2493
2514
  dependentParameterNames = new Set(currentTemplate.dependentParameterNames);
2494
2515
  if (union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)).size !== 0) {
2495
2516
  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 ")));
@@ -2875,14 +2896,7 @@ function createPipelineExecutor(options) {
2875
2896
  ) {
2876
2897
  // TODO: [🧠] Maybe put other blockTypes into report
2877
2898
  executionReport.promptExecutions.push({
2878
- prompt: {
2879
- title: currentTemplate.title /* <- Note: If title in pipeline contains emojis, pass it innto report */,
2880
- content: prompt.content,
2881
- modelRequirements: prompt.modelRequirements,
2882
- expectations: prompt.expectations,
2883
- expectFormat: prompt.expectFormat,
2884
- // <- Note: Do want to pass ONLY wanted information to the report
2885
- },
2899
+ 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 }),
2886
2900
  result: result || undefined,
2887
2901
  error: expectError || undefined,
2888
2902
  });
@@ -4362,11 +4376,8 @@ var promptbookVersionCommandParser = {
4362
4376
  /**
4363
4377
  * Name of the command
4364
4378
  */
4365
- name: 'VERSION',
4366
- /*
4367
- Note: [📇] No need to put here "PROMPTBOOK" alias here
4368
- aliasNames: ['PROMPTBOOK_VERSION'],
4369
- */
4379
+ name: 'PROMPTBOOK_VERSION',
4380
+ aliasNames: ['PTBK_VERSION', 'PTBK_V', 'PTBKV'],
4370
4381
  /**
4371
4382
  * BOILERPLATE command can be used in:
4372
4383
  */
@@ -4382,7 +4393,7 @@ var promptbookVersionCommandParser = {
4382
4393
  /**
4383
4394
  * Example usages of the PROMPTBOOK_VERSION command
4384
4395
  */
4385
- examples: ["PROMPTBOOK VERSION ".concat(PROMPTBOOK_VERSION), "VERSION ".concat(PROMPTBOOK_VERSION)],
4396
+ examples: ["PROMPTBOOK VERSION ".concat(PROMPTBOOK_VERSION), "PTBKV ".concat(PROMPTBOOK_VERSION)],
4386
4397
  /**
4387
4398
  * Parses the PROMPTBOOK_VERSION command
4388
4399
  */
@@ -4416,8 +4427,9 @@ var urlCommandParser = {
4416
4427
  * Name of the command
4417
4428
  */
4418
4429
  name: 'URL',
4430
+ aliasNames: ['PIPELINE_URL'],
4419
4431
  /*
4420
- Note: [🛵] No need for alias name because it is already preprocessed
4432
+ Note: [🛵] No need for this alias name because it is already preprocessed
4421
4433
  aliasNames: ['HTTPS'],
4422
4434
  */
4423
4435
  /**
@@ -4436,6 +4448,7 @@ var urlCommandParser = {
4436
4448
  * Example usages of the URL command
4437
4449
  */
4438
4450
  examples: [
4451
+ 'PIPELINE URL https://promptbook.studio/library/write-cv.ptbk.md',
4439
4452
  'URL https://promptbook.studio/library/write-cv.ptbk.md',
4440
4453
  'https://promptbook.studio/library/write-cv.ptbk.md',
4441
4454
  ],
@@ -4674,10 +4687,6 @@ function parseCommand(raw, usagePlace) {
4674
4687
  .split(' ')
4675
4688
  .map(function (part) { return part.trim(); })
4676
4689
  .filter(function (item) { return item !== ''; })
4677
- // Note: [📇]:
4678
- .filter(function (item) { return !/^PTBK$/i.test(item); })
4679
- .filter(function (item) { return !/^PIPELINE$/i.test(item); })
4680
- .filter(function (item) { return !/^PROMPTBOOK$/i.test(item); })
4681
4690
  .map(removeMarkdownFormatting)
4682
4691
  .map(function (item) { return item.trim(); });
4683
4692
  if (items.length === 0 || items[0] === '') {
@@ -5392,7 +5401,7 @@ function pipelineStringToJsonSync(pipelineString) {
5392
5401
  if (templateModelRequirements.modelVariant === undefined) {
5393
5402
  templateModelRequirements.modelVariant = 'CHAT';
5394
5403
  }
5395
- templateJson.dependentParameterNames = Array.from(extractParametersFromPromptTemplate(templateJson));
5404
+ templateJson.dependentParameterNames = Array.from(extractParameterNamesFromPromptTemplate(templateJson));
5396
5405
  // TODO: [🍧][❔] Remove this condition - modelRequirements should be put here via BLOCK command not removed when PROMPT_TEMPLATE
5397
5406
  if (templateJson.blockType !== 'PROMPT_TEMPLATE') {
5398
5407
  delete templateJson.modelRequirements;