@promptbook/core 0.59.0-8 → 0.59.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 (591) hide show
  1. package/esm/index.es.js +559 -528
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/promptbook-library/index.d.ts +25 -0
  4. package/esm/typings/src/_packages/cli.index.d.ts +10 -0
  5. package/{umd/typings → esm/typings/src}/_packages/core.index.d.ts +11 -9
  6. package/esm/typings/src/_packages/node.index.d.ts +4 -0
  7. package/{umd/typings → esm/typings/src}/_packages/types.index.d.ts +4 -3
  8. package/esm/typings/src/cli/actions/hello.d.ts +7 -0
  9. package/esm/typings/src/cli/actions/make.d.ts +7 -0
  10. package/esm/typings/src/cli/actions/prettify.d.ts +7 -0
  11. package/esm/typings/{conversion/prettify/prettifyPromptbookStringCli.d.ts → src/cli/promptbookCli.d.ts} +2 -2
  12. package/esm/typings/{config.d.ts → src/config.d.ts} +4 -0
  13. package/esm/typings/{conversion → src/conversion}/promptbookStringToJson.d.ts +5 -3
  14. package/esm/typings/src/conversion/promptbookStringToJsonSync.d.ts +23 -0
  15. package/{umd/typings/conversion/validation/validatePromptbookJson.d.ts → esm/typings/src/conversion/validation/validatePromptbook.d.ts} +2 -2
  16. package/esm/typings/src/execution/EmbeddingVector.d.ts +8 -0
  17. package/esm/typings/{execution → src/execution}/LlmExecutionTools.d.ts +1 -0
  18. package/esm/typings/{execution → src/execution}/PromptResult.d.ts +11 -0
  19. package/esm/typings/src/execution/embeddingVectorToString.d.ts +5 -0
  20. package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +21 -0
  21. package/esm/typings/{promptbook-library → src/library}/SimplePromptbookLibrary.d.ts +3 -1
  22. package/esm/typings/{promptbook-library/constructors/createPromptbookLibraryFromDirectory.d.ts → src/library/constructors/createLibraryFromDirectory.d.ts} +2 -2
  23. package/esm/typings/src/library/constructors/createLibraryFromJson.d.ts +12 -0
  24. package/esm/typings/{promptbook-library/constructors/createPromptbookLibraryFromPromise.d.ts → src/library/constructors/createLibraryFromPromise.d.ts} +3 -7
  25. package/esm/typings/{promptbook-library/constructors/createPromptbookLibraryFromUrl.d.ts → src/library/constructors/createLibraryFromUrl.d.ts} +2 -2
  26. package/esm/typings/{promptbook-library/constructors/createPromptbookSublibrary.d.ts → src/library/constructors/createSublibrary.d.ts} +1 -1
  27. package/esm/typings/src/library/libraryToJson.d.ts +8 -0
  28. package/{umd/typings → esm/typings/src}/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +4 -0
  29. package/esm/typings/{llm-providers → src/llm-providers}/anthropic-claude/anthropic-claude-models.d.ts +1 -0
  30. package/{umd/typings → esm/typings/src}/llm-providers/openai/OpenAiExecutionTools.d.ts +13 -0
  31. package/esm/typings/{llm-providers → src/llm-providers}/openai/computeOpenaiUsage.d.ts +4 -2
  32. package/{umd/typings → esm/typings/src}/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +1 -1
  33. package/esm/typings/{llm-providers → src/llm-providers}/remote/startRemoteServer.d.ts +1 -1
  34. package/{umd/typings → esm/typings/src}/types/ModelRequirements.d.ts +1 -1
  35. package/esm/typings/{types → src/types}/PromptbookJson/KnowledgeJson.d.ts +1 -1
  36. package/esm/typings/{types → src/types}/PromptbookJson/MaterialKnowledgePieceJson.d.ts +4 -3
  37. package/package.json +2 -2
  38. package/umd/index.umd.js +566 -533
  39. package/umd/index.umd.js.map +1 -1
  40. package/umd/typings/promptbook-library/index.d.ts +25 -0
  41. package/umd/typings/src/_packages/cli.index.d.ts +10 -0
  42. package/{esm/typings → umd/typings/src}/_packages/core.index.d.ts +11 -9
  43. package/umd/typings/src/_packages/node.index.d.ts +4 -0
  44. package/{esm/typings → umd/typings/src}/_packages/types.index.d.ts +4 -3
  45. package/umd/typings/src/cli/actions/hello.d.ts +7 -0
  46. package/umd/typings/src/cli/actions/make.d.ts +7 -0
  47. package/umd/typings/src/cli/actions/prettify.d.ts +7 -0
  48. package/umd/typings/{conversion/prettify/prettifyPromptbookStringCli.d.ts → src/cli/promptbookCli.d.ts} +2 -2
  49. package/umd/typings/{config.d.ts → src/config.d.ts} +4 -0
  50. package/umd/typings/{conversion → src/conversion}/promptbookStringToJson.d.ts +5 -3
  51. package/umd/typings/src/conversion/promptbookStringToJsonSync.d.ts +23 -0
  52. package/{esm/typings/conversion/validation/validatePromptbookJson.d.ts → umd/typings/src/conversion/validation/validatePromptbook.d.ts} +2 -2
  53. package/umd/typings/src/execution/EmbeddingVector.d.ts +8 -0
  54. package/umd/typings/{execution → src/execution}/LlmExecutionTools.d.ts +1 -0
  55. package/umd/typings/{execution → src/execution}/PromptResult.d.ts +11 -0
  56. package/umd/typings/src/execution/embeddingVectorToString.d.ts +5 -0
  57. package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +21 -0
  58. package/umd/typings/{promptbook-library → src/library}/SimplePromptbookLibrary.d.ts +3 -1
  59. package/umd/typings/{promptbook-library/constructors/createPromptbookLibraryFromDirectory.d.ts → src/library/constructors/createLibraryFromDirectory.d.ts} +2 -2
  60. package/umd/typings/src/library/constructors/createLibraryFromJson.d.ts +12 -0
  61. package/umd/typings/{promptbook-library/constructors/createPromptbookLibraryFromPromise.d.ts → src/library/constructors/createLibraryFromPromise.d.ts} +3 -7
  62. package/umd/typings/{promptbook-library/constructors/createPromptbookLibraryFromUrl.d.ts → src/library/constructors/createLibraryFromUrl.d.ts} +2 -2
  63. package/umd/typings/{promptbook-library/constructors/createPromptbookSublibrary.d.ts → src/library/constructors/createSublibrary.d.ts} +1 -1
  64. package/umd/typings/src/library/libraryToJson.d.ts +8 -0
  65. package/{esm/typings → umd/typings/src}/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +4 -0
  66. package/umd/typings/{llm-providers → src/llm-providers}/anthropic-claude/anthropic-claude-models.d.ts +1 -0
  67. package/{esm/typings → umd/typings/src}/llm-providers/openai/OpenAiExecutionTools.d.ts +13 -0
  68. package/umd/typings/{llm-providers → src/llm-providers}/openai/computeOpenaiUsage.d.ts +4 -2
  69. package/{esm/typings → umd/typings/src}/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +1 -1
  70. package/umd/typings/{llm-providers → src/llm-providers}/remote/startRemoteServer.d.ts +1 -1
  71. package/{esm/typings → umd/typings/src}/types/ModelRequirements.d.ts +1 -1
  72. package/umd/typings/{types → src/types}/PromptbookJson/KnowledgeJson.d.ts +1 -1
  73. package/umd/typings/{types → src/types}/PromptbookJson/MaterialKnowledgePieceJson.d.ts +4 -3
  74. package/umd/typings/src/utils/trimCodeBlock.test.d.ts +1 -0
  75. package/umd/typings/src/utils/trimEndOfCodeBlock.test.d.ts +1 -0
  76. package/umd/typings/src/utils/unwrapResult.test.d.ts +1 -0
  77. package/umd/typings/src/utils/validators/url/isValidUrl.test.d.ts +1 -0
  78. package/esm/typings/_packages/cli.index.d.ts +0 -10
  79. package/esm/typings/_packages/node.index.d.ts +0 -4
  80. package/esm/typings/knowledge/prepare-knowledge/_common/IndexPreparer.d.ts +0 -4
  81. package/esm/typings/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +0 -7
  82. package/esm/typings/promptbook-library/constructors/createPromptbookLibraryFromSources.d.ts +0 -16
  83. package/umd/typings/_packages/cli.index.d.ts +0 -10
  84. package/umd/typings/_packages/node.index.d.ts +0 -4
  85. package/umd/typings/knowledge/prepare-knowledge/_common/IndexPreparer.d.ts +0 -4
  86. package/umd/typings/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +0 -7
  87. package/umd/typings/promptbook-library/constructors/createPromptbookLibraryFromSources.d.ts +0 -16
  88. /package/esm/typings/{_packages → src/_packages}/anthropic-claude.index.d.ts +0 -0
  89. /package/esm/typings/{_packages → src/_packages}/azure-openai.index.d.ts +0 -0
  90. /package/esm/typings/{_packages → src/_packages}/execute-javascript.index.d.ts +0 -0
  91. /package/esm/typings/{_packages → src/_packages}/fake-llm.index.d.ts +0 -0
  92. /package/esm/typings/{_packages → src/_packages}/langtail.index.d.ts +0 -0
  93. /package/esm/typings/{_packages → src/_packages}/openai.index.d.ts +0 -0
  94. /package/esm/typings/{_packages → src/_packages}/remote-client.index.d.ts +0 -0
  95. /package/esm/typings/{_packages → src/_packages}/remote-server.index.d.ts +0 -0
  96. /package/esm/typings/{_packages → src/_packages}/utils.index.d.ts +0 -0
  97. /package/esm/typings/{conversion → src/conversion}/prettify/PrettifyOptions.d.ts +0 -0
  98. /package/esm/typings/{conversion → src/conversion}/prettify/prettifyPromptbookString.d.ts +0 -0
  99. /package/esm/typings/{conversion → src/conversion}/prettify/renderPromptbookMermaid.d.ts +0 -0
  100. /package/esm/typings/{conversion → src/conversion}/promptbookJsonToString.d.ts +0 -0
  101. /package/esm/typings/{conversion → src/conversion}/promptbookStringToJson.test.d.ts +0 -0
  102. /package/esm/typings/{conversion/utils/extractParametersFromPromptTemplate.test.d.ts → src/conversion/promptbookStringToJsonSync.test.d.ts} +0 -0
  103. /package/esm/typings/{conversion → src/conversion}/utils/extractParametersFromPromptTemplate.d.ts +0 -0
  104. /package/{umd/typings → esm/typings/src}/conversion/utils/extractParametersFromPromptTemplate.test.d.ts +0 -0
  105. /package/esm/typings/{conversion → src/conversion}/utils/extractVariables.d.ts +0 -0
  106. /package/esm/typings/{conversion → src/conversion}/utils/extractVariables.test.d.ts +0 -0
  107. /package/esm/typings/{conversion → src/conversion}/utils/parseCommand.d.ts +0 -0
  108. /package/esm/typings/{conversion → src/conversion}/utils/parseCommand.test.d.ts +0 -0
  109. /package/esm/typings/{conversion → src/conversion}/utils/parseNumber.d.ts +0 -0
  110. /package/esm/typings/{conversion → src/conversion}/utils/parseNumber.test.d.ts +0 -0
  111. /package/esm/typings/{conversion → src/conversion}/utils/renameParameter.d.ts +0 -0
  112. /package/esm/typings/{conversion → src/conversion}/utils/renameParameter.test.d.ts +0 -0
  113. /package/esm/typings/{conversion → src/conversion}/utils/titleToName.d.ts +0 -0
  114. /package/esm/typings/{conversion → src/conversion}/utils/titleToName.test.d.ts +0 -0
  115. /package/esm/typings/{conversion → src/conversion}/validation/_importPromptbook.d.ts +0 -0
  116. /package/esm/typings/{conversion → src/conversion}/validation/promptbookStringToJson-syntaxErrors.test.d.ts +0 -0
  117. /package/esm/typings/{conversion/validation/validatePromptbookJson-logicErrors.test.d.ts → src/conversion/validation/validatePromptbook-logicErrors.test.d.ts} +0 -0
  118. /package/esm/typings/{conversion/validation/validatePromptbookJson.test.d.ts → src/conversion/validation/validatePromptbook.test.d.ts} +0 -0
  119. /package/esm/typings/{errors → src/errors}/PromptbookExecutionError.d.ts +0 -0
  120. /package/esm/typings/{errors → src/errors}/PromptbookLibraryError.d.ts +0 -0
  121. /package/esm/typings/{errors → src/errors}/PromptbookLogicError.d.ts +0 -0
  122. /package/esm/typings/{errors → src/errors}/PromptbookNotFoundError.d.ts +0 -0
  123. /package/esm/typings/{errors → src/errors}/PromptbookReferenceError.d.ts +0 -0
  124. /package/esm/typings/{errors → src/errors}/PromptbookSyntaxError.d.ts +0 -0
  125. /package/esm/typings/{errors → src/errors}/TemplateError.d.ts +0 -0
  126. /package/esm/typings/{errors → src/errors}/UnexpectedError.d.ts +0 -0
  127. /package/esm/typings/{errors → src/errors}/_ExpectError.d.ts +0 -0
  128. /package/esm/typings/{execution → src/execution}/CommonExecutionToolsOptions.d.ts +0 -0
  129. /package/esm/typings/{execution → src/execution}/ExecutionTools.d.ts +0 -0
  130. /package/esm/typings/{execution → src/execution}/PromptbookExecutor.d.ts +0 -0
  131. /package/esm/typings/{execution → src/execution}/ScriptExecutionTools.d.ts +0 -0
  132. /package/esm/typings/{execution → src/execution}/UserInterfaceTools.d.ts +0 -0
  133. /package/esm/typings/{execution → src/execution}/addPromptResultUsage.test.d.ts +0 -0
  134. /package/esm/typings/{execution → src/execution}/assertsExecutionSuccessful.d.ts +0 -0
  135. /package/esm/typings/{execution → src/execution}/createPromptbookExecutor.d.ts +0 -0
  136. /package/esm/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts +0 -0
  137. /package/esm/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +0 -0
  138. /package/esm/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +0 -0
  139. /package/esm/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +0 -0
  140. /package/esm/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +0 -0
  141. /package/esm/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +0 -0
  142. /package/esm/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.test.d.ts +0 -0
  143. /package/esm/typings/{execution → src/execution}/translation/automatic-translate/translateMessages.d.ts +0 -0
  144. /package/esm/typings/{execution → src/execution}/utils/addUsage.d.ts +0 -0
  145. /package/esm/typings/{execution → src/execution}/utils/addUsage.test.d.ts +0 -0
  146. /package/esm/typings/{execution → src/execution}/utils/checkExpectations.d.ts +0 -0
  147. /package/esm/typings/{execution → src/execution}/utils/checkExpectations.test.d.ts +0 -0
  148. /package/esm/typings/{execution → src/execution}/utils/computeUsageCounts.d.ts +0 -0
  149. /package/esm/typings/{execution → src/execution}/utils/forEachAsync.d.ts +0 -0
  150. /package/esm/typings/{execution → src/execution}/utils/replaceParameters.d.ts +0 -0
  151. /package/esm/typings/{execution → src/execution}/utils/replaceParameters.test.d.ts +0 -0
  152. /package/esm/typings/{execution → src/execution}/utils/uncertainNumber.d.ts +0 -0
  153. /package/esm/typings/{execution → src/execution}/utils/usageToWorktime.d.ts +0 -0
  154. /package/esm/typings/{execution → src/execution}/utils/usageToWorktime.test.d.ts +0 -0
  155. /package/esm/typings/{expectations → src/expectations}/drafts/isDomainNameFree.d.ts +0 -0
  156. /package/esm/typings/{expectations → src/expectations}/drafts/isGithubNameFree.d.ts +0 -0
  157. /package/esm/typings/{formats → src/formats}/_common/FormatDefinition.d.ts +0 -0
  158. /package/esm/typings/{formats → src/formats}/csv/ListFormatDefinition.d.ts +0 -0
  159. /package/esm/typings/{formats → src/formats}/index.d.ts +0 -0
  160. /package/esm/typings/{formats → src/formats}/json/JsonFormatDefinition.d.ts +0 -0
  161. /package/esm/typings/{formats → src/formats}/json/utils/isValidJsonString.d.ts +0 -0
  162. /package/esm/typings/{formats → src/formats}/json/utils/isValidJsonString.test.d.ts +0 -0
  163. /package/esm/typings/{formats → src/formats}/list/ListFormatDefinition.d.ts +0 -0
  164. /package/esm/typings/{formats → src/formats}/xml/XmlFormatDefinition.d.ts +0 -0
  165. /package/esm/typings/{knowledge → src/knowledge}/dialogs/callback/CallbackInterfaceTools.d.ts +0 -0
  166. /package/esm/typings/{knowledge → src/knowledge}/dialogs/callback/CallbackInterfaceToolsOptions.d.ts +0 -0
  167. /package/esm/typings/{knowledge → src/knowledge}/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +0 -0
  168. /package/esm/typings/{knowledge → src/knowledge}/dialogs/user-interface-execution-tools.test.d.ts +0 -0
  169. /package/esm/typings/{knowledge → src/knowledge}/prepare-knowledge/markdown/playground/markdown-knowledge-playground.d.ts +0 -0
  170. /package/esm/typings/{knowledge → src/knowledge}/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.test.d.ts +0 -0
  171. /package/esm/typings/{knowledge → src/knowledge}/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +0 -0
  172. /package/esm/typings/{knowledge → src/knowledge}/prepare-knowledge/pdf/prepareKnowledgeFromPdf.test.d.ts +0 -0
  173. /package/esm/typings/{promptbook-library → src/library}/PromptbookLibrary.d.ts +0 -0
  174. /package/esm/typings/{llm-providers/mocked/fakeTextToExpectations.test.d.ts → src/library/constructors/createLibraryFromDirectory.test.d.ts} +0 -0
  175. /package/esm/typings/{llm-providers/mocked/faked-completion.test.d.ts → src/library/constructors/createLibraryFromJson.test.d.ts} +0 -0
  176. /package/esm/typings/{llm-providers/openai/computeUsage.test.d.ts → src/library/constructors/createLibraryFromPromise.test.d.ts} +0 -0
  177. /package/esm/typings/{promptbook-library → src/library}/constructors/justTestFsImport.d.ts +0 -0
  178. /package/esm/typings/{promptbook-library/constructors/createPromptbookLibraryFromDirectory.test.d.ts → src/library/libraryToJson.test.d.ts} +0 -0
  179. /package/esm/typings/{llm-providers → src/llm-providers}/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +0 -0
  180. /package/esm/typings/{llm-providers → src/llm-providers}/anthropic-claude/playground/playground.d.ts +0 -0
  181. /package/esm/typings/{llm-providers → src/llm-providers}/azure-openai/AzureOpenAiExecutionTools.d.ts +0 -0
  182. /package/esm/typings/{llm-providers → src/llm-providers}/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +0 -0
  183. /package/esm/typings/{llm-providers → src/llm-providers}/azure-openai/playground/playground.d.ts +0 -0
  184. /package/esm/typings/{llm-providers → src/llm-providers}/langtail/LangtailExecutionTools.d.ts +0 -0
  185. /package/esm/typings/{llm-providers → src/llm-providers}/langtail/LangtailExecutionToolsOptions.d.ts +0 -0
  186. /package/esm/typings/{llm-providers → src/llm-providers}/langtail/playground/playground.d.ts +0 -0
  187. /package/esm/typings/{llm-providers → src/llm-providers}/mocked/MockedEchoLlmExecutionTools.d.ts +0 -0
  188. /package/esm/typings/{llm-providers → src/llm-providers}/mocked/MockedFackedLlmExecutionTools.d.ts +0 -0
  189. /package/esm/typings/{llm-providers → src/llm-providers}/mocked/fakeTextToExpectations.d.ts +0 -0
  190. /package/{umd/typings → esm/typings/src}/llm-providers/mocked/fakeTextToExpectations.test.d.ts +0 -0
  191. /package/{umd/typings → esm/typings/src}/llm-providers/mocked/faked-completion.test.d.ts +0 -0
  192. /package/esm/typings/{llm-providers → src/llm-providers}/mocked/joker.test.d.ts +0 -0
  193. /package/esm/typings/{llm-providers → src/llm-providers}/mocked/mocked-chat.test.d.ts +0 -0
  194. /package/esm/typings/{llm-providers → src/llm-providers}/mocked/mocked-completion.test.d.ts +0 -0
  195. /package/esm/typings/{llm-providers → src/llm-providers}/multiple/MultipleLlmExecutionTools.d.ts +0 -0
  196. /package/esm/typings/{llm-providers → src/llm-providers}/multiple/MultipleLlmExecutionToolsOptions.d.ts +0 -0
  197. /package/esm/typings/{llm-providers → src/llm-providers}/multiple/playground/playground.d.ts +0 -0
  198. /package/esm/typings/{llm-providers → src/llm-providers}/openai/OpenAiExecutionToolsOptions.d.ts +0 -0
  199. /package/esm/typings/{llm-providers → src/llm-providers}/openai/computeUsage.d.ts +0 -0
  200. /package/{umd/typings → esm/typings/src}/llm-providers/openai/computeUsage.test.d.ts +0 -0
  201. /package/esm/typings/{llm-providers → src/llm-providers}/openai/openai-models.d.ts +0 -0
  202. /package/esm/typings/{llm-providers → src/llm-providers}/openai/playground/playground.d.ts +0 -0
  203. /package/esm/typings/{llm-providers → src/llm-providers}/remote/RemoteLlmExecutionTools.d.ts +0 -0
  204. /package/esm/typings/{llm-providers → src/llm-providers}/remote/RemoteLlmExecutionToolsOptions.d.ts +0 -0
  205. /package/esm/typings/{llm-providers → src/llm-providers}/remote/interfaces/Promptbook_Server_Error.d.ts +0 -0
  206. /package/esm/typings/{llm-providers → src/llm-providers}/remote/interfaces/Promptbook_Server_Progress.d.ts +0 -0
  207. /package/esm/typings/{llm-providers → src/llm-providers}/remote/interfaces/Promptbook_Server_Request.d.ts +0 -0
  208. /package/esm/typings/{llm-providers → src/llm-providers}/remote/interfaces/Promptbook_Server_Response.d.ts +0 -0
  209. /package/esm/typings/{scripting → src/scripting}/_test/custom-function-async.test.ts.test.d.ts +0 -0
  210. /package/esm/typings/{scripting → src/scripting}/_test/custom-function-missing.test.d.ts +0 -0
  211. /package/esm/typings/{scripting → src/scripting}/_test/custom-function-with-dependencies.test.d.ts +0 -0
  212. /package/esm/typings/{scripting → src/scripting}/_test/custom-function.test.d.ts +0 -0
  213. /package/esm/typings/{scripting → src/scripting}/_test/postprocessing.test.d.ts +0 -0
  214. /package/esm/typings/{scripting → src/scripting}/_test/script-execution-errors.test.d.ts +0 -0
  215. /package/esm/typings/{scripting → src/scripting}/_test/script-execution-tools.test.d.ts +0 -0
  216. /package/esm/typings/{scripting → src/scripting}/javascript/JavascriptEvalExecutionTools.d.ts +0 -0
  217. /package/esm/typings/{scripting → src/scripting}/javascript/JavascriptEvalExecutionTools.test.d.ts +0 -0
  218. /package/esm/typings/{scripting → src/scripting}/javascript/JavascriptExecutionTools.d.ts +0 -0
  219. /package/esm/typings/{scripting → src/scripting}/javascript/JavascriptExecutionToolsOptions.d.ts +0 -0
  220. /package/esm/typings/{scripting → src/scripting}/javascript/utils/preserve.d.ts +0 -0
  221. /package/esm/typings/{scripting → src/scripting}/javascript/utils/unknownToString.d.ts +0 -0
  222. /package/esm/typings/{scripting → src/scripting}/python/PythonExecutionTools.d.ts +0 -0
  223. /package/esm/typings/{scripting → src/scripting}/typescript/TypescriptExecutionTools.d.ts +0 -0
  224. /package/esm/typings/{types → src/types}/Command.d.ts +0 -0
  225. /package/esm/typings/{types → src/types}/ExecutionTypes.d.ts +0 -0
  226. /package/esm/typings/{types → src/types}/Parameters.d.ts +0 -0
  227. /package/esm/typings/{types → src/types}/Prompt.d.ts +0 -0
  228. /package/esm/typings/{types → src/types}/PromptbookJson/PromptTemplateJson.d.ts +0 -0
  229. /package/esm/typings/{types → src/types}/PromptbookJson/PromptTemplateParameterJson.d.ts +0 -0
  230. /package/esm/typings/{types → src/types}/PromptbookJson/PromptbookJson.d.ts +0 -0
  231. /package/esm/typings/{types → src/types}/PromptbookString.d.ts +0 -0
  232. /package/esm/typings/{types → src/types}/ScriptLanguage.d.ts +0 -0
  233. /package/esm/typings/{types → src/types}/TaskProgress.d.ts +0 -0
  234. /package/esm/typings/{types → src/types}/execution-report/ExecutionReportJson.d.ts +0 -0
  235. /package/esm/typings/{types → src/types}/execution-report/ExecutionReportString.d.ts +0 -0
  236. /package/esm/typings/{types → src/types}/execution-report/ExecutionReportStringOptions.d.ts +0 -0
  237. /package/esm/typings/{types → src/types}/execution-report/config.d.ts +0 -0
  238. /package/esm/typings/{types → src/types}/execution-report/countWorkingDuration.d.ts +0 -0
  239. /package/esm/typings/{types → src/types}/execution-report/countWorkingDuration.test.d.ts +0 -0
  240. /package/esm/typings/{types → src/types}/execution-report/executionReportJsonToString.d.ts +0 -0
  241. /package/esm/typings/{types → src/types}/typeAliasEmoji.d.ts +0 -0
  242. /package/esm/typings/{types → src/types}/typeAliases.d.ts +0 -0
  243. /package/esm/typings/{utils → src/utils}/FromtoItems.d.ts +0 -0
  244. /package/esm/typings/{utils → src/utils}/emojis.d.ts +0 -0
  245. /package/esm/typings/{utils → src/utils}/expectation-counters/countCharacters.d.ts +0 -0
  246. /package/esm/typings/{utils → src/utils}/expectation-counters/countCharacters.test.d.ts +0 -0
  247. /package/esm/typings/{utils → src/utils}/expectation-counters/countLines.d.ts +0 -0
  248. /package/esm/typings/{utils → src/utils}/expectation-counters/countLines.test.d.ts +0 -0
  249. /package/esm/typings/{utils → src/utils}/expectation-counters/countPages.d.ts +0 -0
  250. /package/esm/typings/{utils → src/utils}/expectation-counters/countPages.test.d.ts +0 -0
  251. /package/esm/typings/{utils → src/utils}/expectation-counters/countParagraphs.d.ts +0 -0
  252. /package/esm/typings/{utils → src/utils}/expectation-counters/countParagraphs.test.d.ts +0 -0
  253. /package/esm/typings/{utils → src/utils}/expectation-counters/countSentences.d.ts +0 -0
  254. /package/esm/typings/{utils → src/utils}/expectation-counters/countSentences.test.d.ts +0 -0
  255. /package/esm/typings/{utils → src/utils}/expectation-counters/countWords.d.ts +0 -0
  256. /package/esm/typings/{utils → src/utils}/expectation-counters/countWords.test.d.ts +0 -0
  257. /package/esm/typings/{utils → src/utils}/expectation-counters/index.d.ts +0 -0
  258. /package/esm/typings/{utils → src/utils}/extractParameters.d.ts +0 -0
  259. /package/esm/typings/{utils → src/utils}/extractParameters.test.d.ts +0 -0
  260. /package/esm/typings/{utils → src/utils}/formatNumber.d.ts +0 -0
  261. /package/esm/typings/{utils → src/utils}/formatNumber.test.d.ts +0 -0
  262. /package/esm/typings/{utils → src/utils}/getCurrentIsoDate.d.ts +0 -0
  263. /package/esm/typings/{utils → src/utils}/isRunningInWhatever.d.ts +0 -0
  264. /package/esm/typings/{utils → src/utils}/just.d.ts +0 -0
  265. /package/esm/typings/{utils → src/utils}/markdown/addAutoGeneratedSection.d.ts +0 -0
  266. /package/esm/typings/{utils → src/utils}/markdown/addAutoGeneratedSection.test.d.ts +0 -0
  267. /package/esm/typings/{utils → src/utils}/markdown/createMarkdownChart.d.ts +0 -0
  268. /package/esm/typings/{utils → src/utils}/markdown/createMarkdownChart.test.d.ts +0 -0
  269. /package/esm/typings/{utils → src/utils}/markdown/createMarkdownTable.d.ts +0 -0
  270. /package/esm/typings/{utils → src/utils}/markdown/createMarkdownTable.test.d.ts +0 -0
  271. /package/esm/typings/{utils → src/utils}/markdown/escapeMarkdownBlock.d.ts +0 -0
  272. /package/esm/typings/{utils → src/utils}/markdown/escapeMarkdownBlock.test.d.ts +0 -0
  273. /package/esm/typings/{utils → src/utils}/markdown/extractAllBlocksFromMarkdown.d.ts +0 -0
  274. /package/esm/typings/{utils → src/utils}/markdown/extractAllBlocksFromMarkdown.test.d.ts +0 -0
  275. /package/esm/typings/{utils → src/utils}/markdown/extractAllListItemsFromMarkdown.d.ts +0 -0
  276. /package/esm/typings/{utils → src/utils}/markdown/extractAllListItemsFromMarkdown.test.d.ts +0 -0
  277. /package/esm/typings/{utils → src/utils}/markdown/extractOneBlockFromMarkdown.d.ts +0 -0
  278. /package/esm/typings/{utils → src/utils}/markdown/extractOneBlockFromMarkdown.test.d.ts +0 -0
  279. /package/esm/typings/{utils → src/utils}/markdown/prettifyMarkdown.d.ts +0 -0
  280. /package/esm/typings/{utils → src/utils}/markdown/prettifyMarkdown.test.d.ts +0 -0
  281. /package/esm/typings/{utils → src/utils}/markdown/removeContentComments.d.ts +0 -0
  282. /package/esm/typings/{utils → src/utils}/markdown/removeContentComments.test.d.ts +0 -0
  283. /package/esm/typings/{utils → src/utils}/markdown/removeMarkdownFormatting.d.ts +0 -0
  284. /package/esm/typings/{utils → src/utils}/markdown/removeMarkdownFormatting.test.d.ts +0 -0
  285. /package/esm/typings/{utils → src/utils}/markdown-json/MarkdownStructure.d.ts +0 -0
  286. /package/esm/typings/{utils → src/utils}/markdown-json/countMarkdownStructureDeepness.d.ts +0 -0
  287. /package/esm/typings/{utils → src/utils}/markdown-json/countMarkdownStructureDeepness.test.d.ts +0 -0
  288. /package/esm/typings/{utils → src/utils}/markdown-json/markdownToMarkdownStructure.d.ts +0 -0
  289. /package/esm/typings/{utils → src/utils}/markdown-json/markdownToMarkdownStructure.test.d.ts +0 -0
  290. /package/esm/typings/{utils → src/utils}/normalization/DIACRITIC_VARIANTS_LETTERS.d.ts +0 -0
  291. /package/esm/typings/{utils → src/utils}/normalization/IKeywords.d.ts +0 -0
  292. /package/esm/typings/{utils → src/utils}/normalization/capitalize.d.ts +0 -0
  293. /package/esm/typings/{utils → src/utils}/normalization/capitalize.test.d.ts +0 -0
  294. /package/esm/typings/{utils → src/utils}/normalization/decapitalize.d.ts +0 -0
  295. /package/esm/typings/{utils → src/utils}/normalization/decapitalize.test.d.ts +0 -0
  296. /package/esm/typings/{utils → src/utils}/normalization/isValidKeyword.d.ts +0 -0
  297. /package/esm/typings/{utils → src/utils}/normalization/isValidKeyword.test.d.ts +0 -0
  298. /package/esm/typings/{utils → src/utils}/normalization/nameToUriPart.d.ts +0 -0
  299. /package/esm/typings/{utils → src/utils}/normalization/nameToUriPart.test.d.ts +0 -0
  300. /package/esm/typings/{utils → src/utils}/normalization/nameToUriParts.d.ts +0 -0
  301. /package/esm/typings/{utils → src/utils}/normalization/nameToUriParts.test.d.ts +0 -0
  302. /package/esm/typings/{utils → src/utils}/normalization/normalize-to-kebab-case.d.ts +0 -0
  303. /package/esm/typings/{utils → src/utils}/normalization/normalize-to-kebab-case.test.d.ts +0 -0
  304. /package/esm/typings/{utils → src/utils}/normalization/normalizeTo_PascalCase.d.ts +0 -0
  305. /package/esm/typings/{utils → src/utils}/normalization/normalizeTo_PascalCase.test.d.ts +0 -0
  306. /package/esm/typings/{utils → src/utils}/normalization/normalizeTo_SCREAMING_CASE.d.ts +0 -0
  307. /package/esm/typings/{utils → src/utils}/normalization/normalizeTo_SCREAMING_CASE.test.d.ts +0 -0
  308. /package/esm/typings/{utils → src/utils}/normalization/normalizeTo_camelCase.d.ts +0 -0
  309. /package/esm/typings/{utils → src/utils}/normalization/normalizeTo_camelCase.test.d.ts +0 -0
  310. /package/esm/typings/{utils → src/utils}/normalization/normalizeTo_snake_case.d.ts +0 -0
  311. /package/esm/typings/{utils → src/utils}/normalization/normalizeTo_snake_case.test.d.ts +0 -0
  312. /package/esm/typings/{utils → src/utils}/normalization/normalizeWhitespaces.d.ts +0 -0
  313. /package/esm/typings/{utils → src/utils}/normalization/normalizeWhitespaces.test.d.ts +0 -0
  314. /package/esm/typings/{utils → src/utils}/normalization/parseKeywords.d.ts +0 -0
  315. /package/esm/typings/{utils → src/utils}/normalization/parseKeywords.test.d.ts +0 -0
  316. /package/esm/typings/{utils → src/utils}/normalization/parseKeywordsFromString.d.ts +0 -0
  317. /package/esm/typings/{utils → src/utils}/normalization/parseKeywordsFromString.test.d.ts +0 -0
  318. /package/esm/typings/{utils → src/utils}/normalization/removeDiacritics.d.ts +0 -0
  319. /package/esm/typings/{utils → src/utils}/normalization/removeDiacritics.test.d.ts +0 -0
  320. /package/esm/typings/{utils → src/utils}/normalization/searchKeywords.d.ts +0 -0
  321. /package/esm/typings/{utils → src/utils}/normalization/searchKeywords.test.d.ts +0 -0
  322. /package/esm/typings/{utils → src/utils}/postprocessing/extractBlock.d.ts +0 -0
  323. /package/esm/typings/{utils → src/utils}/removeEmojis.d.ts +0 -0
  324. /package/esm/typings/{utils → src/utils}/removeEmojis.test.d.ts +0 -0
  325. /package/esm/typings/{utils → src/utils}/removeQuotes.d.ts +0 -0
  326. /package/esm/typings/{utils → src/utils}/removeQuotes.test.d.ts +0 -0
  327. /package/esm/typings/{utils → src/utils}/sets/difference.d.ts +0 -0
  328. /package/esm/typings/{utils → src/utils}/sets/difference.test.d.ts +0 -0
  329. /package/esm/typings/{utils → src/utils}/sets/intersection.d.ts +0 -0
  330. /package/esm/typings/{utils → src/utils}/sets/intersection.test.d.ts +0 -0
  331. /package/esm/typings/{utils → src/utils}/sets/union.d.ts +0 -0
  332. /package/esm/typings/{utils → src/utils}/sets/union.test.d.ts +0 -0
  333. /package/esm/typings/{utils → src/utils}/trimCodeBlock.d.ts +0 -0
  334. /package/esm/typings/{utils → src/utils}/trimCodeBlock.test.d.ts +0 -0
  335. /package/esm/typings/{utils → src/utils}/trimEndOfCodeBlock.d.ts +0 -0
  336. /package/esm/typings/{utils → src/utils}/trimEndOfCodeBlock.test.d.ts +0 -0
  337. /package/esm/typings/{utils → src/utils}/unwrapResult.d.ts +0 -0
  338. /package/esm/typings/{utils → src/utils}/unwrapResult.test.d.ts +0 -0
  339. /package/esm/typings/{utils → src/utils}/validators/url/isValidUrl.d.ts +0 -0
  340. /package/esm/typings/{utils → src/utils}/validators/url/isValidUrl.test.d.ts +0 -0
  341. /package/esm/typings/{version.d.ts → src/version.d.ts} +0 -0
  342. /package/umd/typings/{_packages → src/_packages}/anthropic-claude.index.d.ts +0 -0
  343. /package/umd/typings/{_packages → src/_packages}/azure-openai.index.d.ts +0 -0
  344. /package/umd/typings/{_packages → src/_packages}/execute-javascript.index.d.ts +0 -0
  345. /package/umd/typings/{_packages → src/_packages}/fake-llm.index.d.ts +0 -0
  346. /package/umd/typings/{_packages → src/_packages}/langtail.index.d.ts +0 -0
  347. /package/umd/typings/{_packages → src/_packages}/openai.index.d.ts +0 -0
  348. /package/umd/typings/{_packages → src/_packages}/remote-client.index.d.ts +0 -0
  349. /package/umd/typings/{_packages → src/_packages}/remote-server.index.d.ts +0 -0
  350. /package/umd/typings/{_packages → src/_packages}/utils.index.d.ts +0 -0
  351. /package/umd/typings/{conversion → src/conversion}/prettify/PrettifyOptions.d.ts +0 -0
  352. /package/umd/typings/{conversion → src/conversion}/prettify/prettifyPromptbookString.d.ts +0 -0
  353. /package/umd/typings/{conversion → src/conversion}/prettify/renderPromptbookMermaid.d.ts +0 -0
  354. /package/umd/typings/{conversion → src/conversion}/promptbookJsonToString.d.ts +0 -0
  355. /package/umd/typings/{conversion → src/conversion}/promptbookStringToJson.test.d.ts +0 -0
  356. /package/{esm/typings/promptbook-library/constructors/createPromptbookLibraryFromPromise.test.d.ts → umd/typings/src/conversion/promptbookStringToJsonSync.test.d.ts} +0 -0
  357. /package/umd/typings/{conversion → src/conversion}/utils/extractParametersFromPromptTemplate.d.ts +0 -0
  358. /package/{esm/typings/promptbook-library/constructors/createPromptbookLibraryFromSources.test.d.ts → umd/typings/src/conversion/utils/extractParametersFromPromptTemplate.test.d.ts} +0 -0
  359. /package/umd/typings/{conversion → src/conversion}/utils/extractVariables.d.ts +0 -0
  360. /package/umd/typings/{conversion → src/conversion}/utils/extractVariables.test.d.ts +0 -0
  361. /package/umd/typings/{conversion → src/conversion}/utils/parseCommand.d.ts +0 -0
  362. /package/umd/typings/{conversion → src/conversion}/utils/parseCommand.test.d.ts +0 -0
  363. /package/umd/typings/{conversion → src/conversion}/utils/parseNumber.d.ts +0 -0
  364. /package/umd/typings/{conversion → src/conversion}/utils/parseNumber.test.d.ts +0 -0
  365. /package/umd/typings/{conversion → src/conversion}/utils/renameParameter.d.ts +0 -0
  366. /package/umd/typings/{conversion → src/conversion}/utils/renameParameter.test.d.ts +0 -0
  367. /package/umd/typings/{conversion → src/conversion}/utils/titleToName.d.ts +0 -0
  368. /package/umd/typings/{conversion → src/conversion}/utils/titleToName.test.d.ts +0 -0
  369. /package/umd/typings/{conversion → src/conversion}/validation/_importPromptbook.d.ts +0 -0
  370. /package/umd/typings/{conversion → src/conversion}/validation/promptbookStringToJson-syntaxErrors.test.d.ts +0 -0
  371. /package/umd/typings/{conversion/validation/validatePromptbookJson-logicErrors.test.d.ts → src/conversion/validation/validatePromptbook-logicErrors.test.d.ts} +0 -0
  372. /package/umd/typings/{conversion/validation/validatePromptbookJson.test.d.ts → src/conversion/validation/validatePromptbook.test.d.ts} +0 -0
  373. /package/umd/typings/{errors → src/errors}/PromptbookExecutionError.d.ts +0 -0
  374. /package/umd/typings/{errors → src/errors}/PromptbookLibraryError.d.ts +0 -0
  375. /package/umd/typings/{errors → src/errors}/PromptbookLogicError.d.ts +0 -0
  376. /package/umd/typings/{errors → src/errors}/PromptbookNotFoundError.d.ts +0 -0
  377. /package/umd/typings/{errors → src/errors}/PromptbookReferenceError.d.ts +0 -0
  378. /package/umd/typings/{errors → src/errors}/PromptbookSyntaxError.d.ts +0 -0
  379. /package/umd/typings/{errors → src/errors}/TemplateError.d.ts +0 -0
  380. /package/umd/typings/{errors → src/errors}/UnexpectedError.d.ts +0 -0
  381. /package/umd/typings/{errors → src/errors}/_ExpectError.d.ts +0 -0
  382. /package/umd/typings/{execution → src/execution}/CommonExecutionToolsOptions.d.ts +0 -0
  383. /package/umd/typings/{execution → src/execution}/ExecutionTools.d.ts +0 -0
  384. /package/umd/typings/{execution → src/execution}/PromptbookExecutor.d.ts +0 -0
  385. /package/umd/typings/{execution → src/execution}/ScriptExecutionTools.d.ts +0 -0
  386. /package/umd/typings/{execution → src/execution}/UserInterfaceTools.d.ts +0 -0
  387. /package/umd/typings/{execution → src/execution}/addPromptResultUsage.test.d.ts +0 -0
  388. /package/umd/typings/{execution → src/execution}/assertsExecutionSuccessful.d.ts +0 -0
  389. /package/umd/typings/{execution → src/execution}/createPromptbookExecutor.d.ts +0 -0
  390. /package/umd/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts +0 -0
  391. /package/umd/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +0 -0
  392. /package/umd/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +0 -0
  393. /package/umd/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +0 -0
  394. /package/umd/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +0 -0
  395. /package/umd/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +0 -0
  396. /package/umd/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.test.d.ts +0 -0
  397. /package/umd/typings/{execution → src/execution}/translation/automatic-translate/translateMessages.d.ts +0 -0
  398. /package/umd/typings/{execution → src/execution}/utils/addUsage.d.ts +0 -0
  399. /package/umd/typings/{execution → src/execution}/utils/addUsage.test.d.ts +0 -0
  400. /package/umd/typings/{execution → src/execution}/utils/checkExpectations.d.ts +0 -0
  401. /package/umd/typings/{execution → src/execution}/utils/checkExpectations.test.d.ts +0 -0
  402. /package/umd/typings/{execution → src/execution}/utils/computeUsageCounts.d.ts +0 -0
  403. /package/umd/typings/{execution → src/execution}/utils/forEachAsync.d.ts +0 -0
  404. /package/umd/typings/{execution → src/execution}/utils/replaceParameters.d.ts +0 -0
  405. /package/umd/typings/{execution → src/execution}/utils/replaceParameters.test.d.ts +0 -0
  406. /package/umd/typings/{execution → src/execution}/utils/uncertainNumber.d.ts +0 -0
  407. /package/umd/typings/{execution → src/execution}/utils/usageToWorktime.d.ts +0 -0
  408. /package/umd/typings/{execution → src/execution}/utils/usageToWorktime.test.d.ts +0 -0
  409. /package/umd/typings/{expectations → src/expectations}/drafts/isDomainNameFree.d.ts +0 -0
  410. /package/umd/typings/{expectations → src/expectations}/drafts/isGithubNameFree.d.ts +0 -0
  411. /package/umd/typings/{formats → src/formats}/_common/FormatDefinition.d.ts +0 -0
  412. /package/umd/typings/{formats → src/formats}/csv/ListFormatDefinition.d.ts +0 -0
  413. /package/umd/typings/{formats → src/formats}/index.d.ts +0 -0
  414. /package/umd/typings/{formats → src/formats}/json/JsonFormatDefinition.d.ts +0 -0
  415. /package/umd/typings/{formats → src/formats}/json/utils/isValidJsonString.d.ts +0 -0
  416. /package/umd/typings/{formats → src/formats}/json/utils/isValidJsonString.test.d.ts +0 -0
  417. /package/umd/typings/{formats → src/formats}/list/ListFormatDefinition.d.ts +0 -0
  418. /package/umd/typings/{formats → src/formats}/xml/XmlFormatDefinition.d.ts +0 -0
  419. /package/umd/typings/{knowledge → src/knowledge}/dialogs/callback/CallbackInterfaceTools.d.ts +0 -0
  420. /package/umd/typings/{knowledge → src/knowledge}/dialogs/callback/CallbackInterfaceToolsOptions.d.ts +0 -0
  421. /package/umd/typings/{knowledge → src/knowledge}/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +0 -0
  422. /package/umd/typings/{knowledge → src/knowledge}/dialogs/user-interface-execution-tools.test.d.ts +0 -0
  423. /package/umd/typings/{knowledge → src/knowledge}/prepare-knowledge/markdown/playground/markdown-knowledge-playground.d.ts +0 -0
  424. /package/umd/typings/{knowledge → src/knowledge}/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.test.d.ts +0 -0
  425. /package/umd/typings/{knowledge → src/knowledge}/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +0 -0
  426. /package/umd/typings/{knowledge → src/knowledge}/prepare-knowledge/pdf/prepareKnowledgeFromPdf.test.d.ts +0 -0
  427. /package/umd/typings/{promptbook-library → src/library}/PromptbookLibrary.d.ts +0 -0
  428. /package/umd/typings/{promptbook-library/constructors/createPromptbookLibraryFromDirectory.test.d.ts → src/library/constructors/createLibraryFromDirectory.test.d.ts} +0 -0
  429. /package/umd/typings/{promptbook-library/constructors/createPromptbookLibraryFromPromise.test.d.ts → src/library/constructors/createLibraryFromJson.test.d.ts} +0 -0
  430. /package/umd/typings/{promptbook-library/constructors/createPromptbookLibraryFromSources.test.d.ts → src/library/constructors/createLibraryFromPromise.test.d.ts} +0 -0
  431. /package/umd/typings/{promptbook-library → src/library}/constructors/justTestFsImport.d.ts +0 -0
  432. /package/umd/typings/{scripting/_test/custom-function-async.test.ts.test.d.ts → src/library/libraryToJson.test.d.ts} +0 -0
  433. /package/umd/typings/{llm-providers → src/llm-providers}/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +0 -0
  434. /package/umd/typings/{llm-providers → src/llm-providers}/anthropic-claude/playground/playground.d.ts +0 -0
  435. /package/umd/typings/{llm-providers → src/llm-providers}/azure-openai/AzureOpenAiExecutionTools.d.ts +0 -0
  436. /package/umd/typings/{llm-providers → src/llm-providers}/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +0 -0
  437. /package/umd/typings/{llm-providers → src/llm-providers}/azure-openai/playground/playground.d.ts +0 -0
  438. /package/umd/typings/{llm-providers → src/llm-providers}/langtail/LangtailExecutionTools.d.ts +0 -0
  439. /package/umd/typings/{llm-providers → src/llm-providers}/langtail/LangtailExecutionToolsOptions.d.ts +0 -0
  440. /package/umd/typings/{llm-providers → src/llm-providers}/langtail/playground/playground.d.ts +0 -0
  441. /package/umd/typings/{llm-providers → src/llm-providers}/mocked/MockedEchoLlmExecutionTools.d.ts +0 -0
  442. /package/umd/typings/{llm-providers → src/llm-providers}/mocked/MockedFackedLlmExecutionTools.d.ts +0 -0
  443. /package/umd/typings/{llm-providers → src/llm-providers}/mocked/fakeTextToExpectations.d.ts +0 -0
  444. /package/umd/typings/{scripting/_test/custom-function-missing.test.d.ts → src/llm-providers/mocked/fakeTextToExpectations.test.d.ts} +0 -0
  445. /package/umd/typings/{scripting/_test/custom-function-with-dependencies.test.d.ts → src/llm-providers/mocked/faked-completion.test.d.ts} +0 -0
  446. /package/umd/typings/{llm-providers → src/llm-providers}/mocked/joker.test.d.ts +0 -0
  447. /package/umd/typings/{llm-providers → src/llm-providers}/mocked/mocked-chat.test.d.ts +0 -0
  448. /package/umd/typings/{llm-providers → src/llm-providers}/mocked/mocked-completion.test.d.ts +0 -0
  449. /package/umd/typings/{llm-providers → src/llm-providers}/multiple/MultipleLlmExecutionTools.d.ts +0 -0
  450. /package/umd/typings/{llm-providers → src/llm-providers}/multiple/MultipleLlmExecutionToolsOptions.d.ts +0 -0
  451. /package/umd/typings/{llm-providers → src/llm-providers}/multiple/playground/playground.d.ts +0 -0
  452. /package/umd/typings/{llm-providers → src/llm-providers}/openai/OpenAiExecutionToolsOptions.d.ts +0 -0
  453. /package/umd/typings/{llm-providers → src/llm-providers}/openai/computeUsage.d.ts +0 -0
  454. /package/umd/typings/{scripting/_test/custom-function.test.d.ts → src/llm-providers/openai/computeUsage.test.d.ts} +0 -0
  455. /package/umd/typings/{llm-providers → src/llm-providers}/openai/openai-models.d.ts +0 -0
  456. /package/umd/typings/{llm-providers → src/llm-providers}/openai/playground/playground.d.ts +0 -0
  457. /package/umd/typings/{llm-providers → src/llm-providers}/remote/RemoteLlmExecutionTools.d.ts +0 -0
  458. /package/umd/typings/{llm-providers → src/llm-providers}/remote/RemoteLlmExecutionToolsOptions.d.ts +0 -0
  459. /package/umd/typings/{llm-providers → src/llm-providers}/remote/interfaces/Promptbook_Server_Error.d.ts +0 -0
  460. /package/umd/typings/{llm-providers → src/llm-providers}/remote/interfaces/Promptbook_Server_Progress.d.ts +0 -0
  461. /package/umd/typings/{llm-providers → src/llm-providers}/remote/interfaces/Promptbook_Server_Request.d.ts +0 -0
  462. /package/umd/typings/{llm-providers → src/llm-providers}/remote/interfaces/Promptbook_Server_Response.d.ts +0 -0
  463. /package/umd/typings/{scripting/_test/postprocessing.test.d.ts → src/scripting/_test/custom-function-async.test.ts.test.d.ts} +0 -0
  464. /package/umd/typings/{scripting/_test/script-execution-errors.test.d.ts → src/scripting/_test/custom-function-missing.test.d.ts} +0 -0
  465. /package/umd/typings/{scripting/_test/script-execution-tools.test.d.ts → src/scripting/_test/custom-function-with-dependencies.test.d.ts} +0 -0
  466. /package/umd/typings/{types/execution-report/countWorkingDuration.test.d.ts → src/scripting/_test/custom-function.test.d.ts} +0 -0
  467. /package/umd/typings/{utils/expectation-counters/countCharacters.test.d.ts → src/scripting/_test/postprocessing.test.d.ts} +0 -0
  468. /package/umd/typings/{utils/expectation-counters/countLines.test.d.ts → src/scripting/_test/script-execution-errors.test.d.ts} +0 -0
  469. /package/umd/typings/{utils/expectation-counters/countPages.test.d.ts → src/scripting/_test/script-execution-tools.test.d.ts} +0 -0
  470. /package/umd/typings/{scripting → src/scripting}/javascript/JavascriptEvalExecutionTools.d.ts +0 -0
  471. /package/umd/typings/{scripting → src/scripting}/javascript/JavascriptEvalExecutionTools.test.d.ts +0 -0
  472. /package/umd/typings/{scripting → src/scripting}/javascript/JavascriptExecutionTools.d.ts +0 -0
  473. /package/umd/typings/{scripting → src/scripting}/javascript/JavascriptExecutionToolsOptions.d.ts +0 -0
  474. /package/umd/typings/{scripting → src/scripting}/javascript/utils/preserve.d.ts +0 -0
  475. /package/umd/typings/{scripting → src/scripting}/javascript/utils/unknownToString.d.ts +0 -0
  476. /package/umd/typings/{scripting → src/scripting}/python/PythonExecutionTools.d.ts +0 -0
  477. /package/umd/typings/{scripting → src/scripting}/typescript/TypescriptExecutionTools.d.ts +0 -0
  478. /package/umd/typings/{types → src/types}/Command.d.ts +0 -0
  479. /package/umd/typings/{types → src/types}/ExecutionTypes.d.ts +0 -0
  480. /package/umd/typings/{types → src/types}/Parameters.d.ts +0 -0
  481. /package/umd/typings/{types → src/types}/Prompt.d.ts +0 -0
  482. /package/umd/typings/{types → src/types}/PromptbookJson/PromptTemplateJson.d.ts +0 -0
  483. /package/umd/typings/{types → src/types}/PromptbookJson/PromptTemplateParameterJson.d.ts +0 -0
  484. /package/umd/typings/{types → src/types}/PromptbookJson/PromptbookJson.d.ts +0 -0
  485. /package/umd/typings/{types → src/types}/PromptbookString.d.ts +0 -0
  486. /package/umd/typings/{types → src/types}/ScriptLanguage.d.ts +0 -0
  487. /package/umd/typings/{types → src/types}/TaskProgress.d.ts +0 -0
  488. /package/umd/typings/{types → src/types}/execution-report/ExecutionReportJson.d.ts +0 -0
  489. /package/umd/typings/{types → src/types}/execution-report/ExecutionReportString.d.ts +0 -0
  490. /package/umd/typings/{types → src/types}/execution-report/ExecutionReportStringOptions.d.ts +0 -0
  491. /package/umd/typings/{types → src/types}/execution-report/config.d.ts +0 -0
  492. /package/umd/typings/{types → src/types}/execution-report/countWorkingDuration.d.ts +0 -0
  493. /package/umd/typings/{utils/expectation-counters/countParagraphs.test.d.ts → src/types/execution-report/countWorkingDuration.test.d.ts} +0 -0
  494. /package/umd/typings/{types → src/types}/execution-report/executionReportJsonToString.d.ts +0 -0
  495. /package/umd/typings/{types → src/types}/typeAliasEmoji.d.ts +0 -0
  496. /package/umd/typings/{types → src/types}/typeAliases.d.ts +0 -0
  497. /package/umd/typings/{utils → src/utils}/FromtoItems.d.ts +0 -0
  498. /package/umd/typings/{utils → src/utils}/emojis.d.ts +0 -0
  499. /package/umd/typings/{utils → src/utils}/expectation-counters/countCharacters.d.ts +0 -0
  500. /package/umd/typings/{utils/expectation-counters/countSentences.test.d.ts → src/utils/expectation-counters/countCharacters.test.d.ts} +0 -0
  501. /package/umd/typings/{utils → src/utils}/expectation-counters/countLines.d.ts +0 -0
  502. /package/umd/typings/{utils/expectation-counters/countWords.test.d.ts → src/utils/expectation-counters/countLines.test.d.ts} +0 -0
  503. /package/umd/typings/{utils → src/utils}/expectation-counters/countPages.d.ts +0 -0
  504. /package/umd/typings/{utils/extractParameters.test.d.ts → src/utils/expectation-counters/countPages.test.d.ts} +0 -0
  505. /package/umd/typings/{utils → src/utils}/expectation-counters/countParagraphs.d.ts +0 -0
  506. /package/umd/typings/{utils/formatNumber.test.d.ts → src/utils/expectation-counters/countParagraphs.test.d.ts} +0 -0
  507. /package/umd/typings/{utils → src/utils}/expectation-counters/countSentences.d.ts +0 -0
  508. /package/umd/typings/{utils/markdown-json/countMarkdownStructureDeepness.test.d.ts → src/utils/expectation-counters/countSentences.test.d.ts} +0 -0
  509. /package/umd/typings/{utils → src/utils}/expectation-counters/countWords.d.ts +0 -0
  510. /package/umd/typings/{utils/markdown-json/markdownToMarkdownStructure.test.d.ts → src/utils/expectation-counters/countWords.test.d.ts} +0 -0
  511. /package/umd/typings/{utils → src/utils}/expectation-counters/index.d.ts +0 -0
  512. /package/umd/typings/{utils → src/utils}/extractParameters.d.ts +0 -0
  513. /package/umd/typings/{utils/markdown/addAutoGeneratedSection.test.d.ts → src/utils/extractParameters.test.d.ts} +0 -0
  514. /package/umd/typings/{utils → src/utils}/formatNumber.d.ts +0 -0
  515. /package/umd/typings/{utils/markdown/createMarkdownChart.test.d.ts → src/utils/formatNumber.test.d.ts} +0 -0
  516. /package/umd/typings/{utils → src/utils}/getCurrentIsoDate.d.ts +0 -0
  517. /package/umd/typings/{utils → src/utils}/isRunningInWhatever.d.ts +0 -0
  518. /package/umd/typings/{utils → src/utils}/just.d.ts +0 -0
  519. /package/umd/typings/{utils → src/utils}/markdown/addAutoGeneratedSection.d.ts +0 -0
  520. /package/umd/typings/{utils/markdown/extractAllBlocksFromMarkdown.test.d.ts → src/utils/markdown/addAutoGeneratedSection.test.d.ts} +0 -0
  521. /package/umd/typings/{utils → src/utils}/markdown/createMarkdownChart.d.ts +0 -0
  522. /package/umd/typings/{utils/markdown/extractAllListItemsFromMarkdown.test.d.ts → src/utils/markdown/createMarkdownChart.test.d.ts} +0 -0
  523. /package/umd/typings/{utils → src/utils}/markdown/createMarkdownTable.d.ts +0 -0
  524. /package/umd/typings/{utils/markdown/extractOneBlockFromMarkdown.test.d.ts → src/utils/markdown/createMarkdownTable.test.d.ts} +0 -0
  525. /package/umd/typings/{utils → src/utils}/markdown/escapeMarkdownBlock.d.ts +0 -0
  526. /package/umd/typings/{utils/markdown/prettifyMarkdown.test.d.ts → src/utils/markdown/escapeMarkdownBlock.test.d.ts} +0 -0
  527. /package/umd/typings/{utils → src/utils}/markdown/extractAllBlocksFromMarkdown.d.ts +0 -0
  528. /package/umd/typings/{utils/markdown/removeContentComments.test.d.ts → src/utils/markdown/extractAllBlocksFromMarkdown.test.d.ts} +0 -0
  529. /package/umd/typings/{utils → src/utils}/markdown/extractAllListItemsFromMarkdown.d.ts +0 -0
  530. /package/umd/typings/{utils/markdown/removeMarkdownFormatting.test.d.ts → src/utils/markdown/extractAllListItemsFromMarkdown.test.d.ts} +0 -0
  531. /package/umd/typings/{utils → src/utils}/markdown/extractOneBlockFromMarkdown.d.ts +0 -0
  532. /package/umd/typings/{utils/normalization/capitalize.test.d.ts → src/utils/markdown/extractOneBlockFromMarkdown.test.d.ts} +0 -0
  533. /package/umd/typings/{utils → src/utils}/markdown/prettifyMarkdown.d.ts +0 -0
  534. /package/umd/typings/{utils/normalization/decapitalize.test.d.ts → src/utils/markdown/prettifyMarkdown.test.d.ts} +0 -0
  535. /package/umd/typings/{utils → src/utils}/markdown/removeContentComments.d.ts +0 -0
  536. /package/umd/typings/{utils/normalization/isValidKeyword.test.d.ts → src/utils/markdown/removeContentComments.test.d.ts} +0 -0
  537. /package/umd/typings/{utils → src/utils}/markdown/removeMarkdownFormatting.d.ts +0 -0
  538. /package/umd/typings/{utils/normalization/nameToUriPart.test.d.ts → src/utils/markdown/removeMarkdownFormatting.test.d.ts} +0 -0
  539. /package/umd/typings/{utils → src/utils}/markdown-json/MarkdownStructure.d.ts +0 -0
  540. /package/umd/typings/{utils → src/utils}/markdown-json/countMarkdownStructureDeepness.d.ts +0 -0
  541. /package/umd/typings/{utils/markdown/createMarkdownTable.test.d.ts → src/utils/markdown-json/countMarkdownStructureDeepness.test.d.ts} +0 -0
  542. /package/umd/typings/{utils → src/utils}/markdown-json/markdownToMarkdownStructure.d.ts +0 -0
  543. /package/umd/typings/{utils/markdown/escapeMarkdownBlock.test.d.ts → src/utils/markdown-json/markdownToMarkdownStructure.test.d.ts} +0 -0
  544. /package/umd/typings/{utils → src/utils}/normalization/DIACRITIC_VARIANTS_LETTERS.d.ts +0 -0
  545. /package/umd/typings/{utils → src/utils}/normalization/IKeywords.d.ts +0 -0
  546. /package/umd/typings/{utils → src/utils}/normalization/capitalize.d.ts +0 -0
  547. /package/umd/typings/{utils/normalization/nameToUriParts.test.d.ts → src/utils/normalization/capitalize.test.d.ts} +0 -0
  548. /package/umd/typings/{utils → src/utils}/normalization/decapitalize.d.ts +0 -0
  549. /package/umd/typings/{utils/normalization/normalize-to-kebab-case.test.d.ts → src/utils/normalization/decapitalize.test.d.ts} +0 -0
  550. /package/umd/typings/{utils → src/utils}/normalization/isValidKeyword.d.ts +0 -0
  551. /package/umd/typings/{utils/normalization/normalizeTo_PascalCase.test.d.ts → src/utils/normalization/isValidKeyword.test.d.ts} +0 -0
  552. /package/umd/typings/{utils → src/utils}/normalization/nameToUriPart.d.ts +0 -0
  553. /package/umd/typings/{utils/normalization/normalizeTo_SCREAMING_CASE.test.d.ts → src/utils/normalization/nameToUriPart.test.d.ts} +0 -0
  554. /package/umd/typings/{utils → src/utils}/normalization/nameToUriParts.d.ts +0 -0
  555. /package/umd/typings/{utils/normalization/normalizeTo_camelCase.test.d.ts → src/utils/normalization/nameToUriParts.test.d.ts} +0 -0
  556. /package/umd/typings/{utils → src/utils}/normalization/normalize-to-kebab-case.d.ts +0 -0
  557. /package/umd/typings/{utils/normalization/normalizeTo_snake_case.test.d.ts → src/utils/normalization/normalize-to-kebab-case.test.d.ts} +0 -0
  558. /package/umd/typings/{utils → src/utils}/normalization/normalizeTo_PascalCase.d.ts +0 -0
  559. /package/umd/typings/{utils/normalization/normalizeWhitespaces.test.d.ts → src/utils/normalization/normalizeTo_PascalCase.test.d.ts} +0 -0
  560. /package/umd/typings/{utils → src/utils}/normalization/normalizeTo_SCREAMING_CASE.d.ts +0 -0
  561. /package/umd/typings/{utils/normalization/parseKeywords.test.d.ts → src/utils/normalization/normalizeTo_SCREAMING_CASE.test.d.ts} +0 -0
  562. /package/umd/typings/{utils → src/utils}/normalization/normalizeTo_camelCase.d.ts +0 -0
  563. /package/umd/typings/{utils/normalization/parseKeywordsFromString.test.d.ts → src/utils/normalization/normalizeTo_camelCase.test.d.ts} +0 -0
  564. /package/umd/typings/{utils → src/utils}/normalization/normalizeTo_snake_case.d.ts +0 -0
  565. /package/umd/typings/{utils/normalization/removeDiacritics.test.d.ts → src/utils/normalization/normalizeTo_snake_case.test.d.ts} +0 -0
  566. /package/umd/typings/{utils → src/utils}/normalization/normalizeWhitespaces.d.ts +0 -0
  567. /package/umd/typings/{utils/normalization/searchKeywords.test.d.ts → src/utils/normalization/normalizeWhitespaces.test.d.ts} +0 -0
  568. /package/umd/typings/{utils → src/utils}/normalization/parseKeywords.d.ts +0 -0
  569. /package/umd/typings/{utils/removeEmojis.test.d.ts → src/utils/normalization/parseKeywords.test.d.ts} +0 -0
  570. /package/umd/typings/{utils → src/utils}/normalization/parseKeywordsFromString.d.ts +0 -0
  571. /package/umd/typings/{utils/removeQuotes.test.d.ts → src/utils/normalization/parseKeywordsFromString.test.d.ts} +0 -0
  572. /package/umd/typings/{utils → src/utils}/normalization/removeDiacritics.d.ts +0 -0
  573. /package/umd/typings/{utils/sets/difference.test.d.ts → src/utils/normalization/removeDiacritics.test.d.ts} +0 -0
  574. /package/umd/typings/{utils → src/utils}/normalization/searchKeywords.d.ts +0 -0
  575. /package/umd/typings/{utils/sets/intersection.test.d.ts → src/utils/normalization/searchKeywords.test.d.ts} +0 -0
  576. /package/umd/typings/{utils → src/utils}/postprocessing/extractBlock.d.ts +0 -0
  577. /package/umd/typings/{utils → src/utils}/removeEmojis.d.ts +0 -0
  578. /package/umd/typings/{utils/sets/union.test.d.ts → src/utils/removeEmojis.test.d.ts} +0 -0
  579. /package/umd/typings/{utils → src/utils}/removeQuotes.d.ts +0 -0
  580. /package/umd/typings/{utils/trimCodeBlock.test.d.ts → src/utils/removeQuotes.test.d.ts} +0 -0
  581. /package/umd/typings/{utils → src/utils}/sets/difference.d.ts +0 -0
  582. /package/umd/typings/{utils/trimEndOfCodeBlock.test.d.ts → src/utils/sets/difference.test.d.ts} +0 -0
  583. /package/umd/typings/{utils → src/utils}/sets/intersection.d.ts +0 -0
  584. /package/umd/typings/{utils/unwrapResult.test.d.ts → src/utils/sets/intersection.test.d.ts} +0 -0
  585. /package/umd/typings/{utils → src/utils}/sets/union.d.ts +0 -0
  586. /package/umd/typings/{utils/validators/url/isValidUrl.test.d.ts → src/utils/sets/union.test.d.ts} +0 -0
  587. /package/umd/typings/{utils → src/utils}/trimCodeBlock.d.ts +0 -0
  588. /package/umd/typings/{utils → src/utils}/trimEndOfCodeBlock.d.ts +0 -0
  589. /package/umd/typings/{utils → src/utils}/unwrapResult.d.ts +0 -0
  590. /package/umd/typings/{utils → src/utils}/validators/url/isValidUrl.d.ts +0 -0
  591. /package/umd/typings/{version.d.ts → src/version.d.ts} +0 -0
