@promptbook/core 0.61.0-22 → 0.61.0-23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/index.es.js CHANGED
@@ -466,19 +466,26 @@ var MAX_PARALLEL_COUNT = 5;
466
466
  * The maximum number of attempts to execute LLM task before giving up
467
467
  */
468
468
  var MAX_EXECUTION_ATTEMPTS = 3;
469
+ /**
470
+ * Nonce which is used for replacing things in strings
471
+ */
472
+ var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
469
473
  /**
470
474
  * The names of the parameters that are reserved for special purposes
471
475
  */
472
476
  var RESERVED_PARAMETER_NAMES = deepFreeze([
473
477
  'context',
478
+ 'knowledge',
479
+ 'samples',
480
+ 'modelName',
474
481
  'currentDate',
475
482
  // <- TODO: Add more like 'date', 'modelName',...
476
483
  // <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
477
484
  ]);
478
485
  /**
479
- * Nonce which is used for replacing things in strings
486
+ * @@@
480
487
  */
481
- var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
488
+ var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
482
489
  /*
483
490
  TODO: !!! Just testing false-negative detection of [🟡][🟢][🔵][⚪] leak
484
491
  */
@@ -753,7 +760,7 @@ function validatePipeline(pipeline) {
753
760
  throw new PipelineLogicError("Parameter {".concat(template.resultingParameterName, "} is defined multiple times"));
754
761
  }
755
762
  if (RESERVED_PARAMETER_NAMES.includes(template.resultingParameterName)) {
756
- throw new PipelineLogicError("Parameter name {".concat(template.resultingParameterName, "} is reserved, please use fifferent name"));
763
+ throw new PipelineLogicError("Parameter name {".concat(template.resultingParameterName, "} is reserved, please use different name"));
757
764
  }
758
765
  definedParameters.add(template.resultingParameterName);
759
766
  if (template.blockType === 'PROMPT_TEMPLATE' && template.modelRequirements.modelVariant === undefined) {
@@ -930,6 +937,7 @@ function unpreparePipeline(pipeline) {
930
937
  }
931
938
  /**
932
939
  * TODO: [🔼] !!! Export via `@promptbook/core`
940
+ * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
933
941
  * TODO: Write tests for `preparePipeline`
934
942
  */
935
943
 
@@ -1447,7 +1455,7 @@ function forEachAsync(array, options, callbackfunction) {
1447
1455
  });
1448
1456
  }
1449
1457
 
1450
- 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"}];
1458
+ 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"}];
1451
1459
 
