@promptbook/node 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 +142 -50
  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 +2 -2
  77. package/umd/index.umd.js +142 -50
  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
@@ -124,6 +124,39 @@ function __spreadArray(to, from, pack) {
124
124
  return to.concat(ar || Array.prototype.slice.call(from));
125
125
  }
126
126
 
127
+ /**
128
+ * @@@
129
+ *
130
+ * @returns The same object as the input, but deeply frozen
131
+ *
132
+ * Note: This function mutates the object
133
+ */
134
+ function deepFreeze(objectValue) {
135
+ var e_1, _a;
136
+ var propertyNames = Object.getOwnPropertyNames(objectValue);
137
+ try {
138
+ for (var propertyNames_1 = __values(propertyNames), propertyNames_1_1 = propertyNames_1.next(); !propertyNames_1_1.done; propertyNames_1_1 = propertyNames_1.next()) {
139
+ var propertyName = propertyNames_1_1.value;
140
+ var value = objectValue[propertyName];
141
+ if (value && typeof value === 'object') {
142
+ deepFreeze(value);
143
+ }
144
+ }
145
+ }
146
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
147
+ finally {
148
+ try {
149
+ if (propertyNames_1_1 && !propertyNames_1_1.done && (_a = propertyNames_1.return)) _a.call(propertyNames_1);
150
+ }
151
+ finally { if (e_1) throw e_1.error; }
152
+ }
153
+ return Object.freeze(objectValue);
154
+ }
155
+ /**
156
+ * TODO: [🔼] Export from `@promptbook/utils`
157
+ * TODO: [🧠] Is there a way how to meaningfully test this utility
158
+ */
159
+
127
160
  /**
128
161
  * The maximum number of iterations for a loops
129
162
  */
@@ -139,43 +172,74 @@ var PIPELINE_COLLECTION_BASE_FILENAME = "index";
139
172
  /**
140
173
  * The names of the parameters that are reserved for special purposes
141
174
  */
142
- var RESERVED_PARAMETER_NAMES = [
175
+ var RESERVED_PARAMETER_NAMES = deepFreeze([
143
176
  'context',
144
177
  // <- TODO: Add more like 'date', 'modelName',...
145
178
  // <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
146
- ];
179
+ ]);
180
+ /*
181
+ TODO: !!! Just testing false-negative detection of [🟡][🟢][🔵][⚪] leak
182
+ */
183
+ // [🟡][🟢][🔵][⚪]
147
184
 
185
+ /**
186
+ * @@@
187
+ */
188
+ function deepClone(objectValue) {
189
+ return JSON.parse(JSON.stringify(objectValue));
190
+ /*
191
+ TODO: [🧠] Is there a better implementation?
192
+ > const propertyNames = Object.getOwnPropertyNames(objectValue);
193
+ > for (const propertyName of propertyNames) {
194
+ > const value = (objectValue as really_any)[propertyName];
195
+ > if (value && typeof value === 'object') {
196
+ > deepClone(value);
197
+ > }
198
+ > }
199
+ > return Object.assign({}, objectValue);
200
+ */
201
+ }
202
+ /**
203
+ * TODO: [🔼] Export from `@promptbook/utils`
204
+ * TODO: [🧠] Is there a way how to meaningfully test this utility
205
+ */
206
+
207
+ /**
208
+ * @@@
209
+ *
210
+ * TODO: [🔼] Export with addUsage
211
+ */
212
+ var ZERO_USAGE = deepFreeze({
213
+ price: { value: 0 },
214
+ input: {
215
+ tokensCount: { value: 0 },
216
+ charactersCount: { value: 0 },
217
+ wordsCount: { value: 0 },
218
+ sentencesCount: { value: 0 },
219
+ linesCount: { value: 0 },
220
+ paragraphsCount: { value: 0 },
221
+ pagesCount: { value: 0 },
222
+ },
223
+ output: {
224
+ tokensCount: { value: 0 },
225
+ charactersCount: { value: 0 },
226
+ wordsCount: { value: 0 },
227
+ sentencesCount: { value: 0 },
228
+ linesCount: { value: 0 },
229
+ paragraphsCount: { value: 0 },
230
+ pagesCount: { value: 0 },
231
+ },
232
+ });
148
233
  /**
149
234
  * Function `addUsage` will add multiple usages into one
150
235
  *
151
- * Note: If you provide 0 values, it returns void usage
236
+ * Note: If you provide 0 values, it returns ZERO_USAGE
152
237
  */
153
238
  function addUsage() {
154
239
  var usageItems = [];
155
240
  for (var _i = 0; _i < arguments.length; _i++) {
156
241
  usageItems[_i] = arguments[_i];
157
242
  }
158
- var initialStructure = {
159
- price: { value: 0 },
160
- input: {
161
- tokensCount: { value: 0 },
162
- charactersCount: { value: 0 },
163
- wordsCount: { value: 0 },
164
- sentencesCount: { value: 0 },
165
- linesCount: { value: 0 },
166
- paragraphsCount: { value: 0 },
167
- pagesCount: { value: 0 },
168
- },
169
- output: {
170
- tokensCount: { value: 0 },
171
- charactersCount: { value: 0 },
172
- wordsCount: { value: 0 },
173
- sentencesCount: { value: 0 },
174
- linesCount: { value: 0 },
175
- paragraphsCount: { value: 0 },
176
- pagesCount: { value: 0 },
177
- },
178
- };
179
243
  return usageItems.reduce(function (acc, item) {
180
244
  var e_1, _a, e_2, _b;
181
245
  var _c;
@@ -233,7 +297,7 @@ function addUsage() {
233
297
  finally { if (e_2) throw e_2.error; }
234
298
  }
235
299
  return acc;
236
- }, initialStructure);
300
+ }, deepClone(ZERO_USAGE));
237
301
  }
238
302
 
239
303
  /**
@@ -310,7 +374,7 @@ function forEachAsync(array, options, callbackfunction) {
310
374
  });
311
375
  }
312
376
 
313
- 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"}];
377
+ 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"}];
314
378
 
315
379
  /**
316
380
  * Prettify the html code
@@ -550,7 +614,7 @@ function promptTemplateParameterJsonToString(promptTemplateParameterJson) {
550
614
  return parameterString;
551
615
  }
552
616
  /**
553
- * TODO: !!!!! Implement new features and commands into `promptTemplateParameterJsonToString`
617
+ * TODO: !!!! Implement new features and commands into `promptTemplateParameterJsonToString`
554
618
  * TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
555
619
  * TODO: Escape all
556
620
  */
@@ -890,6 +954,7 @@ function validatePipeline(pipeline) {
890
954
  var loopLimit = LOOP_LIMIT;
891
955
  var _loop_2 = function () {
892
956
  if (loopLimit-- < 0) {
957
+ // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
893
958
  throw new UnexpectedError('Loop limit reached during detection of circular dependencies in `validatePipeline`');
894
959
  }
895
960
  var currentlyResovedTemplates = unresovedTemplates.filter(function (template) {
@@ -928,7 +993,9 @@ function validatePipeline(pipeline) {
928
993
  * > ex port function validatePipeline(promptbook: unknown): asserts promptbook is PipelineJson {
929
994
  */
930
995
  /**
931
- * TODO: [🧠] !!!!! Validate new things
996
+ * TODO: [🧠][🐣] !!!! Validate that all samples match expectations
997
+ * TODO: [🧠][🐣] !!!! Validate that knowledge is valid (non-void)
998
+ * TODO: [🧠] !!! Validationg not only logic itself but imports around - files and websites and rerefenced pipelines exists
932
999
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
933
1000
  */
934
1001
 
@@ -971,7 +1038,7 @@ var SimplePipelineCollection = /** @class */ (function () {
971
1038
  /**
972
1039
  * Constructs a pipeline collection from promptbooks
973
1040
  *
974
- * @param promptbooks !!!
1041
+ * @param promptbooks @@@
975
1042
  *
976
1043
  * @private Use instead `createCollectionFromJson`
977
1044
  * Note: During the construction logic of all promptbooks are validated
@@ -1730,7 +1797,7 @@ function arrayableToArray(input) {
1730
1797
  /**
1731
1798
  * The version of the Promptbook library
1732
1799
  */
1733
- var PROMPTBOOK_VERSION = '0.61.0-10';
1800
+ var PROMPTBOOK_VERSION = '0.61.0-12';
1734
1801
  // TODO: !!!! List here all the versions and annotate + put into script
1735
1802
 
1736
1803
  /**
@@ -1843,6 +1910,20 @@ function checkExpectations(expectations, value) {
1843
1910
  * TODO: [💝] Unite object for expecting amount and format
1844
1911
  */
1845
1912
 
1913
+ /**
1914
+ * This error type indicates that some limit was reached
1915
+ */
1916
+ var LimitReachedError = /** @class */ (function (_super) {
1917
+ __extends(LimitReachedError, _super);
1918
+ function LimitReachedError(message) {
1919
+ var _this = _super.call(this, message) || this;
1920
+ _this.name = 'LimitReachedError';
1921
+ Object.setPrototypeOf(_this, LimitReachedError.prototype);
1922
+ return _this;
1923
+ }
1924
+ return LimitReachedError;
1925
+ }(Error));
1926
+
1846
1927
  /**
1847
1928
  * Replaces parameters in template with values from parameters object
1848
1929
  *
@@ -1859,7 +1940,7 @@ function replaceParameters(template, parameters) {
1859
1940
  var loopLimit = LOOP_LIMIT;
1860
1941
  var _loop_1 = function () {
1861
1942
  if (loopLimit-- < 0) {
1862
- throw new UnexpectedError('Loop limit reached during parameters replacement in `replaceParameters`');
1943
+ throw new LimitReachedError('Loop limit reached during parameters replacement in `replaceParameters`');
1863
1944
  }
1864
1945
  var precol = match.groups.precol;
1865
1946
  var parameterName = match.groups.parameterName;
@@ -2347,6 +2428,7 @@ function createPipelineExecutor(options) {
2347
2428
  switch (_e.label) {
2348
2429
  case 0:
2349
2430
  if (loopLimit-- < 0) {
2431
+ // Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
2350
2432
  throw new UnexpectedError('Loop limit reached during resolving parameters pipeline execution');
2351
2433
  }
2352
2434
  currentTemplate = unresovedTemplates.find(function (template) {
@@ -2393,7 +2475,7 @@ function createPipelineExecutor(options) {
2393
2475
  }
2394
2476
  usage_1 = addUsage.apply(void 0, __spreadArray([], __read(executionReport.promptExecutions.map(function (_a) {
2395
2477
  var result = _a.result;
2396
- return (result === null || result === void 0 ? void 0 : result.usage) || addUsage();
2478
+ return (result === null || result === void 0 ? void 0 : result.usage) || ZERO_USAGE;
2397
2479
  })), false));
2398
2480
  return [2 /*return*/, {
2399
2481
  isSuccessful: false,
@@ -2422,7 +2504,7 @@ function createPipelineExecutor(options) {
2422
2504
  }
2423
2505
  usage = addUsage.apply(void 0, __spreadArray([], __read(executionReport.promptExecutions.map(function (_a) {
2424
2506
  var result = _a.result;
2425
- return (result === null || result === void 0 ? void 0 : result.usage) || addUsage();
2507
+ return (result === null || result === void 0 ? void 0 : result.usage) || ZERO_USAGE;
2426
2508
  })), false));
2427
2509
  return [2 /*return*/, {
2428
2510
  isSuccessful: true,
@@ -2454,6 +2536,7 @@ function createPipelineExecutor(options) {
2454
2536
  *
2455
2537
  * @param value any values
2456
2538
  * @returns void
2539
+ * @private within the repository
2457
2540
  */
2458
2541
  function TODO_USE() {
2459
2542
  var value = [];
@@ -2589,6 +2672,7 @@ function prepareKnowledgeFromMarkdown(content /* <- TODO: [🖖] (?maybe not) Al
2589
2672
  });
2590
2673
  }
2591
2674
  /**
2675
+ * TODO: [🔼] !!! Export via `@promptbook/markdown`
2592
2676
  * TODO: [🪂] Do it in parallel 11:11
2593
2677
  * Note: No need to aggregate usage here, it is done by intercepting the llmTools
2594
2678
  */
@@ -2597,7 +2681,6 @@ function prepareKnowledgeFromMarkdown(content /* <- TODO: [🖖] (?maybe not) Al
2597
2681
  * Prepares the knowle
2598
2682
  *
2599
2683
  * @see https://github.com/webgptorg/promptbook/discussions/41
2600
- * @private within the package
2601
2684
  */
2602
2685
  function prepareKnowledgePieces(knowledgeSources, options) {
2603
2686
  return __awaiter(this, void 0, void 0, function () {
@@ -2612,7 +2695,7 @@ function prepareKnowledgePieces(knowledgeSources, options) {
2612
2695
  var partialPieces, pieces;
2613
2696
  return __generator(this, function (_a) {
2614
2697
  switch (_a.label) {
2615
- case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.source, // <- TODO: !!!!! Unhardcode markdown, detect which type it is
2698
+ case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.source, // <- TODO: [🐝] !!!!! Unhardcode markdown, detect which type it is
2616
2699
  options)];
2617
2700
  case 1:
2618
2701
  partialPieces = _a.sent();
@@ -2650,6 +2733,7 @@ TODO: [🧊] This is how it can look in future
2650
2733
  > ):
2651
2734
  */
2652
2735
  /**
2736
+ * TODO: [🔼] !!! Export via `@promptbook/core`
2653
2737
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
2654
2738
  * Put `knowledgePieces` into `PrepareKnowledgeOptions`
2655
2739
  * TODO: [🪂] More than max things can run in parallel by acident [1,[2a,2b,_],[3a,3b,_]]
@@ -2662,7 +2746,6 @@ TODO: [🧊] This is how it can look in future
2662
2746
  * Prepares the persona for the pipeline
2663
2747
  *
2664
2748
  * @see https://github.com/webgptorg/promptbook/discussions/22
2665
- * @private within the package
2666
2749
  */
2667
2750
  function preparePersona(personaDescription, options) {
2668
2751
  return __awaiter(this, void 0, void 0, function () {
@@ -2706,9 +2789,6 @@ function preparePersona(personaDescription, options) {
2706
2789
  console.info("PERSONA ".concat(personaDescription), modelRequirements);
2707
2790
  }
2708
2791
  modelName = modelRequirements.modelName, systemMessage = modelRequirements.systemMessage, temperature = modelRequirements.temperature;
2709
- // TODO: !!! Check validity of `modelName`
2710
- // TODO: !!! Check validity of `systemMessage`
2711
- // TODO: !!! Check validity of `temperature`
2712
2792
  return [2 /*return*/, {
2713
2793
  modelVariant: 'CHAT',
2714
2794
  modelName: modelName,
@@ -2719,6 +2799,12 @@ function preparePersona(personaDescription, options) {
2719
2799
  });
2720
2800
  });
2721
2801
  }
2802
+ /**
2803
+ * TODO: [🔼] !!! Export via `@promptbook/core`
2804
+ * TODO: [🏢] !! Check validity of `modelName` in pipeline
2805
+ * TODO: [🏢] !! Check validity of `systemMessage` in pipeline
2806
+ * TODO: [🏢] !! Check validity of `temperature` in pipeline
2807
+ */
2722
2808
 
2723
2809
  /**
2724
2810
  * Prepare pipeline from string (markdown) format to JSON format
@@ -2744,7 +2830,7 @@ function preparePipeline(pipeline, options) {
2744
2830
  id: 1,
2745
2831
  // TODO: [🍥]> date: $currentDate(),
2746
2832
  promptbookVersion: PROMPTBOOK_VERSION,
2747
- modelUsage: addUsage(),
2833
+ modelUsage: ZERO_USAGE,
2748
2834
  };
2749
2835
  preparations = [
2750
2836
  // ...preparations
@@ -2779,10 +2865,11 @@ function preparePipeline(pipeline, options) {
2779
2865
  });
2780
2866
  }
2781
2867
  /**
2868
+ * TODO: [🔼] !!! Export via `@promptbook/core`
2782
2869
  * TODO: Write tests for `preparePipeline`
2783
2870
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
2784
2871
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
2785
- * TODO: !!!!! Use here countTotalUsage
2872
+ * TODO: [🎐] !!!! Use here countTotalUsage
2786
2873
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
2787
2874
  */
2788
2875
 
@@ -3114,7 +3201,7 @@ var blockCommandParser = {
3114
3201
  'Knowledge BLOCK',
3115
3202
  // 'Knowledge', // <- Note: [⛱] For execution blocks which are also separate commands shortcut does not work
3116
3203
  //---
3117
- /* TODO: !!!! Not implemented block types will be in examples in future -> */
3204
+ /* Note: Not implemented block types will be in examples in future -> */
3118
3205
  'Instrument BLOCK',
3119
3206
  // 'Instrument', // <- Note: [⛱]
3120
3207
  'Action BLOCK',
@@ -3132,10 +3219,10 @@ var blockCommandParser = {
3132
3219
  if (blockTypes.length !== 1) {
3133
3220
  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 "); }));
3134
3221
  }
3135
- // TODO: !!!! Not supported yet
3222
+ var blockType = blockTypes[0];
3136
3223
  return {
3137
3224
  type: 'BLOCK',
3138
- blockType: blockTypes[0],
3225
+ blockType: blockType,
3139
3226
  };
3140
3227
  },
3141
3228
  };
@@ -3380,7 +3467,7 @@ var jokerCommandParser = {
3380
3467
 
3381
3468
  var MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
3382
3469
  /**
3383
- * TODO: [🈁] `seed` should maybe be somewhere else (not in `ModelRequirements`) (simmilar that `user` identification is not here)
3470
+ * TODO: [🧠][🈁] `seed` should maybe be somewhere else (not in `ModelRequirements`) (simmilar that `user` identification is not here)
3384
3471
  * TODO: [🧠][💱] Add more model options: `stop_token`, `logit_bias`, `logprobs` (`top_logprobs`), `top_k`, `top_p`, `presence_penalty`, `frequency_penalty`, `bestOf`, `logitBias`, `logitBiasType`,...
3385
3472
  * [💱] Probbably keep using just `temperature` in Promptbook (not `top_k` and `top_p`)
3386
3473
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
@@ -3840,6 +3927,7 @@ var boilerplateCommandParser = {
3840
3927
  };
3841
3928
  /**
3842
3929
  * TODO: [💐] Implement BOILERPLATE command into `pipelineStringToJsonSync` function
3930
+ * Note: [⚪] This should never be in any released package
3843
3931
  */
3844
3932
 
3845
3933
  /**
@@ -3858,7 +3946,7 @@ var COMMANDS = [
3858
3946
  actionCommandParser,
3859
3947
  instrumentCommandParser,
3860
3948
  personaCommandParser,
3861
- boilerplateCommandParser, // <- TODO: !!!! Only in development, remove in production
3949
+ boilerplateCommandParser, // <- TODO: !! Only in development, remove in production
3862
3950
  ];
3863
3951
 
3864
3952
  /**
@@ -3944,7 +4032,7 @@ function parseCommand(raw, usagePlace) {
3944
4032
  }));
3945
4033
  }
3946
4034
  /**
3947
- * !!!
4035
+ * @@@
3948
4036
  */
3949
4037
  function getSupportedCommandsMessage() {
3950
4038
  return COMMANDS.flatMap(function (_a) {
@@ -3955,7 +4043,7 @@ function getSupportedCommandsMessage() {
3955
4043
  }).join('\n');
3956
4044
  }
3957
4045
  /**
3958
- * !!!
4046
+ * @@@
3959
4047
  */
3960
4048
  function parseCommandVariant(input) {
3961
4049
  var e_1, _a;
@@ -4686,7 +4774,7 @@ function pipelineStringToJsonSync(pipelineString) {
4686
4774
  if (command.blockType === 'KNOWLEDGE') {
4687
4775
  knowledgeCommandParser.applyToPipelineJson(pipelineJson, {
4688
4776
  type: 'KNOWLEDGE',
4689
- source: content, // <- TODO: !!!! Working KNOWLEDGE which not referring to the source file/wweb, but its content itseld
4777
+ source: content, // <- TODO: [🐝] !!!! Work with KNOWLEDGE which not referring to the source file/wweb, but its content itself
4690
4778
  });
4691
4779
  return "continue-templates";
4692
4780
  }
@@ -4824,7 +4912,7 @@ function pipelineStringToJsonSync(pipelineString) {
4824
4912
  delete template.modelRequirements;
4825
4913
  }
4826
4914
  // TODO: [🍧] What actually about preparation and pushing the block into `promptTemplates`
4827
- pipelineJson.promptTemplates.push(template /* <- !!! */);
4915
+ pipelineJson.promptTemplates.push(template);
4828
4916
  };
4829
4917
  try {
4830
4918
  // =============================================================
@@ -4961,6 +5049,9 @@ var isRunningInNode = new Function("\n try {\n return this === global;
4961
5049
  * Detects if the code is running in a web worker
4962
5050
  */
4963
5051
  new Function("\n try {\n if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {\n return true;\n } else {\n return false;\n }\n } catch (e) {\n return false;\n }\n");
5052
+ /**
5053
+ * TODO: [🔼] !!! Export via `@promptbook/utils`
5054
+ */
4964
5055
 
4965
5056
  /**
4966
5057
  * Constructs Promptbook from async sources
@@ -5271,6 +5362,7 @@ function listAllFiles(path, isRecursive) {
5271
5362
  }
5272
5363
  /**
5273
5364
  * TODO: !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
5365
+ * Note: [🟢] This code should never be published outside of `@promptbook/node`
5274
5366
  */
5275
5367
 
5276
5368
  export { PROMPTBOOK_VERSION, createCollectionFromDirectory };