@promptbook/core 0.69.0-14 → 0.69.0-16

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 (29) hide show
  1. package/README.md +4 -0
  2. package/esm/index.es.js +40 -44
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/promptbook-collection/index.d.ts +0 -3
  5. package/esm/typings/src/cli/cli-commands/make.d.ts +1 -1
  6. package/esm/typings/src/collection/constructors/createCollectionFromUrl.d.ts +1 -1
  7. package/esm/typings/src/commands/FOREACH/ForeachCommand.d.ts +1 -1
  8. package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +0 -1
  9. package/esm/typings/src/config.d.ts +2 -2
  10. package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +1 -1
  11. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +6 -6
  12. package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +1 -1
  13. package/esm/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +1 -1
  14. package/esm/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +1 -1
  15. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  16. package/esm/typings/src/llm-providers/anthropic-claude/createAnthropicClaudeExecutionTools.d.ts +2 -2
  17. package/esm/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +2 -2
  18. package/esm/typings/src/llm-providers/openai/playground/playground.d.ts +1 -1
  19. package/esm/typings/src/personas/preparePersona.d.ts +1 -1
  20. package/esm/typings/src/prepare/isPipelinePrepared.d.ts +1 -1
  21. package/esm/typings/src/prepare/prepareTemplates.d.ts +1 -1
  22. package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -1
  23. package/esm/typings/src/types/typeAliases.d.ts +1 -1
  24. package/esm/typings/src/utils/serialization/checkSerializableAsJson.d.ts +1 -1
  25. package/esm/typings/src/utils/serialization/isSerializableAsJson.d.ts +1 -1
  26. package/package.json +1 -1
  27. package/umd/index.umd.js +40 -44
  28. package/umd/index.umd.js.map +1 -1
  29. /package/esm/typings/src/{personas/preparePersona.test.d.ts → collection/constructors/createCollectionFromDirectory.test.d.ts} +0 -0
package/README.md CHANGED
@@ -42,6 +42,10 @@ Core of the library, it contains the main logic for promptbooks.
42
42
 
43
43
  Rest of the documentation is common for **entire promptbook ecosystem**:
44
44
 
