@promptbook/core 0.61.0-28 → 0.61.0-29

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.
@@ -1,4 +1,5 @@
1
1
  import type { Promisable } from 'type-fest';
2
+ import type { PipelineJson } from '../types/PipelineJson/PipelineJson';
2
3
  import { PipelineExecutionError } from '../errors/PipelineExecutionError';
3
4
  import type { TaskProgress } from '../types/TaskProgress';
4
5
  import type { ExecutionReportJson } from '../types/execution-report/ExecutionReportJson';
@@ -10,6 +11,8 @@ import type { PromptResultUsage } from './PromptResultUsage';
10
11
  *
11
12
  * It can be created with `createPipelineExecutor` function.
12
13
  *
14
+ * @@@ almost-JSON (what about errors)
15
+ *
13
16
  * @see https://github.com/webgptorg/promptbook#executor
14
17
  */
15
18
  export type PipelineExecutor = {
@@ -17,8 +20,16 @@ export type PipelineExecutor = {
17
20
  };
18
21
  /**
19
22
  * @@@
23
+ *
24
+ * @@@ almost-JSON (what about errors)
20
25
  */
21
26
  export type PipelineExecutorResult = {
27
+ /**
28
+ * Result parameters of the execution
29
+ *
30
+ * Note: If the execution was not successful, there are only some of the result parameters
31
+ */
32
+ readonly outputParameters: Parameters;
22
33
  /**
23
34
  * Whether the execution was successful, details are aviable in `executionReport`
24
35
  */
@@ -40,13 +51,14 @@ export type PipelineExecutorResult = {
40
51
  */
41
52
  readonly executionReport: ExecutionReportJson;
42
53
  /**
43
- * Result parameters of the execution
54
+ * The prepared pipeline that was used for the execution
44
55
  *
45
- * Note: If the execution was not successful, there are only some of the result parameters
56
+ * Note: If you called `createPipelineExecutor` with fully prepared pipeline, this is the same object as this pipeline
57
+ * If you passed not fully prepared pipeline, this is same pipeline but fully prepared
46
58
  */
47
- readonly outputParameters: Parameters;
59
+ readonly preparedPipeline: PipelineJson;
48
60
  };
49
61
  /**
50
62
  * TODO: [🧠] Should this file be in /execution or /types folder?
51
- * TODO: [💷] `assertsExecutionSuccessful` should be the method of `PipelineExecutor` result
63
+ * TODO: [💷] `assertsExecutionSuccessful` should be the method of `PipelineExecutor` result - BUT maybe NOT?
52
64
  */
@@ -20,6 +20,16 @@ type CreatePipelineExecutorSettings = {
20
20
  * @default false
21
21
  */
22
22
  readonly isVerbose?: boolean;
23
+ /**
24
+ * If you pass fully prepared pipeline, this does not matter
25
+ *
26
+ * Otherwise:
27
+ * If false or not set, warning is shown when pipeline is not prepared
28
+ * If true, warning is suppressed
29
+ *
30
+ * @default false
31
+ */
32
+ readonly isNotPreparedWarningSupressed?: boolean;
23
33
  };
24
34
  /**
25
35
  * Options for `createPipelineExecutor`
@@ -47,8 +57,6 @@ interface CreatePipelineExecutorOptions {
47
57
  export declare function createPipelineExecutor(options: CreatePipelineExecutorOptions): PipelineExecutor;
48
58
  export {};
49
59
  /**
50
- * TODO: !!!!! return `preparedPipeline` from execution
51
- * TODO: !!!!! `isNotPreparedWarningSupressed`
52
60
  * TODO: Use isVerbose here (not only pass to `preparePipeline`)
53
61
  * TODO: [🪂] Use maxParallelCount here (not only pass to `preparePipeline`)
54
62
  * TODO: [♈] Probbably move expectations from templates to parameters
@@ -41,7 +41,7 @@ export type ExecutionReportJson = {
41
41
  /**
42
42
  * The prompt wich was executed
43
43
  */
44
- readonly prompt: Omit<Prompt, 'pipelineUrl' | 'parameters'>;
44
+ readonly prompt: Omit<Prompt, 'pipelineUrl'>;
45
45
  /**
46
46
  * Result of the prompt execution (if not failed during LLM execution)
47
47
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/core",
3
- "version": "0.61.0-28",
3
+ "version": "0.61.0-29",
4
4
  "description": "Supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
package/umd/index.umd.js CHANGED
@@ -1524,7 +1524,7 @@
1524
1524
  });
1525
1525
  }
1526
1526
 
1527
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-27",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-27",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-27",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-27",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-27",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-27",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-27",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-27",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"}];
1527
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-28",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-28",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-28",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-28",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-28",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-28",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-28",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-28",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"}];
1528
1528
 
1529
1529
  var defaultDiacriticsRemovalMap = [
1530
1530
  {
@@ -2529,7 +2529,7 @@
2529
2529
  /**
2530
2530
  * The version of the Promptbook library
2531
2531
  */
2532
- var PROMPTBOOK_VERSION = '0.61.0-27';
2532
+ var PROMPTBOOK_VERSION = '0.61.0-28';
2533
2533
  // TODO: !!!! List here all the versions and annotate + put into script
2534
2534
 
2535
2535
  /**
@@ -2671,17 +2671,17 @@
2671
2671
  */
2672
2672
  function createPipelineExecutor(options) {
2673
2673
  var _this = this;
2674
- var rawPipeline = options.pipeline, tools = options.tools, _a = options.settings, settings = _a === void 0 ? {} : _a;
2675
- var _b = settings.maxExecutionAttempts, maxExecutionAttempts = _b === void 0 ? MAX_EXECUTION_ATTEMPTS : _b, _c = settings.maxParallelCount, maxParallelCount = _c === void 0 ? MAX_PARALLEL_COUNT : _c, _d = settings.isVerbose, isVerbose = _d === void 0 ? false : _d;
2676
- validatePipeline(rawPipeline);
2674
+ var pipeline = options.pipeline, tools = options.tools, _a = options.settings, settings = _a === void 0 ? {} : _a;
2675
+ var _b = settings.maxExecutionAttempts, maxExecutionAttempts = _b === void 0 ? MAX_EXECUTION_ATTEMPTS : _b, _c = settings.maxParallelCount, maxParallelCount = _c === void 0 ? MAX_PARALLEL_COUNT : _c, _d = settings.isVerbose, isVerbose = _d === void 0 ? false : _d, _e = settings.isNotPreparedWarningSupressed, isNotPreparedWarningSupressed = _e === void 0 ? false : _e;
2676
+ validatePipeline(pipeline);
2677
2677
  var llmTools = joinLlmExecutionTools.apply(void 0, __spreadArray([], __read(arrayableToArray(tools.llm)), false));
2678
- var pipeline;
2679
- if (isPipelinePrepared(rawPipeline)) {
2680
- pipeline = rawPipeline;
2678
+ var preparedPipeline;
2679
+ if (isPipelinePrepared(pipeline)) {
2680
+ preparedPipeline = pipeline;
2681
2681
  }
2682
- else {
2683
- // TODO: !!!!! This should be maybe warning in report
2684
- console.warn(spaceTrim.spaceTrim("\n Pipeline ".concat(rawPipeline.pipelineUrl || rawPipeline.sourceFile || rawPipeline.title, " is not prepared\n\n ").concat(rawPipeline.sourceFile, "\n\n It will be prepared ad-hoc before the first execution\n But it is recommended to prepare the pipeline during collection preparation\n\n @see more at https://ptbk.io/prepare-pipeline\n ")));
2682
+ else if (isNotPreparedWarningSupressed !== true) {
2683
+ // TODO: !!!!! Test that this work as intended together with prepared pipeline
2684
+ console.warn(spaceTrim.spaceTrim("\n Pipeline ".concat(pipeline.pipelineUrl || pipeline.sourceFile || pipeline.title, " is not prepared\n\n ").concat(pipeline.sourceFile, "\n\n It will be prepared ad-hoc before the first execution and **returned as `preparedPipeline` in `PipelineExecutorResult`**\n But it is recommended to prepare the pipeline during collection preparation\n\n @see more at https://ptbk.io/prepare-pipeline\n ")));
2685
2685
  }
2686
2686
  var pipelineExecutor = function (inputParameters, onProgress) { return __awaiter(_this, void 0, void 0, function () {
2687
2687
  // TODO: !!! Extract to separate functions and files - ALL FUNCTIONS BELOW
@@ -2698,9 +2698,9 @@
2698
2698
  template) {
2699
2699
  return __awaiter(this, void 0, void 0, function () {
2700
2700
  return __generator(this, function (_a) {
2701
- // TODO: [♨] Implement Better - use real index and keyword search
2701
+ // TODO: [♨] Implement Better - use real index and keyword search from `template` and {samples}
2702
2702
  TODO_USE(template);
2703
- return [2 /*return*/, pipeline.knowledgePieces.map(function (_a) {
2703
+ return [2 /*return*/, preparedPipeline.knowledgePieces.map(function (_a) {
2704
2704
  var content = _a.content;
2705
2705
  return "- ".concat(content);
2706
2706
  }).join('\n')];
@@ -2773,7 +2773,7 @@
2773
2773
  case 0:
2774
2774
  name = "pipeline-executor-frame-".concat(currentTemplate.name);
2775
2775
  title = currentTemplate.title;
2776
- priority = pipeline.promptTemplates.length - pipeline.promptTemplates.indexOf(currentTemplate);
2776
+ priority = preparedPipeline.promptTemplates.length - preparedPipeline.promptTemplates.indexOf(currentTemplate);
2777
2777
  if (!onProgress /* <- [3] */) return [3 /*break*/, 2]; /* <- [3] */
2778
2778
  return [4 /*yield*/, onProgress({
2779
2779
  name: name,
@@ -2877,13 +2877,13 @@
2877
2877
  case 7:
2878
2878
  prompt = {
2879
2879
  title: currentTemplate.title,
2880
- pipelineUrl: "".concat(pipeline.pipelineUrl
2881
- ? pipeline.pipelineUrl
2880
+ pipelineUrl: "".concat(preparedPipeline.pipelineUrl
2881
+ ? preparedPipeline.pipelineUrl
2882
2882
  : 'anonymous' /* <- TODO: [🧠] How to deal with anonymous pipelines, do here some auto-url like SHA-256 based ad-hoc identifier? */, "#").concat(currentTemplate.name),
2883
2883
  parameters: parameters,
2884
2884
  content: preparedContent,
2885
2885
  modelRequirements: currentTemplate.modelRequirements,
2886
- expectations: __assign(__assign({}, (pipeline.personas.find(function (_a) {
2886
+ expectations: __assign(__assign({}, (preparedPipeline.personas.find(function (_a) {
2887
2887
  var name = _a.name;
2888
2888
  return name === currentTemplate.personaName;
2889
2889
  }) || {})), currentTemplate.expectations),
@@ -3175,7 +3175,7 @@
3175
3175
  ) {
3176
3176
  // TODO: [🧠] Maybe put other blockTypes into report
3177
3177
  executionReport.promptExecutions.push({
3178
- 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 }),
3178
+ prompt: __assign({}, prompt),
3179
3179
  result: result || undefined,
3180
3180
  error: expectError || undefined,
3181
3181
  });
@@ -3216,7 +3216,7 @@
3216
3216
  var outputParameters = {};
3217
3217
  try {
3218
3218
  // Note: Filter ONLY output parameters
3219
- for (var _b = __values(pipeline.parameters.filter(function (_a) {
3219
+ for (var _b = __values(preparedPipeline.parameters.filter(function (_a) {
3220
3220
  var isOutput = _a.isOutput;
3221
3221
  return isOutput;
3222
3222
  })), _c = _b.next(); !_c.done; _c = _b.next()) {
@@ -3243,29 +3243,29 @@
3243
3243
  return __generator(this, function (_g) {
3244
3244
  switch (_g.label) {
3245
3245
  case 0:
3246
- if (!(pipeline === undefined)) return [3 /*break*/, 2];
3247
- return [4 /*yield*/, preparePipeline(rawPipeline, {
3246
+ if (!(preparedPipeline === undefined)) return [3 /*break*/, 2];
3247
+ return [4 /*yield*/, preparePipeline(pipeline, {
3248
3248
  llmTools: llmTools,
3249
3249
  isVerbose: isVerbose,
3250
3250
  maxParallelCount: maxParallelCount,
3251
3251
  })];
3252
3252
  case 1:
3253
- pipeline = _g.sent();
3253
+ preparedPipeline = _g.sent();
3254
3254
  _g.label = 2;
3255
3255
  case 2:
3256
3256
  errors = [];
3257
3257
  warnings = [];
3258
3258
  executionReport = {
3259
- pipelineUrl: pipeline.pipelineUrl,
3260
- title: pipeline.title,
3259
+ pipelineUrl: preparedPipeline.pipelineUrl,
3260
+ title: preparedPipeline.title,
3261
3261
  promptbookUsedVersion: PROMPTBOOK_VERSION,
3262
- promptbookRequestedVersion: pipeline.promptbookVersion,
3263
- description: pipeline.description,
3262
+ promptbookRequestedVersion: preparedPipeline.promptbookVersion,
3263
+ description: preparedPipeline.description,
3264
3264
  promptExecutions: [],
3265
3265
  };
3266
3266
  try {
3267
3267
  // Note: Check that all input input parameters are defined
3268
- for (_a = __values(pipeline.parameters.filter(function (_a) {
3268
+ for (_a = __values(preparedPipeline.parameters.filter(function (_a) {
3269
3269
  var isInput = _a.isInput;
3270
3270
  return isInput;
3271
3271
  })), _b = _a.next(); !_b.done; _b = _a.next()) {
@@ -3280,6 +3280,7 @@
3280
3280
  executionReport: executionReport,
3281
3281
  outputParameters: {},
3282
3282
  usage: ZERO_USAGE,
3283
+ preparedPipeline: preparedPipeline,
3283
3284
  })];
3284
3285
  }
3285
3286
  }
@@ -3292,7 +3293,7 @@
3292
3293
  finally { if (e_1) throw e_1.error; }
3293
3294
  }
3294
3295
  _loop_1 = function (parameterName) {
3295
- var parameter = pipeline.parameters.find(function (_a) {
3296
+ var parameter = preparedPipeline.parameters.find(function (_a) {
3296
3297
  var name = _a.name;
3297
3298
  return name === parameterName;
3298
3299
  });
@@ -3309,6 +3310,7 @@
3309
3310
  executionReport: executionReport,
3310
3311
  outputParameters: {},
3311
3312
  usage: ZERO_USAGE,
3313
+ preparedPipeline: preparedPipeline,
3312
3314
  }) };
3313
3315
  }
3314
3316
  };
@@ -3332,7 +3334,7 @@
3332
3334
  _g.label = 3;
3333
3335
  case 3:
3334
3336
  _g.trys.push([3, 8, , 9]);
3335
- resovedParameterNames_1 = pipeline.parameters
3337
+ resovedParameterNames_1 = preparedPipeline.parameters
3336
3338
  .filter(function (_a) {
3337
3339
  var isInput = _a.isInput;
3338
3340
  return isInput;
@@ -3341,7 +3343,7 @@
3341
3343
  var name = _a.name;
3342
3344
  return name;
3343
3345
  });
3344
- unresovedTemplates_1 = __spreadArray([], __read(pipeline.promptTemplates), false);
3346
+ unresovedTemplates_1 = __spreadArray([], __read(preparedPipeline.promptTemplates), false);
3345
3347
  resolving_1 = [];
3346
3348
  loopLimit = LOOP_LIMIT;
3347
3349
  _loop_2 = function () {
@@ -3418,6 +3420,7 @@
3418
3420
  usage: usage_1,
3419
3421
  executionReport: executionReport,
3420
3422
  outputParameters: outputParameters_1,
3423
+ preparedPipeline: preparedPipeline,
3421
3424
  })];
3422
3425
  case 9:
3423
3426
  usage = addUsage.apply(void 0, __spreadArray([], __read(executionReport.promptExecutions.map(function (_a) {
@@ -3432,6 +3435,7 @@
3432
3435
  usage: usage,
3433
3436
  executionReport: executionReport,
3434
3437
  outputParameters: outputParameters,
3438
+ preparedPipeline: preparedPipeline,
3435
3439
  })];
3436
3440
  }
3437
3441
  });
@@ -3439,8 +3443,6 @@
3439
3443
  return pipelineExecutor;
3440
3444
  }
3441
3445
  /**
3442
- * TODO: !!!!! return `preparedPipeline` from execution
3443
- * TODO: !!!!! `isNotPreparedWarningSupressed`
3444
3446
  * TODO: Use isVerbose here (not only pass to `preparePipeline`)
3445
3447
  * TODO: [🪂] Use maxParallelCount here (not only pass to `preparePipeline`)
3446
3448
  * TODO: [♈] Probbably move expectations from templates to parameters
@@ -3500,6 +3502,7 @@
3500
3502
  outputParameters = result.outputParameters;
3501
3503
  knowledgePiecesRaw = outputParameters.knowledgePieces;
3502
3504
  knowledgeTextPieces = (knowledgePiecesRaw || '').split('\n---\n');
3505
+ // <- TODO: !!!!! Smarter split and filter out empty pieces
3503
3506
  if (isVerbose) {
3504
3507
  console.info('knowledgeTextPieces:', knowledgeTextPieces);
3505
3508
  }