@promptbook/core 0.61.0-11 → 0.61.0-13

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 (159) hide show
  1. package/esm/index.es.js +152 -56
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/execute-javascript.index.d.ts +1 -1
  4. package/esm/typings/src/_packages/utils.index.d.ts +1 -1
  5. package/esm/typings/src/cli/cli-commands/hello.d.ts +3 -0
  6. package/esm/typings/src/cli/cli-commands/make.d.ts +3 -0
  7. package/esm/typings/src/cli/cli-commands/prettify.d.ts +3 -0
  8. package/esm/typings/src/cli/promptbookCli.d.ts +1 -0
  9. package/esm/typings/src/collection/PipelineCollection.d.ts +1 -1
  10. package/esm/typings/src/collection/SimplePipelineCollection.d.ts +1 -1
  11. package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -0
  12. package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -0
  13. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +1 -1
  14. package/esm/typings/src/config.d.ts +1 -1
  15. package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
  16. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +4 -2
  17. package/esm/typings/src/errors/LimitReachedError.d.ts +7 -0
  18. package/esm/typings/src/execution/CommonExecutionToolsOptions.d.ts +1 -0
  19. package/esm/typings/src/execution/utils/addUsage.d.ts +57 -1
  20. package/esm/typings/src/formats/csv/ListFormatDefinition.d.ts +1 -0
  21. package/esm/typings/src/formats/json/JsonFormatDefinition.d.ts +1 -0
  22. package/esm/typings/src/formats/list/ListFormatDefinition.d.ts +1 -0
  23. package/esm/typings/src/formats/xml/XmlFormatDefinition.d.ts +1 -0
  24. package/esm/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +3 -0
  25. package/esm/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +1 -1
  26. package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +1 -0
  27. package/esm/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +1 -0
  28. package/{umd/typings/src/llm-providers/utils → esm/typings/src/llm-providers/_common}/createLlmToolsFromEnv.d.ts +3 -2
  29. package/esm/typings/src/llm-providers/_common/getLlmToolsForCli.d.ts +10 -0
  30. package/esm/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +10 -0
  31. package/{umd/typings/src/llm-providers → esm/typings/src/llm-providers/_common}/utils/cache/CacheItem.d.ts +4 -4
  32. package/{umd/typings/src/llm-providers → esm/typings/src/llm-providers/_common}/utils/cache/CacheLlmToolsOptions.d.ts +1 -1
  33. package/esm/typings/src/llm-providers/{utils → _common/utils}/cache/cacheLlmTools.d.ts +3 -4
  34. package/esm/typings/src/llm-providers/{utils → _common/utils}/count-total-cost/LlmExecutionToolsWithTotalCost.d.ts +2 -2
  35. package/{umd/typings/src/llm-providers → esm/typings/src/llm-providers/_common}/utils/count-total-cost/countTotalCost.d.ts +2 -2
  36. package/esm/typings/src/llm-providers/_common/utils/count-total-cost/limitTotalCost.d.ts +32 -0
  37. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -0
  38. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  39. package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -0
  40. package/esm/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +3 -0
  41. package/esm/typings/src/llm-providers/langtail/LangtailExecutionToolsOptions.d.ts +1 -1
  42. package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +1 -1
  43. package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +1 -1
  44. package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +1 -0
  45. package/esm/typings/src/llm-providers/openai/computeUsage.d.ts +2 -2
  46. package/esm/typings/src/personas/preparePersona.d.ts +6 -1
  47. package/esm/typings/src/prepare/preparePipeline.d.ts +2 -1
  48. package/esm/typings/src/prepare/unpreparePipeline.d.ts +1 -0
  49. package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +1 -0
  50. package/esm/typings/src/storage/_common/PromptbookStorage.test-type.d.ts +1 -1
  51. package/esm/typings/src/storage/files-storage/FilesStorage.d.ts +2 -0
  52. package/esm/typings/src/storage/files-storage/FilesStorageOptions.d.ts +3 -0
  53. package/esm/typings/src/storage/local-storage/getLocalStorage.d.ts +2 -1
  54. package/esm/typings/src/storage/local-storage/getSessionStorage.d.ts +2 -1
  55. package/esm/typings/src/storage/memory/MemoryStorage.d.ts +3 -0
  56. package/esm/typings/src/storage/utils/PrefixStorage.d.ts +3 -0
  57. package/esm/typings/src/storage/utils/makePromptbookStorageFromWebStorage.d.ts +0 -1
  58. package/esm/typings/src/types/ModelRequirements.d.ts +1 -1
  59. package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -1
  60. package/esm/typings/src/types/PipelineString.d.ts +1 -1
  61. package/esm/typings/src/types/execution-report/countWorkingDuration.d.ts +1 -1
  62. package/esm/typings/src/utils/deepClone.d.ts +9 -0
  63. package/esm/typings/src/utils/deepFreeze.d.ts +13 -0
  64. package/esm/typings/src/utils/emojis.d.ts +2 -2
  65. package/esm/typings/src/utils/formatNumber.d.ts +1 -1
  66. package/esm/typings/src/utils/isRunningInWhatever.d.ts +3 -0
  67. package/esm/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +1 -1
  68. package/esm/typings/src/utils/markdown/createMarkdownChart.d.ts +1 -1
  69. package/esm/typings/src/utils/markdown/createMarkdownTable.d.ts +1 -1
  70. package/esm/typings/src/utils/organization/TODO.d.ts +2 -0
  71. package/esm/typings/src/utils/organization/TODO_USE.d.ts +1 -0
  72. package/esm/typings/src/utils/organization/___.d.ts +2 -0
  73. package/esm/typings/src/utils/organization/just.d.ts +5 -1
  74. package/esm/typings/src/utils/organization/keepUnused.d.ts +16 -0
  75. package/esm/typings/src/utils/organization/really_any.d.ts +2 -0
  76. package/package.json +1 -1
  77. package/umd/index.umd.js +152 -56
  78. package/umd/index.umd.js.map +1 -1
  79. package/umd/typings/src/_packages/execute-javascript.index.d.ts +1 -1
  80. package/umd/typings/src/_packages/utils.index.d.ts +1 -1
  81. package/umd/typings/src/cli/cli-commands/hello.d.ts +3 -0
  82. package/umd/typings/src/cli/cli-commands/make.d.ts +3 -0
  83. package/umd/typings/src/cli/cli-commands/prettify.d.ts +3 -0
  84. package/umd/typings/src/cli/promptbookCli.d.ts +1 -0
  85. package/umd/typings/src/collection/PipelineCollection.d.ts +1 -1
  86. package/umd/typings/src/collection/SimplePipelineCollection.d.ts +1 -1
  87. package/umd/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -0
  88. package/umd/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -0
  89. package/umd/typings/src/commands/_common/types/CommandParser.d.ts +1 -1
  90. package/umd/typings/src/config.d.ts +1 -1
  91. package/umd/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
  92. package/umd/typings/src/conversion/validation/validatePipeline.d.ts +4 -2
  93. package/umd/typings/src/errors/LimitReachedError.d.ts +7 -0
  94. package/umd/typings/src/execution/CommonExecutionToolsOptions.d.ts +1 -0
  95. package/umd/typings/src/execution/utils/addUsage.d.ts +57 -1
  96. package/umd/typings/src/formats/csv/ListFormatDefinition.d.ts +1 -0
  97. package/umd/typings/src/formats/json/JsonFormatDefinition.d.ts +1 -0
  98. package/umd/typings/src/formats/list/ListFormatDefinition.d.ts +1 -0
  99. package/umd/typings/src/formats/xml/XmlFormatDefinition.d.ts +1 -0
  100. package/umd/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +3 -0
  101. package/umd/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +1 -1
  102. package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +1 -0
  103. package/umd/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +1 -0
  104. package/{esm/typings/src/llm-providers/utils → umd/typings/src/llm-providers/_common}/createLlmToolsFromEnv.d.ts +3 -2
  105. package/umd/typings/src/llm-providers/_common/getLlmToolsForCli.d.ts +10 -0
  106. package/umd/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +10 -0
  107. package/{esm/typings/src/llm-providers → umd/typings/src/llm-providers/_common}/utils/cache/CacheItem.d.ts +4 -4
  108. package/{esm/typings/src/llm-providers → umd/typings/src/llm-providers/_common}/utils/cache/CacheLlmToolsOptions.d.ts +1 -1
  109. package/umd/typings/src/llm-providers/{utils → _common/utils}/cache/cacheLlmTools.d.ts +3 -4
  110. package/umd/typings/src/llm-providers/{utils → _common/utils}/count-total-cost/LlmExecutionToolsWithTotalCost.d.ts +2 -2
  111. package/{esm/typings/src/llm-providers → umd/typings/src/llm-providers/_common}/utils/count-total-cost/countTotalCost.d.ts +2 -2
  112. package/umd/typings/src/llm-providers/_common/utils/count-total-cost/limitTotalCost.d.ts +32 -0
  113. package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -0
  114. package/umd/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  115. package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -0
  116. package/umd/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +3 -0
  117. package/umd/typings/src/llm-providers/langtail/LangtailExecutionToolsOptions.d.ts +1 -1
  118. package/umd/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +1 -1
  119. package/umd/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +1 -1
  120. package/umd/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +1 -0
  121. package/umd/typings/src/llm-providers/openai/computeUsage.d.ts +2 -2
  122. package/umd/typings/src/personas/preparePersona.d.ts +6 -1
  123. package/umd/typings/src/prepare/preparePipeline.d.ts +2 -1
  124. package/umd/typings/src/prepare/unpreparePipeline.d.ts +1 -0
  125. package/umd/typings/src/storage/_common/PromptbookStorage.d.ts +1 -0
  126. package/umd/typings/src/storage/_common/PromptbookStorage.test-type.d.ts +1 -1
  127. package/umd/typings/src/storage/files-storage/FilesStorage.d.ts +2 -0
  128. package/umd/typings/src/storage/files-storage/FilesStorageOptions.d.ts +3 -0
  129. package/umd/typings/src/storage/local-storage/getLocalStorage.d.ts +2 -1
  130. package/umd/typings/src/storage/local-storage/getSessionStorage.d.ts +2 -1
  131. package/umd/typings/src/storage/memory/MemoryStorage.d.ts +3 -0
  132. package/umd/typings/src/storage/utils/PrefixStorage.d.ts +3 -0
  133. package/umd/typings/src/storage/utils/makePromptbookStorageFromWebStorage.d.ts +0 -1
  134. package/umd/typings/src/types/ModelRequirements.d.ts +1 -1
  135. package/umd/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -1
  136. package/umd/typings/src/types/PipelineString.d.ts +1 -1
  137. package/umd/typings/src/types/execution-report/countWorkingDuration.d.ts +1 -1
  138. package/umd/typings/src/utils/deepClone.d.ts +9 -0
  139. package/umd/typings/src/utils/deepFreeze.d.ts +13 -0
  140. package/umd/typings/src/utils/emojis.d.ts +2 -2
  141. package/umd/typings/src/utils/formatNumber.d.ts +1 -1
  142. package/umd/typings/src/utils/isRunningInWhatever.d.ts +3 -0
  143. package/umd/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +1 -1
  144. package/umd/typings/src/utils/markdown/createMarkdownChart.d.ts +1 -1
  145. package/umd/typings/src/utils/markdown/createMarkdownTable.d.ts +1 -1
  146. package/umd/typings/src/utils/organization/TODO.d.ts +2 -0
  147. package/umd/typings/src/utils/organization/TODO_USE.d.ts +1 -0
  148. package/umd/typings/src/utils/organization/___.d.ts +2 -0
  149. package/umd/typings/src/utils/organization/just.d.ts +5 -1
  150. package/umd/typings/src/utils/organization/keepUnused.d.ts +16 -0
  151. package/umd/typings/src/utils/organization/really_any.d.ts +2 -0
  152. package/esm/typings/src/execution/addPromptResultUsage.test.d.ts +0 -1
  153. package/esm/typings/src/knowledge/prepare-knowledge/_common/utils/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +0 -10
  154. package/esm/typings/src/utils/organization/notUsing.d.ts +0 -11
  155. package/umd/typings/src/execution/addPromptResultUsage.test.d.ts +0 -1
  156. package/umd/typings/src/knowledge/prepare-knowledge/_common/utils/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +0 -10
  157. package/umd/typings/src/utils/organization/notUsing.d.ts +0 -11
  158. /package/esm/typings/src/{utils/postprocessing → postprocessing/utils}/extractBlock.d.ts +0 -0
  159. /package/umd/typings/src/{utils/postprocessing → postprocessing/utils}/extractBlock.d.ts +0 -0