45
+ # ✨ New Features
46
+
47
+ - ✨ **Support [OpenAI o1 model](https://openai.com/o1/)**
48
+
45
49
  ## 🤍 The Promptbook Whitepaper
46
50
 
47
51
 
package/esm/index.es.js CHANGED
@@ -11,8 +11,8 @@ import moment from 'moment';
11
11
  /**
12
12
  * The version of the Promptbook library
13
13
  */
14
- var PROMPTBOOK_VERSION = '0.69.0-13';
15
- // TODO: !!!! List here all the versions and annotate + put into script
14
+ var PROMPTBOOK_VERSION = '0.69.0-15';
15
+ // TODO:[main] !!!! List here all the versions and annotate + put into script
16
16
 
17
17
  /*! *****************************************************************************
18
18
  Copyright (c) Microsoft Corporation.
@@ -224,7 +224,7 @@ function pipelineJsonToString(pipelineJson) {
224
224
  commands.push("PIPELINE URL ".concat(pipelineUrl));
225
225
  }
226
226
  commands.push("PROMPTBOOK VERSION ".concat(promptbookVersion));
227
- // TODO: !!! This increase size of the bundle and is probbably not necessary
227
+ // TODO:[main] !!! This increase size of the bundle and is probbably not necessary
228
228
  pipelineString = prettifyMarkdown(pipelineString);
229
229
  try {
230
230
  for (var _g = __values(parameters.filter(function (_a) {
@@ -372,12 +372,12 @@ function pipelineJsonToString(pipelineJson) {
372
372
  pipelineString += '```' + contentLanguage;
373
373
  pipelineString += '\n';
374
374
  pipelineString += spaceTrim(content);
375
- // <- TODO: !!! Escape
375
+ // <- TODO:[main] !!! Escape
376
376
  // <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
377
377
  pipelineString += '\n';
378
378
  pipelineString += '```';
379
379
  pipelineString += '\n\n';
380
- pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: !!! If the parameter here has description, add it and use templateParameterJsonToString
380
+ pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO:[main] !!! If the parameter here has description, add it and use templateParameterJsonToString
381
381
  }
382
382
  }
383
383
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
@@ -597,7 +597,7 @@ function checkSerializableAsJson(name, value) {
597
597
  }
598
598
  /**
599
599
  * TODO: [🧠][🛣] More elegant way to tracking than passing `name`
600
- * TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
600
+ * TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
601
601
  * Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
602
602
  */
603
603
 
@@ -668,14 +668,14 @@ var MAX_EXECUTION_ATTEMPTS = 3; // <- TODO: [🤹‍♂️]
668
668
  var MAX_FILENAME_LENGTH = 30;
669
669
  /**
670
670
  * @@@
671
- * TODO: [🐝] !!! Use
671
+ * TODO: [🐝][main] !!! Use
672
672
  *
673
673
  * @public exported from `@promptbook/core`
674
674
  */
675
675
  var MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH = 3;
676
676
  /**
677
677
  * @@@
678
- * TODO: [🐝] !!! Use
678
+ * TODO: [🐝][main] !!! Use
679
679
  *
680
680
  * @public exported from `@promptbook/core`
681
681
  */
@@ -851,7 +851,7 @@ function isValidPromptbookVersion(version) {
851
851
  if ( /* version === '1.0.0' || */version === '2.0.0' || version === '3.0.0') {
852
852
  return false;
853
853
  }
854
- // <- TODO: !!! Check isValidPromptbookVersion against PROMPTBOOK_VERSIONS
854
+ // <- TODO:[main] !!! Check isValidPromptbookVersion against PROMPTBOOK_VERSIONS
855
855
  return true;
856
856
  }
857
857
 
@@ -1020,7 +1020,7 @@ function validatePipelineCore(pipeline) {
1020
1020
  // <- Note: [🚲]
1021
1021
  throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Invalid promptbook URL \"".concat(pipeline.pipelineUrl, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
1022
1022
  }
1023
- if (!isValidPromptbookVersion(pipeline.promptbookVersion)) {
1023
+ if (pipeline.promptbookVersion !== undefined && !isValidPromptbookVersion(pipeline.promptbookVersion)) {
1024
1024
  // <- Note: [🚲]
1025
1025
  throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.promptbookVersion, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
1026
1026
  }
@@ -1203,7 +1203,7 @@ function validatePipelineCore(pipeline) {
1203
1203
  }
1204
1204
  }
1205
1205
  /**
1206
- * TODO: !!!!!! [🧞‍♀️] Do not allow joker + foreach
1206
+ * TODO: !!!!! [🧞‍♀️] Do not allow joker + foreach
1207
1207
  * TODO: [🧠] Work with promptbookVersion
1208
1208
  * TODO: Use here some json-schema, Zod or something similar and change it to:
1209
1209
  * > /**
@@ -1215,11 +1215,11 @@ function validatePipelineCore(pipeline) {
1215
1215
  * > ex port function validatePipeline(promptbook: really_unknown): asserts promptbook is PipelineJson {
1216
1216
  */
1217
1217
  /**
1218
- * TODO: [🐣] !!!! Validate that all samples match expectations
1219
- * TODO: [🐣][🐝] !!!! Validate that knowledge is valid (non-void)
1220
- * TODO: [🐣] !!!! Validate that persona can be used only with CHAT variant
1221
- * TODO: [🐣] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
1222
- * TODO: [🐣] !!!! Validate that reserved parameter is not used as joker
1218
+ * TODO: [🐣][main] !!!! Validate that all samples match expectations
1219
+ * TODO: [🐣][🐝][main] !!!! Validate that knowledge is valid (non-void)
1220
+ * TODO: [🐣][main] !!!! Validate that persona can be used only with CHAT variant
1221
+ * TODO: [🐣][main] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
1222
+ * TODO: [🐣][main] !!!! Validate that reserved parameter is not used as joker
1223
1223
  * TODO: [🧠] Validation not only logic itself but imports around - files and websites and rerefenced pipelines exists
1224
1224
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
1225
1225
  */
@@ -1533,7 +1533,7 @@ function createCollectionFromUrl(url, options) {
1533
1533
  });
1534
1534
  }
