@promptbook/cli 0.61.0-23 → 0.61.0-24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/esm/index.es.js +116 -51
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +1 -0
  4. package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -0
  5. package/esm/typings/src/execution/PromptResultUsage.d.ts +3 -0
  6. package/esm/typings/src/prepare/preparePipeline.d.ts +0 -1
  7. package/esm/typings/src/prepare/prepareTemplates.d.ts +31 -0
  8. package/esm/typings/src/prepare/unpreparePipeline.d.ts +1 -0
  9. package/esm/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +3 -0
  10. package/esm/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +3 -0
  11. package/esm/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +1 -0
  12. package/esm/typings/src/types/PipelineJson/PersonaJson.d.ts +3 -0
  13. package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -0
  14. package/esm/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -0
  15. package/esm/typings/src/types/PipelineJson/PromptDialogJson.d.ts +4 -3
  16. package/esm/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +10 -0
  17. package/esm/typings/src/types/PipelineJson/PromptTemplateParameterJson.d.ts +1 -0
  18. package/esm/typings/src/types/PipelineJson/ScriptJson.d.ts +5 -2
  19. package/esm/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +5 -2
  20. package/package.json +2 -2
  21. package/umd/index.umd.js +116 -51
  22. package/umd/index.umd.js.map +1 -1
  23. package/umd/typings/src/conversion/pipelineStringToJsonSync.d.ts +1 -0
  24. package/umd/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -0
  25. package/umd/typings/src/execution/PromptResultUsage.d.ts +3 -0
  26. package/umd/typings/src/prepare/preparePipeline.d.ts +0 -1
  27. package/umd/typings/src/prepare/prepareTemplates.d.ts +31 -0
  28. package/umd/typings/src/prepare/unpreparePipeline.d.ts +1 -0
  29. package/umd/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +3 -0
  30. package/umd/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +3 -0
  31. package/umd/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +1 -0
  32. package/umd/typings/src/types/PipelineJson/PersonaJson.d.ts +3 -0
  33. package/umd/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -0
  34. package/umd/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -0
  35. package/umd/typings/src/types/PipelineJson/PromptDialogJson.d.ts +4 -3
  36. package/umd/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +10 -0
  37. package/umd/typings/src/types/PipelineJson/PromptTemplateParameterJson.d.ts +1 -0
  38. package/umd/typings/src/types/PipelineJson/ScriptJson.d.ts +5 -2
  39. package/umd/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +5 -2
package/esm/index.es.js CHANGED
@@ -150,7 +150,7 @@ new Function("\n try {\n if (typeof WorkerGlobalScope !== 'undefined'
150
150
  /**
151
151
  * The version of the Promptbook library
152
152
  */
153
- var PROMPTBOOK_VERSION = '0.61.0-22';
153
+ var PROMPTBOOK_VERSION = '0.61.0-23';
154
154
  // TODO: !!!! List here all the versions and annotate + put into script
155
155
 
156
156
  /**
@@ -742,7 +742,7 @@ function forEachAsync(array, options, callbackfunction) {
742
742
  });
743
743
  }
744
744
 
745
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-22",parameters:[{name:"content",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> {content}",dependentParameterNames:["content"],resultingParameterName:"knowledgePieces"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-22",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-22",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-22",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-22",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-22",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-22",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-22",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"}];
745
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-23",parameters:[{name:"content",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> {content}",dependentParameterNames:["content"],resultingParameterName:"knowledgePieces"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-23",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-23",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-23",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-23",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-23",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-23",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-23",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"}];
746
746
 
747
747
  /**
748
748
  * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
@@ -1180,15 +1180,17 @@ var ReferenceError$1 = /** @class */ (function (_super) {
1180
1180
  * Unprepare just strips the preparation data of the pipeline
1181
1181
  */
1182
1182
  function unpreparePipeline(pipeline) {
1183
- var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources;
1183
+ var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources, promptTemplates = pipeline.promptTemplates;
1184
1184
  personas = personas.map(function (persona) { return (__assign(__assign({}, persona), { modelRequirements: undefined, preparationIds: undefined })); });
1185
1185
  knowledgeSources = knowledgeSources.map(function (knowledgeSource) { return (__assign(__assign({}, knowledgeSource), { preparationIds: undefined })); });
1186
- return __assign(__assign({}, pipeline), { knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] });
1186
+ promptTemplates = promptTemplates.map(function (promptTemplate) { return (__assign(__assign({}, promptTemplate), { preparedContent: undefined })); });
1187
+ return __assign(__assign({}, pipeline), { promptTemplates: promptTemplates, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] });
1187
1188
  }
1188
1189
  /**
1189
1190
  * TODO: [🔼] !!! Export via `@promptbook/core`
1190
1191
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
1191
1192
  * TODO: Write tests for `preparePipeline`
1193
+ * TODO: [🍙] Make some standart order of json properties
1192
1194
  */
1193
1195
 
1194
1196
  /**
@@ -2095,6 +2097,12 @@ function isPipelinePrepared(pipeline) {
2095
2097
  if (!pipeline.knowledgeSources.every(function (knowledgeSource) { return knowledgeSource.preparationIds !== undefined; })) {
2096
2098
  return false;
2097
2099
  }
2100
+ /*
2101
+ TODO: [🧠][🍫] `promptTemplates` can not be determined if they are fully prepared SO ignoring them
2102
+ > if (!pipeline.promptTemplates.every(({ preparedContent }) => preparedContent === undefined)) {
2103
+ > return false;
2104
+ > }
2105
+ */
2098
2106
  return true;
2099
2107
  }
