@promptbook/node 0.61.0-20 → 0.61.0-22

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
@@ -638,7 +638,7 @@ function forEachAsync(array, options, callbackfunction) {
638
638
  });
639
639
  }
640
640
 
641
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-19",parameters:[{name:"content",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledge",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> {content}",dependentParameterNames:["content"],resultingParameterName:"knowledge"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-19",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-19",parameters:[{name:"content",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> {content}",dependentParameterNames:["content"],resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-19",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-19",parameters:[{name:"content",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> {content}",expectations:{words:{min:1,max:8}},dependentParameterNames:["content"],resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-19",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-19",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-19",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"}];
641
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-21",parameters:[{name:"content",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledge",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> {content}",dependentParameterNames:["content"],resultingParameterName:"knowledge"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-21",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-21",parameters:[{name:"content",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> {content}",dependentParameterNames:["content"],resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-21",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-21",parameters:[{name:"content",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> {content}",expectations:{words:{min:1,max:8}},dependentParameterNames:["content"],resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-21",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-21",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-21",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"}];
642
642
 
643
643
  /**
644
644
  * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
@@ -1001,7 +1001,9 @@ function validatePipeline(pipeline) {
1001
1001
  return template.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
1002
1002
  });
1003
1003
  if (currentlyResovedTemplates.length === 0) {
1004
- throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n Can not resolve:\n ".concat(block(unresovedTemplates
1004
+ throw new PipelineLogicError(
1005
+ // TODO: [🐎] DRY
1006
+ spaceTrim$1(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n Can not resolve:\n ".concat(block(unresovedTemplates
1005
1007
  .map(function (_a) {
1006
1008
  var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
1007
1009
  return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
@@ -1560,7 +1562,11 @@ function assertsExecutionSuccessful(executionResult) {
1560
1562
  throw errors[0];
1561
1563
  }
1562
1564
  else {
1563
- throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Multiple errors occurred during promptnook execution\n\n ".concat(block(errors.map(function (error) { return '- ' + error.message; }).join('\n')), "\n "); }));
1565
+ throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Multiple errors occurred during promptnook execution\n\n ".concat(block(errors
1566
+ .map(function (error, index) {
1567
+ return spaceTrim$1(function (block) { return "\n Error ".concat(index + 1, ":\n ").concat(block(error.stack || error.message), "\n "); });
1568
+ })
1569
+ .join('\n')), "\n "); }));
1564
1570
  }
1565
1571
  }
1566
1572
  /**
@@ -2181,7 +2187,7 @@ function union() {
2181
2187
  /**
2182
2188
  * The version of the Promptbook library
2183
2189
  */
2184
- var PROMPTBOOK_VERSION = '0.61.0-19';
2190
+ var PROMPTBOOK_VERSION = '0.61.0-21';
2185
2191
  // TODO: !!!! List here all the versions and annotate + put into script
2186
2192
 
2187
2193
  /**
@@ -2814,7 +2820,34 @@ function createPipelineExecutor(options) {
2814
2820
  });
2815
2821
  });
2816
2822
  }
2817
- var executionReport, _a, _b, parameter, parametersToPass, resovedParameters_1, unresovedTemplates_1, resolving_1, loopLimit, _loop_1, error_1, usage_1, outputParameters, errors, _c, _d, parameter, usage;
2823
+ function filterJustOutputParameters() {
2824
+ var e_9, _a;
2825
+ var outputParameters = {};
2826
+ try {
2827
+ // Note: Filter ONLY output parameters
2828
+ for (var _b = __values(pipeline.parameters.filter(function (_a) {
2829
+ var isOutput = _a.isOutput;
2830
+ return isOutput;
2831
+ })), _c = _b.next(); !_c.done; _c = _b.next()) {
2832
+ var parameter = _c.value;
2833
+ if (parametersToPass[parameter.name] === undefined) {
2834
+ // [4]
2835
+ errors.push(new PipelineExecutionError("Parameter {".concat(parameter.name, "} should be an output parameter, but it was not be resolved")));
2836
+ continue;
2837
+ }
2838
+ outputParameters[parameter.name] = parametersToPass[parameter.name] || '';
2839
+ }
2840
+ }
2841
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
2842
+ finally {
2843
+ try {
2844
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2845
+ }
2846
+ finally { if (e_9) throw e_9.error; }
2847
+ }
2848
+ return outputParameters;
2849
+ }
2850
+ var executionReport, _a, _b, parameter, errors, _loop_1, _c, _d, parameterName, state_1, parametersToPass, resovedParameterNames_1, unresovedTemplates_1, resolving_1, loopLimit, _loop_2, error_1, usage_1, outputParameters_1, usage, outputParameters;
2818
2851
  var e_1, _e, e_2, _f;
2819
2852
  return __generator(this, function (_g) {
2820
2853
  switch (_g.label) {
@@ -2839,9 +2872,12 @@ function createPipelineExecutor(options) {
2839
2872
  };
2840
2873
  try {
2841
2874
  // Note: Check that all input input parameters are defined
2842
- for (_a = __values(pipeline.parameters), _b = _a.next(); !_b.done; _b = _a.next()) {
2875
+ for (_a = __values(pipeline.parameters.filter(function (_a) {
2876
+ var isInput = _a.isInput;
2877
+ return isInput;
2878
+ })), _b = _a.next(); !_b.done; _b = _a.next()) {
2843
2879
  parameter = _b.value;
2844
- if (parameter.isInput && inputParameters[parameter.name] === undefined) {
2880
+ if (inputParameters[parameter.name] === undefined) {
2845
2881
  return [2 /*return*/, deepFreezeWithSameType({
2846
2882
  isSuccessful: false,
2847
2883
  errors: [
@@ -2862,11 +2898,49 @@ function createPipelineExecutor(options) {
2862
2898
  }
2863
2899
  finally { if (e_1) throw e_1.error; }
2864
2900
  }
2901
+ errors = [];
2902
+ _loop_1 = function (parameterName) {
2903
+ var parameter = pipeline.parameters.find(function (_a) {
2904
+ var name = _a.name;
2905
+ return name === parameterName;
2906
+ });
2907
+ if (parameter === undefined) {
2908
+ errors.push(new PipelineExecutionError("Extra parameter {".concat(parameterName, "} is passed as input parameter")));
2909
+ }
2910
+ else if (parameter.isInput === false) {
2911
+ return { value: deepFreezeWithSameType({
2912
+ isSuccessful: false,
2913
+ errors: [
2914
+ new PipelineExecutionError("Parameter {".concat(parameter.name, "} is passed as input parameter but is not input")),
2915
+ // <- TODO: !!!!! Test this error
2916
+ ],
2917
+ executionReport: executionReport,
2918
+ outputParameters: {},
2919
+ usage: ZERO_USAGE,
2920
+ }) };
2921
+ }
2922
+ };
2923
+ try {
2924
+ // Note: Check that no extra input parameters are passed
2925
+ for (_c = __values(Object.keys(inputParameters)), _d = _c.next(); !_d.done; _d = _c.next()) {
2926
+ parameterName = _d.value;
2927
+ state_1 = _loop_1(parameterName);
2928
+ if (typeof state_1 === "object")
2929
+ return [2 /*return*/, state_1.value];
2930
+ }
2931
+ }
2932
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
2933
+ finally {
2934
+ try {
2935
+ if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
2936
+ }
2937
+ finally { if (e_2) throw e_2.error; }
2938
+ }
2865
2939
  parametersToPass = inputParameters;
2866
2940
  _g.label = 3;
2867
2941
  case 3:
2868
2942
  _g.trys.push([3, 8, , 9]);
2869
- resovedParameters_1 = pipeline.parameters
2943
+ resovedParameterNames_1 = pipeline.parameters
2870
2944
  .filter(function (_a) {
2871
2945
  var isInput = _a.isInput;
2872
2946
  return isInput;
@@ -2878,7 +2952,7 @@ function createPipelineExecutor(options) {
2878
2952
  unresovedTemplates_1 = __spreadArray([], __read(pipeline.promptTemplates), false);
2879
2953
  resolving_1 = [];
2880
2954
  loopLimit = LOOP_LIMIT;
2881
- _loop_1 = function () {
2955
+ _loop_2 = function () {
2882
2956
  var currentTemplate, work_1;
2883
2957
  return __generator(this, function (_h) {
2884
2958
  switch (_h.label) {
@@ -2888,15 +2962,21 @@ function createPipelineExecutor(options) {
2888
2962
  throw new UnexpectedError('Loop limit reached during resolving parameters pipeline execution');
2889
2963
  }
2890
2964
  currentTemplate = unresovedTemplates_1.find(function (template) {
2891
- return template.dependentParameterNames.every(function (name) { return resovedParameters_1.includes(name); });
2965
+ return template.dependentParameterNames.every(function (name) {
2966
+ return __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), __read(RESERVED_PARAMETER_NAMES), false).includes(name);
2967
+ });
2892
2968
  });
2893
2969
  if (!(!currentTemplate && resolving_1.length === 0)) return [3 /*break*/, 1];
2894
- throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Can not resolve some parameters\n\n Note: This should be catched in `validatePipeline`\n\n\n Unresolved parameters:\n ".concat(block(unresovedTemplates_1
2970
+ throw new UnexpectedError(
2971
+ // TODO: [🐎] DRY
2972
+ spaceTrim$1(function (block) { return "\n Can not resolve some parameters:\n\n Can not resolve:\n ".concat(block(unresovedTemplates_1
2895
2973
  .map(function (_a) {
2896
- var resultingParameterName = _a.resultingParameterName;
2897
- return "- {".concat(resultingParameterName, "}");
2974
+ var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
2975
+ return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
2976
+ .map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
2977
+ .join(' and '));
2898
2978
  })
2899
- .join('\n')), "\n\n Resolved parameters:\n ").concat(block(resovedParameters_1.map(function (name) { return "- {".concat(name, "}"); }).join('\n')), "\n "); }));
2979
+ .join('\n')), "\n\n Resolved:\n ").concat(block(resovedParameterNames_1.map(function (name) { return "- Parameter {".concat(name, "}"); }).join('\n')), "\n\n Note: This should be catched in `validatePipeline`\n "); }));
2900
2980
  case 1:
2901
2981
  if (!!currentTemplate) return [3 /*break*/, 3];
2902
2982
  /* [5] */ return [4 /*yield*/, Promise.race(resolving_1)];
@@ -2907,7 +2987,7 @@ function createPipelineExecutor(options) {
2907
2987
  unresovedTemplates_1 = unresovedTemplates_1.filter(function (template) { return template !== currentTemplate; });
2908
2988
  work_1 = executeSingleTemplate(currentTemplate)
2909
2989
  .then(function () {
2910
- resovedParameters_1 = __spreadArray(__spreadArray([], __read(resovedParameters_1), false), [currentTemplate.resultingParameterName], false);
2990
+ resovedParameterNames_1 = __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), [currentTemplate.resultingParameterName], false);
2911
2991
  })
2912
2992
  .then(function () {
2913
2993
  resolving_1 = resolving_1.filter(function (w) { return w !== work_1; });
@@ -2921,7 +3001,7 @@ function createPipelineExecutor(options) {
2921
3001
  _g.label = 4;
2922
3002
  case 4:
2923
3003
  if (!(unresovedTemplates_1.length > 0)) return [3 /*break*/, 6];
2924
- return [5 /*yield**/, _loop_1()];
3004
+ return [5 /*yield**/, _loop_2()];
2925
3005
  case 5:
2926
3006
  _g.sent();
2927
3007
  return [3 /*break*/, 4];
@@ -2938,41 +3018,20 @@ function createPipelineExecutor(options) {
2938
3018
  var result = _a.result;
2939
3019
  return (result === null || result === void 0 ? void 0 : result.usage) || ZERO_USAGE;
2940
3020
  })), false));
3021
+ outputParameters_1 = filterJustOutputParameters();
2941
3022
  return [2 /*return*/, deepFreezeWithSameType({
2942
3023
  isSuccessful: false,
2943
- errors: [error_1],
3024
+ errors: __spreadArray([error_1], __read(errors), false),
2944
3025
  usage: usage_1,
2945
3026
  executionReport: executionReport,
2946
- outputParameters: parametersToPass,
3027
+ outputParameters: outputParameters_1,
2947
3028
  })];
2948
3029
  case 9:
2949
- outputParameters = {};
2950
- errors = [];
2951
- try {
2952
- // Note: Filter ONLY output parameters
2953
- for (_c = __values(pipeline.parameters.filter(function (_a) {
2954
- var isOutput = _a.isOutput;
2955
- return isOutput;
2956
- })), _d = _c.next(); !_d.done; _d = _c.next()) {
2957
- parameter = _d.value;
2958
- if (parametersToPass[parameter.name] === undefined) {
2959
- errors.push(new PipelineExecutionError("Parameter {".concat(parameter.name, "} is required as an output parameter but not set in the pipeline")));
2960
- continue;
2961
- }
2962
- outputParameters[parameter.name] = parametersToPass[parameter.name] || '';
2963
- }
2964
- }
2965
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
2966
- finally {
2967
- try {
2968
- if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
2969
- }
2970
- finally { if (e_2) throw e_2.error; }
2971
- }
2972
3030
  usage = addUsage.apply(void 0, __spreadArray([], __read(executionReport.promptExecutions.map(function (_a) {
2973
3031
  var result = _a.result;
2974
3032
  return (result === null || result === void 0 ? void 0 : result.usage) || ZERO_USAGE;
2975
3033
  })), false));
3034
+ outputParameters = filterJustOutputParameters();
2976
3035
  return [2 /*return*/, deepFreezeWithSameType({
2977
3036
  isSuccessful: true,
2978
3037
  errors: errors,
@@ -2994,6 +3053,7 @@ function createPipelineExecutor(options) {
2994
3053
  * Note: CreatePipelineExecutorOptions are just connected to PipelineExecutor so do not extract to types folder
2995
3054
  * TODO: [🧠][3] transparent = (report intermediate parameters) / opaque execution = (report only output parameters) progress reporting mode
2996
3055
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
3056
+ * TODO: [💷] !!!! `assertsExecutionSuccessful` should be the method of `PipelineExecutor` result
2997
3057
  */
2998
3058
 
2999
3059
  /**