1535
1535
  /**
1536
- * TODO: !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
1536
+ * TODO:[main] !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
1537
1537
  */
1538
1538
 
1539
1539
  /**
@@ -1830,7 +1830,7 @@ function forEachAsync(array, options, callbackfunction) {
1830
1830
  });
1831
1831
  }
1832
1832
 
1833
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.69.0-13",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",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}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.69.0-13",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",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}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.69.0-13",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",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}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.69.0-13",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}],templates:[{templateType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",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- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `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### Key `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}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
1833
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",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}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",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}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",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}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",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}],templates:[{templateType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",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- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `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### Key `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}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
1834
1834
 
1835
1835
  var defaultDiacriticsRemovalMap = [
1836
1836
  {
@@ -2381,7 +2381,7 @@ function isPipelinePrepared(pipeline) {
2381
2381
  return true;
2382
2382
  }
2383
2383
  /**
2384
- * TODO: [🔃] !!!!! If the pipeline was prepared with different version or different set of models, prepare it once again
2384
+ * TODO: [🔃][main] !!!!! If the pipeline was prepared with different version or different set of models, prepare it once again
2385
2385
  * TODO: [🐠] Maybe base this on `makeValidator`
2386
2386
  * TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
2387
2387
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
@@ -2433,9 +2433,10 @@ var MultipleLlmExecutionTools = /** @class */ (function () {
2433
2433
  });
2434
2434
  Object.defineProperty(MultipleLlmExecutionTools.prototype, "description", {
2435
2435
  get: function () {
2436
- return this.llmExecutionTools
2437
- .map(function (tools, index) { return "".concat(index + 1, ") ").concat(tools.title, " ").concat(tools.description || ''); })
2438
- .join('\n');
2436
+ return this.llmExecutionTools.map(function (_a, index) {
2437
+ var title = _a.title;
2438
+ return "".concat(index + 1, ") `").concat(title, "`");
2439
+ }).join('\n');
2439
2440
  },
2440
2441
  enumerable: false,
2441
2442
  configurable: true
@@ -2633,7 +2634,7 @@ var MultipleLlmExecutionTools = /** @class */ (function () {
2633
2634
  throw new PipelineExecutionError("You have not provided any `LlmExecutionTools`");
2634
2635
  }
2635
2636
  else {
2636
- throw new PipelineExecutionError(spaceTrim(function (block) { return "\n You have not provided any `LlmExecutionTools` that support model variant \"".concat(prompt.modelRequirements.modelVariant, "\"\n\n Available `LlmExecutionTools`:\n ").concat(block(_this.llmExecutionTools.map(function (tools) { return "- ".concat(tools.title); }).join('\n')), "\n\n "); }));
2637
+ throw new PipelineExecutionError(spaceTrim(function (block) { return "\n You have not provided any `LlmExecutionTools` that support model variant \"".concat(prompt.modelRequirements.modelVariant, "\"\n\n Available `LlmExecutionTools`:\n ").concat(block(_this.description), "\n\n "); }));
2637
2638
  }
2638
2639
  }
2639
2640
  });