2100
2108
  /**
@@ -2431,7 +2439,8 @@ function createPipelineExecutor(options) {
2431
2439
  pipeline = rawPipeline;
2432
2440
  }
2433
2441
  else {
2434
- console.warn(spaceTrim$1("\n Pipeline ".concat(rawPipeline.pipelineUrl || rawPipeline.sourceFile || rawPipeline.title, " is not prepared\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 ")));
2442
+ // TODO: !!!! This should be maybe warning in report
2443
+ console.warn(spaceTrim$1("\n Pipeline ".concat(rawPipeline.pipelineUrl || rawPipeline.sourceFile || rawPipeline.title, " is not prepared\n\n ").concat(rawPipeline.sourceFile, "\n\n It will be prepared ad-hoc before the first execution\n But it is recommended to prepare the pipeline during collection preparation\n\n @see more at https://ptbk.io/prepare-pipeline\n ")));
2435
2444
  }
2436
2445
  var pipelineExecutor = function (inputParameters, onProgress) { return __awaiter(_this, void 0, void 0, function () {
2437
2446
  // TODO: !!!!! Extract to separate functions and files - ALL FUNCTIONS BELOW
@@ -2440,7 +2449,7 @@ function createPipelineExecutor(options) {
2440
2449
  return __awaiter(this, void 0, void 0, function () {
2441
2450
  return __generator(this, function (_a) {
2442
2451
  TODO_USE(template);
2443
- return [2 /*return*/, ''];
2452
+ return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: !!!! Implement */];
2444
2453
  });
2445
2454
  });
2446
2455
  }
@@ -2463,7 +2472,7 @@ function createPipelineExecutor(options) {
2463
2472
  return __generator(this, function (_a) {
2464
2473
  // TODO: !!!! Implement Better - use real index and keyword search
2465
2474
  TODO_USE(template);
2466
- return [2 /*return*/, ''];
2475
+ return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: !!!! Implement */];
2467
2476
  });
2468
2477
  });
2469
2478
  }
@@ -2514,7 +2523,7 @@ function createPipelineExecutor(options) {
2514
2523
  }