1452
1460
  var defaultDiacriticsRemovalMap = [
1453
1461
  {
@@ -2243,22 +2251,21 @@ function isPipelinePrepared(pipeline) {
2243
2251
  // Note: Ignoring `pipeline.preparations` @@@
2244
2252
  // Note: Ignoring `pipeline.knowledgePieces` @@@
2245
2253
  if (!pipeline.personas.every(function (persona) { return persona.modelRequirements !== undefined; })) {
2246
- console.log('!!!!', 'Not all personas have modelRequirements');
2247
2254
  return false;
2248
2255
  }
2249
2256
  if (!pipeline.knowledgeSources.every(function (knowledgeSource) { return knowledgeSource.preparationIds !== undefined; })) {
2250
- console.log('!!!!', 'Not all knowledgeSources have preparationIds');
2251
2257
  return false;
2252
2258
  }
2253
- // TODO: !!!!! Is context in each template
2254
- // TODO: !!!!! Are samples prepared
2255
- // TODO: !!!!! Are templates prepared
2256
2259
  return true;
2257
2260
  }
2258
2261
  /**
2259
2262
  * TODO: [🐠] Maybe base this on `makeValidator`
2260
2263
  * TODO: [🔼] Export via core or utils
2261
2264
  * TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
2265
+ * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
2266
+ * - Is context in each template
2267
+ * - Are samples prepared
2268
+ * - Are templates prepared
2262
2269
  */
2263
2270
 
2264
2271
  /**
@@ -2320,6 +2327,22 @@ var LimitReachedError = /** @class */ (function (_super) {
2320
2327
  * @throws {PipelineExecutionError} if parameter is not defined, not closed, or not opened
2321
2328
  */
2322
2329
  function replaceParameters(template, parameters) {
2330
+ var e_1, _a;
2331
+ try {
2332
+ for (var _b = __values(Object.entries(parameters)), _c = _b.next(); !_c.done; _c = _b.next()) {
2333
+ var _d = __read(_c.value, 2), parameterName = _d[0], parameterValue = _d[1];
2334
+ if (parameterValue === RESERVED_PARAMETER_MISSING_VALUE) {
2335
+ throw new UnexpectedError("Parameter {".concat(parameterName, "} has missing value"));
2336
+ }
2337
+ }
2338
+ }
2339
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
2340
+ finally {
2341
+ try {
2342
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2343
+ }
2344
+ finally { if (e_1) throw e_1.error; }
2345
+ }
2323
2346
  var replacedTemplate = template;
2324
2347
  var match;
2325
2348
  var loopLimit = LOOP_LIMIT;
@@ -2445,7 +2468,7 @@ function union() {
2445
2468
  /**
2446
2469
  * The version of the Promptbook library
2447
2470
  */
2448
- var PROMPTBOOK_VERSION = '0.61.0-21';
2471
+ var PROMPTBOOK_VERSION = '0.61.0-22';
2449
2472
  // TODO: !!!! List here all the versions and annotate + put into script
2450
2473
 
2451
2474
  /**
@@ -2599,11 +2622,21 @@ function createPipelineExecutor(options) {
2599
2622
  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 ")));
2600
2623
  }
2601
2624
  var pipelineExecutor = function (inputParameters, onProgress) { return __awaiter(_this, void 0, void 0, function () {
2625
+ // TODO: !!!!! Extract to separate functions and files - ALL FUNCTIONS BELOW
2602
2626
  function getContextForTemplate(// <- TODO: [🧠][🥜]
2603
2627
  template) {
2604
2628
  return __awaiter(this, void 0, void 0, function () {
2605
2629
  return __generator(this, function (_a) {
2606
- // TODO: !!!!!! Implement Better - use real index and keyword search
2630
+ TODO_USE(template);
2631
+ return [2 /*return*/, ''];
2632
+ });
2633
+ });
2634
+ }
2635
+ function getKnowledgeForTemplate(// <- TODO: [🧠][🥜]
2636
+ template) {
2637
+ return __awaiter(this, void 0, void 0, function () {
2638
+ return __generator(this, function (_a) {
2639
+ // TODO: !!!! Implement Better - use real index and keyword search
2607
2640
  TODO_USE(template);
2608
2641
  return [2 /*return*/, pipeline.knowledgePieces.map(function (_a) {
2609
2642
  var content = _a.content;
@@ -2612,19 +2645,39 @@ function createPipelineExecutor(options) {
2612
2645
  });
2613
2646
  });
2614
2647
  }
2648
+ function getSamplesForTemplate(// <- TODO: [🧠][🥜]
2649
+ template) {
2650
+ return __awaiter(this, void 0, void 0, function () {
2651
+ return __generator(this, function (_a) {
2652
+ // TODO: !!!! Implement Better - use real index and keyword search
2653
+ TODO_USE(template);
2654
+ return [2 /*return*/, ''];
2655
+ });
2656
+ });
2657
+ }
2615
2658
  function getReservedParametersForTemplate(template) {
2616
2659
  return __awaiter(this, void 0, void 0, function () {
2617
- var context, currentDate, reservedParameters, RESERVED_PARAMETER_NAMES_1, RESERVED_PARAMETER_NAMES_1_1, parameterName;
2660
+ var context, knowledge, samples, currentDate, modelName, reservedParameters, RESERVED_PARAMETER_NAMES_1, RESERVED_PARAMETER_NAMES_1_1, parameterName;
2618
2661
  var e_3, _a;
2619
2662
  return __generator(this, function (_b) {
2620
2663
  switch (_b.label) {
2621
2664
  case 0: return [4 /*yield*/, getContextForTemplate(template)];
2622
2665
  case 1:
2623
2666
  context = _b.sent();
2667
+ return [4 /*yield*/, getKnowledgeForTemplate(template)];
2668
+ case 2:
2669
+ knowledge = _b.sent();
2670
+ return [4 /*yield*/, getSamplesForTemplate(template)];
2671
+ case 3:
2672
+ samples = _b.sent();
2624
2673
  currentDate = new Date().toISOString();
2674
+ modelName = RESERVED_PARAMETER_MISSING_VALUE;
2625
2675
  reservedParameters = {
2626
2676
  context: context,
2677
+ knowledge: knowledge,
2678
+ samples: samples,
2627
2679
  currentDate: currentDate,
2680
+ modelName: modelName,
2628
2681
  };
2629
2682
  try {
2630
2683
  // Note: Doublecheck that ALL reserved parameters are defined:
@@ -3111,7 +3164,7 @@ function createPipelineExecutor(options) {
3111
3164
  var parameter = _c.value;
3112
3165
  if (parametersToPass[parameter.name] === undefined) {
3113
3166
  // [4]
3114
- errors.push(new PipelineExecutionError("Parameter {".concat(parameter.name, "} should be an output parameter, but it was not be resolved")));
3167
+ warnings.push(new PipelineExecutionError("Parameter {".concat(parameter.name, "} should be an output parameter, but it was not be resolved")));
3115
3168
  continue;
3116
3169
  }
3117
3170
  outputParameters[parameter.name] = parametersToPass[parameter.name] || '';
@@ -3126,7 +3179,7 @@ function createPipelineExecutor(options) {
3126
3179
  }
3127
3180
  return outputParameters;
3128
3181
  }
3129
- 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;
3182
+ 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;
3130
3183
  var e_1, _e, e_2, _f;
3131
3184
  return __generator(this, function (_g) {
3132
3185
  switch (_g.label) {
@@ -3161,8 +3214,8 @@ function createPipelineExecutor(options) {
3161
3214
  isSuccessful: false,
3162
3215
  errors: [
3163
3216
  new PipelineExecutionError("Parameter {".concat(parameter.name, "} is required as an input parameter")),
3164
- // <- TODO: !!!!! Test this error
3165
3217
  ],
3218
+ warnings: [],
3166
3219
  executionReport: executionReport,
3167
3220
  outputParameters: {},
3168
3221
  usage: ZERO_USAGE,
@@ -3178,21 +3231,22 @@ function createPipelineExecutor(options) {
3178
3231
  finally { if (e_1) throw e_1.error; }
3179
3232
  }
3180
3233
  errors = [];
3234
+ warnings = [];
3181
3235
  _loop_1 = function (parameterName) {
3182
3236
  var parameter = pipeline.parameters.find(function (_a) {
3183
3237
  var name = _a.name;
3184
3238
  return name === parameterName;
3185
3239
  });
3186
3240
  if (parameter === undefined) {
3187
- errors.push(new PipelineExecutionError("Extra parameter {".concat(parameterName, "} is passed as input parameter")));
3241
+ warnings.push(new PipelineExecutionError("Extra parameter {".concat(parameterName, "} is being passed which is not part of the pipeline.")));
3188
3242
  }
3189
3243
  else if (parameter.isInput === false) {
3190
3244
  return { value: deepFreezeWithSameType({
3191
3245
  isSuccessful: false,
3192
3246
  errors: [
3193
- new PipelineExecutionError("Parameter {".concat(parameter.name, "} is passed as input parameter but is not input")),
3194
- // <- TODO: !!!!! Test this error
3247
+ new PipelineExecutionError("Parameter {".concat(parameter.name, "} is passed as input parameter but it is not input")),
3195
3248
  ],
3249
+ warnings: warnings,
3196
3250
  executionReport: executionReport,
3197
3251
  outputParameters: {},
3198
3252
  usage: ZERO_USAGE,
@@ -3301,6 +3355,7 @@ function createPipelineExecutor(options) {
3301
3355
  return [2 /*return*/, deepFreezeWithSameType({
3302
3356
  isSuccessful: false,
3303
3357
  errors: __spreadArray([error_1], __read(errors), false),
3358
+ warnings: warnings,
3304
3359
  usage: usage_1,
3305
3360
  executionReport: executionReport,
3306
3361
  outputParameters: outputParameters_1,
@@ -3314,6 +3369,7 @@ function createPipelineExecutor(options) {
3314
3369
  return [2 /*return*/, deepFreezeWithSameType({
3315
3370
  isSuccessful: true,
3316
3371
  errors: errors,
3372
+ warnings: warnings,
3317
3373
  usage: usage,
3318
3374
  executionReport: executionReport,
3319
3375
  outputParameters: outputParameters,
@@ -3340,7 +3396,7 @@ function createPipelineExecutor(options) {
3340
3396
  */
3341
3397
  function prepareKnowledgeFromMarkdown(content /* <- TODO: [🖖] (?maybe not) Always the file */, options) {
3342
3398
  return __awaiter(this, void 0, void 0, function () {
3343
- var llmTools, _a, maxParallelCount, _b, isVerbose, collection, prepareKnowledgeFromMarkdownExecutor, _c, prepareTitleExecutor, _d, prepareKeywordsExecutor, _e, result, outputParameters, knowledgeRaw, knowledgeTextPieces, knowledge;
3399
+ var llmTools, _a, maxParallelCount, _b, isVerbose, collection, prepareKnowledgeFromMarkdownExecutor, _c, prepareTitleExecutor, _d, prepareKeywordsExecutor, _e, result, outputParameters, knowledgePiecesRaw, knowledgeTextPieces, knowledge;
3344
3400
  var _f, _g, _h;
3345
3401
  var _this = this;
3346
3402
  return __generator(this, function (_j) {
@@ -3381,8 +3437,8 @@ function prepareKnowledgeFromMarkdown(content /* <- TODO: [🖖] (?maybe not) Al
3381
3437
  result = _j.sent();
3382
3438
  assertsExecutionSuccessful(result);
3383
3439
  outputParameters = result.outputParameters;
3384
- knowledgeRaw = outputParameters.knowledge;
3385
- knowledgeTextPieces = (knowledgeRaw || '').split('\n---\n');
3440
+ knowledgePiecesRaw = outputParameters.knowledgePieces;
3441
+ knowledgeTextPieces = (knowledgePiecesRaw || '').split('\n---\n');
3386
3442
  if (isVerbose) {
3387
3443
  console.info('knowledgeTextPieces:', knowledgeTextPieces);
3388
3444
  }
@@ -3650,7 +3706,8 @@ function preparePipeline(pipeline, options) {
3650
3706
  knowledgePiecesPrepared = partialknowledgePiecesPrepared.map(function (piece) { return (__assign(__assign({}, piece), { preparationIds: [/* TODO: [🧊] -> */ currentPreparation.id] })); });
3651
3707
  // ----- /Knowledge preparation -----
3652
3708
  // TODO: !!!!! Add context to each template (if missing)
3653
- // TODO: !!!!! Apply samples to each template (if missing)
3709
+ // TODO: !!!!! Add knowledge to each template (if missing and is in pipeline defined)
3710
+ // TODO: !!!!! Apply samples to each template (if missing and is for the template defined)
3654
3711
  return [2 /*return*/, __assign(__assign({}, pipeline), { knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: preparations })];
3655
3712
  }
3656
3713
  });