@@ -4813,7 +4814,7 @@ function prepareKnowledgeFromMarkdown(knowledgeContent /* <- TODO: [🖖] (?mayb
4813
4814
  outputParameters = result.outputParameters;
4814
4815
  knowledgePiecesRaw = outputParameters.knowledgePieces;
4815
4816
  knowledgeTextPieces = (knowledgePiecesRaw || '').split('\n---\n');
4816
- // <- TODO: !!!!! Smarter split and filter out empty pieces
4817
+ // <- TODO:[main] !!!!! Smarter split and filter out empty pieces
4817
4818
  if (isVerbose) {
4818
4819
  console.info('knowledgeTextPieces:', knowledgeTextPieces);
4819
4820
  }
@@ -4898,7 +4899,7 @@ function prepareKnowledgeFromMarkdown(knowledgeContent /* <- TODO: [🖖] (?mayb
4898
4899
  });
4899
4900
  }
4900
4901
  /**
4901
- * TODO: [🐝][🔼] !!! Export via `@promptbook/markdown`
4902
+ * TODO: [🐝][🔼][main] !!! Export via `@promptbook/markdown`
4902
4903
  * TODO: [🪂] Do it in parallel 11:11
4903
4904
  * Note: No need to aggregate usage here, it is done by intercepting the llmTools
4904
4905
  */
@@ -4922,7 +4923,7 @@ function prepareKnowledgePieces(knowledgeSources, options) {
4922
4923
  var partialPieces, pieces;
4923
4924
  return __generator(this, function (_a) {
4924
4925
  switch (_a.label) {
4925
- case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.sourceContent, // <- TODO: [🐝] !!! Unhardcode markdown, detect which type it is - BE AWARE of big package size
4926
+ case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.sourceContent, // <- TODO: [🐝][main] !!! Unhardcode markdown, detect which type it is - BE AWARE of big package size
4926
4927
  options)];
4927
4928
  case 1:
4928
4929
  partialPieces = _a.sent();
@@ -5114,7 +5115,7 @@ function preparePersona(personaDescription, options) {
5114
5115
  });
5115
5116
  }
5116
5117
  /**
5117
- * TODO: [🔃] !!!!! If the persona was prepared with different version or different set of models, prepare it once again
5118
+ * TODO: [🔃][main] !!!!! If the persona was prepared with different version or different set of models, prepare it once again
5118
5119
  * TODO: [🏢] !! Check validity of `modelName` in pipeline
5119
5120
  * TODO: [🏢] !! Check validity of `systemMessage` in pipeline
5120
5121
  * TODO: [🏢] !! Check validity of `temperature` in pipeline
@@ -5163,7 +5164,7 @@ function prepareTemplates(pipeline, options) {
5163
5164
  case 0:
5164
5165
  _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a;
5165
5166
  templates = pipeline.templates, parameters = pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
5166
- // TODO: !!!!! Apply samples to each template (if missing and is for the template defined)
5167
+ // TODO:[main] !!!!! Apply samples to each template (if missing and is for the template defined)
5167
5168
  TODO_USE(parameters);
5168
5169
  templatesPrepared = new Array(
5169
5170
  // <- TODO: [🧱] Implement in a functional (not new Class) way
@@ -5195,7 +5196,7 @@ function prepareTemplates(pipeline, options) {
5195
5196
  /**
5196
5197
  * TODO: [🧠] Add context to each template (if missing)
5197
5198
  * TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
5198
- * TODO: [♨] !!! Prepare index the samples and maybe templates
5199
+ * TODO: [♨][main] !!! Prepare index the samples and maybe templates
5199
5200
  * TODO: Write tests for `preparePipeline`
5200
5201
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
5201
5202
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
@@ -5367,7 +5368,7 @@ var knowledgeCommandParser = {
5367
5368
  if (sourceContent === '') {
5368
5369
  throw new ParseError("Source is not defined");
5369
5370
  }
5370
- // TODO: !!!! Following checks should be applied every link in the `sourceContent`
5371
+ // TODO:[main] !!!! Following checks should be applied every link in the `sourceContent`
5371
5372
  if (sourceContent.startsWith('http://')) {
5372
5373
  throw new ParseError("Source is not secure");
5373
5374
  }
@@ -5552,7 +5553,7 @@ var templateCommandParser = {
5552
5553
  if (command.templateType === 'KNOWLEDGE') {
5553
5554
  knowledgeCommandParser.$applyToPipelineJson({
5554
5555
  type: 'KNOWLEDGE',
5555
- sourceContent: $templateJson.content, // <- TODO: [🐝] !!! Work with KNOWLEDGE which not referring to the source file or website, but its content itself
5556
+ sourceContent: $templateJson.content, // <- TODO: [🐝][main] !!! Work with KNOWLEDGE which not referring to the source file or website, but its content itself
5556
5557
  }, $pipelineJson);
5557
5558
  $templateJson.isTemplate = false;
5558
5559
  return;
@@ -6070,7 +6071,7 @@ var foreachCommandParser = {
6070
6071
  /**
6071
6072
  * Link to discussion
6072
6073
  */
6073
- documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
6074
+ documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/148',
6074
6075
  /**
6075
6076
  * Example usages of the FOREACH command
6076
6077
  */
@@ -6078,7 +6079,6 @@ var foreachCommandParser = {
6078
6079
  'FOREACH Text Line `{customers}` -> `{customer}`',
6079
6080
  'FOR Csv Row `{customers}` -> `{firstName}`, `{lastName}`',
6080
6081
  'EACH Csv Cell `{customers}` -> `{cell}`',
6081
- // <- TODO: [🍭] !!!!!! More
6082
6082
  ],
6083
6083
  /**
6084
6084
  * Parses the FOREACH command
@@ -6093,7 +6093,6 @@ var foreachCommandParser = {
6093
6093
  return __spreadArray([formatDefinition.formatName], __read((formatDefinition.aliases || [])), false).includes(formatName);
6094
6094
  });
6095
6095
  if (formatDefinition === undefined) {
6096
- console.info({ args: args, formatName: formatName });
6097
6096
  throw new ParseError(spaceTrim(function (block) { return "\n Unsupported format \"".concat(formatName, "\"\n\n Available formats:\n ").concat(block(FORMAT_DEFINITIONS.map(function (formatDefinition) { return formatDefinition.formatName; })
6098
6097
  .map(function (formatName) { return "- ".concat(formatName); })
6099
6098
  .join('\n')), "\n "); }));
@@ -6103,7 +6102,6 @@ var foreachCommandParser = {
6103
6102
  return __spreadArray([subvalueDefinition.subvalueName], __read((subvalueDefinition.aliases || [])), false).includes(cellName);
6104
6103
  });
6105
6104
  if (subvalueDefinition === undefined) {
6106
- console.info({ args: args, cellName: cellName });
6107
6105
  throw new ParseError(spaceTrim(function (block) { return "\n Unsupported cell name \"".concat(cellName, "\" for format \"").concat(formatName, "\"\n\n Available cell names for format \"").concat(formatDefinition.formatName, "\":\n ").concat(block(formatDefinition.subvalueDefinitions
6108
6106
  .map(function (subvalueDefinition) { return subvalueDefinition.subvalueName; })
6109
6107
  .map(function (subvalueName) { return "- ".concat(subvalueName); })
@@ -6111,14 +6109,12 @@ var foreachCommandParser = {
6111
6109
  // <- TODO: [🏢] List all supported cell names for the format
6112
6110
  }
6113
6111
  if (assignSign !== '->') {
6114
- console.info({ args: args, assignSign: assignSign });
6115
6112
  throw new ParseError("FOREACH command must have '->' to assign the value to the parameter");
6116
6113
  }
6117
- // TODO: !!!!!! Replace with propper parameter name validation `validateParameterName`
6114
+ // TODO: !!! Replace with propper parameter name validation `validateParameterName`
6118
6115
  if ((parameterNameWrapped === null || parameterNameWrapped === void 0 ? void 0 : parameterNameWrapped.substring(0, 1)) !== '{' ||
6119
6116
  (parameterNameWrapped === null || parameterNameWrapped === void 0 ? void 0 : parameterNameWrapped.substring(parameterNameWrapped.length - 1, parameterNameWrapped.length)) !== '}') {
6120
- console.info({ args: args, parameterNameWrapped: parameterNameWrapped }, parameterNameWrapped === null || parameterNameWrapped === void 0 ? void 0 : parameterNameWrapped.substring(0, 1), parameterNameWrapped === null || parameterNameWrapped === void 0 ? void 0 : parameterNameWrapped.substring(parameterNameWrapped.length - 1, parameterNameWrapped.length));
6121
- throw new ParseError("!!!!!! 1 Here will be error (with rules and precise error) from validateParameterName");
6117
+ throw new ParseError("Invalid parameter name \"".concat(parameterNameWrapped, "\" - must be wrapped in curly brackets: {parameterName}"));
6122
6118
  }
6123
6119
  var parameterName = parameterNameWrapped.substring(1, parameterNameWrapped.length - 1);
6124
6120
  var subparameterNames = args
@@ -6147,7 +6143,7 @@ var foreachCommandParser = {
6147
6143
  // TODO: !!!!!! Detect double use
6148
6144
  // TODO: !!!!!! Detect usage with JOKER and don't allow it
6149
6145
  $templateJson.foreach = { formatName: formatName, cellName: cellName, parameterName: parameterName, subparameterNames: subparameterNames };
6150
- keepUnused($pipelineJson); // <- TODO: !!!!!! BUT Maybe register subparameter from foreach into parameters of the pipeline
6146
+ keepUnused($pipelineJson); // <- TODO: [🧠] Maybe register subparameter from foreach into parameters of the pipeline
6151
6147
  // Note: [🍭] FOREACH apply has some sideeffects on different places in codebase
6152
6148
  },
6153
6149
  /**
@@ -6170,7 +6166,6 @@ var foreachCommandParser = {
6170
6166
  },
6171
6167
  };
6172
6168
  /**
6173
- * TODO: !!!!!! Remove console logs
6174
6169
  * TODO: [🧠][🦥] Better (less confusing) name for "cell" / "subvalue" / "subparameter"
6175
6170
  * TODO: [🍭] !!!!!! Make .ptbk.md file with examples of the FOREACH command and also with wrong parsing and logic
6176
6171
  */
@@ -6855,6 +6850,7 @@ var promptbookVersionCommandParser = {
6855
6850
  * Note: `$` is used to indicate that this function mutates given `pipelineJson`
6856
6851
  */
6857
6852
  $applyToPipelineJson: function (command, $pipelineJson) {
6853
+ // TODO: Warn if the version is overridden
6858
6854
  $pipelineJson.promptbookVersion = command.promptbookVersion;
6859
6855
  },
6860
6856
  /**
@@ -7675,7 +7671,7 @@ function pipelineStringToJsonSync(pipelineString) {
7675
7671
  var $pipelineJson = {
7676
7672
  title: undefined /* <- Note: [🍙] Putting here placeholder to keep `title` on top at final JSON */,
7677
7673
  pipelineUrl: undefined /* <- Note: Putting here placeholder to keep `pipelineUrl` on top at final JSON */,
7678
- promptbookVersion: PROMPTBOOK_VERSION,
7674
+ promptbookVersion: undefined /* <- Note: By default no explicit version */,
7679
7675
  description: undefined /* <- Note: [🍙] Putting here placeholder to keep `description` on top at final JSON */,
7680
7676
  parameters: [],
7681
7677
  templates: [],
@@ -7966,7 +7962,7 @@ function pipelineStringToJsonSync(pipelineString) {
7966
7962
  return $asDeeplyFrozenSerializableJson('pipelineJson', $pipelineJson);
7967
7963
  }
7968
7964
  /**
7969
- * TODO: !!!! Warn if used only sync version
7965
+ * TODO:[main] !!!! Warn if used only sync version
7970
7966
  * TODO: [🚞] Report here line/column of error
7971
7967
  * TODO: Use spaceTrim more effectively
7972
7968
  * TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
@@ -8180,7 +8176,7 @@ function isSerializableAsJson(value) {
8180
8176
  }
8181
8177
  }
8182
8178
  /**
8183
- * TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
8179
+ * TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
8184
8180
  * TODO: [🧠][💺] Can be done this on type-level?
8185
8181
  */
8186
8182