package/esm/index.es.js CHANGED
@@ -385,11 +385,44 @@ function promptTemplateParameterJsonToString(promptTemplateParameterJson) {
385
385
  return parameterString;
386
386
  }
387
387
  /**
388
- * TODO: !!!!! Implement new features and commands into `promptTemplateParameterJsonToString`
388
+ * TODO: !!!! Implement new features and commands into `promptTemplateParameterJsonToString`
389
389
  * TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
390
390
  * TODO: Escape all
391
391
  */
392
392
 
393
+ /**
394
+ * @@@
395
+ *
396
+ * @returns The same object as the input, but deeply frozen
397
+ *
398
+ * Note: This function mutates the object
399
+ */
400
+ function deepFreeze(objectValue) {
401
+ var e_1, _a;
402
+ var propertyNames = Object.getOwnPropertyNames(objectValue);
403
+ try {
404
+ for (var propertyNames_1 = __values(propertyNames), propertyNames_1_1 = propertyNames_1.next(); !propertyNames_1_1.done; propertyNames_1_1 = propertyNames_1.next()) {
405
+ var propertyName = propertyNames_1_1.value;
406
+ var value = objectValue[propertyName];
407
+ if (value && typeof value === 'object') {
408
+ deepFreeze(value);
409
+ }
410
+ }
411
+ }
412
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
413
+ finally {
414
+ try {
415
+ if (propertyNames_1_1 && !propertyNames_1_1.done && (_a = propertyNames_1.return)) _a.call(propertyNames_1);
416
+ }
417
+ finally { if (e_1) throw e_1.error; }
418
+ }
419
+ return Object.freeze(objectValue);
420
+ }
421
+ /**
422
+ * TODO: [🔼] Export from `@promptbook/utils`
423
+ * TODO: [🧠] Is there a way how to meaningfully test this utility
424
+ */
425
+
393
426
  /**
394
427
  * The maximum number of iterations for a loops
395
428
  */