2515
2524
  function executeSingleTemplate(currentTemplate) {
2516
2525
  return __awaiter(this, void 0, void 0, function () {
2517
- var name, title, priority, usedParameterNames, dependentParameterNames, definedParameters, _a, _b, _c, definedParameterNames, parameters, _d, _e, parameterName, prompt, chatResult, completionResult, embeddingResult, result, resultString, expectError, scriptPipelineExecutionErrors, maxAttempts, jokerParameterNames, attempt, isJokerAttempt, jokerParameterName, _f, _g, _h, _j, scriptTools, error_2, e_4_1, _k, _l, functionName, postprocessingError, _m, _o, scriptTools, error_3, e_5_1, e_6_1, error_4;
2526
+ var name, title, priority, usedParameterNames, dependentParameterNames, definedParameters, _a, _b, _c, definedParameterNames, parameters, _d, _e, parameterName, prompt, chatResult, completionResult, embeddingResult, result, resultString, expectError, scriptPipelineExecutionErrors, maxAttempts, jokerParameterNames, preparedContent, attempt, isJokerAttempt, jokerParameterName, _f, _g, _h, _j, scriptTools, error_2, e_4_1, _k, _l, functionName, postprocessingError, _m, _o, scriptTools, error_3, e_5_1, e_6_1, error_4;
2518
2527
  var e_7, _p, e_4, _q, e_6, _r, e_5, _s, _t;
2519
2528
  var _this = this;
2520
2529
  return __generator(this, function (_u) {
@@ -2584,6 +2593,9 @@ function createPipelineExecutor(options) {
2584
2593
  expectError = null;
2585
2594
  maxAttempts = currentTemplate.blockType === 'PROMPT_DIALOG' ? Infinity : maxExecutionAttempts;
2586
2595
  jokerParameterNames = currentTemplate.jokerParameterNames || [];
2596
+ preparedContent = (currentTemplate.preparedContent || '{content}')
2597
+ .split('{content}')
2598
+ .join(currentTemplate.content);
2587
2599
  attempt = -jokerParameterNames.length;
2588
2600
  _u.label = 4;
2589
2601
  case 4:
@@ -2618,7 +2630,7 @@ function createPipelineExecutor(options) {
2618
2630
  }
2619
2631
  return [3 /*break*/, 29];
2620
2632
  case 6:
2621
- resultString = replaceParameters(currentTemplate.content, parameters);
2633
+ resultString = replaceParameters(preparedContent, parameters);
2622
2634
  return [3 /*break*/, 30];
2623
2635
  case 7:
2624
2636
  prompt = {
@@ -2627,7 +2639,7 @@ function createPipelineExecutor(options) {
2627
2639
  ? pipeline.pipelineUrl
2628
2640
  : 'anonymous' /* <- TODO: [🧠] How to deal with anonymous pipelines, do here some auto-url like SHA-256 based ad-hoc identifier? */, "#").concat(currentTemplate.name),
2629
2641
  parameters: parameters,
2630
- content: currentTemplate.content,
2642
+ content: preparedContent,
2631
2643
  modelRequirements: currentTemplate.modelRequirements,
2632
2644
  expectations: __assign(__assign({}, (pipeline.personas.find(function (_a) {
2633
2645
  var name = _a.name;
@@ -2749,7 +2761,7 @@ function createPipelineExecutor(options) {
2749
2761
  _u.trys.push([19, 21, , 22]);
2750
2762
  return [4 /*yield*/, scriptTools.execute(deepFreeze({
2751
2763
  scriptLanguage: currentTemplate.contentLanguage,
2752
- script: currentTemplate.content,
2764
+ script: preparedContent,
2753
2765
  parameters: parameters,
2754
2766
  }))];
2755
2767
  case 20:
@@ -2798,7 +2810,7 @@ function createPipelineExecutor(options) {
2798
2810
  return [4 /*yield*/, tools.userInterface.promptDialog(deepFreeze({
2799
2811
  promptTitle: currentTemplate.title,
2800
2812
  promptMessage: replaceParameters(currentTemplate.description || '', parameters),
2801
- defaultValue: replaceParameters(currentTemplate.content, parameters),
2813
+ defaultValue: replaceParameters(preparedContent, parameters),
2802
2814
  // TODO: [🧠] !! Figure out how to define placeholder in .ptbk.md file
2803
2815
  placeholder: undefined,
2804
2816
  priority: priority,
@@ -2976,7 +2988,7 @@ function createPipelineExecutor(options) {
2976
2988
  var parameter = _c.value;
2977
2989
  if (parametersToPass[parameter.name] === undefined) {
2978
2990
  // [4]
2979
- warnings.push(new PipelineExecutionError("Parameter {".concat(parameter.name, "} should be an output parameter, but it was not be resolved")));
2991
+ warnings.push(new PipelineExecutionError("Parameter {".concat(parameter.name, "} should be an output parameter, but it was not generated during pipeline execution")));
2980
2992
  continue;
2981
2993
  }
2982
2994
  outputParameters[parameter.name] = parametersToPass[parameter.name] || '';
@@ -2991,7 +3003,7 @@ function createPipelineExecutor(options) {
2991
3003
  }
2992
3004
  return outputParameters;
2993
3005
  }
2994
- var executionReport, _a, _b, parameter, errors, warnings, _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;
3006
+ var errors, warnings, executionReport, _a, _b, parameter, _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;
2995
3007
  var e_1, _e, e_2, _f;
2996
3008
  return __generator(this, function (_g) {
2997
3009
  switch (_g.label) {
@@ -3006,6 +3018,8 @@ function createPipelineExecutor(options) {
3006
3018
  pipeline = _g.sent();
3007
3019
  _g.label = 2;
3008
3020
  case 2:
3021
+ errors = [];
3022
+ warnings = [];
3009
3023
  executionReport = {
3010
3024
  pipelineUrl: pipeline.pipelineUrl,
3011
3025
  title: pipeline.title,
@@ -3024,9 +3038,9 @@ function createPipelineExecutor(options) {
3024
3038
  if (inputParameters[parameter.name] === undefined) {
3025
3039
  return [2 /*return*/, deepFreezeWithSameType({
3026
3040
  isSuccessful: false,
3027
- errors: [
3028
- new PipelineExecutionError("Parameter {".concat(parameter.name, "} is required as an input parameter")),
3029
- ],
3041
+ errors: __spreadArray([
3042
+ new PipelineExecutionError("Parameter {".concat(parameter.name, "} is required as an input parameter"))
3043
+ ], __read(errors), false),
3030
3044
  warnings: [],
3031
3045
  executionReport: executionReport,
3032
3046
  outputParameters: {},
@@ -3042,8 +3056,6 @@ function createPipelineExecutor(options) {
3042
3056
  }
3043
3057
  finally { if (e_1) throw e_1.error; }
3044
3058
  }
3045
- errors = [];
3046
- warnings = [];
3047
3059
  _loop_1 = function (parameterName) {
3048
3060
  var parameter = pipeline.parameters.find(function (_a) {
3049
3061
  var name = _a.name;
@@ -3055,9 +3067,9 @@ function createPipelineExecutor(options) {
3055
3067
  else if (parameter.isInput === false) {
3056
3068
  return { value: deepFreezeWithSameType({
3057
3069
  isSuccessful: false,
3058
- errors: [
3059
- new PipelineExecutionError("Parameter {".concat(parameter.name, "} is passed as input parameter but it is not input")),
3060
- ],
3070
+ errors: __spreadArray([
3071
+ new PipelineExecutionError("Parameter {".concat(parameter.name, "} is passed as input parameter but it is not input"))
3072
+ ], __read(errors), false),
3061
3073
  warnings: warnings,
3062
3074
  executionReport: executionReport,
3063
3075
  outputParameters: {},
@@ -3464,6 +3476,53 @@ function preparePersona(personaDescription, options) {
3464
3476
  * TODO: [🏢] !! Check validity of `temperature` in pipeline
3465
3477
  */
3466
3478
 
3479
+ /**
3480
+ * @@@
3481
+ */
3482
+ function prepareTemplates(pipeline, options) {
3483
+ return __awaiter(this, void 0, void 0, function () {
3484
+ var _a, maxParallelCount, promptTemplates, parameters, knowledgePiecesCount, promptTemplatesPrepared;
3485
+ var _this = this;
3486
+ return __generator(this, function (_b) {
3487
+ switch (_b.label) {
3488
+ case 0:
3489
+ _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a;
3490
+ promptTemplates = pipeline.promptTemplates, parameters = pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
3491
+ // TODO: !!!! Apply samples to each template (if missing and is for the template defined)
3492
+ TODO_USE(parameters);
3493
+ promptTemplatesPrepared = new Array(promptTemplates.length);
3494
+ return [4 /*yield*/, forEachAsync(promptTemplates, { maxParallelCount: maxParallelCount /* <- TODO: [🪂] When there are subtasks, this maximul limit can be broken */ }, function (template, index) { return __awaiter(_this, void 0, void 0, function () {
3495
+ var preparedContent, preparedTemplate;
3496
+ return __generator(this, function (_a) {
3497
+ preparedContent = undefined;
3498
+ if (knowledgePiecesCount > 0) {
3499
+ preparedContent = spaceTrim$1("\n {content}\n\n ## Knowledge\n\n {knowledge}\n ");
3500
+ // <- TODO: [🧠][🧻] Cutomize shape/language/formatting of the addition to the prompt
3501
+ }
3502
+ preparedTemplate = __assign(__assign({}, template), { preparedContent: preparedContent });
3503
+ promptTemplatesPrepared[index] = preparedTemplate;
3504
+ return [2 /*return*/];
3505
+ });
3506
+ }); })];
3507
+ case 1:
3508
+ _b.sent();
3509
+ return [2 /*return*/, { promptTemplatesPrepared: promptTemplatesPrepared }];
3510
+ }
3511
+ });
3512
+ });
3513
+ }
3514
+ /**
3515
+ * TODO: [🧠] Add context to each template (if missing)
3516
+ * TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
3517
+ * TODO: !!!!! Index the samples and maybe templates
3518
+ * TODO: [🔼] !!! Export via `@promptbook/core`
3519
+ * TODO: Write tests for `preparePipeline`
3520
+ * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
3521
+ * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
3522
+ * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
3523
+ * TODO: [🧠][🥜]
3524
+ */
3525
+
3467
3526
  /**
3468
3527
  * Prepare pipeline from string (markdown) format to JSON format
3469
3528
  *
@@ -3472,18 +3531,18 @@ function preparePersona(personaDescription, options) {
3472
3531
  */
3473
3532
  function preparePipeline(pipeline, options) {
3474
3533
  return __awaiter(this, void 0, void 0, function () {
3475
- var _a, maxParallelCount,
3534
+ var _a, maxParallelCount, parameters, promptTemplates,
3476
3535
  /*
3477
3536
  <- TODO: [🧠][0] `promptbookVersion` */
3478
3537
  knowledgeSources /*
3479
3538
  <- TODO: [🧊] `knowledgePieces` */, personas /*
3480
- <- TODO: [🧊] `preparations` */, currentPreparation, preparations, preparedPersonas, knowledgeSourcesPrepared, partialknowledgePiecesPrepared, knowledgePiecesPrepared;
3539
+ <- TODO: [🧊] `preparations` */, currentPreparation, preparations, preparedPersonas, knowledgeSourcesPrepared, partialknowledgePiecesPrepared, knowledgePiecesPrepared, promptTemplatesPrepared /* TODO: parameters: parametersPrepared*/;
3481
3540
  var _this = this;
3482
3541
  return __generator(this, function (_b) {
3483
3542
  switch (_b.label) {
3484
3543
  case 0:
3485
3544
  _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a;
3486
- knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
3545
+ parameters = pipeline.parameters, promptTemplates = pipeline.promptTemplates, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
3487
3546
  currentPreparation = {
3488
3547
  id: 1,
3489
3548
  // TODO: [🍥]> date: $currentDate(),
@@ -3516,17 +3575,20 @@ function preparePipeline(pipeline, options) {
3516
3575
  case 2:
3517
3576
  partialknowledgePiecesPrepared = _b.sent();
3518
3577
  knowledgePiecesPrepared = partialknowledgePiecesPrepared.map(function (piece) { return (__assign(__assign({}, piece), { preparationIds: [/* TODO: [🧊] -> */ currentPreparation.id] })); });
3519
- // ----- /Knowledge preparation -----
3520
- // TODO: !!!!! Add context to each template (if missing)
3521
- // TODO: !!!!! Add knowledge to each template (if missing and is in pipeline defined)
3522
- // TODO: !!!!! Apply samples to each template (if missing and is for the template defined)
3523
- return [2 /*return*/, __assign(__assign({}, pipeline), { knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: preparations })];
3578
+ return [4 /*yield*/, prepareTemplates({
3579
+ parameters: parameters,
3580
+ promptTemplates: promptTemplates,
3581
+ knowledgePiecesCount: knowledgePiecesPrepared.length,
3582
+ }, options)];
3583
+ case 3:
3584
+ promptTemplatesPrepared = (_b.sent()).promptTemplatesPrepared;
3585
+ // ----- /Templates preparation -----
3586
+ return [2 /*return*/, __assign(__assign({}, pipeline), { promptTemplates: promptTemplatesPrepared, knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: preparations })];
3524
3587
  }
3525
3588
  });
3526
3589
  });
3527
3590
  }
3528
3591
  /**
3529
- * TODO: !!!!! Index the samples and maybe templates
3530
3592
  * TODO: [🔼] !!! Export via `@promptbook/core`
3531
3593
  * TODO: Write tests for `preparePipeline`
3532
3594
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
@@ -5459,6 +5521,7 @@ function pipelineStringToJsonSync(pipelineString) {
5459
5521
  * TODO: [🥞] Not optimal parsing because `splitMarkdownIntoSections` is executed twice with same string, once through `flattenMarkdown` and second directly here
5460
5522
  * TODO: [♈] Probbably move expectations from templates to parameters
5461
5523
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
5524
+ * TODO: [🍙] Make some standart order of json properties
5462
5525
  */
5463
5526
 
5464
5527
  /**
@@ -6131,7 +6194,7 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
6131
6194
  */
6132
6195
  AnthropicClaudeExecutionTools.prototype.callChatModel = function (prompt) {
6133
6196
  return __awaiter(this, void 0, void 0, function () {
6134
- var content, parameters, modelRequirements, rawRequest, start, complete, rawResponse, resultContent, usage;
6197
+ var content, parameters, modelRequirements, modelName, rawRequest, start, complete, rawResponse, resultContent, usage;
6135
6198
  return __generator(this, function (_a) {
6136
6199
  switch (_a.label) {
6137
6200
  case 0:
@@ -6143,6 +6206,7 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
6143
6206
  if (modelRequirements.modelVariant !== 'CHAT') {
6144
6207
  throw new PipelineExecutionError('Use callChatModel only for CHAT variant');
6145
6208
  }
6209
+ modelName = modelRequirements.modelName || this.getDefaultChatModel().modelName;
6146
6210
  rawRequest = {
6147
6211
  model: modelRequirements.modelName || this.getDefaultChatModel().modelName,
6148
6212
  max_tokens: modelRequirements.maxTokens || 4096,
@@ -6154,7 +6218,7 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
6154
6218
  messages: [
6155
6219
  {
6156
6220
  role: 'user',
6157
- content: replaceParameters(content, parameters),
6221
+ content: replaceParameters(content, __assign(__assign({}, parameters), { modelName: modelName })),
6158
6222
  },
6159
6223
  ],
6160
6224
  // TODO: Is here some equivalent of user identification?> user: this.options.user,
@@ -6215,9 +6279,9 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
6215
6279
  throw new PipelineExecutionError('Use callCompletionModel only for COMPLETION variant');
6216
6280
  }
6217
6281
 
6218
- const model = modelRequirements.modelName || this.getDefaultChatModel().modelName;
6282
+ const modelName = modelRequirements.modelName || this.getDefaultChatModel().modelName;
6219
6283
  const modelSettings = {
6220
- model: rawResponse.model || model,
6284
+ model: modelName,
6221
6285
  max_tokens: modelRequirements.maxTokens || 2000, // <- Note: 2000 is for lagacy reasons
6222
6286
  // <- TODO: [🌾] Make some global max cap for maxTokens
6223
6287
  // <- TODO: Use here `systemMessage`, `temperature` and `seed`
@@ -6225,7 +6289,7 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
6225
6289
 
6226
6290
  const rawRequest: xxxx.Completions.CompletionCreateParamsNonStreaming = {
6227
6291
  ...modelSettings,
6228
- prompt: replaceParameters(content, parameters),
6292
+ prompt: replaceParameters(content, { ...parameters, modelName }),
6229
6293
  user: this.options.user,
6230
6294
  };
6231
6295
  const start: string_date_iso8601 = getCurrentIsoDate();
@@ -6732,7 +6796,7 @@ var OpenAiExecutionTools = /** @class */ (function () {
6732
6796
  */
6733
6797
  OpenAiExecutionTools.prototype.callChatModel = function (prompt) {
6734
6798
  return __awaiter(this, void 0, void 0, function () {
6735
- var content, parameters, modelRequirements, expectFormat, model, modelSettings, rawRequest, start, complete, rawResponse, resultContent, usage;
6799
+ var content, parameters, modelRequirements, expectFormat, modelName, modelSettings, rawRequest, start, complete, rawResponse, resultContent, usage;
6736
6800
  return __generator(this, function (_a) {
6737
6801
  switch (_a.label) {
6738
6802
  case 0:
@@ -6744,9 +6808,9 @@ var OpenAiExecutionTools = /** @class */ (function () {
6744
6808
  if (modelRequirements.modelVariant !== 'CHAT') {
6745
6809
  throw new PipelineExecutionError('Use callChatModel only for CHAT variant');
6746
6810
  }
6747
- model = modelRequirements.modelName || this.getDefaultChatModel().modelName;
6811
+ modelName = modelRequirements.modelName || this.getDefaultChatModel().modelName;
6748
6812
  modelSettings = {
6749
- model: model,
6813
+ model: modelName,
6750
6814
  max_tokens: modelRequirements.maxTokens,
6751
6815
  // <- TODO: [🌾] Make some global max cap for maxTokens
6752
6816
  temperature: modelRequirements.temperature,
@@ -6768,7 +6832,7 @@ var OpenAiExecutionTools = /** @class */ (function () {
6768
6832
  ])), false), [
6769
6833
  {
6770
6834
  role: 'user',
6771
- content: replaceParameters(content, parameters),
6835
+ content: replaceParameters(content, __assign(__assign({}, parameters), { modelName: modelName })),
6772
6836
  },
6773
6837
  ], false), user: this.options.user });
6774
6838
  start = getCurrentIsoDate();
@@ -6797,7 +6861,7 @@ var OpenAiExecutionTools = /** @class */ (function () {
6797
6861
  }
6798
6862
  return [2 /*return*/, {
6799
6863
  content: resultContent,
6800
- modelName: rawResponse.model || model,
6864
+ modelName: rawResponse.model || modelName,
6801
6865
  timing: {
6802
6866
  start: start,
6803
6867
  complete: complete,
@@ -6815,7 +6879,7 @@ var OpenAiExecutionTools = /** @class */ (function () {
6815
6879
  */
6816
6880
  OpenAiExecutionTools.prototype.callCompletionModel = function (prompt) {
6817
6881
  return __awaiter(this, void 0, void 0, function () {
6818
- var content, parameters, modelRequirements, model, modelSettings, rawRequest, start, complete, rawResponse, resultContent, usage;
6882
+ var content, parameters, modelRequirements, modelName, modelSettings, rawRequest, start, complete, rawResponse, resultContent, usage;
6819
6883
  return __generator(this, function (_a) {
6820
6884
  switch (_a.label) {
6821
6885
  case 0:
@@ -6827,16 +6891,16 @@ var OpenAiExecutionTools = /** @class */ (function () {
6827
6891
  if (modelRequirements.modelVariant !== 'COMPLETION') {
6828
6892
  throw new PipelineExecutionError('Use callCompletionModel only for COMPLETION variant');
6829
6893
  }
6830
- model = modelRequirements.modelName || this.getDefaultCompletionModel().modelName;
6894
+ modelName = modelRequirements.modelName || this.getDefaultCompletionModel().modelName;
6831
6895
  modelSettings = {
6832
- model: model,
6896
+ model: modelName,
6833
6897
  max_tokens: modelRequirements.maxTokens || 2000,
6834
6898
  // <- TODO: [🌾] Make some global max cap for maxTokens
6835
6899
  temperature: modelRequirements.temperature,
6836
6900
  // <- TODO: [🈁] Use `seed` here AND/OR use is `isDeterministic` for entire execution tools
6837
6901
  // <- Note: [🧆]
6838
6902
  };
6839
- rawRequest = __assign(__assign({}, modelSettings), { prompt: replaceParameters(content, parameters), user: this.options.user });
6903
+ rawRequest = __assign(__assign({}, modelSettings), { prompt: replaceParameters(content, __assign(__assign({}, parameters), { modelName: modelName })), user: this.options.user });
6840
6904
  start = getCurrentIsoDate();
6841
6905
  if (this.options.isVerbose) {
6842
6906
  console.info(colors.bgWhite('rawRequest'), JSON.stringify(rawRequest, null, 4));
@@ -6860,7 +6924,7 @@ var OpenAiExecutionTools = /** @class */ (function () {
6860
6924
  usage = computeOpenaiUsage(content, resultContent || '', rawResponse);
6861
6925
  return [2 /*return*/, {
6862
6926
  content: resultContent,
6863
- modelName: rawResponse.model || model,
6927
+ modelName: rawResponse.model || modelName,
6864
6928
  timing: {
6865
6929
  start: start,
6866
6930
  complete: complete,
@@ -6878,7 +6942,7 @@ var OpenAiExecutionTools = /** @class */ (function () {
6878
6942
  */
6879
6943
  OpenAiExecutionTools.prototype.callEmbeddingModel = function (prompt) {
6880
6944
  return __awaiter(this, void 0, void 0, function () {
6881
- var content, parameters, modelRequirements, model, rawRequest, start, complete, rawResponse, resultContent, usage;
6945
+ var content, parameters, modelRequirements, modelName, rawRequest, start, complete, rawResponse, resultContent, usage;
6882
6946
  return __generator(this, function (_a) {
6883
6947
  switch (_a.label) {
6884
6948
  case 0:
@@ -6890,10 +6954,10 @@ var OpenAiExecutionTools = /** @class */ (function () {
6890
6954
  if (modelRequirements.modelVariant !== 'EMBEDDING') {
6891
6955
  throw new PipelineExecutionError('Use embed only for EMBEDDING variant');
6892
6956
  }
6893
- model = modelRequirements.modelName || this.getDefaultEmbeddingModel().modelName;
6957
+ modelName = modelRequirements.modelName || this.getDefaultEmbeddingModel().modelName;
6894
6958
  rawRequest = {
6895
- input: replaceParameters(content, parameters),
6896
- model: model,
6959
+ input: replaceParameters(content, __assign(__assign({}, parameters), { modelName: modelName })),
6960
+ model: modelName,
6897
6961
  // TODO: !!!! Test model 3 and dimensions
6898
6962
  };
6899
6963
  start = getCurrentIsoDate();
@@ -6915,7 +6979,7 @@ var OpenAiExecutionTools = /** @class */ (function () {
6915
6979
  usage = computeOpenaiUsage(content, '', rawResponse);
6916
6980
  return [2 /*return*/, {
6917
6981
  content: resultContent,
6918
- modelName: rawResponse.model || model,
6982
+ modelName: rawResponse.model || modelName,
6919
6983
  timing: {
6920
6984
  start: start,
6921
6985
  complete: complete,
@@ -7238,6 +7302,7 @@ function stringifyPipelineJson(pipeline) {
7238
7302
  * TODO: !!!! Not Working propperly @see https://promptbook.studio/samples/mixed-knowledge.ptbk.md
7239
7303
  * TODO: [🧠][0] Maybe rename to `stringifyPipelineJson`, `stringifyIndexedJson`,...
7240
7304
  * TODO: [🧠] Maybe more elegant solution than replacing via regex
7305
+ * TODO: [🍙] Make some standart order of json properties
7241
7306
  */
7242
7307
 
7243
7308
  /**