@promptbook/utils 0.61.0-9 → 0.61.0

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 (366) hide show
  1. package/README.md +3 -3
  2. package/esm/index.es.js +349 -189
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/promptbook-collection/index.d.ts +200 -30
  5. package/esm/typings/src/_packages/core.index.d.ts +7 -2
  6. package/esm/typings/src/_packages/execute-javascript.index.d.ts +1 -1
  7. package/esm/typings/src/_packages/node.index.d.ts +2 -1
  8. package/esm/typings/src/_packages/types.index.d.ts +12 -8
  9. package/esm/typings/src/_packages/utils.index.d.ts +11 -8
  10. package/esm/typings/src/cli/cli-commands/hello.d.ts +3 -0
  11. package/esm/typings/src/cli/cli-commands/make.d.ts +3 -0
  12. package/esm/typings/src/cli/cli-commands/prettify.d.ts +3 -0
  13. package/esm/typings/src/cli/promptbookCli.d.ts +1 -0
  14. package/esm/typings/src/collection/PipelineCollection.d.ts +1 -1
  15. package/esm/typings/src/collection/SimplePipelineCollection.d.ts +10 -10
  16. package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +7 -7
  17. package/esm/typings/src/collection/constructors/createCollectionFromUrl.d.ts +2 -2
  18. package/esm/typings/src/commands/KNOWLEDGE/KnowledgeCommand.d.ts +2 -3
  19. package/esm/typings/src/commands/MODEL/ModelCommand.d.ts +2 -2
  20. package/esm/typings/src/commands/PERSONA/PersonaCommand.d.ts +4 -2
  21. package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -0
  22. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +42 -14
  23. package/esm/typings/src/config.d.ts +46 -1
  24. package/esm/typings/src/config.test.d.ts +4 -0
  25. package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
  26. package/esm/typings/src/conversion/pipelineStringToJson.d.ts +9 -5
  27. package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +6 -3
  28. package/esm/typings/src/conversion/prettify/PrettifyOptions.d.ts +2 -2
  29. package/{umd/typings/src/conversion/utils/extractParametersFromPromptTemplate.d.ts → esm/typings/src/conversion/utils/extractParameterNamesFromPromptTemplate.d.ts} +2 -2
  30. package/esm/typings/src/conversion/utils/renameParameter.d.ts +3 -3
  31. package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +14 -0
  32. package/esm/typings/src/conversion/validation/_importPipeline.d.ts +12 -3
  33. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +10 -1
  34. package/esm/typings/src/errors/EnvironmentMismatchError.d.ts +7 -0
  35. package/esm/typings/src/errors/LimitReachedError.d.ts +7 -0
  36. package/esm/typings/src/errors/VersionMismatchError.d.ts +8 -0
  37. package/esm/typings/src/execution/CommonExecutionToolsOptions.d.ts +1 -0
  38. package/esm/typings/src/execution/LlmExecutionTools.d.ts +10 -8
  39. package/esm/typings/src/execution/PipelineExecutor.d.ts +48 -26
  40. package/esm/typings/src/execution/PromptResult.d.ts +39 -54
  41. package/esm/typings/src/execution/PromptResultUsage.d.ts +29 -0
  42. package/esm/typings/src/execution/ScriptExecutionTools.d.ts +5 -4
  43. package/esm/typings/src/execution/UncertainNumber.d.ts +18 -0
  44. package/esm/typings/src/execution/UserInterfaceTools.d.ts +5 -5
  45. package/esm/typings/src/execution/createPipelineExecutor.d.ts +30 -3
  46. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +2 -2
  47. package/esm/typings/src/execution/utils/addUsage.d.ts +58 -2
  48. package/esm/typings/src/execution/utils/computeUsageCounts.d.ts +1 -1
  49. package/esm/typings/src/execution/utils/forEachAsync.d.ts +1 -1
  50. package/esm/typings/src/execution/utils/uncertainNumber.d.ts +1 -1
  51. package/esm/typings/src/execution/utils/usageToWorktime.d.ts +2 -2
  52. package/esm/typings/src/formats/_common/FormatDefinition.d.ts +1 -1
  53. package/esm/typings/src/formats/csv/ListFormatDefinition.d.ts +2 -1
  54. package/esm/typings/src/formats/json/JsonFormatDefinition.d.ts +2 -1
  55. package/esm/typings/src/formats/list/ListFormatDefinition.d.ts +2 -1
  56. package/esm/typings/src/formats/xml/XmlFormatDefinition.d.ts +1 -0
  57. package/esm/typings/src/knowledge/dialogs/callback/CallbackInterfaceToolsOptions.d.ts +1 -1
  58. package/esm/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +3 -0
  59. package/esm/typings/src/knowledge/prepare-knowledge/_common/Scraper.d.ts +27 -0
  60. package/esm/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +18 -0
  61. package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +9 -23
  62. package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.test.d.ts +3 -0
  63. package/esm/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +8 -14
  64. package/esm/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +30 -0
  65. package/esm/typings/src/llm-providers/_common/getLlmToolsForCli.d.ts +10 -0
  66. package/esm/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +11 -0
  67. package/esm/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +29 -0
  68. package/esm/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +10 -0
  69. package/esm/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +16 -0
  70. package/esm/typings/src/llm-providers/_common/utils/count-total-cost/LlmExecutionToolsWithTotalCost.d.ts +11 -0
  71. package/esm/typings/src/llm-providers/_common/utils/count-total-cost/countTotalCost.d.ts +14 -0
  72. package/esm/typings/src/llm-providers/_common/utils/count-total-cost/limitTotalCost.d.ts +32 -0
  73. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +4 -3
  74. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +1 -1
  75. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +3 -3
  76. package/esm/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +3 -0
  77. package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +5 -4
  78. package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +5 -5
  79. package/esm/typings/src/llm-providers/azure-openai/playground/playground.d.ts +3 -0
  80. package/esm/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +3 -0
  81. package/esm/typings/src/llm-providers/langtail/LangtailExecutionToolsOptions.d.ts +1 -1
  82. package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +5 -5
  83. package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +7 -7
  84. package/esm/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +12 -8
  85. package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +7 -6
  86. package/esm/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +1 -1
  87. package/esm/typings/src/llm-providers/openai/computeOpenaiUsage.d.ts +1 -1
  88. package/esm/typings/src/llm-providers/openai/computeUsage.d.ts +2 -2
  89. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +3 -2
  90. package/esm/typings/src/llm-providers/openai/playground/playground.d.ts +3 -0
  91. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +10 -8
  92. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionToolsOptions.d.ts +1 -1
  93. package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +2 -2
  94. package/esm/typings/src/personas/preparePersona.d.ts +15 -0
  95. package/esm/typings/src/prepare/PrepareOptions.d.ts +22 -0
  96. package/esm/typings/src/prepare/isPipelinePrepared.d.ts +14 -0
  97. package/esm/typings/src/prepare/preparePipeline.d.ts +17 -0
  98. package/esm/typings/src/prepare/prepareTemplates.d.ts +31 -0
  99. package/esm/typings/src/prepare/unpreparePipeline.d.ts +11 -0
  100. package/esm/typings/src/scripting/javascript/JavascriptExecutionToolsOptions.d.ts +1 -1
  101. package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +1 -1
  102. package/esm/typings/src/scripting/javascript/utils/unknownToString.d.ts +2 -1
  103. package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +25 -0
  104. package/esm/typings/src/storage/_common/PromptbookStorage.test-type.d.ts +5 -0
  105. package/esm/typings/src/storage/files-storage/FilesStorage.d.ts +30 -0
  106. package/esm/typings/src/storage/files-storage/FilesStorageOptions.d.ts +13 -0
  107. package/esm/typings/src/storage/files-storage/utils/nameToSubfolderPath.d.ts +7 -0
  108. package/esm/typings/src/storage/local-storage/getLocalStorage.d.ts +9 -0
  109. package/esm/typings/src/storage/local-storage/getSessionStorage.d.ts +9 -0
  110. package/esm/typings/src/storage/memory/MemoryStorage.d.ts +34 -0
  111. package/esm/typings/src/storage/utils/PrefixStorage.d.ts +26 -0
  112. package/esm/typings/src/storage/utils/makePromptbookStorageFromWebStorage.d.ts +11 -0
  113. package/esm/typings/src/types/ModelRequirements.d.ts +71 -11
  114. package/esm/typings/src/types/ModelVariant.d.ts +14 -0
  115. package/esm/typings/src/types/PipelineJson/Expectations.d.ts +6 -2
  116. package/esm/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +70 -0
  117. package/esm/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +27 -0
  118. package/esm/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +10 -1
  119. package/esm/typings/src/types/PipelineJson/PersonaJson.d.ts +41 -0
  120. package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +31 -5
  121. package/esm/typings/src/types/PipelineJson/PreparationJson.d.ts +22 -0
  122. package/esm/typings/src/types/PipelineJson/PromptDialogJson.d.ts +8 -2
  123. package/esm/typings/src/types/PipelineJson/PromptTemplateJson.d.ts +5 -1
  124. package/esm/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +23 -4
  125. package/esm/typings/src/types/PipelineJson/PromptTemplateParameterJson.d.ts +12 -2
  126. package/esm/typings/src/types/PipelineJson/ScriptJson.d.ts +7 -2
  127. package/esm/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +7 -2
  128. package/esm/typings/src/types/PipelineString.d.ts +1 -1
  129. package/esm/typings/src/types/Prompt.d.ts +54 -10
  130. package/esm/typings/src/types/execution-report/ExecutionReportJson.d.ts +4 -4
  131. package/esm/typings/src/types/execution-report/ExecutionReportStringOptions.d.ts +3 -3
  132. package/esm/typings/src/types/execution-report/countWorkingDuration.d.ts +1 -1
  133. package/esm/typings/src/types/typeAliases.d.ts +114 -15
  134. package/esm/typings/src/utils/FromtoItems.d.ts +3 -3
  135. package/esm/typings/src/utils/currentDate.d.ts +7 -0
  136. package/esm/typings/src/utils/deepClone.d.ts +9 -0
  137. package/esm/typings/src/utils/deepFreeze.d.ts +22 -0
  138. package/esm/typings/src/utils/emojis.d.ts +2 -2
  139. package/esm/typings/src/utils/{extractParameters.d.ts → extractParameterNames.d.ts} +2 -2
  140. package/esm/typings/src/utils/formatNumber.d.ts +1 -1
  141. package/esm/typings/src/utils/isRunningInWhatever.d.ts +3 -0
  142. package/esm/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +3 -3
  143. package/esm/typings/src/utils/markdown/createMarkdownChart.d.ts +7 -10
  144. package/esm/typings/src/utils/markdown/createMarkdownTable.d.ts +1 -1
  145. package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +9 -2
  146. package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +1 -1
  147. package/esm/typings/src/utils/markdown/parseMarkdownSection.d.ts +3 -3
  148. package/esm/typings/src/utils/normalization/parseKeywords.d.ts +2 -1
  149. package/esm/typings/src/utils/organization/TODO_USE.d.ts +12 -0
  150. package/esm/typings/src/utils/organization/TODO_any.d.ts +6 -0
  151. package/esm/typings/src/utils/organization/TODO_object.d.ts +6 -0
  152. package/esm/typings/src/utils/organization/TODO_unknown.d.ts +6 -0
  153. package/esm/typings/src/utils/organization/___.d.ts +6 -0
  154. package/{umd/typings/src/utils → esm/typings/src/utils/organization}/just.d.ts +5 -1
  155. package/esm/typings/src/utils/organization/keepUnused.d.ts +16 -0
  156. package/esm/typings/src/utils/organization/really_any.d.ts +6 -0
  157. package/esm/typings/src/utils/organization/really_unknown.d.ts +6 -0
  158. package/esm/typings/src/utils/random/randomSeed.d.ts +7 -0
  159. package/esm/typings/src/{execution/utils → utils}/replaceParameters.d.ts +2 -4
  160. package/esm/typings/src/utils/replaceParameters.test.d.ts +1 -0
  161. package/esm/typings/src/utils/sets/difference.d.ts +3 -0
  162. package/esm/typings/src/utils/validators/email/isValidEmail.d.ts +2 -1
  163. package/esm/typings/src/utils/validators/filePath/isValidFilePath.d.ts +2 -1
  164. package/esm/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +2 -1
  165. package/esm/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +2 -1
  166. package/esm/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +2 -1
  167. package/esm/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +2 -1
  168. package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +2 -1
  169. package/esm/typings/src/utils/validators/uuid/isValidUuid.d.ts +2 -1
  170. package/package.json +1 -1
  171. package/umd/index.umd.js +367 -201
  172. package/umd/index.umd.js.map +1 -1
  173. package/umd/typings/promptbook-collection/index.d.ts +200 -30
  174. package/umd/typings/src/_packages/core.index.d.ts +7 -2
  175. package/umd/typings/src/_packages/execute-javascript.index.d.ts +1 -1
  176. package/umd/typings/src/_packages/node.index.d.ts +2 -1
  177. package/umd/typings/src/_packages/types.index.d.ts +12 -8
  178. package/umd/typings/src/_packages/utils.index.d.ts +11 -8
  179. package/umd/typings/src/cli/cli-commands/hello.d.ts +3 -0
  180. package/umd/typings/src/cli/cli-commands/make.d.ts +3 -0
  181. package/umd/typings/src/cli/cli-commands/prettify.d.ts +3 -0
  182. package/umd/typings/src/cli/promptbookCli.d.ts +1 -0
  183. package/umd/typings/src/collection/PipelineCollection.d.ts +1 -1
  184. package/umd/typings/src/collection/SimplePipelineCollection.d.ts +10 -10
  185. package/umd/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +7 -7
  186. package/umd/typings/src/collection/constructors/createCollectionFromUrl.d.ts +2 -2
  187. package/umd/typings/src/commands/KNOWLEDGE/KnowledgeCommand.d.ts +2 -3
  188. package/umd/typings/src/commands/MODEL/ModelCommand.d.ts +2 -2
  189. package/umd/typings/src/commands/PERSONA/PersonaCommand.d.ts +4 -2
  190. package/umd/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -0
  191. package/umd/typings/src/commands/_common/types/CommandParser.d.ts +42 -14
  192. package/umd/typings/src/config.d.ts +46 -1
  193. package/umd/typings/src/config.test.d.ts +4 -0
  194. package/umd/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
  195. package/umd/typings/src/conversion/pipelineStringToJson.d.ts +9 -5
  196. package/umd/typings/src/conversion/pipelineStringToJsonSync.d.ts +6 -3
  197. package/umd/typings/src/conversion/prettify/PrettifyOptions.d.ts +2 -2
  198. package/{esm/typings/src/conversion/utils/extractParametersFromPromptTemplate.d.ts → umd/typings/src/conversion/utils/extractParameterNamesFromPromptTemplate.d.ts} +2 -2
  199. package/umd/typings/src/conversion/utils/extractParameterNamesFromPromptTemplate.test.d.ts +1 -0
  200. package/umd/typings/src/conversion/utils/renameParameter.d.ts +3 -3
  201. package/umd/typings/src/conversion/utils/stringifyPipelineJson.d.ts +14 -0
  202. package/umd/typings/src/conversion/utils/stringifyPipelineJson.test.d.ts +1 -0
  203. package/umd/typings/src/conversion/validation/_importPipeline.d.ts +12 -3
  204. package/umd/typings/src/conversion/validation/validatePipeline.d.ts +10 -1
  205. package/umd/typings/src/errors/EnvironmentMismatchError.d.ts +7 -0
  206. package/umd/typings/src/errors/LimitReachedError.d.ts +7 -0
  207. package/umd/typings/src/errors/VersionMismatchError.d.ts +8 -0
  208. package/umd/typings/src/execution/CommonExecutionToolsOptions.d.ts +1 -0
  209. package/umd/typings/src/execution/LlmExecutionTools.d.ts +10 -8
  210. package/umd/typings/src/execution/PipelineExecutor.d.ts +48 -26
  211. package/umd/typings/src/execution/PromptResult.d.ts +39 -54
  212. package/umd/typings/src/execution/PromptResultUsage.d.ts +29 -0
  213. package/umd/typings/src/execution/ScriptExecutionTools.d.ts +5 -4
  214. package/umd/typings/src/execution/UncertainNumber.d.ts +18 -0
  215. package/umd/typings/src/execution/UserInterfaceTools.d.ts +5 -5
  216. package/umd/typings/src/execution/createPipelineExecutor.d.ts +30 -3
  217. package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +2 -2
  218. package/umd/typings/src/execution/utils/addUsage.d.ts +58 -2
  219. package/umd/typings/src/execution/utils/computeUsageCounts.d.ts +1 -1
  220. package/umd/typings/src/execution/utils/forEachAsync.d.ts +1 -1
  221. package/umd/typings/src/execution/utils/uncertainNumber.d.ts +1 -1
  222. package/umd/typings/src/execution/utils/usageToWorktime.d.ts +2 -2
  223. package/umd/typings/src/formats/_common/FormatDefinition.d.ts +1 -1
  224. package/umd/typings/src/formats/csv/ListFormatDefinition.d.ts +2 -1
  225. package/umd/typings/src/formats/json/JsonFormatDefinition.d.ts +2 -1
  226. package/umd/typings/src/formats/list/ListFormatDefinition.d.ts +2 -1
  227. package/umd/typings/src/formats/xml/XmlFormatDefinition.d.ts +1 -0
  228. package/umd/typings/src/knowledge/dialogs/callback/CallbackInterfaceToolsOptions.d.ts +1 -1
  229. package/umd/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +3 -0
  230. package/umd/typings/src/knowledge/prepare-knowledge/_common/Scraper.d.ts +27 -0
  231. package/umd/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +18 -0
  232. package/umd/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.test.d.ts +1 -0
  233. package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +9 -23
  234. package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.test.d.ts +3 -0
  235. package/umd/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +8 -14
  236. package/umd/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +30 -0
  237. package/umd/typings/src/llm-providers/_common/getLlmToolsForCli.d.ts +10 -0
  238. package/umd/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +11 -0
  239. package/umd/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +29 -0
  240. package/umd/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +10 -0
  241. package/umd/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +16 -0
  242. package/umd/typings/src/llm-providers/_common/utils/count-total-cost/LlmExecutionToolsWithTotalCost.d.ts +11 -0
  243. package/umd/typings/src/llm-providers/_common/utils/count-total-cost/countTotalCost.d.ts +14 -0
  244. package/umd/typings/src/llm-providers/_common/utils/count-total-cost/limitTotalCost.d.ts +32 -0
  245. package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +4 -3
  246. package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +1 -1
  247. package/umd/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +3 -3
  248. package/umd/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +3 -0
  249. package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +5 -4
  250. package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +5 -5
  251. package/umd/typings/src/llm-providers/azure-openai/playground/playground.d.ts +3 -0
  252. package/umd/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +3 -0
  253. package/umd/typings/src/llm-providers/langtail/LangtailExecutionToolsOptions.d.ts +1 -1
  254. package/umd/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +5 -5
  255. package/umd/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +7 -7
  256. package/umd/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +12 -8
  257. package/umd/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +7 -6
  258. package/umd/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +1 -1
  259. package/umd/typings/src/llm-providers/openai/computeOpenaiUsage.d.ts +1 -1
  260. package/umd/typings/src/llm-providers/openai/computeUsage.d.ts +2 -2
  261. package/umd/typings/src/llm-providers/openai/openai-models.d.ts +3 -2
  262. package/umd/typings/src/llm-providers/openai/playground/playground.d.ts +3 -0
  263. package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +10 -8
  264. package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionToolsOptions.d.ts +1 -1
  265. package/umd/typings/src/llm-providers/remote/startRemoteServer.d.ts +2 -2
  266. package/umd/typings/src/personas/preparePersona.d.ts +15 -0
  267. package/umd/typings/src/personas/preparePersona.test.d.ts +1 -0
  268. package/umd/typings/src/prepare/PrepareOptions.d.ts +22 -0
  269. package/umd/typings/src/prepare/isPipelinePrepared.d.ts +14 -0
  270. package/umd/typings/src/prepare/isPipelinePrepared.test.d.ts +1 -0
  271. package/umd/typings/src/prepare/preparePipeline.d.ts +17 -0
  272. package/umd/typings/src/prepare/prepareTemplates.d.ts +31 -0
  273. package/umd/typings/src/prepare/unpreparePipeline.d.ts +11 -0
  274. package/umd/typings/src/scripting/javascript/JavascriptExecutionToolsOptions.d.ts +1 -1
  275. package/umd/typings/src/scripting/javascript/utils/preserve.d.ts +1 -1
  276. package/umd/typings/src/scripting/javascript/utils/unknownToString.d.ts +2 -1
  277. package/umd/typings/src/storage/_common/PromptbookStorage.d.ts +25 -0
  278. package/umd/typings/src/storage/_common/PromptbookStorage.test-type.d.ts +5 -0
  279. package/umd/typings/src/storage/files-storage/FilesStorage.d.ts +30 -0
  280. package/umd/typings/src/storage/files-storage/FilesStorageOptions.d.ts +13 -0
  281. package/umd/typings/src/storage/files-storage/utils/nameToSubfolderPath.d.ts +7 -0
  282. package/umd/typings/src/storage/files-storage/utils/nameToSubfolderPath.test.d.ts +1 -0
  283. package/umd/typings/src/storage/local-storage/getLocalStorage.d.ts +9 -0
  284. package/umd/typings/src/storage/local-storage/getSessionStorage.d.ts +9 -0
  285. package/umd/typings/src/storage/memory/MemoryStorage.d.ts +34 -0
  286. package/umd/typings/src/storage/utils/PrefixStorage.d.ts +26 -0
  287. package/umd/typings/src/storage/utils/makePromptbookStorageFromWebStorage.d.ts +11 -0
  288. package/umd/typings/src/types/ModelRequirements.d.ts +71 -11
  289. package/umd/typings/src/types/ModelVariant.d.ts +14 -0
  290. package/umd/typings/src/types/PipelineJson/Expectations.d.ts +6 -2
  291. package/umd/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +70 -0
  292. package/umd/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +27 -0
  293. package/umd/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +10 -1
  294. package/umd/typings/src/types/PipelineJson/PersonaJson.d.ts +41 -0
  295. package/umd/typings/src/types/PipelineJson/PipelineJson.d.ts +31 -5
  296. package/umd/typings/src/types/PipelineJson/PreparationJson.d.ts +22 -0
  297. package/umd/typings/src/types/PipelineJson/PromptDialogJson.d.ts +8 -2
  298. package/umd/typings/src/types/PipelineJson/PromptTemplateJson.d.ts +5 -1
  299. package/umd/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +23 -4
  300. package/umd/typings/src/types/PipelineJson/PromptTemplateParameterJson.d.ts +12 -2
  301. package/umd/typings/src/types/PipelineJson/ScriptJson.d.ts +7 -2
  302. package/umd/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +7 -2
  303. package/umd/typings/src/types/PipelineString.d.ts +1 -1
  304. package/umd/typings/src/types/Prompt.d.ts +54 -10
  305. package/umd/typings/src/types/execution-report/ExecutionReportJson.d.ts +4 -4
  306. package/umd/typings/src/types/execution-report/ExecutionReportStringOptions.d.ts +3 -3
  307. package/umd/typings/src/types/execution-report/countWorkingDuration.d.ts +1 -1
  308. package/umd/typings/src/types/typeAliases.d.ts +114 -15
  309. package/umd/typings/src/utils/FromtoItems.d.ts +3 -3
  310. package/umd/typings/src/utils/currentDate.d.ts +7 -0
  311. package/umd/typings/src/utils/deepClone.d.ts +9 -0
  312. package/umd/typings/src/utils/deepFreeze.d.ts +22 -0
  313. package/umd/typings/src/utils/emojis.d.ts +2 -2
  314. package/umd/typings/src/utils/{extractParameters.d.ts → extractParameterNames.d.ts} +2 -2
  315. package/umd/typings/src/utils/extractParameterNames.test.d.ts +1 -0
  316. package/umd/typings/src/utils/formatNumber.d.ts +1 -1
  317. package/umd/typings/src/utils/isRunningInWhatever.d.ts +3 -0
  318. package/umd/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +3 -3
  319. package/umd/typings/src/utils/markdown/createMarkdownChart.d.ts +7 -10
  320. package/umd/typings/src/utils/markdown/createMarkdownTable.d.ts +1 -1
  321. package/umd/typings/src/utils/markdown/extractAllBlocksFromMarkdown-real.test.d.ts +1 -0
  322. package/umd/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +9 -2
  323. package/umd/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +1 -1
  324. package/umd/typings/src/utils/markdown/parseMarkdownSection.d.ts +3 -3
  325. package/umd/typings/src/utils/normalization/parseKeywords.d.ts +2 -1
  326. package/umd/typings/src/utils/organization/TODO_USE.d.ts +12 -0
  327. package/umd/typings/src/utils/organization/TODO_any.d.ts +6 -0
  328. package/umd/typings/src/utils/organization/TODO_object.d.ts +6 -0
  329. package/umd/typings/src/utils/organization/TODO_unknown.d.ts +6 -0
  330. package/umd/typings/src/utils/organization/___.d.ts +6 -0
  331. package/{esm/typings/src/utils → umd/typings/src/utils/organization}/just.d.ts +5 -1
  332. package/umd/typings/src/utils/organization/keepUnused.d.ts +16 -0
  333. package/umd/typings/src/utils/organization/really_any.d.ts +6 -0
  334. package/umd/typings/src/utils/organization/really_unknown.d.ts +6 -0
  335. package/umd/typings/src/utils/random/randomSeed.d.ts +7 -0
  336. package/umd/typings/src/{execution/utils → utils}/replaceParameters.d.ts +2 -4
  337. package/umd/typings/src/utils/replaceParameters.test.d.ts +1 -0
  338. package/umd/typings/src/utils/sets/difference.d.ts +3 -0
  339. package/umd/typings/src/utils/validators/email/isValidEmail.d.ts +2 -1
  340. package/umd/typings/src/utils/validators/filePath/isValidFilePath.d.ts +2 -1
  341. package/umd/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +2 -1
  342. package/umd/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +2 -1
  343. package/umd/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +2 -1
  344. package/umd/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +2 -1
  345. package/umd/typings/src/utils/validators/url/isValidUrl.d.ts +2 -1
  346. package/umd/typings/src/utils/validators/uuid/isValidUuid.d.ts +2 -1
  347. package/esm/typings/src/collection/constructors/justTestFsImport.d.ts +0 -7
  348. package/esm/typings/src/personas/personaToModelRequirements.d.ts +0 -6
  349. package/esm/typings/src/types/Parameters.d.ts +0 -14
  350. package/esm/typings/src/types/PipelineJson/KnowledgeJson.d.ts +0 -6
  351. package/esm/typings/src/types/PipelineJson/MaterialKnowledgePieceJson.d.ts +0 -28
  352. package/umd/typings/src/collection/constructors/justTestFsImport.d.ts +0 -7
  353. package/umd/typings/src/personas/personaToModelRequirements.d.ts +0 -6
  354. package/umd/typings/src/types/Parameters.d.ts +0 -14
  355. package/umd/typings/src/types/PipelineJson/KnowledgeJson.d.ts +0 -6
  356. package/umd/typings/src/types/PipelineJson/MaterialKnowledgePieceJson.d.ts +0 -28
  357. /package/esm/typings/src/conversion/utils/{extractParametersFromPromptTemplate.test.d.ts → extractParameterNamesFromPromptTemplate.test.d.ts} +0 -0
  358. /package/esm/typings/src/{execution/addPromptResultUsage.test.d.ts → conversion/utils/stringifyPipelineJson.test.d.ts} +0 -0
  359. /package/esm/typings/src/{execution/utils/replaceParameters.test.d.ts → knowledge/prepare-knowledge/_common/prepareKnowledgePieces.test.d.ts} +0 -0
  360. /package/esm/typings/src/{utils/extractParameters.test.d.ts → personas/preparePersona.test.d.ts} +0 -0
  361. /package/esm/typings/src/{utils/postprocessing → postprocessing/utils}/extractBlock.d.ts +0 -0
  362. /package/{umd/typings/src/conversion/utils/extractParametersFromPromptTemplate.test.d.ts → esm/typings/src/prepare/isPipelinePrepared.test.d.ts} +0 -0
  363. /package/{umd/typings/src/execution/addPromptResultUsage.test.d.ts → esm/typings/src/storage/files-storage/utils/nameToSubfolderPath.test.d.ts} +0 -0
  364. /package/{umd/typings/src/execution/utils/replaceParameters.test.d.ts → esm/typings/src/utils/extractParameterNames.test.d.ts} +0 -0
  365. /package/{umd/typings/src/utils/extractParameters.test.d.ts → esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown-real.test.d.ts} +0 -0
  366. /package/umd/typings/src/{utils/postprocessing → postprocessing/utils}/extractBlock.d.ts +0 -0
package/umd/index.umd.js CHANGED
@@ -1,8 +1,12 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim')) :
3
3
  typeof define === 'function' && define.amd ? define(['exports', 'spacetrim'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-utils"] = {}, global.spacetrim));
5
- })(this, (function (exports, spacetrim) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-utils"] = {}, global.spaceTrim));
5
+ })(this, (function (exports, spaceTrim) { 'use strict';
6
+
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
+
9
+ var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim);
6
10
 
7
11
  /*! *****************************************************************************
8
12
  Copyright (c) Microsoft Corporation.
@@ -129,7 +133,7 @@
129
133
  var UnexpectedError = /** @class */ (function (_super) {
130
134
  __extends(UnexpectedError, _super);
131
135
  function UnexpectedError(message) {
132
- var _this = _super.call(this, spacetrim.spaceTrim(function (block) { return "\n ".concat(block(message), "\n\n Note: This error should not happen.\n It's probbably a bug in the pipeline collection\n\n Please report issue:\n https://github.com/webgptorg/promptbook/issues\n\n Or contact us on me@pavolhejny.com\n\n "); })) || this;
136
+ var _this = _super.call(this, spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(message), "\n\n Note: This error should not happen.\n It's probbably a bug in the pipeline collection\n\n Please report issue:\n https://github.com/webgptorg/promptbook/issues\n\n Or contact us on me@pavolhejny.com\n\n "); })) || this;
133
137
  _this.name = 'UnexpectedError';
134
138
  Object.setPrototypeOf(_this, UnexpectedError.prototype);
135
139
  return _this;
@@ -516,6 +520,14 @@
516
520
  * Function normalizes title to name which can be used as identifier
517
521
  */
518
522
  function titleToName(value) {
523
+ if (value.startsWith('http://') || value.startsWith('https://')) {
524
+ // TODO: Maybe check against some list unallowed characters
525
+ return value;
526
+ }
527
+ if (value.startsWith('./') || value.startsWith('../')) {
528
+ // TODO: Maybe check against some list unallowed characters
529
+ return value;
530
+ }
519
531
  value = removeEmojis(value);
520
532
  value = normalizeToKebabCase(value);
521
533
  // TODO: [🧠] Maybe warn or add some padding to short name which are not good identifiers
@@ -543,7 +555,7 @@
543
555
  }
544
556
  return normalizeTo_camelCase('template-' + titleToName(template.title));
545
557
  };
546
- var promptbookMermaid = spacetrim.spaceTrim(function (block) { return "\n\n %% \uD83D\uDD2E Tip: Open this on GitHub or in the VSCode website to see the Mermaid graph visually\n\n flowchart LR\n subgraph \"".concat(pipelineJson.title, "\"\n\n direction TB\n\n input((Input)):::input\n ").concat(block(pipelineJson.promptTemplates
558
+ var promptbookMermaid = spaceTrim.spaceTrim(function (block) { return "\n\n %% \uD83D\uDD2E Tip: Open this on GitHub or in the VSCode website to see the Mermaid graph visually\n\n flowchart LR\n subgraph \"".concat(pipelineJson.title, "\"\n\n direction TB\n\n input((Input)):::input\n ").concat(block(pipelineJson.promptTemplates
547
559
  .flatMap(function (_a) {
548
560
  var title = _a.title, dependentParameterNames = _a.dependentParameterNames, resultingParameterName = _a.resultingParameterName;
549
561
  return __spreadArray([
@@ -586,7 +598,7 @@
586
598
  * @param template the template with parameters in {curly} braces
587
599
  * @returns the list of parameter names
588
600
  */
589
- function extractParameters(template) {
601
+ function extractParameterNames(template) {
590
602
  var e_1, _a;
591
603
  var matches = template.matchAll(/{\w+}/g);
592
604
  var parameterNames = new Set();
@@ -661,7 +673,7 @@
661
673
  if (!(error instanceof Error)) {
662
674
  throw error;
663
675
  }
664
- throw new ParsingError(spacetrim.spaceTrim(function (block) { return "\n Can not extract variables from the script\n\n ".concat(block(error.name), ": ").concat(block(error.message), "\n "); }));
676
+ throw new ParsingError(spaceTrim.spaceTrim(function (block) { return "\n Can not extract variables from the script\n\n ".concat(block(error.name), ": ").concat(block(error.message), "\n "); }));
665
677
  }
666
678
  return variables;
667
679
  }
@@ -676,37 +688,53 @@
676
688
  * @returns the set of parameter names
677
689
  * @throws {ParsingError} if the script is invalid
678
690
  */
679
- function extractParametersFromPromptTemplate(promptTemplate) {
680
- var e_1, _a, e_2, _b;
691
+ function extractParameterNamesFromPromptTemplate(promptTemplate) {
692
+ var e_1, _a, e_2, _b, e_3, _c;
693
+ var title = promptTemplate.title, description = promptTemplate.description, blockType = promptTemplate.blockType, content = promptTemplate.content, preparedContent = promptTemplate.preparedContent, jokerParameterNames = promptTemplate.jokerParameterNames;
681
694
  var parameterNames = new Set();
682
695
  try {
683
- for (var _c = __values(__spreadArray(__spreadArray(__spreadArray([], __read(extractParameters(promptTemplate.title)), false), __read(extractParameters(promptTemplate.description || '')), false), __read(extractParameters(promptTemplate.content)), false)), _d = _c.next(); !_d.done; _d = _c.next()) {
684
- var parameterName = _d.value;
696
+ for (var _d = __values(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(extractParameterNames(title)), false), __read(extractParameterNames(description || '')), false), __read(extractParameterNames(content)), false), __read(extractParameterNames(preparedContent || '')), false)), _e = _d.next(); !_e.done; _e = _d.next()) {
697
+ var parameterName = _e.value;
685
698
  parameterNames.add(parameterName);
686
699
  }
687
700
  }
688
701
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
689
702
  finally {
690
703
  try {
691
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
704
+ if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
692
705
  }
693
706
  finally { if (e_1) throw e_1.error; }
694
707
  }
695
- if (promptTemplate.blockType === 'SCRIPT') {
708
+ if (blockType === 'SCRIPT') {
696
709
  try {
697
- for (var _e = __values(extractVariables(promptTemplate.content)), _f = _e.next(); !_f.done; _f = _e.next()) {
698
- var parameterName = _f.value;
710
+ for (var _f = __values(extractVariables(content)), _g = _f.next(); !_g.done; _g = _f.next()) {
711
+ var parameterName = _g.value;
699
712
  parameterNames.add(parameterName);
700
713
  }
701
714
  }
702
715
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
703
716
  finally {
704
717
  try {
705
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
718
+ if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
706
719
  }
707
720
  finally { if (e_2) throw e_2.error; }
708
721
  }
709
722
  }
723
+ try {
724
+ for (var _h = __values(jokerParameterNames || []), _j = _h.next(); !_j.done; _j = _h.next()) {
725
+ var jokerName = _j.value;
726
+ parameterNames.add(jokerName);
727
+ }
728
+ }
729
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
730
+ finally {
731
+ try {
732
+ if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
733
+ }
734
+ finally { if (e_3) throw e_3.error; }
735
+ }
736
+ parameterNames.delete('content');
737
+ // <- Note {websiteContent} is used in `preparedContent`
710
738
  return parameterNames;
711
739
  }
712
740
  /**
@@ -792,12 +820,12 @@
792
820
  */
793
821
  function forEachAsync(array, options, callbackfunction) {
794
822
  return __awaiter(this, void 0, void 0, function () {
795
- var _a, inParallelCount, index, runningTasks, tasks, _loop_1, _b, _c, item, e_1_1;
823
+ var _a, maxParallelCount, index, runningTasks, tasks, _loop_1, _b, _c, item, e_1_1;
796
824
  var e_1, _d;
797
825
  return __generator(this, function (_e) {
798
826
  switch (_e.label) {
799
827
  case 0:
800
- _a = options.inParallelCount, inParallelCount = _a === void 0 ? Infinity : _a;
828
+ _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? Infinity : _a;
801
829
  index = 0;
802
830
  runningTasks = [];
803
831
  tasks = [];
@@ -813,7 +841,7 @@
813
841
  /* not await */ Promise.resolve(task).then(function () {
814
842
  runningTasks = runningTasks.filter(function (t) { return t !== task; });
815
843
  });
816
- if (!(inParallelCount < runningTasks.length)) return [3 /*break*/, 2];
844
+ if (!(maxParallelCount < runningTasks.length)) return [3 /*break*/, 2];
817
845
  return [4 /*yield*/, Promise.race(runningTasks)];
818
846
  case 1:
819
847
  _f.sent();
@@ -858,101 +886,154 @@
858
886
  }
859
887
 
860
888
  /**
861
- * The maximum number of iterations for a loops
889
+ * Function isValidJsonString will tell you if the string is valid JSON or not
862
890
  */
863
- var LOOP_LIMIT = 1000;
891
+ function isValidJsonString(value /* <- [👨‍⚖️] */) {
892
+ try {
893
+ JSON.parse(value);
894
+ return true;
895
+ }
896
+ catch (error) {
897
+ if (!(error instanceof Error)) {
898
+ throw error;
899
+ }
900
+ if (error.message.includes('Unexpected token')) {
901
+ return false;
902
+ }
903
+ return false;
904
+ }
905
+ }
864
906
 
865
907
  /**
866
- * This error indicates errors during the execution of the pipeline
908
+ * Makes first letter of a string uppercase
909
+ *
867
910
  */
868
- var PipelineExecutionError = /** @class */ (function (_super) {
869
- __extends(PipelineExecutionError, _super);
870
- function PipelineExecutionError(message) {
871
- var _this = _super.call(this, message) || this;
872
- _this.name = 'PipelineExecutionError';
873
- Object.setPrototypeOf(_this, PipelineExecutionError.prototype);
874
- return _this;
875
- }
876
- return PipelineExecutionError;
877
- }(Error));
911
+ function capitalize(word) {
912
+ return word.substring(0, 1).toUpperCase() + word.substring(1);
913
+ }
878
914
 
879
915
  /**
880
- * Replaces parameters in template with values from parameters object
916
+ * Extracts all code blocks from markdown.
881
917
  *
882
- * @param template the template with parameters in {curly} braces
883
- * @param parameters the object with parameters
884
- * @returns the template with replaced parameters
885
- * @throws {PipelineExecutionError} if parameter is not defined, not closed, or not opened
918
+ * Note: There are 3 simmilar function:
919
+ * - `extractBlock` just extracts the content of the code block which is also used as build-in function for postprocessing
920
+ * - `extractOneBlockFromMarkdown` extracts exactly one code block with language of the code block
921
+ * - `extractAllBlocksFromMarkdown` extracts all code blocks with language of the code block
922
+ *
923
+ * @param markdown any valid markdown
924
+ * @returns code blocks with language and content
886
925
  *
887
- * @private within the createPipelineExecutor
888
926
  */
889
- function replaceParameters(template, parameters) {
890
- var replacedTemplate = template;
891
- var match;
892
- var loopLimit = LOOP_LIMIT;
893
- var _loop_1 = function () {
894
- if (loopLimit-- < 0) {
895
- throw new UnexpectedError('Loop limit reached during parameters replacement in `replaceParameters`');
896
- }
897
- var precol = match.groups.precol;
898
- var parameterName = match.groups.parameterName;
899
- if (parameterName === '') {
900
- return "continue";
901
- }
902
- if (parameterName.indexOf('{') !== -1 || parameterName.indexOf('}') !== -1) {
903
- throw new PipelineExecutionError('Parameter is already opened or not closed');
904
- }
905
- if (parameters[parameterName] === undefined) {
906
- throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
907
- }
908
- var parameterValue = parameters[parameterName];
909
- if (parameterValue === undefined) {
910
- throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
911
- }
912
- parameterValue = parameterValue.toString();
913
- if (parameterValue.includes('\n') && /^\s*\W{0,3}\s*$/.test(precol)) {
914
- parameterValue = parameterValue
915
- .split('\n')
916
- .map(function (line, index) { return (index === 0 ? line : "".concat(precol).concat(line)); })
917
- .join('\n');
927
+ function extractAllBlocksFromMarkdown(markdown) {
928
+ var e_1, _a;
929
+ var codeBlocks = [];
930
+ var lines = markdown.split('\n');
931
+ // Note: [0] Ensure that the last block notated by gt > will be closed
932
+ lines.push('');
933
+ var currentCodeBlock = null;
934
+ try {
935
+ for (var lines_1 = __values(lines), lines_1_1 = lines_1.next(); !lines_1_1.done; lines_1_1 = lines_1.next()) {
936
+ var line = lines_1_1.value;
937
+ if (line.startsWith('> ') || line === '>') {
938
+ if (currentCodeBlock === null) {
939
+ currentCodeBlock = { blockNotation: '>', language: null, content: '' };
940
+ } /* not else */
941
+ if (currentCodeBlock.blockNotation === '>') {
942
+ if (currentCodeBlock.content !== '') {
943
+ currentCodeBlock.content += '\n';
944
+ }
945
+ currentCodeBlock.content += line.slice(2);
946
+ }
947
+ }
948
+ else if (currentCodeBlock !== null && currentCodeBlock.blockNotation === '>' /* <- Note: [0] */) {
949
+ codeBlocks.push(currentCodeBlock);
950
+ currentCodeBlock = null;
951
+ }
952
+ /* not else */
953
+ if (line.startsWith('```')) {
954
+ var language = line.slice(3).trim() || null;
955
+ if (currentCodeBlock === null) {
956
+ currentCodeBlock = { blockNotation: '```', language: language, content: '' };
957
+ }
958
+ else {
959
+ if (language !== null) {
960
+ throw new ParsingError("".concat(capitalize(currentCodeBlock.language || 'the'), " code block was not closed and already opening new ").concat(language, " code block"));
961
+ }
962
+ codeBlocks.push(currentCodeBlock);
963
+ currentCodeBlock = null;
964
+ }
965
+ }
966
+ else if (currentCodeBlock !== null && currentCodeBlock.blockNotation === '```') {
967
+ if (currentCodeBlock.content !== '') {
968
+ currentCodeBlock.content += '\n';
969
+ }
970
+ currentCodeBlock.content += line.split('\\`\\`\\`').join('```') /* <- TODO: Maybe make propper unescape */;
971
+ }
918
972
  }
919
- replacedTemplate =
920
- replacedTemplate.substring(0, match.index + precol.length) +
921
- parameterValue +
922
- replacedTemplate.substring(match.index + precol.length + parameterName.length + 2);
923
- };
924
- while ((match = /^(?<precol>.*){(?<parameterName>\w+)}(.*)/m /* <- Not global */
925
- .exec(replacedTemplate))) {
926
- _loop_1();
927
973
  }
928
- // [💫] Check if there are parameters that are not closed properly
929
- if (/{\w+$/.test(replacedTemplate)) {
930
- throw new PipelineExecutionError('Parameter is not closed');
974
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
975
+ finally {
976
+ try {
977
+ if (lines_1_1 && !lines_1_1.done && (_a = lines_1.return)) _a.call(lines_1);
978
+ }
979
+ finally { if (e_1) throw e_1.error; }
931
980
  }
932
- // [💫] Check if there are parameters that are not opened properly
933
- if (/^\w+}/.test(replacedTemplate)) {
934
- throw new PipelineExecutionError('Parameter is not opened');
981
+ if (currentCodeBlock !== null) {
982
+ throw new ParsingError("".concat(capitalize(currentCodeBlock.language || 'the'), " code block was not closed at the end of the markdown"));
935
983
  }
936
- return replacedTemplate;
984
+ return codeBlocks;
937
985
  }
986
+ /**
987
+ * TODO: Maybe name for `blockNotation` instead of '```' and '>'
988
+ */
938
989
 
939
990
  /**
940
- * Function isValidJsonString will tell you if the string is valid JSON or not
991
+ * Extracts exactly ONE code block from markdown.
992
+ *
993
+ * Note: If there are multiple or no code blocks the function throws an error
994
+ *
995
+ * Note: There are 3 simmilar function:
996
+ * - `extractBlock` just extracts the content of the code block which is also used as build-in function for postprocessing
997
+ * - `extractOneBlockFromMarkdown` extracts exactly one code block with language of the code block
998
+ * - `extractAllBlocksFromMarkdown` extracts all code blocks with language of the code block
999
+ *
1000
+ * @param markdown any valid markdown
1001
+ * @returns code block with language and content
941
1002
  */
942
- function isValidJsonString(value /* <-[👨‍⚖️] */) {
943
- try {
944
- JSON.parse(value);
945
- return true;
946
- }
947
- catch (error) {
948
- if (!(error instanceof Error)) {
949
- throw error;
950
- }
951
- if (error.message.includes('Unexpected token')) {
952
- return false;
953
- }
954
- return false;
1003
+ function extractOneBlockFromMarkdown(markdown) {
1004
+ var codeBlocks = extractAllBlocksFromMarkdown(markdown);
1005
+ if (codeBlocks.length !== 1) {
1006
+ throw new ParsingError(spaceTrim__default["default"](function (block) { return "\n There should be exactly 1 code block, found ".concat(codeBlocks.length, " code blocks\n\n ").concat(block(codeBlocks.map(function (block, i) { return "Block ".concat(i + 1, ":\n").concat(block.content); }).join('\n\n\n')), "\n "); }));
955
1007
  }
1008
+ return codeBlocks[0];
1009
+ }
1010
+ /***
1011
+ * TODO: [🍓][🌻] Decide of this is internal util, external util OR validator/postprocessor
1012
+ */
1013
+
1014
+ /**
1015
+ * Extracts code block from markdown.
1016
+ *
1017
+ * Note: If there are multiple or no code blocks the function throws an error
1018
+ *
1019
+ * Note: There are 3 simmilar function:
1020
+ * - `extractBlock` just extracts the content of the code block which is also used as build-in function for postprocessing
1021
+ * - `extractOneBlockFromMarkdown` extracts exactly one code block with language of the code block
1022
+ * - `extractAllBlocksFromMarkdown` extracts all code blocks with language of the code block
1023
+ */
1024
+ function extractBlock(markdown) {
1025
+ var content = extractOneBlockFromMarkdown(markdown).content;
1026
+ return content;
1027
+ }
1028
+ //
1029
+
1030
+ /**
1031
+ * Simple wrapper `new Date().toISOString()`
1032
+ *
1033
+ * @returns string_date branded type
1034
+ */
1035
+ function $currentDate() {
1036
+ return new Date().toISOString();
956
1037
  }
957
1038
 
958
1039
  /**
@@ -1029,14 +1110,6 @@
1029
1110
  PAGES: countPages,
1030
1111
  };
1031
1112
 
1032
- /**
1033
- * Makes first letter of a string uppercase
1034
- *
1035
- */
1036
- function capitalize(word) {
1037
- return word.substring(0, 1).toUpperCase() + word.substring(1);
1038
- }
1039
-
1040
1113
  /**
1041
1114
  * Makes first letter of a string uppercase
1042
1115
  *
@@ -1295,122 +1368,210 @@
1295
1368
  */
1296
1369
 
1297
1370
  /**
1298
- * Extracts all code blocks from markdown.
1371
+ * Generates random seed
1299
1372
  *
1300
- * Note: There are 3 simmilar function:
1301
- * - `extractBlock` just extracts the content of the code block which is also used as build-in function for postprocessing
1302
- * - `extractOneBlockFromMarkdown` extracts exactly one code block with language of the code block
1303
- * - `extractAllBlocksFromMarkdown` extracts all code blocks with language of the code block
1373
+ * Warning: This function is not cryptographically secure (it uses Math.random internally)
1374
+ */
1375
+ function $randomSeed() {
1376
+ return Math.random();
1377
+ }
1378
+
1379
+ /**
1380
+ * Removes quotes from a string
1304
1381
  *
1305
- * @param markdown any valid markdown
1306
- * @returns code blocks with language and content
1382
+ * Tip: This is very usefull for post-processing of the result of the LLM model
1383
+ * Note: This function removes only the same quotes from the beginning and the end of the string
1384
+ * Note: There are two simmilar functions:
1385
+ * - `removeQuotes` which removes only bounding quotes
1386
+ * - `unwrapResult` which removes whole introduce sentence
1307
1387
  *
1388
+ * @param text optionally quoted text
1389
+ * @returns text without quotes
1308
1390
  */
1309
- function extractAllBlocksFromMarkdown(markdown) {
1391
+ function removeQuotes(text) {
1392
+ if (text.startsWith('"') && text.endsWith('"')) {
1393
+ return text.slice(1, -1);
1394
+ }
1395
+ if (text.startsWith('\'') && text.endsWith('\'')) {
1396
+ return text.slice(1, -1);
1397
+ }
1398
+ return text;
1399
+ }
1400
+
1401
+ /**
1402
+ * @@@
1403
+ *
1404
+ * @returns The same object as the input, but deeply frozen
1405
+ *
1406
+ * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
1407
+ */
1408
+ function deepFreeze(objectValue) {
1310
1409
  var e_1, _a;
1311
- var codeBlocks = [];
1312
- var lines = markdown.split('\n');
1313
- var currentCodeBlock = null;
1410
+ var propertyNames = Object.getOwnPropertyNames(objectValue);
1314
1411
  try {
1315
- for (var lines_1 = __values(lines), lines_1_1 = lines_1.next(); !lines_1_1.done; lines_1_1 = lines_1.next()) {
1316
- var line = lines_1_1.value;
1317
- if (line.startsWith('```')) {
1318
- var language = line.slice(3).trim() || null;
1319
- if (currentCodeBlock === null) {
1320
- currentCodeBlock = { language: language, content: '' };
1321
- }
1322
- else {
1323
- if (language !== null) {
1324
- // [🌻]
1325
- throw new Error("".concat(capitalize(currentCodeBlock.language || 'the'), " code block was not closed and already opening new ").concat(language, " code block"));
1326
- }
1327
- codeBlocks.push(currentCodeBlock);
1328
- currentCodeBlock = null;
1329
- }
1330
- }
1331
- else if (currentCodeBlock !== null) {
1332
- if (currentCodeBlock.content !== '') {
1333
- currentCodeBlock.content += '\n';
1334
- }
1335
- currentCodeBlock.content += line.split('\\`\\`\\`').join('```') /* <- TODO: Maybe make propper unescape */;
1412
+ for (var propertyNames_1 = __values(propertyNames), propertyNames_1_1 = propertyNames_1.next(); !propertyNames_1_1.done; propertyNames_1_1 = propertyNames_1.next()) {
1413
+ var propertyName = propertyNames_1_1.value;
1414
+ var value = objectValue[propertyName];
1415
+ if (value && typeof value === 'object') {
1416
+ deepFreeze(value);
1336
1417
  }
1337
1418
  }
1338
1419
  }
1339
1420
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
1340
1421
  finally {
1341
1422
  try {
1342
- if (lines_1_1 && !lines_1_1.done && (_a = lines_1.return)) _a.call(lines_1);
1423
+ if (propertyNames_1_1 && !propertyNames_1_1.done && (_a = propertyNames_1.return)) _a.call(propertyNames_1);
1343
1424
  }
1344
1425
  finally { if (e_1) throw e_1.error; }
1345
1426
  }
1346
- if (currentCodeBlock !== null) {
1347
- // [🌻]
1348
- throw new Error("".concat(capitalize(currentCodeBlock.language || 'the'), " code block was not closed at the end of the markdown"));
1349
- }
1350
- return codeBlocks;
1427
+ return Object.freeze(objectValue);
1351
1428
  }
1429
+ /**
1430
+ * TODO: [🔼] Export from `@promptbook/utils`
1431
+ * TODO: [🧠] Is there a way how to meaningfully test this utility
1432
+ */
1352
1433
 
1353
1434
  /**
1354
- * Extracts exactly ONE code block from markdown.
1355
- *
1356
- * Note: If there are multiple or no code blocks the function throws an error
1357
- *
1358
- * Note: There are 3 simmilar function:
1359
- * - `extractBlock` just extracts the content of the code block which is also used as build-in function for postprocessing
1360
- * - `extractOneBlockFromMarkdown` extracts exactly one code block with language of the code block
1361
- * - `extractAllBlocksFromMarkdown` extracts all code blocks with language of the code block
1362
- *
1363
- * @param markdown any valid markdown
1364
- * @returns code block with language and content
1435
+ * The maximum number of iterations for a loops
1365
1436
  */
1366
- function extractOneBlockFromMarkdown(markdown) {
1367
- var codeBlocks = extractAllBlocksFromMarkdown(markdown);
1368
- if (codeBlocks.length !== 1) {
1369
- // TODO: Report more specific place where the error happened
1370
- throw new Error(/* <- [🌻] */ 'There should be exactly one code block in the markdown');
1371
- }
1372
- return codeBlocks[0];
1373
- }
1374
- /***
1375
- * TODO: [🍓][🌻] !!! Decide of this is internal util, external util OR validator/postprocessor
1437
+ var LOOP_LIMIT = 1000;
1438
+ /**
1439
+ * Nonce which is used for replacing things in strings
1440
+ */
1441
+ var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
1442
+ /**
1443
+ * The names of the parameters that are reserved for special purposes
1444
+ */
1445
+ deepFreeze([
1446
+ 'content',
1447
+ 'context',
1448
+ 'knowledge',
1449
+ 'samples',
1450
+ 'modelName',
1451
+ 'currentDate',
1452
+ // <- TODO: Add more like 'date', 'modelName',...
1453
+ // <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
1454
+ ]);
1455
+ /**
1456
+ * @@@
1457
+ */
1458
+ var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
1459
+ /**
1460
+ * @@@
1461
+ */
1462
+ var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
1463
+ /*
1464
+ TODO: !!! Just testing false-negative detection of [🟡][🟢][🔵][⚪] leak
1465
+ */
1466
+ // [🟡][🟢][🔵][⚪]
1467
+ /**
1468
+ * TODO: [🔼] Export all to core
1376
1469
  */
1377
1470
 
1378
1471
  /**
1379
- * Extracts code block from markdown.
1380
- *
1381
- * Note: If there are multiple or no code blocks the function throws an error
1382
- *
1383
- * Note: There are 3 simmilar function:
1384
- * - `extractBlock` just extracts the content of the code block which is also used as build-in function for postprocessing
1385
- * - `extractOneBlockFromMarkdown` extracts exactly one code block with language of the code block
1386
- * - `extractAllBlocksFromMarkdown` extracts all code blocks with language of the code block
1472
+ * This error type indicates that some limit was reached
1387
1473
  */
1388
- function extractBlock(markdown) {
1389
- var content = extractOneBlockFromMarkdown(markdown).content;
1390
- return content;
1391
- }
1392
- //
1474
+ var LimitReachedError = /** @class */ (function (_super) {
1475
+ __extends(LimitReachedError, _super);
1476
+ function LimitReachedError(message) {
1477
+ var _this = _super.call(this, message) || this;
1478
+ _this.name = 'LimitReachedError';
1479
+ Object.setPrototypeOf(_this, LimitReachedError.prototype);
1480
+ return _this;
1481
+ }
1482
+ return LimitReachedError;
1483
+ }(Error));
1393
1484
 
1394
1485
  /**
1395
- * Removes quotes from a string
1396
- *
1397
- * Tip: This is very usefull for post-processing of the result of the LLM model
1398
- * Note: This function removes only the same quotes from the beginning and the end of the string
1399
- * Note: There are two simmilar functions:
1400
- * - `removeQuotes` which removes only bounding quotes
1401
- * - `unwrapResult` which removes whole introduce sentence
1486
+ * This error indicates errors during the execution of the pipeline
1487
+ */
1488
+ var PipelineExecutionError = /** @class */ (function (_super) {
1489
+ __extends(PipelineExecutionError, _super);
1490
+ function PipelineExecutionError(message) {
1491
+ var _this = _super.call(this, message) || this;
1492
+ _this.name = 'PipelineExecutionError';
1493
+ Object.setPrototypeOf(_this, PipelineExecutionError.prototype);
1494
+ return _this;
1495
+ }
1496
+ return PipelineExecutionError;
1497
+ }(Error));
1498
+
1499
+ /**
1500
+ * Replaces parameters in template with values from parameters object
1402
1501
  *
1403
- * @param text optionally quoted text
1404
- * @returns text without quotes
1502
+ * @param template the template with parameters in {curly} braces
1503
+ * @param parameters the object with parameters
1504
+ * @returns the template with replaced parameters
1505
+ * @throws {PipelineExecutionError} if parameter is not defined, not closed, or not opened
1405
1506
  */
1406
- function removeQuotes(text) {
1407
- if (text.startsWith('"') && text.endsWith('"')) {
1408
- return text.slice(1, -1);
1507
+ function replaceParameters(template, parameters) {
1508
+ var e_1, _a;
1509
+ try {
1510
+ for (var _b = __values(Object.entries(parameters)), _c = _b.next(); !_c.done; _c = _b.next()) {
1511
+ var _d = __read(_c.value, 2), parameterName = _d[0], parameterValue = _d[1];
1512
+ if (parameterValue === RESERVED_PARAMETER_MISSING_VALUE) {
1513
+ throw new UnexpectedError("Parameter {".concat(parameterName, "} has missing value"));
1514
+ }
1515
+ else if (parameterValue === RESERVED_PARAMETER_RESTRICTED) {
1516
+ // TODO: [🍵]
1517
+ throw new UnexpectedError("Parameter {".concat(parameterName, "} is restricted to use"));
1518
+ }
1519
+ }
1409
1520
  }
1410
- if (text.startsWith('\'') && text.endsWith('\'')) {
1411
- return text.slice(1, -1);
1521
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1522
+ finally {
1523
+ try {
1524
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1525
+ }
1526
+ finally { if (e_1) throw e_1.error; }
1412
1527
  }
1413
- return text;
1528
+ var replacedTemplate = template;
1529
+ var match;
1530
+ var loopLimit = LOOP_LIMIT;
1531
+ var _loop_1 = function () {
1532
+ if (loopLimit-- < 0) {
1533
+ throw new LimitReachedError('Loop limit reached during parameters replacement in `replaceParameters`');
1534
+ }
1535
+ var precol = match.groups.precol;
1536
+ var parameterName = match.groups.parameterName;
1537
+ if (parameterName === '') {
1538
+ return "continue";
1539
+ }
1540
+ if (parameterName.indexOf('{') !== -1 || parameterName.indexOf('}') !== -1) {
1541
+ throw new PipelineExecutionError('Parameter is already opened or not closed');
1542
+ }
1543
+ if (parameters[parameterName] === undefined) {
1544
+ throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
1545
+ }
1546
+ var parameterValue = parameters[parameterName];
1547
+ if (parameterValue === undefined) {
1548
+ throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
1549
+ }
1550
+ parameterValue = parameterValue.toString();
1551
+ if (parameterValue.includes('\n') && /^\s*\W{0,3}\s*$/.test(precol)) {
1552
+ parameterValue = parameterValue
1553
+ .split('\n')
1554
+ .map(function (line, index) { return (index === 0 ? line : "".concat(precol).concat(line)); })
1555
+ .join('\n');
1556
+ }
1557
+ replacedTemplate =
1558
+ replacedTemplate.substring(0, match.index + precol.length) +
1559
+ parameterValue +
1560
+ replacedTemplate.substring(match.index + precol.length + parameterName.length + 2);
1561
+ };
1562
+ while ((match = /^(?<precol>.*){(?<parameterName>\w+)}(.*)/m /* <- Not global */
1563
+ .exec(replacedTemplate))) {
1564
+ _loop_1();
1565
+ }
1566
+ // [💫] Check if there are parameters that are not closed properly
1567
+ if (/{\w+$/.test(replacedTemplate)) {
1568
+ throw new PipelineExecutionError('Parameter is not closed');
1569
+ }
1570
+ // [💫] Check if there are parameters that are not opened properly
1571
+ if (/^\w+}/.test(replacedTemplate)) {
1572
+ throw new PipelineExecutionError('Parameter is not opened');
1573
+ }
1574
+ return replacedTemplate;
1414
1575
  }
1415
1576
 
1416
1577
  /**
@@ -1442,6 +1603,9 @@
1442
1603
  }
1443
1604
  return diff;
1444
1605
  }
1606
+ /**
1607
+ * TODO: [🧠][💯] Maybe also implement symmetricDifference
1608
+ */
1445
1609
 
1446
1610
  /**
1447
1611
  * Creates a new set with all elements that are present in all sets
@@ -1530,13 +1694,13 @@
1530
1694
  *
1531
1695
  */
1532
1696
  function trimCodeBlock(value) {
1533
- value = spacetrim.spaceTrim(value);
1697
+ value = spaceTrim.spaceTrim(value);
1534
1698
  if (!/^```[a-z]*(.*)```$/is.test(value)) {
1535
1699
  return value;
1536
1700
  }
1537
1701
  value = value.replace(/^```[a-z]*/i, '');
1538
1702
  value = value.replace(/```$/i, '');
1539
- value = spacetrim.spaceTrim(value);
1703
+ value = spaceTrim.spaceTrim(value);
1540
1704
  return value;
1541
1705
  }
1542
1706
 
@@ -1547,9 +1711,9 @@
1547
1711
  * if you want to start code block in the prompt but you don't want to end it in the result.
1548
1712
  */
1549
1713
  function trimEndOfCodeBlock(value) {
1550
- value = spacetrim.spaceTrim(value);
1714
+ value = spaceTrim.spaceTrim(value);
1551
1715
  value = value.replace(/```$/g, '');
1552
- value = spacetrim.spaceTrim(value);
1716
+ value = spaceTrim.spaceTrim(value);
1553
1717
  return value;
1554
1718
  }
1555
1719
 
@@ -1570,7 +1734,7 @@
1570
1734
  var trimmedText = text;
1571
1735
  // Remove leading and trailing spaces and newlines
1572
1736
  if (isTrimmed) {
1573
- trimmedText = spacetrim.spaceTrim(trimmedText);
1737
+ trimmedText = spaceTrim.spaceTrim(trimmedText);
1574
1738
  }
1575
1739
  var processedText = trimmedText;
1576
1740
  if (isIntroduceSentenceRemoved) {
@@ -1579,7 +1743,7 @@
1579
1743
  // Remove the introduce sentence and quotes by replacing it with an empty string
1580
1744
  processedText = processedText.replace(introduceSentenceRegex, '');
1581
1745
  }
1582
- processedText = spacetrim.spaceTrim(processedText);
1746
+ processedText = spaceTrim.spaceTrim(processedText);
1583
1747
  }
1584
1748
  if (processedText.length < 3) {
1585
1749
  return trimmedText;
@@ -1690,7 +1854,7 @@
1690
1854
  if ( /* version === '1.0.0' || */version === '2.0.0' || version === '3.0.0') {
1691
1855
  return false;
1692
1856
  }
1693
- // <- TODO: !!!! Check isValidPromptbookVersion against PROMPTBOOK_VERSIONS
1857
+ // <- TODO: !!! Check isValidPromptbookVersion against PROMPTBOOK_VERSIONS
1694
1858
  return true;
1695
1859
  }
1696
1860
 
@@ -1812,7 +1976,7 @@
1812
1976
  /**
1813
1977
  * The version of the Promptbook library
1814
1978
  */
1815
- var PROMPTBOOK_VERSION = '0.61.0-8';
1979
+ var PROMPTBOOK_VERSION = '0.61.0-30';
1816
1980
  // TODO: !!!! List here all the versions and annotate + put into script
1817
1981
 
1818
1982
  // @promptbook/utils
@@ -1832,8 +1996,10 @@
1832
1996
 
1833
1997
  Object.defineProperty(exports, 'spaceTrim', {
1834
1998
  enumerable: true,
1835
- get: function () { return spacetrim.spaceTrim; }
1999
+ get: function () { return spaceTrim.spaceTrim; }
1836
2000
  });
2001
+ exports.$currentDate = $currentDate;
2002
+ exports.$randomSeed = $randomSeed;
1837
2003
  exports.CountUtils = CountUtils;
1838
2004
  exports.DIACRITIC_VARIANTS_LETTERS = DIACRITIC_VARIANTS_LETTERS;
1839
2005
  exports.PROMPTBOOK_VERSION = PROMPTBOOK_VERSION;
@@ -1847,8 +2013,8 @@
1847
2013
  exports.decapitalize = decapitalize;
1848
2014
  exports.difference = difference;
1849
2015
  exports.extractBlock = extractBlock;
1850
- exports.extractParameters = extractParameters;
1851
- exports.extractParametersFromPromptTemplate = extractParametersFromPromptTemplate;
2016
+ exports.extractParameterNames = extractParameterNames;
2017
+ exports.extractParameterNamesFromPromptTemplate = extractParameterNamesFromPromptTemplate;
1852
2018
  exports.extractVariables = extractVariables;
1853
2019
  exports.forEachAsync = forEachAsync;
1854
2020
  exports.intersection = intersection;