@promptbook/cli 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.
@@ -40,4 +40,5 @@ export type PipelineExecutor = {
40
40
  };
41
41
  /**
42
42
  * TODO: [🧠] Should this file be in /execution or /types folder?
43
+ * TODO: [💷] !!!! `assertsExecutionSuccessful` should be the method of `PipelineExecutor` result
43
44
  */
@@ -55,4 +55,5 @@ export {};
55
55
  * Note: CreatePipelineExecutorOptions are just connected to PipelineExecutor so do not extract to types folder
56
56
  * TODO: [🧠][3] transparent = (report intermediate parameters) / opaque execution = (report only output parameters) progress reporting mode
57
57
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
58
+ * TODO: [💷] !!!! `assertsExecutionSuccessful` should be the method of `PipelineExecutor` result
58
59
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/cli",
3
- "version": "0.61.0-20",
3
+ "version": "0.61.0-22",
4
4
  "description": "Supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -54,7 +54,7 @@
54
54
  }
55
55
  ],
56
56
  "peerDependencies": {
57
- "@promptbook/core": "0.61.0-20"
57
+ "@promptbook/core": "0.61.0-22"
58
58
  },
59
59
  "main": "./umd/index.umd.js",
60
60
  "module": "./esm/index.es.js",
package/umd/index.umd.js CHANGED
@@ -154,7 +154,7 @@
154
154
  /**
155
155
  * The version of the Promptbook library
156
156
  */
157
- var PROMPTBOOK_VERSION = '0.61.0-19';
157
+ var PROMPTBOOK_VERSION = '0.61.0-21';
158
158
  // TODO: !!!! List here all the versions and annotate + put into script
159
159
 