@@ -401,11 +434,15 @@ var MAX_PARALLEL_COUNT = 5;
401
434
  /**
402
435
  * The names of the parameters that are reserved for special purposes
403
436
  */
404
- var RESERVED_PARAMETER_NAMES = [
437
+ var RESERVED_PARAMETER_NAMES = deepFreeze([
405
438
  'context',
406
439
  // <- TODO: Add more like 'date', 'modelName',...
407
440
  // <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
408
- ];
441
+ ]);
442
+ /*
443
+ TODO: !!! Just testing false-negative detection of [🟡][🟢][🔵][⚪] leak
444
+ */
445
+ // [🟡][🟢][🔵][⚪]
409
446
 
410
447
  /**
411
448
  * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
@@ -742,6 +779,7 @@ function validatePipeline(pipeline) {
742
779
  var loopLimit = LOOP_LIMIT;
743
780
  var _loop_2 = function () {
744
781
  if (loopLimit-- < 0) {
782
+ // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
745
783
  throw new UnexpectedError('Loop limit reached during detection of circular dependencies in `validatePipeline`');
746
784
  }
747
785
  var currentlyResovedTemplates = unresovedTemplates.filter(function (template) {
@@ -780,7 +818,9 @@ function validatePipeline(pipeline) {
780
818
  * > ex port function validatePipeline(promptbook: unknown): asserts promptbook is PipelineJson {
781
819
  */
782
820
  /**
783
- * TODO: [🧠] !!!!! Validate new things
821
+ * TODO: [🧠][🐣] !!!! Validate that all samples match expectations
822
+ * TODO: [🧠][🐣] !!!! Validate that knowledge is valid (non-void)
823
+ * TODO: [🧠] !!! Validationg not only logic itself but imports around - files and websites and rerefenced pipelines exists
784
824
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
785
825
  */
786
826
 
@@ -823,7 +863,7 @@ var SimplePipelineCollection = /** @class */ (function () {
823
863
  /**
824
864
  * Constructs a pipeline collection from promptbooks
825
865
  *
826
- * @param promptbooks !!!
866
+ * @param promptbooks @@@
827
867
  *
828
868
  * @private Use instead `createCollectionFromJson`
829
869
  * Note: During the construction logic of all promptbooks are validated
@@ -1127,37 +1167,64 @@ var BlockTypes = [
1127
1167
  // <- [🩻]
1128
1168
  ];
1129
1169
 
1170
+ /**
1171
+ * @@@
1172
+ */
1173
+ function deepClone(objectValue) {
1174
+ return JSON.parse(JSON.stringify(objectValue));
1175
+ /*
1176
+ TODO: [🧠] Is there a better implementation?
1177
+ > const propertyNames = Object.getOwnPropertyNames(objectValue);
1178
+ > for (const propertyName of propertyNames) {
1179
+ > const value = (objectValue as really_any)[propertyName];
1180
+ > if (value && typeof value === 'object') {
1181
+ > deepClone(value);
1182
+ > }
1183
+ > }
1184
+ > return Object.assign({}, objectValue);
1185
+ */
1186
+ }
1187
+ /**
1188
+ * TODO: [🔼] Export from `@promptbook/utils`
1189
+ * TODO: [🧠] Is there a way how to meaningfully test this utility
1190
+ */
1191
+
1192
+ /**
1193
+ * @@@
1194
+ *
1195
+ * TODO: [🔼] Export with addUsage
1196
+ */
1197
+ var ZERO_USAGE = deepFreeze({
1198
+ price: { value: 0 },
1199
+ input: {
1200
+ tokensCount: { value: 0 },
1201
+ charactersCount: { value: 0 },
1202
+ wordsCount: { value: 0 },
1203
+ sentencesCount: { value: 0 },
1204
+ linesCount: { value: 0 },
1205
+ paragraphsCount: { value: 0 },
1206
+ pagesCount: { value: 0 },
1207
+ },
1208
+ output: {
1209
+ tokensCount: { value: 0 },
1210
+ charactersCount: { value: 0 },
1211
+ wordsCount: { value: 0 },
1212
+ sentencesCount: { value: 0 },
1213
+ linesCount: { value: 0 },
1214
+ paragraphsCount: { value: 0 },
1215
+ pagesCount: { value: 0 },
1216
+ },
1217
+ });
1130
1218
  /**
1131
1219
  * Function `addUsage` will add multiple usages into one
1132
1220
  *
1133
- * Note: If you provide 0 values, it returns void usage
1221
+ * Note: If you provide 0 values, it returns ZERO_USAGE
1134
1222
  */
1135
1223
  function addUsage() {
1136
1224
  var usageItems = [];
1137
1225
  for (var _i = 0; _i < arguments.length; _i++) {
1138
1226
  usageItems[_i] = arguments[_i];
1139
1227
  }
1140
- var initialStructure = {
1141
- price: { value: 0 },
1142
- input: {
1143
- tokensCount: { value: 0 },
1144
- charactersCount: { value: 0 },
1145
- wordsCount: { value: 0 },
1146
- sentencesCount: { value: 0 },
1147
- linesCount: { value: 0 },
1148
- paragraphsCount: { value: 0 },
1149
- pagesCount: { value: 0 },
1150
- },
1151
- output: {
1152
- tokensCount: { value: 0 },
1153
- charactersCount: { value: 0 },
1154
- wordsCount: { value: 0 },
1155
- sentencesCount: { value: 0 },
1156
- linesCount: { value: 0 },
1157
- paragraphsCount: { value: 0 },
1158
- pagesCount: { value: 0 },
1159
- },
1160
- };
1161
1228
  return usageItems.reduce(function (acc, item) {
1162
1229
  var e_1, _a, e_2, _b;
1163
1230
  var _c;
@@ -1215,7 +1282,7 @@ function addUsage() {
1215
1282
  finally { if (e_2) throw e_2.error; }
1216
1283
  }
1217
1284
  return acc;
1218
- }, initialStructure);
1285
+ }, deepClone(ZERO_USAGE));
1219
1286
  }
1220
1287
 
1221
1288
  /**
@@ -1292,7 +1359,7 @@ function forEachAsync(array, options, callbackfunction) {
1292
1359
  });
1293
1360
  }
1294
1361
 
1295
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-10",parameters:[{name:"content",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledge",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],blockType:"PROMPT_TEMPLATE",personaName:null,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}",resultingParameterName:"knowledge"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-10",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-10",parameters:[{name:"content",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],blockType:"PROMPT_TEMPLATE",personaName:null,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}",resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-10",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-10",parameters:[{name:"content",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],blockType:"PROMPT_TEMPLATE",expectations:{words:{min:1,max:8}},personaName:null,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}",resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-10",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-10",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:[{name:"make-model-requirements",title:"Make modelRequirements",dependentParameterNames:["availableModelNames","personaDescription"],blockType:"PROMPT_TEMPLATE",expectFormat:"JSON",personaName:null,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}",resultingParameterName:"modelRequirements"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-10",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"}];
1362
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-12",parameters:[{name:"content",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledge",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],blockType:"PROMPT_TEMPLATE",personaName:null,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}",resultingParameterName:"knowledge"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-12",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-12",parameters:[{name:"content",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],blockType:"PROMPT_TEMPLATE",personaName:null,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}",resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-12",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-12",parameters:[{name:"content",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],blockType:"PROMPT_TEMPLATE",expectations:{words:{min:1,max:8}},personaName:null,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}",resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-12",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-12",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:[{name:"make-model-requirements",title:"Make modelRequirements",dependentParameterNames:["availableModelNames","personaDescription"],blockType:"PROMPT_TEMPLATE",expectFormat:"JSON",personaName:null,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}",resultingParameterName:"modelRequirements"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-12",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"}];
1296
1363
 
1297
1364
  var defaultDiacriticsRemovalMap = [
1298
1365
  {
@@ -1966,7 +2033,7 @@ function arrayableToArray(input) {
1966
2033
  /**
1967
2034
  * The version of the Promptbook library
1968
2035
  */
1969
- var PROMPTBOOK_VERSION = '0.61.0-10';
2036
+ var PROMPTBOOK_VERSION = '0.61.0-12';
1970
2037
  // TODO: !!!! List here all the versions and annotate + put into script
1971
2038
 
1972
2039
  /**
@@ -2100,6 +2167,20 @@ function isPassingExpectations(expectations, value) {
2100
2167
  * TODO: [💝] Unite object for expecting amount and format
2101
2168
  */
2102
2169
 
2170
+ /**
2171
+ * This error type indicates that some limit was reached
2172
+ */
2173
+ var LimitReachedError = /** @class */ (function (_super) {
2174
+ __extends(LimitReachedError, _super);
2175
+ function LimitReachedError(message) {
2176
+ var _this = _super.call(this, message) || this;
2177
+ _this.name = 'LimitReachedError';
2178
+ Object.setPrototypeOf(_this, LimitReachedError.prototype);
2179
+ return _this;
2180
+ }
2181
+ return LimitReachedError;
2182
+ }(Error));
2183
+
2103
2184
  /**
2104
2185
  * Replaces parameters in template with values from parameters object
2105
2186
  *
@@ -2116,7 +2197,7 @@ function replaceParameters(template, parameters) {
2116
2197
  var loopLimit = LOOP_LIMIT;
2117
2198
  var _loop_1 = function () {
2118
2199
  if (loopLimit-- < 0) {
2119
- throw new UnexpectedError('Loop limit reached during parameters replacement in `replaceParameters`');
2200
+ throw new LimitReachedError('Loop limit reached during parameters replacement in `replaceParameters`');
2120
2201
  }
2121
2202
  var precol = match.groups.precol;
2122
2203
  var parameterName = match.groups.parameterName;
@@ -2604,6 +2685,7 @@ function createPipelineExecutor(options) {
2604
2685
  switch (_e.label) {
2605
2686
  case 0:
2606
2687
  if (loopLimit-- < 0) {
2688
+ // Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
2607
2689
  throw new UnexpectedError('Loop limit reached during resolving parameters pipeline execution');
2608
2690
  }
2609
2691
  currentTemplate = unresovedTemplates.find(function (template) {
@@ -2650,7 +2732,7 @@ function createPipelineExecutor(options) {
2650
2732
  }
2651
2733
  usage_1 = addUsage.apply(void 0, __spreadArray([], __read(executionReport.promptExecutions.map(function (_a) {
2652
2734
  var result = _a.result;
2653
- return (result === null || result === void 0 ? void 0 : result.usage) || addUsage();
2735
+ return (result === null || result === void 0 ? void 0 : result.usage) || ZERO_USAGE;
2654
2736
  })), false));
2655
2737
  return [2 /*return*/, {
2656
2738
  isSuccessful: false,
@@ -2679,7 +2761,7 @@ function createPipelineExecutor(options) {
2679
2761
  }
2680
2762
  usage = addUsage.apply(void 0, __spreadArray([], __read(executionReport.promptExecutions.map(function (_a) {
2681
2763
  var result = _a.result;
2682
- return (result === null || result === void 0 ? void 0 : result.usage) || addUsage();
2764
+ return (result === null || result === void 0 ? void 0 : result.usage) || ZERO_USAGE;
2683
2765
  })), false));
2684
2766
  return [2 /*return*/, {
2685
2767
  isSuccessful: true,
@@ -2711,6 +2793,7 @@ function createPipelineExecutor(options) {
2711
2793
  *
2712
2794
  * @param value any values
2713
2795
  * @returns void
2796
+ * @private within the repository
2714
2797
  */
2715
2798
  function TODO_USE() {
2716
2799
  var value = [];
@@ -2846,6 +2929,7 @@ function prepareKnowledgeFromMarkdown(content /* <- TODO: [🖖] (?maybe not) Al
2846
2929
  });
2847
2930
  }
2848
2931
  /**
2932
+ * TODO: [🔼] !!! Export via `@promptbook/markdown`
2849
2933
  * TODO: [🪂] Do it in parallel 11:11
2850
2934
  * Note: No need to aggregate usage here, it is done by intercepting the llmTools
2851
2935
  */
@@ -2854,7 +2938,6 @@ function prepareKnowledgeFromMarkdown(content /* <- TODO: [🖖] (?maybe not) Al
2854
2938
  * Prepares the knowle
2855
2939
  *
2856
2940
  * @see https://github.com/webgptorg/promptbook/discussions/41
2857
- * @private within the package
2858
2941
  */
2859
2942
  function prepareKnowledgePieces(knowledgeSources, options) {
2860
2943
  return __awaiter(this, void 0, void 0, function () {
@@ -2869,7 +2952,7 @@ function prepareKnowledgePieces(knowledgeSources, options) {
2869
2952
  var partialPieces, pieces;
2870
2953
  return __generator(this, function (_a) {
2871
2954
  switch (_a.label) {
2872
- case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.source, // <- TODO: !!!!! Unhardcode markdown, detect which type it is
2955
+ case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.source, // <- TODO: [🐝] !!!!! Unhardcode markdown, detect which type it is
2873
2956
  options)];
2874
2957
  case 1:
2875
2958
  partialPieces = _a.sent();
@@ -2907,6 +2990,7 @@ TODO: [🧊] This is how it can look in future
2907
2990
  > ):
2908
2991
  */
2909
2992
  /**
2993
+ * TODO: [🔼] !!! Export via `@promptbook/core`
2910
2994
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
2911
2995
  * Put `knowledgePieces` into `PrepareKnowledgeOptions`
2912
2996
  * TODO: [🪂] More than max things can run in parallel by acident [1,[2a,2b,_],[3a,3b,_]]
@@ -2919,7 +3003,6 @@ TODO: [🧊] This is how it can look in future
2919
3003
  * Prepares the persona for the pipeline
2920
3004
  *
2921
3005
  * @see https://github.com/webgptorg/promptbook/discussions/22
2922
- * @private within the package
2923
3006
  */
2924
3007
  function preparePersona(personaDescription, options) {
2925
3008
  return __awaiter(this, void 0, void 0, function () {
@@ -2963,9 +3046,6 @@ function preparePersona(personaDescription, options) {
2963
3046
  console.info("PERSONA ".concat(personaDescription), modelRequirements);
2964
3047
  }
2965
3048
  modelName = modelRequirements.modelName, systemMessage = modelRequirements.systemMessage, temperature = modelRequirements.temperature;
2966
- // TODO: !!! Check validity of `modelName`
2967
- // TODO: !!! Check validity of `systemMessage`
2968
- // TODO: !!! Check validity of `temperature`
2969
3049
  return [2 /*return*/, {
2970
3050
  modelVariant: 'CHAT',
2971
3051
  modelName: modelName,
@@ -2976,6 +3056,12 @@ function preparePersona(personaDescription, options) {
2976
3056
  });
2977
3057
  });
2978
3058
  }
3059
+ /**
3060
+ * TODO: [🔼] !!! Export via `@promptbook/core`
3061
+ * TODO: [🏢] !! Check validity of `modelName` in pipeline
3062
+ * TODO: [🏢] !! Check validity of `systemMessage` in pipeline
3063
+ * TODO: [🏢] !! Check validity of `temperature` in pipeline
3064
+ */
2979
3065
 
2980
3066
  /**
2981
3067
  * Prepare pipeline from string (markdown) format to JSON format
@@ -3001,7 +3087,7 @@ function preparePipeline(pipeline, options) {
3001
3087
  id: 1,
3002
3088
  // TODO: [🍥]> date: $currentDate(),
3003
3089
  promptbookVersion: PROMPTBOOK_VERSION,
3004
- modelUsage: addUsage(),
3090
+ modelUsage: ZERO_USAGE,
3005
3091
  };
3006
3092
  preparations = [
3007
3093
  // ...preparations
@@ -3036,10 +3122,11 @@ function preparePipeline(pipeline, options) {
3036
3122
  });
3037
3123
  }
3038
3124
  /**
3125
+ * TODO: [🔼] !!! Export via `@promptbook/core`
3039
3126
  * TODO: Write tests for `preparePipeline`
3040
3127
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
3041
3128
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
3042
- * TODO: !!!!! Use here countTotalUsage
3129
+ * TODO: [🎐] !!!! Use here countTotalUsage
3043
3130
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
3044
3131
  */
3045
3132
 
@@ -3354,7 +3441,7 @@ var blockCommandParser = {
3354
3441
  'Knowledge BLOCK',
3355
3442
  // 'Knowledge', // <- Note: [⛱] For execution blocks which are also separate commands shortcut does not work
3356
3443
  //---
3357
- /* TODO: !!!! Not implemented block types will be in examples in future -> */
3444
+ /* Note: Not implemented block types will be in examples in future -> */
3358
3445
  'Instrument BLOCK',
3359
3446
  // 'Instrument', // <- Note: [⛱]
3360
3447
  'Action BLOCK',
@@ -3372,10 +3459,10 @@ var blockCommandParser = {
3372
3459
  if (blockTypes.length !== 1) {
3373
3460
  throw new ParsingError(spaceTrim(function (block) { return "\n Unknown block type in BLOCK command\n\n Supported block types are:\n ".concat(block(BlockTypes.join(', ')), "\n "); }));
3374
3461
  }
3375
- // TODO: !!!! Not supported yet
3462
+ var blockType = blockTypes[0];
3376
3463
  return {
3377
3464
  type: 'BLOCK',
3378
- blockType: blockTypes[0],
3465
+ blockType: blockType,
3379
3466
  };
3380
3467
  },
3381
3468
  };
@@ -3620,7 +3707,7 @@ var jokerCommandParser = {
3620
3707
 
3621
3708
  var MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
3622
3709
  /**
3623
- * TODO: [🈁] `seed` should maybe be somewhere else (not in `ModelRequirements`) (simmilar that `user` identification is not here)
3710
+ * TODO: [🧠][🈁] `seed` should maybe be somewhere else (not in `ModelRequirements`) (simmilar that `user` identification is not here)
3624
3711
  * TODO: [🧠][💱] Add more model options: `stop_token`, `logit_bias`, `logprobs` (`top_logprobs`), `top_k`, `top_p`, `presence_penalty`, `frequency_penalty`, `bestOf`, `logitBias`, `logitBiasType`,...
3625
3712
  * [💱] Probbably keep using just `temperature` in Promptbook (not `top_k` and `top_p`)
3626
3713
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
@@ -4080,6 +4167,7 @@ var boilerplateCommandParser = {
4080
4167
  };
4081
4168
  /**
4082
4169
  * TODO: [💐] Implement BOILERPLATE command into `pipelineStringToJsonSync` function
4170
+ * Note: [⚪] This should never be in any released package
4083
4171
  */
4084
4172
 
4085
4173
  /**
@@ -4098,7 +4186,7 @@ var COMMANDS = [
4098
4186
  actionCommandParser,
4099
4187
  instrumentCommandParser,
4100
4188
  personaCommandParser,
4101
- boilerplateCommandParser, // <- TODO: !!!! Only in development, remove in production
4189
+ boilerplateCommandParser, // <- TODO: !! Only in development, remove in production
4102
4190
  ];
4103
4191
 
4104
4192
  /**
@@ -4184,7 +4272,7 @@ function parseCommand(raw, usagePlace) {
4184
4272
  }));
4185
4273
  }
4186
4274
  /**
4187
- * !!!
4275
+ * @@@
4188
4276
  */
4189
4277
  function getSupportedCommandsMessage() {
4190
4278
  return COMMANDS.flatMap(function (_a) {
@@ -4195,7 +4283,7 @@ function getSupportedCommandsMessage() {
4195
4283
  }).join('\n');
4196
4284
  }
4197
4285
  /**
4198
- * !!!
4286
+ * @@@
4199
4287
  */
4200
4288
  function parseCommandVariant(input) {
4201
4289
  var e_1, _a;
@@ -4926,7 +5014,7 @@ function pipelineStringToJsonSync(pipelineString) {
4926
5014
  if (command.blockType === 'KNOWLEDGE') {
4927
5015
  knowledgeCommandParser.applyToPipelineJson(pipelineJson, {
4928
5016
  type: 'KNOWLEDGE',
4929
- source: content, // <- TODO: !!!! Working KNOWLEDGE which not referring to the source file/wweb, but its content itseld
5017
+ source: content, // <- TODO: [🐝] !!!! Work with KNOWLEDGE which not referring to the source file/wweb, but its content itself
4930
5018
  });
4931
5019
  return "continue-templates";
4932
5020
  }
@@ -5064,7 +5152,7 @@ function pipelineStringToJsonSync(pipelineString) {
5064
5152
  delete template.modelRequirements;
5065
5153
  }
5066
5154
  // TODO: [🍧] What actually about preparation and pushing the block into `promptTemplates`
5067
- pipelineJson.promptTemplates.push(template /* <- !!! */);
5155
+ pipelineJson.promptTemplates.push(template);
5068
5156
  };
5069
5157
  try {
5070
5158
  // =============================================================
@@ -5178,7 +5266,7 @@ function pipelineStringToJson(pipelineString, options) {
5178
5266
  /**
5179
5267
  * Add or modify an auto-generated section in a markdown file
5180
5268
  *
5181
- * @private within the package
5269
+ * @private within the repository
5182
5270
  */
5183
5271
  function addAutoGeneratedSection(content, options) {
5184
5272
  var sectionName = options.sectionName, sectionContent = options.sectionContent;
@@ -5465,6 +5553,9 @@ var SimplePromptInterfaceTools = /** @class */ (function () {
5465
5553
  };
5466
5554
  return SimplePromptInterfaceTools;
5467
5555
  }());
5556
+ /**
5557
+ * Note: [🔵] This code should never be published outside of `@promptbook/browser`
5558
+ */
5468
5559
 
5469
5560
  /**
5470
5561
  * Unprepare just strips the preparation data of the pipeline
@@ -5476,6 +5567,7 @@ function unpreparePipeline(pipeline) {
5476
5567
  return __assign(__assign({}, pipeline), { knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] });
5477
5568
  }
5478
5569
  /**
5570
+ * TODO: [🔼] !!! Export via `@promptbook/core`
5479
5571
  * TODO: Write tests for `preparePipeline`
5480
5572
  */
5481
5573
 
@@ -5490,7 +5582,7 @@ var ExecutionReportStringOptionsDefaults = {
5490
5582
  /**
5491
5583
  * Format either small or big number
5492
5584
  *
5493
- * @private within the package
5585
+ * @private within the repository
5494
5586
  */
5495
5587
  function formatNumber(value) {
5496
5588
  if (value === 0) {
@@ -5510,7 +5602,7 @@ function formatNumber(value) {
5510
5602
  /**
5511
5603
  * Create a markdown table from a 2D array of strings
5512
5604
  *
5513
- * @private within the package
5605
+ * @private within the repository
5514
5606
  */
5515
5607
  function createMarkdownTable(table) {
5516
5608
  var columnWidths = table.reduce(function (widths, row) {
@@ -5538,7 +5630,7 @@ function createMarkdownTable(table) {
5538
5630
  /**
5539
5631
  * Function createMarkdownChart will draw a chart in markdown from ⬛+🟦 tiles
5540
5632
  *
5541
- * @private within the package
5633
+ * @private within the repository
5542
5634
  */
5543
5635
  function createMarkdownChart(options) {
5544
5636
  var e_1, _a;
@@ -5583,10 +5675,14 @@ function escapeMarkdownBlock(value) {
5583
5675
  * Returns the same value that is passed as argument.
5584
5676
  * No side effects.
5585
5677
  *
5586
- * Note: It can be usefull for leveling indentation
5678
+ * Note: It can be usefull for:
5679
+ *
5680
+ * 1) Leveling indentation
5681
+ * 2) Putting always-true or always-false conditions without getting eslint errors
5587
5682
  *
5588
5683
  * @param value any values
5589
5684
  * @returns the same values
5685
+ * @private within the repository
5590
5686
  */
5591
5687
  function just(value) {
5592
5688
  if (value === undefined) {
@@ -5607,7 +5703,7 @@ var MOMENT_ARG_THRESHOLDS = {
5607
5703
  /**
5608
5704
  * Count the duration of working time
5609
5705
  *
5610
- * @private within the package
5706
+ * @private within the repository
5611
5707
  */
5612
5708
  function countWorkingDuration(items) {
5613
5709
  var e_1, _a;