package/umd/index.umd.js CHANGED
@@ -192,19 +192,7 @@
192
192
  }
193
193
  }
194
194
 
195
- /**
196
- * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
197
- */
198
- var PromptbookSyntaxError = /** @class */ (function (_super) {
199
- __extends(PromptbookSyntaxError, _super);
200
- function PromptbookSyntaxError(message) {
201
- var _this = _super.call(this, message) || this;
202
- _this.name = 'PromptbookSyntaxError';
203
- Object.setPrototypeOf(_this, PromptbookSyntaxError.prototype);
204
- return _this;
205
- }
206
- return PromptbookSyntaxError;
207
- }(Error));
195
+ var promptbookLibrary = [{title:"Prepare Keywords",promptbookUrl:"https://promptbook.studio/promptbook/prepare-keywords.ptbk.md",promptbookVersion:"0.59.0-36",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"],executionType:"PROMPT_TEMPLATE",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"}],knowledge:[]},{title:"Prepare Knowledge from Markdown",promptbookUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.59.0-36",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"],executionType:"PROMPT_TEMPLATE",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"}],knowledge:[]}];
208
196
 
209
197
  /**
210
198
  * This error indicates errors during the execution of the promptbook
@@ -264,6 +252,20 @@
264
252
  return PromptbookLogicError;
265
253
  }(Error));
266
254
 
255
+ /**
256
+ * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
257
+ */
258
+ var PromptbookSyntaxError = /** @class */ (function (_super) {
259
+ __extends(PromptbookSyntaxError, _super);
260
+ function PromptbookSyntaxError(message) {
261
+ var _this = _super.call(this, message) || this;
262
+ _this.name = 'PromptbookSyntaxError';
263
+ Object.setPrototypeOf(_this, PromptbookSyntaxError.prototype);
264
+ return _this;
265
+ }
266
+ return PromptbookSyntaxError;
267
+ }(Error));
268
+
267
269
  /**
268
270
  * This error type indicates that the error should not happen and its last check before crashing with some other error
269
271
  */
@@ -317,7 +319,7 @@
317
319
  * @returns the same promptbook if it is logically valid
318
320
  * @throws {PromptbookLogicError} on logical error in the promptbook
319
321
  */
320
- function validatePromptbookJson(promptbook) {
322
+ function validatePromptbook(promptbook) {
321
323
  // TODO: [🧠] Maybe test if promptbook is a promise and make specific error case for that
322
324
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
323
325
  if (promptbook.promptbookUrl !== undefined) {
@@ -381,8 +383,7 @@
381
383
  throw new PromptbookLogicError("Parameter {".concat(template.resultingParameterName, "} is defined multiple times"));
382
384
  }
383
385
  definedParameters.add(template.resultingParameterName);
384
- if (template.executionType === 'PROMPT_TEMPLATE' &&
385
- (template.modelRequirements.modelVariant === undefined)) {
386
+ if (template.executionType === 'PROMPT_TEMPLATE' && template.modelRequirements.modelVariant === undefined) {
386
387
  throw new PromptbookLogicError(spaceTrim.spaceTrim("\n\n You must specify MODEL VARIANT in the prompt template \"".concat(template.title, "\"\n\n For example:\n - MODEL VARIANT Chat\n - MODEL NAME `gpt-4-1106-preview`\n\n ")));
387
388
  }
388
389
  if (template.jokers && template.jokers.length > 0) {
@@ -452,7 +453,7 @@
452
453
  var loopLimit = LOOP_LIMIT;
453
454
  var _loop_2 = function () {
454
455
  if (loopLimit-- < 0) {
455
- throw new UnexpectedError('Loop limit reached during detection of circular dependencies in `validatePromptbookJson`');
456
+ throw new UnexpectedError('Loop limit reached during detection of circular dependencies in `validatePromptbook`');
456
457
  }
457
458
  var currentlyResovedTemplates = unresovedTemplates.filter(function (template) {
458
459
  return template.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
@@ -487,7 +488,7 @@
487
488
  * > * It checks:
488
489
  * > * - it has a valid structure
489
490
  * > * - ...
490
- * > ex port function validatePromptbookJson(promptbook: unknown): asserts promptbook is PromptbookJson {
491
+ * > ex port function validatePromptbook(promptbook: unknown): asserts promptbook is PromptbookJson {
491
492
  */
492
493
 
493
494
  /**
@@ -529,7 +530,7 @@
529
530
  /**
530
531
  * The version of the Promptbook library
531
532
  */
532
- var PROMPTBOOK_VERSION = '0.59.0-7';
533
+ var PROMPTBOOK_VERSION = '0.59.0-36';
533
534
 
534
535
  /**
535
536
  * Function `addUsage` will add multiple usages into one
@@ -1091,7 +1092,7 @@
1091
1092
  var _this = this;
1092
1093
  var promptbook = options.promptbook, tools = options.tools, _a = options.settings, settings = _a === void 0 ? {} : _a;
1093
1094
  var _b = settings.maxExecutionAttempts, maxExecutionAttempts = _b === void 0 ? 3 : _b;
1094
- validatePromptbookJson(promptbook);
1095
+ validatePromptbook(promptbook);
1095
1096
  var promptbookExecutor = function (inputParameters, onProgress) { return __awaiter(_this, void 0, void 0, function () {
1096
1097
  function executeSingleTemplate(currentTemplate) {
1097
1098
  return __awaiter(this, void 0, void 0, function () {
@@ -1522,7 +1523,7 @@
1522
1523
  return template.dependentParameterNames.every(function (name) { return resovedParameters_1.includes(name); });
1523
1524
  });
1524
1525
  if (!(!currentTemplate && resolving_1.length === 0)) return [3 /*break*/, 1];
1525
- throw new UnexpectedError(spaceTrim.spaceTrim("\n Can not resolve some parameters\n\n Note: This should be catched during validatePromptbookJson\n "));
1526
+ throw new UnexpectedError(spaceTrim.spaceTrim("\n Can not resolve some parameters\n\n Note: This should be catched during validatePromptbook\n "));
1526
1527
  case 1:
1527
1528
  if (!!currentTemplate) return [3 /*break*/, 3];
1528
1529
  /* [5] */ return [4 /*yield*/, Promise.race(resolving_1)];
@@ -1851,6 +1852,7 @@
1851
1852
  * Library of promptbooks that groups together promptbooks for an application.
1852
1853
  * This implementation is a very thin wrapper around the Array / Map of promptbooks.
1853
1854
  *
1855
+ * @private use `createLibraryFromJson` instead
1854
1856
  * @see https://github.com/webgptorg/promptbook#promptbook-library
1855
1857
  */
1856
1858
  var SimplePromptbookLibrary = /** @class */ (function () {
@@ -1859,8 +1861,9 @@
1859
1861
  *
1860
1862
  * @param promptbooks !!!
1861
1863
  *
1864
+ * @private Use instead `createLibraryFromJson`
1862
1865
  * Note: During the construction logic of all promptbooks are validated
1863
- * Note: It is not recommended to use this constructor directly, use `createPromptbookLibraryFromSources` *(or other variant)* instead
1866
+ * Note: It is not recommended to use this constructor directly, use `createLibraryFromJson` *(or other variant)* instead
1864
1867
  */
1865
1868
  function SimplePromptbookLibrary() {
1866
1869
  var e_1, _a;
@@ -1875,7 +1878,7 @@
1875
1878
  if (promptbook.promptbookUrl === undefined) {
1876
1879
  throw new PromptbookReferenceError(spaceTrim.spaceTrim("\n Promptbook with name \"".concat(promptbook.title, "\" does not have defined URL\n\n Note: Promptbooks without URLs are called anonymous promptbooks\n They can be used as standalone promptbooks, but they cannot be referenced by other promptbooks\n And also they cannot be used in the promptbook library\n\n ")));
1877
1880
  }
1878
- validatePromptbookJson(promptbook);
1881
+ validatePromptbook(promptbook);
1879
1882
  // Note: [🦄]
1880
1883
  if (this.library.has(promptbook.promptbookUrl) &&
1881
1884
  promptbookJsonToString(promptbook) !==
@@ -1929,68 +1932,19 @@
1929
1932
  /**
1930
1933
  * Creates PromptbookLibrary from array of PromptbookJson or PromptbookString
1931
1934
  *
1932
- * Note: You can combine `PromptbookString` (`.ptbk.md`) with `PromptbookJson` BUT it is not recommended
1935
+ * Note: Functions `libraryToJson` and `createLibraryFromJson` are complementary
1933
1936
  * Note: During the construction syntax and logic of all sources are validated
1934
1937
  *
1935
1938
  * @param promptbookSources
1936
1939
  * @returns PromptbookLibrary
1937
1940
  */
1938
- function createPromptbookLibraryFromSources() {
1939
- var promptbookSources = [];
1941
+ function createLibraryFromJson() {
1942
+ var promptbooks = [];
1940
1943
  for (var _i = 0; _i < arguments.length; _i++) {
1941
- promptbookSources[_i] = arguments[_i];
1944
+ promptbooks[_i] = arguments[_i];
1942
1945
  }
1943
- return __awaiter(this, void 0, void 0, function () {
1944
- var promptbooks, promptbookSources_1, promptbookSources_1_1, source, promptbook, e_1_1;
1945
- var e_1, _a;
1946
- return __generator(this, function (_b) {
1947
- switch (_b.label) {
1948
- case 0:
1949
- promptbooks = new Array();
1950
- _b.label = 1;
1951
- case 1:
1952
- _b.trys.push([1, 8, 9, 10]);
1953
- promptbookSources_1 = __values(promptbookSources), promptbookSources_1_1 = promptbookSources_1.next();
1954
- _b.label = 2;
1955
- case 2:
1956
- if (!!promptbookSources_1_1.done) return [3 /*break*/, 7];
1957
- source = promptbookSources_1_1.value;
1958
- promptbook = void 0;
1959
- if (!(typeof source === 'string')) return [3 /*break*/, 4];
1960
- return [4 /*yield*/, promptbookStringToJson(source)];
1961
- case 3:
1962
- // Note: When directly creating from string, no need to validate the source
1963
- // The validation is performed always before execution
1964
- promptbook = _b.sent();
1965
- return [3 /*break*/, 5];
1966
- case 4:
1967
- promptbook = source;
1968
- _b.label = 5;
1969
- case 5:
1970
- promptbooks.push(promptbook);
1971
- _b.label = 6;
1972
- case 6:
1973
- promptbookSources_1_1 = promptbookSources_1.next();
1974
- return [3 /*break*/, 2];
1975
- case 7: return [3 /*break*/, 10];
1976
- case 8:
1977
- e_1_1 = _b.sent();
1978
- e_1 = { error: e_1_1 };
1979
- return [3 /*break*/, 10];
1980
- case 9:
1981
- try {
1982
- if (promptbookSources_1_1 && !promptbookSources_1_1.done && (_a = promptbookSources_1.return)) _a.call(promptbookSources_1);
1983
- }
1984
- finally { if (e_1) throw e_1.error; }
1985
- return [7 /*endfinally*/];
1986
- case 10: return [2 /*return*/, new (SimplePromptbookLibrary.bind.apply(SimplePromptbookLibrary, __spreadArray([void 0], __read(promptbooks), false)))()];
1987
- }
1988
- });
1989
- });
1946
+ return new (SimplePromptbookLibrary.bind.apply(SimplePromptbookLibrary, __spreadArray([void 0], __read(promptbooks), false)))();
1990
1947
  }
1991
- /**
1992
- * TODO: !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
1993
- */
1994
1948
 
1995
1949
  /* tslint:disable */
1996
1950
  function normalizeToKebabCase(sentence) {
@@ -2049,96 +2003,106 @@
2049
2003
 
2050
2004
  function prepareKnowledgeFromMarkdown(options) {
2051
2005
  return __awaiter(this, void 0, void 0, function () {
2052
- var content, llmTools, library, promptbook, executor, result, outputParameters, knowledgeRaw, knowledgeTextPieces, knowledge;
2006
+ var content, llmTools, _a, isVerbose, library, prepareKnowledgeFromMarkdownPromptbook, prepareKnowledgeFromMarkdownExecutor, prepareKeywordsPromptbook, prepareKeywordsExecutor, result, outputParameters, knowledgeRaw, knowledgeTextPieces, knowledge;
2053
2007
  var _this = this;
2054
- return __generator(this, function (_a) {
2055
- switch (_a.label) {
2008
+ return __generator(this, function (_b) {
2009
+ switch (_b.label) {
2056
2010
  case 0:
2057
- content = options.content, llmTools = options.llmTools;
2058
- return [4 /*yield*/, createPromptbookLibraryFromSources(
2059
- /* !!!! ...(promptbookLibrary as Array<PromptbookJson>)*/ {
2060
- title: 'Prepare Knowledge from Markdown',
2061
- promptbookUrl: 'https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md',
2062
- promptbookVersion: '0.59.0-5',
2063
- parameters: [
2064
- { name: 'content', description: 'Markdown document content', isInput: true, isOutput: false },
2065
- { name: 'knowledge', description: 'The knowledge JSON object', isInput: false, isOutput: true },
2066
- ],
2067
- promptTemplates: [
2068
- {
2069
- name: 'knowledge',
2070
- title: 'Knowledge',
2071
- dependentParameterNames: ['content'],
2072
- executionType: 'PROMPT_TEMPLATE',
2073
- modelRequirements: { modelVariant: 'CHAT', modelName: 'claude-3-opus-20240229' },
2074
- 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}',
2075
- resultingParameterName: 'knowledge',
2076
- },
2077
- ],
2078
- knowledge: [],
2079
- })];
2011
+ content = options.content, llmTools = options.llmTools, _a = options.isVerbose, isVerbose = _a === void 0 ? false : _a;
2012
+ library = createLibraryFromJson.apply(void 0, __spreadArray([], __read(promptbookLibrary), false));
2013
+ return [4 /*yield*/, library.getPromptbookByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md')];
2080
2014
  case 1:
2081
- library = _a.sent();
2082
- promptbook = library.getPromptbookByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md');
2083
- executor = createPromptbookExecutor({
2084
- promptbook: promptbook,
2015
+ prepareKnowledgeFromMarkdownPromptbook = _b.sent();
2016
+ prepareKnowledgeFromMarkdownExecutor = createPromptbookExecutor({
2017
+ promptbook: prepareKnowledgeFromMarkdownPromptbook,
2085
2018
  tools: {
2086
2019
  llm: llmTools,
2087
2020
  script: [
2088
- /* <- TODO: Allow to just not define script tools */
2021
+ /* <- TODO: Allow to just keep script undefined */
2089
2022
  ],
2090
2023
  },
2091
2024
  });
2092
- return [4 /*yield*/, executor({ content: content })];
2025
+ return [4 /*yield*/, library.getPromptbookByUrl('https://promptbook.studio/promptbook/prepare-keywords.ptbk.md')];
2093
2026
  case 2:
2094
- result = _a.sent();
2027
+ prepareKeywordsPromptbook = _b.sent();
2028
+ prepareKeywordsExecutor = createPromptbookExecutor({
2029
+ promptbook: prepareKeywordsPromptbook,
2030
+ tools: {
2031
+ llm: llmTools,
2032
+ script: [
2033
+ /* <- TODO: Allow to just keep script undefined */
2034
+ ],
2035
+ },
2036
+ });
2037
+ return [4 /*yield*/, prepareKnowledgeFromMarkdownExecutor({ content: content })];
2038
+ case 3:
2039
+ result = _b.sent();
2095
2040
  assertsExecutionSuccessful(result);
2096
2041
  outputParameters = result.outputParameters;
2097
2042
  knowledgeRaw = outputParameters.knowledge;
2098
2043
  knowledgeTextPieces = (knowledgeRaw || '').split('\n---\n');
2044
+ if (isVerbose) {
2045
+ console.info('knowledgeTextPieces:', knowledgeTextPieces);
2046
+ }
2099
2047
  return [4 /*yield*/, Promise.all(knowledgeTextPieces.map(function (knowledgeTextPiece, i) { return __awaiter(_this, void 0, void 0, function () {
2100
- var name, title, content, keywords, index, sources;
2101
- return __generator(this, function (_a) {
2102
- name = "piece-".concat(i);
2103
- title = spaceTrim__default["default"](knowledgeTextPiece.substring(0, 100));
2104
- content = spaceTrim__default["default"](knowledgeTextPiece);
2105
- keywords = [];
2106
- index = [];
2107
- sources = [];
2108
- try {
2109
- // TODO: !!!! Summarize name and title from the content
2110
- title = spaceTrim__default["default"](knowledgeTextPiece.substring(0, 30));
2111
- name = normalizeToKebabCase(title);
2112
- // TODO: !!!! Extract keywords via prompt
2113
- // TODO: !!!! Index through LLM model
2114
- // TODO: [🖖] !!!! Make system for sources and identification of sources
2115
- }
2116
- catch (error) {
2117
- console.error(error);
2048
+ var name, title, content, keywords, index, sources, result_1, _a, outputParameters_1, keywordsRaw, error_1;
2049
+ return __generator(this, function (_b) {
2050
+ switch (_b.label) {
2051
+ case 0:
2052
+ name = "piece-".concat(i);
2053
+ title = spaceTrim__default["default"](knowledgeTextPiece.substring(0, 100));
2054
+ content = spaceTrim__default["default"](knowledgeTextPiece);
2055
+ keywords = [];
2056
+ index = [];
2057
+ sources = [];
2058
+ _b.label = 1;
2059
+ case 1:
2060
+ _b.trys.push([1, 3, , 4]);
2061
+ // TODO: !!!! Summarize name and title from the content
2062
+ title = spaceTrim__default["default"](knowledgeTextPiece.substring(0, 30));
2063
+ name = normalizeToKebabCase(title);
2064
+ return [4 /*yield*/, prepareKeywordsExecutor({ content: content })];
2065
+ case 2:
2066
+ result_1 = _b.sent();
2067
+ _a = result_1.outputParameters, outputParameters_1 = _a === void 0 ? {} : _a;
2068
+ keywordsRaw = outputParameters_1.keywords;
2069
+ keywords = (keywordsRaw || '')
2070
+ .split(',')
2071
+ .map(function (keyword) { return keyword.trim(); })
2072
+ .filter(function (keyword) { return keyword !== ''; });
2073
+ if (isVerbose) {
2074
+ console.info("Keywords for \"".concat(title, "\":"), keywords);
2075
+ }
2076
+ // ---
2077
+ // TODO: !!!! Index through LLM model
2078
+ index.push({
2079
+ modelName: 'fake-model',
2080
+ position: new Array(25).fill(0).map(function () { return Math.random() * 2 - 1; }),
2081
+ });
2082
+ return [3 /*break*/, 4];
2083
+ case 3:
2084
+ error_1 = _b.sent();
2085
+ console.error(error_1);
2086
+ return [3 /*break*/, 4];
2087
+ case 4: return [2 /*return*/, {
2088
+ name: name,
2089
+ title: title,
2090
+ content: content,
2091
+ keywords: keywords,
2092
+ index: index,
2093
+ sources: sources,
2094
+ }];
2118
2095
  }
2119
- return [2 /*return*/, {
2120
- name: name,
2121
- title: title,
2122
- content: content,
2123
- keywords: keywords,
2124
- index: index,
2125
- sources: sources,
2126
- }];
2127
2096
  });
2128
2097
  }); }))];
2129
- case 3:
2130
- knowledge = _a.sent();
2098
+ case 4:
2099
+ knowledge = _b.sent();
2131
2100
  return [2 /*return*/, knowledge];
2132
2101
  }
2133
2102
  });
2134
2103
  });
2135
2104
  }
2136
2105
 
2137
- /**
2138
- * Supported script languages
2139
- */
2140
- var SUPPORTED_SCRIPT_LANGUAGES = ['javascript', 'typescript', 'python'];
2141
-
2142
2106
  /**
2143
2107
  * Returns the same value that is passed as argument.
2144
2108
  * No side effects.
@@ -2156,6 +2120,11 @@
2156
2120
  return value;
2157
2121
  }
2158
2122
 
2123
+ /**
2124
+ * Supported script languages
2125
+ */
2126
+ var SUPPORTED_SCRIPT_LANGUAGES = ['javascript', 'typescript', 'python'];
2127
+
2159
2128
  /**
2160
2129
  * Computes the deepness of the markdown structure.
2161
2130
  *
@@ -2983,9 +2952,279 @@
2983
2952
  return value;
2984
2953
  }
2985
2954
 
2955
+ /**
2956
+ * Compile promptbook from string (markdown) format to JSON format synchronously
2957
+ *
2958
+ * Note: There are two similar functions:
2959
+ * - `promptbookStringToJson` **(preferred)** - which propperly compiles the promptbook and use embedding for external knowledge
2960
+ * - `promptbookStringToJsonSync` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
2961
+ *
2962
+ * @param promptbookString {Promptbook} in string markdown format (.ptbk.md)
2963
+ * @param options - Options and tools for the compilation
2964
+ * @returns {Promptbook} compiled in JSON format (.ptbk.json)
2965
+ * @throws {PromptbookSyntaxError} if the promptbook string is not valid
2966
+ *
2967
+ * Note: This function does not validate logic of the pipeline only the syntax
2968
+ * Note: This function acts as compilation process
2969
+ */
2970
+ function promptbookStringToJsonSync(promptbookString) {
2971
+ var e_1, _a, e_2, _b;
2972
+ var promptbookJson = {
2973
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2974
+ title: undefined /* <- Note: Putting here placeholder to keep `title` on top at final JSON */,
2975
+ promptbookUrl: undefined /* <- Note: Putting here placeholder to keep `promptbookUrl` on top at final JSON */,
2976
+ promptbookVersion: PROMPTBOOK_VERSION,
2977
+ description: undefined /* <- Note: Putting here placeholder to keep `description` on top at final JSON */,
2978
+ parameters: [],
2979
+ promptTemplates: [],
2980
+ knowledge: [],
2981
+ };
2982
+ // =============================================================
2983
+ // Note: 1️⃣ Normalization of the PROMPTBOOK string
2984
+ promptbookString = removeContentComments(promptbookString);
2985
+ promptbookString = promptbookString.replaceAll(/`\{(?<parameterName>[a-z0-9_]+)\}`/gi, '{$<parameterName>}');
2986
+ promptbookString = promptbookString.replaceAll(/`->\s+\{(?<parameterName>[a-z0-9_]+)\}`/gi, '-> {$<parameterName>}');
2987
+ // =============================================================
2988
+ ///Note: 2️⃣ Function for adding parameters
2989
+ var addParam = function (parameterCommand) {
2990
+ var parameterName = parameterCommand.parameterName, parameterDescription = parameterCommand.parameterDescription, isInput = parameterCommand.isInput, isOutput = parameterCommand.isOutput;
2991
+ var existingParameter = promptbookJson.parameters.find(function (parameter) { return parameter.name === parameterName; });
2992
+ if (existingParameter &&
2993
+ existingParameter.description &&
2994
+ existingParameter.description !== parameterDescription &&
2995
+ parameterDescription) {
2996
+ throw new PromptbookSyntaxError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameterName, "} is defined multiple times with different description.\n\n First definition:\n ").concat(block(existingParameter.description || '[undefined]'), "\n\n Second definition:\n ").concat(block(parameterDescription || '[undefined]'), "\n "); }));
2997
+ }
2998
+ if (existingParameter) {
2999
+ if (parameterDescription) {
3000
+ existingParameter.description = parameterDescription;
3001
+ }
3002
+ }
3003
+ else {
3004
+ promptbookJson.parameters.push({
3005
+ name: parameterName,
3006
+ description: parameterDescription || undefined,
3007
+ isInput: isInput,
3008
+ isOutput: isOutput,
3009
+ });
3010
+ }
3011
+ };
3012
+ // =============================================================
3013
+ // Note: 3️⃣ Parse the dynamic part - the template pipeline
3014
+ var markdownStructure = markdownToMarkdownStructure(promptbookString);
3015
+ var markdownStructureDeepness = countMarkdownStructureDeepness(markdownStructure);
3016
+ if (markdownStructureDeepness !== 2) {
3017
+ throw new PromptbookSyntaxError(spaceTrim.spaceTrim("\n Invalid markdown structure.\n The markdown must have exactly 2 levels of headings (one top-level section and one section for each template).\n Now it has ".concat(markdownStructureDeepness, " levels of headings.\n ")));
3018
+ }
3019
+ promptbookJson.title = markdownStructure.title;
3020
+ // TODO: [1] DRY description
3021
+ var description = markdownStructure.content;
3022
+ // Note: Remove codeblocks
3023
+ description = description.split(/^```.*^```/gms).join('');
3024
+ //Note: Remove lists and return statement
3025
+ description = description.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
3026
+ description = spaceTrim.spaceTrim(description);
3027
+ if (description === '') {
3028
+ description = undefined;
3029
+ }
3030
+ promptbookJson.description = description;
3031
+ var defaultModelRequirements = {};
3032
+ var listItems = extractAllListItemsFromMarkdown(markdownStructure.content);
3033
+ try {
3034
+ for (var listItems_1 = __values(listItems), listItems_1_1 = listItems_1.next(); !listItems_1_1.done; listItems_1_1 = listItems_1.next()) {
3035
+ var listItem = listItems_1_1.value;
3036
+ var command = parseCommand(listItem);
3037
+ switch (command.type) {
3038
+ case 'PROMPTBOOK_URL':
3039
+ promptbookJson.promptbookUrl = command.promptbookUrl.href;
3040
+ break;
3041
+ case 'PROMPTBOOK_VERSION':
3042
+ promptbookJson.promptbookVersion = command.promptbookVersion;
3043
+ break;
3044
+ case 'MODEL':
3045
+ defaultModelRequirements[command.key] = command.value;
3046
+ break;
3047
+ case 'PARAMETER':
3048
+ addParam(command);
3049
+ break;
3050
+ default:
3051
+ throw new PromptbookSyntaxError("Command ".concat(command.type, " is not allowed in the head of the promptbook ONLY at the prompt template block"));
3052
+ }
3053
+ }
3054
+ }
3055
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
3056
+ finally {
3057
+ try {
3058
+ if (listItems_1_1 && !listItems_1_1.done && (_a = listItems_1.return)) _a.call(listItems_1);
3059
+ }
3060
+ finally { if (e_1) throw e_1.error; }
3061
+ }
3062
+ var _loop_1 = function (section) {
3063
+ var e_3, _e;
3064
+ // TODO: Parse prompt template description (the content out of the codeblock and lists)
3065
+ var templateModelRequirements = __assign({}, defaultModelRequirements);
3066
+ var listItems_3 = extractAllListItemsFromMarkdown(section.content);
3067
+ var dependentParameterNames = new Set();
3068
+ var executionType = 'PROMPT_TEMPLATE';
3069
+ var jokers = [];
3070
+ var postprocessing = [];
3071
+ var expectAmount = {};
3072
+ var expectFormat = undefined;
3073
+ var isExecutionTypeChanged = false;
3074
+ try {
3075
+ for (var listItems_2 = (e_3 = void 0, __values(listItems_3)), listItems_2_1 = listItems_2.next(); !listItems_2_1.done; listItems_2_1 = listItems_2.next()) {
3076
+ var listItem = listItems_2_1.value;
3077
+ var command = parseCommand(listItem);
3078
+ switch (command.type) {
3079
+ case 'JOKER':
3080
+ jokers.push(command.parameterName);
3081
+ dependentParameterNames.add(command.parameterName);
3082
+ break;
3083
+ case 'EXECUTE':
3084
+ if (isExecutionTypeChanged) {
3085
+ throw new PromptbookSyntaxError('Execution type is already defined in the prompt template. It can be defined only once.');
3086
+ }
3087
+ executionType = command.executionType;
3088
+ isExecutionTypeChanged = true;
3089
+ break;
3090
+ case 'MODEL':
3091
+ templateModelRequirements[command.key] = command.value;
3092
+ break;
3093
+ case 'PARAMETER':
3094
+ // Note: This is just for detecting resulitng parameter name
3095
+ addParam(command);
3096
+ break;
3097
+ case 'POSTPROCESS':
3098
+ postprocessing.push(command.functionName);
3099
+ break;
3100
+ case 'EXPECT_AMOUNT':
3101
+ // eslint-disable-next-line no-case-declarations
3102
+ var unit = command.unit.toLowerCase();
3103
+ expectAmount[unit] = expectAmount[unit] || {};
3104
+ if (command.sign === 'MINIMUM' || command.sign === 'EXACTLY') {
3105
+ if (expectAmount[unit].min !== undefined) {
3106
+ throw new PromptbookSyntaxError("Already defined minumum ".concat(expectAmount[unit].min, " ").concat(command.unit.toLowerCase(), ", now trying to redefine it to ").concat(command.amount));
3107
+ }
3108
+ expectAmount[unit].min = command.amount;
3109
+ } /* not else */
3110
+ if (command.sign === 'MAXIMUM' || command.sign === 'EXACTLY') {
3111
+ if (expectAmount[unit].max !== undefined) {
3112
+ throw new PromptbookSyntaxError("Already defined maximum ".concat(expectAmount[unit].max, " ").concat(command.unit.toLowerCase(), ", now trying to redefine it to ").concat(command.amount));
3113
+ }
3114
+ expectAmount[unit].max = command.amount;
3115
+ }
3116
+ break;
3117
+ case 'EXPECT_FORMAT':
3118
+ if (expectFormat !== undefined && command.format !== expectFormat) {
3119
+ throw new PromptbookSyntaxError("Expect format is already defined to \"".concat(expectFormat, "\". Now you try to redefine it by \"").concat(command.format, "\"."));
3120
+ }
3121
+ expectFormat = command.format;
3122
+ break;
3123
+ default:
3124
+ throw new PromptbookSyntaxError("Command ".concat(command.type, " is not allowed in the block of the prompt template ONLY at the head of the promptbook"));
3125
+ }
3126
+ }
3127
+ }
3128
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
3129
+ finally {
3130
+ try {
3131
+ if (listItems_2_1 && !listItems_2_1.done && (_e = listItems_2.return)) _e.call(listItems_2);
3132
+ }
3133
+ finally { if (e_3) throw e_3.error; }
3134
+ }
3135
+ var _f = extractOneBlockFromMarkdown(section.content), language = _f.language, content = _f.content;
3136
+ if (executionType === 'SCRIPT') {
3137
+ if (!language) {
3138
+ throw new PromptbookSyntaxError('You must specify the language of the script in the prompt template');
3139
+ }
3140
+ else if (!SUPPORTED_SCRIPT_LANGUAGES.includes(language)) {
3141
+ throw new PromptbookSyntaxError(spaceTrim.spaceTrim(function (block) { return "\n Script language ".concat(language, " is not supported.\n\n Supported languages are:\n ").concat(block(SUPPORTED_SCRIPT_LANGUAGES.join(', ')), "\n\n "); }));
3142
+ }
3143
+ }
3144
+ var lastLine = section.content.split('\n').pop();
3145
+ var match = /^->\s*\{(?<resultingParamName>[a-z0-9_]+)\}/im.exec(lastLine);
3146
+ if (!match || match.groups === undefined || match.groups.resultingParamName === undefined) {
3147
+ throw new PromptbookSyntaxError(spaceTrim.spaceTrim(function (block) { return "\n Invalid template - each section must end with \"-> {...}\"\n\n Invalid section:\n ".concat(block(
3148
+ // TODO: Show code of invalid sections each time + DRY
3149
+ section.content
3150
+ .split('\n')
3151
+ .map(function (line) { return "> ".concat(line); })
3152
+ .join('\n')), "\n "); }));
3153
+ }
3154
+ var resultingParameterName = match.groups.resultingParamName;
3155
+ // TODO: [1] DRY description
3156
+ var description_1 = section.content;
3157
+ // Note: Remove codeblocks
3158
+ description_1 = description_1.split(/^```.*^```/gms).join('');
3159
+ //Note: Remove lists and return statement
3160
+ description_1 = description_1.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
3161
+ description_1 = spaceTrim.spaceTrim(description_1);
3162
+ if (description_1 === '') {
3163
+ description_1 = undefined;
3164
+ }
3165
+ if (Object.keys(jokers).length === 0) {
3166
+ jokers = undefined;
3167
+ }
3168
+ if (Object.keys(expectAmount).length === 0) {
3169
+ expectAmount = undefined;
3170
+ }
3171
+ if (Object.keys(postprocessing).length === 0) {
3172
+ postprocessing = undefined;
3173
+ }
3174
+ dependentParameterNames = union(dependentParameterNames, extractParametersFromPromptTemplate(__assign(__assign({}, section), { description: description_1, executionType: executionType, content: content })));
3175
+ if (templateModelRequirements.modelVariant === undefined) {
3176
+ templateModelRequirements.modelVariant = 'CHAT';
3177
+ }
3178
+ var template = {
3179
+ name: titleToName(section.title),
3180
+ title: section.title,
3181
+ description: description_1,
3182
+ dependentParameterNames: Array.from(dependentParameterNames),
3183
+ executionType: executionType,
3184
+ jokers: jokers,
3185
+ postprocessing: postprocessing,
3186
+ expectations: expectAmount,
3187
+ expectFormat: expectFormat,
3188
+ modelRequirements: templateModelRequirements,
3189
+ contentLanguage: executionType === 'SCRIPT' ? language : undefined,
3190
+ content: content,
3191
+ resultingParameterName: resultingParameterName,
3192
+ };
3193
+ if (executionType !== 'PROMPT_TEMPLATE') {
3194
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3195
+ delete template.modelRequirements;
3196
+ }
3197
+ promptbookJson.promptTemplates.push(template);
3198
+ };
3199
+ try {
3200
+ for (var _c = __values(markdownStructure.sections), _d = _c.next(); !_d.done; _d = _c.next()) {
3201
+ var section = _d.value;
3202
+ _loop_1(section);
3203
+ }
3204
+ }
3205
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
3206
+ finally {
3207
+ try {
3208
+ if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
3209
+ }
3210
+ finally { if (e_2) throw e_2.error; }
3211
+ }
3212
+ // =============================================================
3213
+ return promptbookJson;
3214
+ }
3215
+ /**
3216
+ * TODO: Report here line/column of error
3217
+ * TODO: Use spaceTrim more effectively
3218
+ * TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
3219
+ */
3220
+
2986
3221
  /**
2987
3222
  * Compile promptbook from string (markdown) format to JSON format
2988
3223
  *
3224
+ * Note: There are two similar functions:
3225
+ * - `promptbookStringToJson` **(preferred)** - which propperly compiles the promptbook and use embedding for external knowledge
3226
+ * - `promptbookStringToJsonSync` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
3227
+ *
2989
3228
  * @param promptbookString {Promptbook} in string markdown format (.ptbk.md)
2990
3229
  * @param options - Options and tools for the compilation
2991
3230
  * @returns {Promptbook} compiled in JSON format (.ptbk.json)
@@ -2997,262 +3236,29 @@
2997
3236
  function promptbookStringToJson(promptbookString, options) {
2998
3237
  if (options === void 0) { options = {}; }
2999
3238
  return __awaiter(this, void 0, void 0, function () {
3000
- var llmTools, promptbookJson, knowledge, addParam, markdownStructure, markdownStructureDeepness, description, defaultModelRequirements, listItems, listItems_1, listItems_1_1, listItem, command, _loop_1, _a, _b, section;
3001
- var e_1, _c, e_2, _d;
3002
- return __generator(this, function (_e) {
3003
- switch (_e.label) {
3239
+ var llmTools, knowledge, promptbookJson;
3240
+ return __generator(this, function (_a) {
3241
+ switch (_a.label) {
3004
3242
  case 0:
3005
3243
  llmTools = options.llmTools;
3006
- promptbookJson = {
3007
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3008
- title: undefined /* <- Note: Putting here placeholder to keep `title` on top at final JSON */,
3009
- promptbookUrl: undefined /* <- Note: Putting here placeholder to keep `promptbookUrl` on top at final JSON */,
3010
- promptbookVersion: PROMPTBOOK_VERSION,
3011
- description: undefined /* <- Note: Putting here placeholder to keep `description` on top at final JSON */,
3012
- parameters: [],
3013
- promptTemplates: [],
3014
- knowledge: [],
3015
- };
3016
3244
  if (!llmTools) return [3 /*break*/, 2];
3017
3245
  return [4 /*yield*/, prepareKnowledgeFromMarkdown({
3018
3246
  content: 'Roses are red, violets are blue, programmers use Promptbook, users too',
3019
3247
  llmTools: llmTools,
3020
3248
  })];
3021
3249
  case 1:
3022
- knowledge = _e.sent();
3250
+ knowledge = _a.sent();
3023
3251
  console.info('!!!! knowledge', knowledge);
3024
- _e.label = 2;
3252
+ _a.label = 2;
3025
3253
  case 2:
3026
- // =============================================================
3027
- // Note: 1️⃣ Normalization of the PROMPTBOOK string
3028
- promptbookString = removeContentComments(promptbookString);
3029
- promptbookString = promptbookString.replaceAll(/`\{(?<parameterName>[a-z0-9_]+)\}`/gi, '{$<parameterName>}');
3030
- promptbookString = promptbookString.replaceAll(/`->\s+\{(?<parameterName>[a-z0-9_]+)\}`/gi, '-> {$<parameterName>}');
3031
- addParam = function (parameterCommand) {
3032
- var parameterName = parameterCommand.parameterName, parameterDescription = parameterCommand.parameterDescription, isInput = parameterCommand.isInput, isOutput = parameterCommand.isOutput;
3033
- var existingParameter = promptbookJson.parameters.find(function (parameter) { return parameter.name === parameterName; });
3034
- if (existingParameter &&
3035
- existingParameter.description &&
3036
- existingParameter.description !== parameterDescription &&
3037
- parameterDescription) {
3038
- throw new PromptbookSyntaxError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameterName, "} is defined multiple times with different description.\n\n First definition:\n ").concat(block(existingParameter.description || '[undefined]'), "\n\n Second definition:\n ").concat(block(parameterDescription || '[undefined]'), "\n "); }));
3039
- }
3040
- if (existingParameter) {
3041
- if (parameterDescription) {
3042
- existingParameter.description = parameterDescription;
3043
- }
3044
- }
3045
- else {
3046
- promptbookJson.parameters.push({
3047
- name: parameterName,
3048
- description: parameterDescription || undefined,
3049
- isInput: isInput,
3050
- isOutput: isOutput,
3051
- });
3052
- }
3053
- };
3054
- markdownStructure = markdownToMarkdownStructure(promptbookString);
3055
- markdownStructureDeepness = countMarkdownStructureDeepness(markdownStructure);
3056
- if (markdownStructureDeepness !== 2) {
3057
- throw new PromptbookSyntaxError(spaceTrim.spaceTrim("\n Invalid markdown structure.\n The markdown must have exactly 2 levels of headings (one top-level section and one section for each template).\n Now it has ".concat(markdownStructureDeepness, " levels of headings.\n ")));
3058
- }
3059
- promptbookJson.title = markdownStructure.title;
3060
- description = markdownStructure.content;
3061
- // Note: Remove codeblocks
3062
- description = description.split(/^```.*^```/gms).join('');
3063
- //Note: Remove lists and return statement
3064
- description = description.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
3065
- description = spaceTrim.spaceTrim(description);
3066
- if (description === '') {
3067
- description = undefined;
3068
- }
3069
- promptbookJson.description = description;
3070
- defaultModelRequirements = {};
3071
- listItems = extractAllListItemsFromMarkdown(markdownStructure.content);
3072
- try {
3073
- for (listItems_1 = __values(listItems), listItems_1_1 = listItems_1.next(); !listItems_1_1.done; listItems_1_1 = listItems_1.next()) {
3074
- listItem = listItems_1_1.value;
3075
- command = parseCommand(listItem);
3076
- switch (command.type) {
3077
- case 'PROMPTBOOK_URL':
3078
- promptbookJson.promptbookUrl = command.promptbookUrl.href;
3079
- break;
3080
- case 'PROMPTBOOK_VERSION':
3081
- promptbookJson.promptbookVersion = command.promptbookVersion;
3082
- break;
3083
- case 'MODEL':
3084
- defaultModelRequirements[command.key] = command.value;
3085
- break;
3086
- case 'PARAMETER':
3087
- addParam(command);
3088
- break;
3089
- default:
3090
- throw new PromptbookSyntaxError("Command ".concat(command.type, " is not allowed in the head of the promptbook ONLY at the prompt template block"));
3091
- }
3092
- }
3093
- }
3094
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
3095
- finally {
3096
- try {
3097
- if (listItems_1_1 && !listItems_1_1.done && (_c = listItems_1.return)) _c.call(listItems_1);
3098
- }
3099
- finally { if (e_1) throw e_1.error; }
3100
- }
3101
- _loop_1 = function (section) {
3102
- var e_3, _f;
3103
- // TODO: Parse prompt template description (the content out of the codeblock and lists)
3104
- var templateModelRequirements = __assign({}, defaultModelRequirements);
3105
- var listItems_3 = extractAllListItemsFromMarkdown(section.content);
3106
- var dependentParameterNames = new Set();
3107
- var executionType = 'PROMPT_TEMPLATE';
3108
- var jokers = [];
3109
- var postprocessing = [];
3110
- var expectAmount = {};
3111
- var expectFormat = undefined;
3112
- var isExecutionTypeChanged = false;
3113
- try {
3114
- for (var listItems_2 = (e_3 = void 0, __values(listItems_3)), listItems_2_1 = listItems_2.next(); !listItems_2_1.done; listItems_2_1 = listItems_2.next()) {
3115
- var listItem = listItems_2_1.value;
3116
- var command = parseCommand(listItem);
3117
- switch (command.type) {
3118
- case 'JOKER':
3119
- jokers.push(command.parameterName);
3120
- dependentParameterNames.add(command.parameterName);
3121
- break;
3122
- case 'EXECUTE':
3123
- if (isExecutionTypeChanged) {
3124
- throw new PromptbookSyntaxError('Execution type is already defined in the prompt template. It can be defined only once.');
3125
- }
3126
- executionType = command.executionType;
3127
- isExecutionTypeChanged = true;
3128
- break;
3129
- case 'MODEL':
3130
- templateModelRequirements[command.key] = command.value;
3131
- break;
3132
- case 'PARAMETER':
3133
- // Note: This is just for detecting resulitng parameter name
3134
- addParam(command);
3135
- break;
3136
- case 'POSTPROCESS':
3137
- postprocessing.push(command.functionName);
3138
- break;
3139
- case 'EXPECT_AMOUNT':
3140
- // eslint-disable-next-line no-case-declarations
3141
- var unit = command.unit.toLowerCase();
3142
- expectAmount[unit] = expectAmount[unit] || {};
3143
- if (command.sign === 'MINIMUM' || command.sign === 'EXACTLY') {
3144
- if (expectAmount[unit].min !== undefined) {
3145
- throw new PromptbookSyntaxError("Already defined minumum ".concat(expectAmount[unit].min, " ").concat(command.unit.toLowerCase(), ", now trying to redefine it to ").concat(command.amount));
3146
- }
3147
- expectAmount[unit].min = command.amount;
3148
- } /* not else */
3149
- if (command.sign === 'MAXIMUM' || command.sign === 'EXACTLY') {
3150
- if (expectAmount[unit].max !== undefined) {
3151
- throw new PromptbookSyntaxError("Already defined maximum ".concat(expectAmount[unit].max, " ").concat(command.unit.toLowerCase(), ", now trying to redefine it to ").concat(command.amount));
3152
- }
3153
- expectAmount[unit].max = command.amount;
3154
- }
3155
- break;
3156
- case 'EXPECT_FORMAT':
3157
- if (expectFormat !== undefined && command.format !== expectFormat) {
3158
- throw new PromptbookSyntaxError("Expect format is already defined to \"".concat(expectFormat, "\". Now you try to redefine it by \"").concat(command.format, "\"."));
3159
- }
3160
- expectFormat = command.format;
3161
- break;
3162
- default:
3163
- throw new PromptbookSyntaxError("Command ".concat(command.type, " is not allowed in the block of the prompt template ONLY at the head of the promptbook"));
3164
- }
3165
- }
3166
- }
3167
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
3168
- finally {
3169
- try {
3170
- if (listItems_2_1 && !listItems_2_1.done && (_f = listItems_2.return)) _f.call(listItems_2);
3171
- }
3172
- finally { if (e_3) throw e_3.error; }
3173
- }
3174
- var _g = extractOneBlockFromMarkdown(section.content), language = _g.language, content = _g.content;
3175
- if (executionType === 'SCRIPT') {
3176
- if (!language) {
3177
- throw new PromptbookSyntaxError('You must specify the language of the script in the prompt template');
3178
- }
3179
- else if (!SUPPORTED_SCRIPT_LANGUAGES.includes(language)) {
3180
- throw new PromptbookSyntaxError(spaceTrim.spaceTrim(function (block) { return "\n Script language ".concat(language, " is not supported.\n\n Supported languages are:\n ").concat(block(SUPPORTED_SCRIPT_LANGUAGES.join(', ')), "\n\n "); }));
3181
- }
3182
- }
3183
- var lastLine = section.content.split('\n').pop();
3184
- var match = /^->\s*\{(?<resultingParamName>[a-z0-9_]+)\}/im.exec(lastLine);
3185
- if (!match || match.groups === undefined || match.groups.resultingParamName === undefined) {
3186
- throw new PromptbookSyntaxError(spaceTrim.spaceTrim(function (block) { return "\n Invalid template - each section must end with \"-> {...}\"\n\n Invalid section:\n ".concat(block(
3187
- // TODO: Show code of invalid sections each time + DRY
3188
- section.content
3189
- .split('\n')
3190
- .map(function (line) { return "> ".concat(line); })
3191
- .join('\n')), "\n "); }));
3192
- }
3193
- var resultingParameterName = match.groups.resultingParamName;
3194
- // TODO: [1] DRY description
3195
- var description_1 = section.content;
3196
- // Note: Remove codeblocks
3197
- description_1 = description_1.split(/^```.*^```/gms).join('');
3198
- //Note: Remove lists and return statement
3199
- description_1 = description_1.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
3200
- description_1 = spaceTrim.spaceTrim(description_1);
3201
- if (description_1 === '') {
3202
- description_1 = undefined;
3203
- }
3204
- if (Object.keys(jokers).length === 0) {
3205
- jokers = undefined;
3206
- }
3207
- if (Object.keys(expectAmount).length === 0) {
3208
- expectAmount = undefined;
3209
- }
3210
- if (Object.keys(postprocessing).length === 0) {
3211
- postprocessing = undefined;
3212
- }
3213
- dependentParameterNames = union(dependentParameterNames, extractParametersFromPromptTemplate(__assign(__assign({}, section), { description: description_1, executionType: executionType, content: content })));
3214
- if (templateModelRequirements.modelVariant === undefined) {
3215
- templateModelRequirements.modelVariant = 'CHAT';
3216
- }
3217
- promptbookJson.promptTemplates.push({
3218
- name: titleToName(section.title),
3219
- title: section.title,
3220
- description: description_1,
3221
- dependentParameterNames: Array.from(dependentParameterNames),
3222
- executionType: executionType,
3223
- jokers: jokers,
3224
- postprocessing: postprocessing,
3225
- expectations: expectAmount,
3226
- expectFormat: expectFormat,
3227
- modelRequirements: templateModelRequirements,
3228
- contentLanguage: executionType === 'SCRIPT' ? language : undefined,
3229
- content: content,
3230
- resultingParameterName: resultingParameterName,
3231
- });
3232
- };
3233
- try {
3234
- for (_a = __values(markdownStructure.sections), _b = _a.next(); !_b.done; _b = _a.next()) {
3235
- section = _b.value;
3236
- _loop_1(section);
3237
- }
3238
- }
3239
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
3240
- finally {
3241
- try {
3242
- if (_b && !_b.done && (_d = _a.return)) _d.call(_a);
3243
- }
3244
- finally { if (e_2) throw e_2.error; }
3245
- }
3246
- // =============================================================
3254
+ promptbookJson = promptbookStringToJsonSync(promptbookString);
3247
3255
  return [2 /*return*/, promptbookJson];
3248
3256
  }
3249
3257
  });
3250
3258
  });
3251
3259
  }
3252
3260
  /**
3253
- * TODO: Report here line/column of error
3254
- * TODO: Use spaceTrim more effectively
3255
- * TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
3261
+ * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
3256
3262
  */
3257
3263
 
3258
3264
  /* tslint:disable */
@@ -3379,7 +3385,7 @@
3379
3385
  case 0:
3380
3386
  isGraphAdded = options.isGraphAdded, isPrettifyed = options.isPrettifyed;
3381
3387
  if (!isGraphAdded) return [3 /*break*/, 2];
3382
- return [4 /*yield*/, promptbookStringToJson(promptbookString /* , {!!!!} */)];
3388
+ return [4 /*yield*/, promptbookStringToJson(promptbookString)];
3383
3389
  case 1:
3384
3390
  promptbookJson = _a.sent();
3385
3391
  promptbookMermaid_1 = renderPromptbookMermaid(promptbookJson, {
@@ -3421,6 +3427,14 @@
3421
3427
  return PromptbookLibraryError;
3422
3428
  }(Error));
3423
3429
 
3430
+ /**
3431
+ * Pretty print an embedding vector for logging
3432
+ */
3433
+ function embeddingVectorToString(embeddingVector) {
3434
+ var vectorLength = Math.pow(embeddingVector.reduce(function (acc, val) { return acc + Math.pow(val, 2); }, 0), 0.5);
3435
+ return "[EmbeddingVector; ".concat(embeddingVector.length, " dimensions; length: ").concat(vectorLength.toFixed(2), "; ").concat(embeddingVector.slice(0, 3).join(', '), "...]");
3436
+ }
3437
+
3424
3438
  /**
3425
3439
  * Function usageToWorktime will take usage and estimate saved worktime in hours of reading / writing
3426
3440
  *
@@ -3501,137 +3515,6 @@
3501
3515
  return SimplePromptInterfaceTools;
3502
3516
  }());
3503
3517
 
3504
- /**
3505
- * Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
3506
- *
3507
- * @see https://github.com/webgptorg/promptbook#multiple-server
3508
- */
3509
- var MultipleLlmExecutionTools = /** @class */ (function () {
3510
- /**
3511
- * Gets array of execution tools in order of priority
3512
- */
3513
- function MultipleLlmExecutionTools() {
3514
- var llmExecutionTools = [];
3515
- for (var _i = 0; _i < arguments.length; _i++) {
3516
- llmExecutionTools[_i] = arguments[_i];
3517
- }
3518
- this.llmExecutionTools = llmExecutionTools;
3519
- }
3520
- /**
3521
- * Calls the best available chat model
3522
- */
3523
- MultipleLlmExecutionTools.prototype.gptChat = function (prompt) {
3524
- return this.gptCommon(prompt);
3525
- };
3526
- /**
3527
- * Calls the best available completion model
3528
- */
3529
- MultipleLlmExecutionTools.prototype.gptComplete = function (prompt) {
3530
- return this.gptCommon(prompt);
3531
- };
3532
- /**
3533
- * Calls the best available model
3534
- */
3535
- MultipleLlmExecutionTools.prototype.gptCommon = function (prompt) {
3536
- return __awaiter(this, void 0, void 0, function () {
3537
- var errors, _a, _b, llmExecutionTools, error_1, e_1_1;
3538
- var e_1, _c;
3539
- return __generator(this, function (_d) {
3540
- switch (_d.label) {
3541
- case 0:
3542
- errors = [];
3543
- _d.label = 1;
3544
- case 1:
3545
- _d.trys.push([1, 11, 12, 13]);
3546
- _a = __values(this.llmExecutionTools), _b = _a.next();
3547
- _d.label = 2;
3548
- case 2:
3549
- if (!!_b.done) return [3 /*break*/, 10];
3550
- llmExecutionTools = _b.value;
3551
- _d.label = 3;
3552
- case 3:
3553
- _d.trys.push([3, 8, , 9]);
3554
- if (!(prompt.modelRequirements.modelVariant === 'CHAT')) return [3 /*break*/, 5];
3555
- return [4 /*yield*/, llmExecutionTools.gptChat(prompt)];
3556
- case 4: return [2 /*return*/, _d.sent()];
3557
- case 5:
3558
- if (!(prompt.modelRequirements.modelVariant === 'COMPLETION')) return [3 /*break*/, 7];
3559
- return [4 /*yield*/, llmExecutionTools.gptComplete(prompt)];
3560
- case 6: return [2 /*return*/, _d.sent()];
3561
- case 7: return [3 /*break*/, 9];
3562
- case 8:
3563
- error_1 = _d.sent();
3564
- if (!(error_1 instanceof Error)) {
3565
- throw error_1;
3566
- }
3567
- errors.push(error_1);
3568
- return [3 /*break*/, 9];
3569
- case 9:
3570
- _b = _a.next();
3571
- return [3 /*break*/, 2];
3572
- case 10: return [3 /*break*/, 13];
3573
- case 11:
3574
- e_1_1 = _d.sent();
3575
- e_1 = { error: e_1_1 };
3576
- return [3 /*break*/, 13];
3577
- case 12:
3578
- try {
3579
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
3580
- }
3581
- finally { if (e_1) throw e_1.error; }
3582
- return [7 /*endfinally*/];
3583
- case 13: throw new Error(spaceTrim__default["default"](function (block) { return "\n All execution tools failed:\n \n ".concat(block(errors.map(function (error) { return "- ".concat(error.name || 'Error', ": ").concat(error.message); }).join('\n')), "\n \n "); }));
3584
- }
3585
- });
3586
- });
3587
- };
3588
- /**
3589
- * List all available models that can be used
3590
- * This liost is a combination of all available models from all execution tools
3591
- */
3592
- MultipleLlmExecutionTools.prototype.listModels = function () {
3593
- return __awaiter(this, void 0, void 0, function () {
3594
- var availableModels, _a, _b, llmExecutionTools, models, e_2_1;
3595
- var e_2, _c;
3596
- return __generator(this, function (_d) {
3597
- switch (_d.label) {
3598
- case 0:
3599
- availableModels = [];
3600
- _d.label = 1;
3601
- case 1:
3602
- _d.trys.push([1, 6, 7, 8]);
3603
- _a = __values(this.llmExecutionTools), _b = _a.next();
3604
- _d.label = 2;
3605
- case 2:
3606
- if (!!_b.done) return [3 /*break*/, 5];
3607
- llmExecutionTools = _b.value;
3608
- return [4 /*yield*/, llmExecutionTools.listModels()];
3609
- case 3:
3610
- models = _d.sent();
3611
- availableModels.push.apply(availableModels, __spreadArray([], __read(models), false));
3612
- _d.label = 4;
3613
- case 4:
3614
- _b = _a.next();
3615
- return [3 /*break*/, 2];
3616
- case 5: return [3 /*break*/, 8];
3617
- case 6:
3618
- e_2_1 = _d.sent();
3619
- e_2 = { error: e_2_1 };
3620
- return [3 /*break*/, 8];
3621
- case 7:
3622
- try {
3623
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
3624
- }
3625
- finally { if (e_2) throw e_2.error; }
3626
- return [7 /*endfinally*/];
3627
- case 8: return [2 /*return*/, availableModels];
3628
- }
3629
- });
3630
- });
3631
- };
3632
- return MultipleLlmExecutionTools;
3633
- }());
3634
-
3635
3518
  /**
3636
3519
  * Constructs Promptbook from async sources
3637
3520
  * It can be one of the following:
@@ -3639,19 +3522,19 @@
3639
3522
  * - Factory function that returns Promise of array of PromptbookJson or PromptbookString
3640
3523
  *
3641
3524
  * Note: This is useful as internal tool for other constructor functions like
3642
- * `createPromptbookLibraryFromUrl` or `createPromptbookLibraryFromDirectory`
3525
+ * `createLibraryFromUrl` or `createLibraryFromDirectory`
3643
3526
  * Consider using those functions instead of this one
3644
3527
  *
3645
3528
  * Note: The function does NOT return promise it returns the library directly which waits for the sources to be resolved
3646
3529
  * when error occurs in given promise or factory function, it is thrown during `listPromptbooks` or `getPromptbookByUrl` call
3647
3530
  *
3648
- * Note: Consider using `createPromptbookLibraryFromDirectory` or `createPromptbookLibraryFromUrl`
3531
+ * Note: Consider using `createLibraryFromDirectory` or `createLibraryFromUrl`
3649
3532
  *
3650
3533
  * @param promptbookSourcesPromiseOrFactory
3651
3534
  * @returns PromptbookLibrary
3652
3535
  * @deprecated Do not use, it will became internal tool for other constructor functions
3653
3536
  */
3654
- function createPromptbookLibraryFromPromise(promptbookSourcesPromiseOrFactory) {
3537
+ function createLibraryFromPromise(promptbookSourcesPromiseOrFactory) {
3655
3538
  var library;
3656
3539
  function forSources() {
3657
3540
  return __awaiter(this, void 0, void 0, function () {
@@ -3666,9 +3549,7 @@
3666
3549
  return [4 /*yield*/, promptbookSourcesPromiseOrFactory];
3667
3550
  case 1:
3668
3551
  promptbookSources = _a.sent();
3669
- return [4 /*yield*/, createPromptbookLibraryFromSources.apply(void 0, __spreadArray([], __read(promptbookSources), false))];
3670
- case 2:
3671
- library = _a.sent();
3552
+ library = createLibraryFromJson.apply(void 0, __spreadArray([], __read(promptbookSources), false));
3672
3553
  return [2 /*return*/];
3673
3554
  }
3674
3555
  });
@@ -3716,16 +3597,13 @@
3716
3597
  isResponsibleForPrompt: isResponsibleForPrompt,
3717
3598
  };
3718
3599
  }
3719
- /**
3720
- * TODO: !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
3721
- */
3722
3600
 
3723
3601
  /**
3724
3602
  * Constructs Promptbook from remote Promptbase URL
3725
3603
 
3726
3604
  * @returns PromptbookLibrary
3727
3605
  */
3728
- function createPromptbookLibraryFromUrl(url, options) {
3606
+ function createLibraryFromUrl(url, options) {
3729
3607
  return __awaiter(this, void 0, void 0, function () {
3730
3608
  var _a, _b, isVerbose, _c, isLazyLoaded, library;
3731
3609
  var _this = this;
@@ -3733,7 +3611,7 @@
3733
3611
  switch (_d.label) {
3734
3612
  case 0:
3735
3613
  _a = options || {}, _b = _a.isVerbose, isVerbose = _b === void 0 ? false : _b, _c = _a.isLazyLoaded, isLazyLoaded = _c === void 0 ? false : _c;
3736
- library = createPromptbookLibraryFromPromise(function () { return __awaiter(_this, void 0, void 0, function () {
3614
+ library = createLibraryFromPromise(function () { return __awaiter(_this, void 0, void 0, function () {
3737
3615
  return __generator(this, function (_a) {
3738
3616
  if (isVerbose) {
3739
3617
  console.info("Creating promptbook library from url ".concat(url.toString()));
@@ -3764,7 +3642,7 @@
3764
3642
  * @param promptbookSources
3765
3643
  * @returns PromptbookLibrary
3766
3644
  */
3767
- function createPromptbookSublibrary(library, predicate) {
3645
+ function createSublibrary(library, predicate) {
3768
3646
  function listPromptbooks() {
3769
3647
  return __awaiter(this, void 0, void 0, function () {
3770
3648
  var promptbooks;
@@ -3834,6 +3712,159 @@
3834
3712
  };
3835
3713
  }
3836
3714
 
3715
+ /**
3716
+ * Converts PromptbookLibrary to serialized JSON
3717
+ *
3718
+ * Note: Functions `libraryToJson` and `createLibraryFromJson` are complementary
3719
+ */
3720
+ function libraryToJson(library) {
3721
+ return __awaiter(this, void 0, void 0, function () {
3722
+ var promptbookUrls, promptbooks;
3723
+ return __generator(this, function (_a) {
3724
+ switch (_a.label) {
3725
+ case 0: return [4 /*yield*/, library.listPromptbooks()];
3726
+ case 1:
3727
+ promptbookUrls = _a.sent();
3728
+ return [4 /*yield*/, Promise.all(promptbookUrls.map(function (url) { return library.getPromptbookByUrl(url); }))];
3729
+ case 2:
3730
+ promptbooks = _a.sent();
3731
+ return [2 /*return*/, promptbooks];
3732
+ }
3733
+ });
3734
+ });
3735
+ }
3736
+
3737
+ /**
3738
+ * Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
3739
+ *
3740
+ * @see https://github.com/webgptorg/promptbook#multiple-server
3741
+ */
3742
+ var MultipleLlmExecutionTools = /** @class */ (function () {
3743
+ /**
3744
+ * Gets array of execution tools in order of priority
3745
+ */
3746
+ function MultipleLlmExecutionTools() {
3747
+ var llmExecutionTools = [];
3748
+ for (var _i = 0; _i < arguments.length; _i++) {
3749
+ llmExecutionTools[_i] = arguments[_i];
3750
+ }
3751
+ this.llmExecutionTools = llmExecutionTools;
3752
+ }
3753
+ /**
3754
+ * Calls the best available chat model
3755
+ */
3756
+ MultipleLlmExecutionTools.prototype.gptChat = function (prompt) {
3757
+ return this.gptCommon(prompt);
3758
+ };
3759
+ /**
3760
+ * Calls the best available completion model
3761
+ */
3762
+ MultipleLlmExecutionTools.prototype.gptComplete = function (prompt) {
3763
+ return this.gptCommon(prompt);
3764
+ };
3765
+ /**
3766
+ * Calls the best available model
3767
+ */
3768
+ MultipleLlmExecutionTools.prototype.gptCommon = function (prompt) {
3769
+ return __awaiter(this, void 0, void 0, function () {
3770
+ var errors, _a, _b, llmExecutionTools, error_1, e_1_1;
3771
+ var e_1, _c;
3772
+ return __generator(this, function (_d) {
3773
+ switch (_d.label) {
3774
+ case 0:
3775
+ errors = [];
3776
+ _d.label = 1;
3777
+ case 1:
3778
+ _d.trys.push([1, 11, 12, 13]);
3779
+ _a = __values(this.llmExecutionTools), _b = _a.next();
3780
+ _d.label = 2;
3781
+ case 2:
3782
+ if (!!_b.done) return [3 /*break*/, 10];
3783
+ llmExecutionTools = _b.value;
3784
+ _d.label = 3;
3785
+ case 3:
3786
+ _d.trys.push([3, 8, , 9]);
3787
+ if (!(prompt.modelRequirements.modelVariant === 'CHAT')) return [3 /*break*/, 5];
3788
+ return [4 /*yield*/, llmExecutionTools.gptChat(prompt)];
3789
+ case 4: return [2 /*return*/, _d.sent()];
3790
+ case 5:
3791
+ if (!(prompt.modelRequirements.modelVariant === 'COMPLETION')) return [3 /*break*/, 7];
3792
+ return [4 /*yield*/, llmExecutionTools.gptComplete(prompt)];
3793
+ case 6: return [2 /*return*/, _d.sent()];
3794
+ case 7: return [3 /*break*/, 9];
3795
+ case 8:
3796
+ error_1 = _d.sent();
3797
+ if (!(error_1 instanceof Error)) {
3798
+ throw error_1;
3799
+ }
3800
+ errors.push(error_1);
3801
+ return [3 /*break*/, 9];
3802
+ case 9:
3803
+ _b = _a.next();
3804
+ return [3 /*break*/, 2];
3805
+ case 10: return [3 /*break*/, 13];
3806
+ case 11:
3807
+ e_1_1 = _d.sent();
3808
+ e_1 = { error: e_1_1 };
3809
+ return [3 /*break*/, 13];
3810
+ case 12:
3811
+ try {
3812
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
3813
+ }
3814
+ finally { if (e_1) throw e_1.error; }
3815
+ return [7 /*endfinally*/];
3816
+ case 13: throw new Error(spaceTrim__default["default"](function (block) { return "\n All execution tools failed:\n \n ".concat(block(errors.map(function (error) { return "- ".concat(error.name || 'Error', ": ").concat(error.message); }).join('\n')), "\n \n "); }));
3817
+ }
3818
+ });
3819
+ });
3820
+ };
3821
+ /**
3822
+ * List all available models that can be used
3823
+ * This liost is a combination of all available models from all execution tools
3824
+ */
3825
+ MultipleLlmExecutionTools.prototype.listModels = function () {
3826
+ return __awaiter(this, void 0, void 0, function () {
3827
+ var availableModels, _a, _b, llmExecutionTools, models, e_2_1;
3828
+ var e_2, _c;
3829
+ return __generator(this, function (_d) {
3830
+ switch (_d.label) {
3831
+ case 0:
3832
+ availableModels = [];
3833
+ _d.label = 1;
3834
+ case 1:
3835
+ _d.trys.push([1, 6, 7, 8]);
3836
+ _a = __values(this.llmExecutionTools), _b = _a.next();
3837
+ _d.label = 2;
3838
+ case 2:
3839
+ if (!!_b.done) return [3 /*break*/, 5];
3840
+ llmExecutionTools = _b.value;
3841
+ return [4 /*yield*/, llmExecutionTools.listModels()];
3842
+ case 3:
3843
+ models = _d.sent();
3844
+ availableModels.push.apply(availableModels, __spreadArray([], __read(models), false));
3845
+ _d.label = 4;
3846
+ case 4:
3847
+ _b = _a.next();
3848
+ return [3 /*break*/, 2];
3849
+ case 5: return [3 /*break*/, 8];
3850
+ case 6:
3851
+ e_2_1 = _d.sent();
3852
+ e_2 = { error: e_2_1 };
3853
+ return [3 /*break*/, 8];
3854
+ case 7:
3855
+ try {
3856
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
3857
+ }
3858
+ finally { if (e_2) throw e_2.error; }
3859
+ return [7 /*endfinally*/];
3860
+ case 8: return [2 /*return*/, availableModels];
3861
+ }
3862
+ });
3863
+ });
3864
+ };
3865
+ return MultipleLlmExecutionTools;
3866
+ }());
3867
+
3837
3868
  /**
3838
3869
  * Format either small or big number
3839
3870
  *
@@ -4150,25 +4181,27 @@
4150
4181
  exports.PromptbookReferenceError = PromptbookReferenceError;
4151
4182
  exports.PromptbookSyntaxError = PromptbookSyntaxError;
4152
4183
  exports.SimplePromptInterfaceTools = SimplePromptInterfaceTools;
4153
- exports.SimplePromptbookLibrary = SimplePromptbookLibrary;
4154
4184
  exports.TemplateError = TemplateError;
4155
4185
  exports.UnexpectedError = UnexpectedError;
4156
4186
  exports.addUsage = addUsage;
4157
4187
  exports.assertsExecutionSuccessful = assertsExecutionSuccessful;
4158
4188
  exports.checkExpectations = checkExpectations;
4189
+ exports.createLibraryFromJson = createLibraryFromJson;
4190
+ exports.createLibraryFromPromise = createLibraryFromPromise;
4191
+ exports.createLibraryFromUrl = createLibraryFromUrl;
4159
4192
  exports.createPromptbookExecutor = createPromptbookExecutor;
4160
- exports.createPromptbookLibraryFromPromise = createPromptbookLibraryFromPromise;
4161
- exports.createPromptbookLibraryFromSources = createPromptbookLibraryFromSources;
4162
- exports.createPromptbookLibraryFromUrl = createPromptbookLibraryFromUrl;
4163
- exports.createPromptbookSublibrary = createPromptbookSublibrary;
4193
+ exports.createSublibrary = createSublibrary;
4194
+ exports.embeddingVectorToString = embeddingVectorToString;
4164
4195
  exports.executionReportJsonToString = executionReportJsonToString;
4165
4196
  exports.isPassingExpectations = isPassingExpectations;
4197
+ exports.libraryToJson = libraryToJson;
4166
4198
  exports.prepareKnowledgeFromMarkdown = prepareKnowledgeFromMarkdown;
4167
4199
  exports.prettifyPromptbookString = prettifyPromptbookString;
4168
4200
  exports.promptbookJsonToString = promptbookJsonToString;
4169
4201
  exports.promptbookStringToJson = promptbookStringToJson;
4202
+ exports.promptbookStringToJsonSync = promptbookStringToJsonSync;
4170
4203
  exports.usageToWorktime = usageToWorktime;
4171
- exports.validatePromptbookJson = validatePromptbookJson;
4204
+ exports.validatePromptbook = validatePromptbook;
4172
4205
 
4173
4206
  Object.defineProperty(exports, '__esModule', { value: true });
4174
4207