160
160
  /**
@@ -739,7 +739,7 @@
739
739
  });
740
740
  }
741
741
 
742
- 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"}];
742
+ 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"}];
743
743
 
744
744
  /**
745
745
  * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
@@ -1102,7 +1102,9 @@
1102
1102
  return template.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
1103
1103
  });
1104
1104
  if (currentlyResovedTemplates.length === 0) {
1105
- throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n Can not resolve:\n ".concat(block(unresovedTemplates
1105
+ throw new PipelineLogicError(
1106
+ // TODO: [🐎] DRY
1107
+ spaceTrim.spaceTrim(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n Can not resolve:\n ".concat(block(unresovedTemplates
1106
1108
  .map(function (_a) {
1107
1109
  var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
1108
1110
  return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
@@ -1661,7 +1663,11 @@
1661
1663
  throw errors[0];
1662
1664
  }
1663
1665
  else {
1664
- throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Multiple errors occurred during promptnook execution\n\n ".concat(block(errors.map(function (error) { return '- ' + error.message; }).join('\n')), "\n "); }));
1666
+ throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Multiple errors occurred during promptnook execution\n\n ".concat(block(errors
1667
+ .map(function (error, index) {
1668
+ return spaceTrim.spaceTrim(function (block) { return "\n Error ".concat(index + 1, ":\n ").concat(block(error.stack || error.message), "\n "); });
1669
+ })
1670
+ .join('\n')), "\n "); }));
1665
1671
  }
1666
1672
  }
1667
1673
  /**
@@ -2909,7 +2915,34 @@
2909
2915
  });
2910
2916
  });
2911
2917
  }
2912
- 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;
2918
+ function filterJustOutputParameters() {
2919
+ var e_9, _a;
2920
+ var outputParameters = {};
2921
+ try {
2922
+ // Note: Filter ONLY output parameters
2923
+ for (var _b = __values(pipeline.parameters.filter(function (_a) {
2924
+ var isOutput = _a.isOutput;
2925
+ return isOutput;
2926
+ })), _c = _b.next(); !_c.done; _c = _b.next()) {
2927
+ var parameter = _c.value;
2928
+ if (parametersToPass[parameter.name] === undefined) {
2929
+ // [4]
2930
+ errors.push(new PipelineExecutionError("Parameter {".concat(parameter.name, "} should be an output parameter, but it was not be resolved")));
2931
+ continue;
2932
+ }
2933
+ outputParameters[parameter.name] = parametersToPass[parameter.name] || '';
2934
+ }
2935
+ }
2936
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
2937
+ finally {
2938
+ try {
2939
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2940
+ }
2941
+ finally { if (e_9) throw e_9.error; }
2942
+ }
2943
+ return outputParameters;
2944
+ }
2945
+ 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;
2913
2946
  var e_1, _e, e_2, _f;
2914
2947
  return __generator(this, function (_g) {
2915
2948
  switch (_g.label) {
@@ -2934,9 +2967,12 @@
2934
2967
  };
2935
2968
  try {
2936
2969
  // Note: Check that all input input parameters are defined
2937
- for (_a = __values(pipeline.parameters), _b = _a.next(); !_b.done; _b = _a.next()) {
2970
+ for (_a = __values(pipeline.parameters.filter(function (_a) {
2971
+ var isInput = _a.isInput;
2972
+ return isInput;
2973
+ })), _b = _a.next(); !_b.done; _b = _a.next()) {
2938
2974
  parameter = _b.value;
2939
- if (parameter.isInput && inputParameters[parameter.name] === undefined) {
2975
+ if (inputParameters[parameter.name] === undefined) {
2940
2976
  return [2 /*return*/, deepFreezeWithSameType({
2941
2977
  isSuccessful: false,
2942
2978
  errors: [
@@ -2957,11 +2993,49 @@
2957
2993
  }
2958
2994
  finally { if (e_1) throw e_1.error; }
2959
2995
  }
2996
+ errors = [];
2997
+ _loop_1 = function (parameterName) {
2998
+ var parameter = pipeline.parameters.find(function (_a) {
2999
+ var name = _a.name;
3000
+ return name === parameterName;
3001
+ });
3002
+ if (parameter === undefined) {
3003
+ errors.push(new PipelineExecutionError("Extra parameter {".concat(parameterName, "} is passed as input parameter")));
3004
+ }
3005
+ else if (parameter.isInput === false) {
3006
+ return { value: deepFreezeWithSameType({
3007
+ isSuccessful: false,
3008
+ errors: [
3009
+ new PipelineExecutionError("Parameter {".concat(parameter.name, "} is passed as input parameter but is not input")),
3010
+ // <- TODO: !!!!! Test this error
3011
+ ],
3012
+ executionReport: executionReport,
3013
+ outputParameters: {},
3014
+ usage: ZERO_USAGE,
3015
+ }) };
3016
+ }
3017
+ };
3018
+ try {
3019
+ // Note: Check that no extra input parameters are passed
3020
+ for (_c = __values(Object.keys(inputParameters)), _d = _c.next(); !_d.done; _d = _c.next()) {
3021
+ parameterName = _d.value;
3022
+ state_1 = _loop_1(parameterName);
3023
+ if (typeof state_1 === "object")
3024
+ return [2 /*return*/, state_1.value];
3025
+ }
3026
+ }
3027
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
3028
+ finally {
3029
+ try {
3030
+ if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
3031
+ }
3032
+ finally { if (e_2) throw e_2.error; }
3033
+ }
2960
3034
  parametersToPass = inputParameters;
2961
3035
  _g.label = 3;
2962
3036
  case 3:
2963
3037
  _g.trys.push([3, 8, , 9]);
2964
- resovedParameters_1 = pipeline.parameters
3038
+ resovedParameterNames_1 = pipeline.parameters
2965
3039
  .filter(function (_a) {
2966
3040
  var isInput = _a.isInput;
2967
3041
  return isInput;
@@ -2973,7 +3047,7 @@
2973
3047
  unresovedTemplates_1 = __spreadArray([], __read(pipeline.promptTemplates), false);
2974
3048
  resolving_1 = [];
2975
3049
  loopLimit = LOOP_LIMIT;
2976
- _loop_1 = function () {
3050
+ _loop_2 = function () {
2977
3051
  var currentTemplate, work_1;
2978
3052
  return __generator(this, function (_h) {
2979
3053
  switch (_h.label) {
@@ -2983,15 +3057,21 @@
2983
3057
  throw new UnexpectedError('Loop limit reached during resolving parameters pipeline execution');
2984
3058
  }
2985
3059
  currentTemplate = unresovedTemplates_1.find(function (template) {
2986
- return template.dependentParameterNames.every(function (name) { return resovedParameters_1.includes(name); });
3060
+ return template.dependentParameterNames.every(function (name) {
3061
+ return __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), __read(RESERVED_PARAMETER_NAMES), false).includes(name);
3062
+ });
2987
3063
  });
2988
3064
  if (!(!currentTemplate && resolving_1.length === 0)) return [3 /*break*/, 1];
2989
- throw new UnexpectedError(spaceTrim.spaceTrim(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
3065
+ throw new UnexpectedError(
3066
+ // TODO: [🐎] DRY
3067
+ spaceTrim.spaceTrim(function (block) { return "\n Can not resolve some parameters:\n\n Can not resolve:\n ".concat(block(unresovedTemplates_1
2990
3068
  .map(function (_a) {
2991
- var resultingParameterName = _a.resultingParameterName;
2992
- return "- {".concat(resultingParameterName, "}");
3069
+ var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
3070
+ return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
3071
+ .map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
3072
+ .join(' and '));
2993
3073
  })
2994
- .join('\n')), "\n\n Resolved parameters:\n ").concat(block(resovedParameters_1.map(function (name) { return "- {".concat(name, "}"); }).join('\n')), "\n "); }));
3074
+ .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 "); }));
2995
3075
  case 1:
2996
3076
  if (!!currentTemplate) return [3 /*break*/, 3];
2997
3077
  /* [5] */ return [4 /*yield*/, Promise.race(resolving_1)];
@@ -3002,7 +3082,7 @@
3002
3082
  unresovedTemplates_1 = unresovedTemplates_1.filter(function (template) { return template !== currentTemplate; });
3003
3083
  work_1 = executeSingleTemplate(currentTemplate)
3004
3084
  .then(function () {
3005
- resovedParameters_1 = __spreadArray(__spreadArray([], __read(resovedParameters_1), false), [currentTemplate.resultingParameterName], false);
3085
+ resovedParameterNames_1 = __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), [currentTemplate.resultingParameterName], false);
3006
3086
  })
3007
3087
  .then(function () {
3008
3088
  resolving_1 = resolving_1.filter(function (w) { return w !== work_1; });
@@ -3016,7 +3096,7 @@
3016
3096
  _g.label = 4;
3017
3097
  case 4:
3018
3098
  if (!(unresovedTemplates_1.length > 0)) return [3 /*break*/, 6];
3019
- return [5 /*yield**/, _loop_1()];
3099
+ return [5 /*yield**/, _loop_2()];
3020
3100
  case 5:
3021
3101
  _g.sent();
3022
3102
  return [3 /*break*/, 4];
@@ -3033,41 +3113,20 @@
3033
3113
  var result = _a.result;
3034
3114
  return (result === null || result === void 0 ? void 0 : result.usage) || ZERO_USAGE;
3035
3115
  })), false));
3116
+ outputParameters_1 = filterJustOutputParameters();
3036
3117
  return [2 /*return*/, deepFreezeWithSameType({
3037
3118
  isSuccessful: false,
3038
- errors: [error_1],
3119
+ errors: __spreadArray([error_1], __read(errors), false),
3039
3120
  usage: usage_1,
3040
3121
  executionReport: executionReport,
3041
- outputParameters: parametersToPass,
3122
+ outputParameters: outputParameters_1,
3042
3123
  })];
3043
3124
  case 9:
3044
- outputParameters = {};
3045
- errors = [];
3046
- try {
3047
- // Note: Filter ONLY output parameters
3048
- for (_c = __values(pipeline.parameters.filter(function (_a) {
3049
- var isOutput = _a.isOutput;
3050
- return isOutput;
3051
- })), _d = _c.next(); !_d.done; _d = _c.next()) {
3052
- parameter = _d.value;
3053
- if (parametersToPass[parameter.name] === undefined) {
3054
- errors.push(new PipelineExecutionError("Parameter {".concat(parameter.name, "} is required as an output parameter but not set in the pipeline")));
3055
- continue;
3056
- }
3057
- outputParameters[parameter.name] = parametersToPass[parameter.name] || '';
3058
- }
3059
- }
3060
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
3061
- finally {
3062
- try {
3063
- if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
3064
- }
3065
- finally { if (e_2) throw e_2.error; }
3066
- }
3067
3125
  usage = addUsage.apply(void 0, __spreadArray([], __read(executionReport.promptExecutions.map(function (_a) {
3068
3126
  var result = _a.result;
3069
3127
  return (result === null || result === void 0 ? void 0 : result.usage) || ZERO_USAGE;
3070
3128
  })), false));
3129
+ outputParameters = filterJustOutputParameters();
3071
3130
  return [2 /*return*/, deepFreezeWithSameType({
3072
3131
  isSuccessful: true,
3073
3132
  errors: errors,
@@ -3089,6 +3148,7 @@
3089
3148
  * Note: CreatePipelineExecutorOptions are just connected to PipelineExecutor so do not extract to types folder
3090
3149
  * TODO: [🧠][3] transparent = (report intermediate parameters) / opaque execution = (report only output parameters) progress reporting mode
3091
3150
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
3151
+ * TODO: [💷] !!!! `assertsExecutionSuccessful` should be the method of `PipelineExecutor` result
3092
3152
  */
3093
3153
 
3094
3154
  /**
@@ -7518,8 +7578,8 @@
7518
7578
  throw error_1;
7519
7579
  }
7520
7580
  console.info(colors__default["default"].red("Prettify ".concat(error_1.name, " ").concat(filePath)));
7521
- console.error(colors__default["default"].bgRed(error_1.name));
7522
- console.error(error_1);
7581
+ console.error(colors__default["default"].bgRed(error_1.name /* <- 11:11 */));
7582
+ console.error(colors__default["default"].red(error_1.stack || error_1.message));
7523
7583
  process.exit(1);
7524
7584
  return [3 /*break*/, 9];
7525
7585
  case 9: