@promptbook/cli 0.41.109

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 (363) hide show
  1. package/README.md +5 -0
  2. package/bin/promptbook-cli.js +11 -0
  3. package/esm/index.es.js +1356 -0
  4. package/esm/index.es.js.map +1 -0
  5. package/esm/typings/_packages/cli.index.d.ts +8 -0
  6. package/esm/typings/_packages/core.index.d.ts +20 -0
  7. package/esm/typings/_packages/execute-javascript.index.d.ts +3 -0
  8. package/esm/typings/_packages/openai.index.d.ts +3 -0
  9. package/esm/typings/_packages/remote-client.index.d.ts +4 -0
  10. package/esm/typings/_packages/remote-server.index.d.ts +3 -0
  11. package/esm/typings/_packages/types.index.d.ts +27 -0
  12. package/esm/typings/_packages/utils.index.d.ts +31 -0
  13. package/esm/typings/_packages/wizzard.index.d.ts +5 -0
  14. package/esm/typings/config.d.ts +4 -0
  15. package/esm/typings/conversion/prettify/PrettifyOptions.d.ts +7 -0
  16. package/esm/typings/conversion/prettify/prettifyPromptbookString.d.ts +10 -0
  17. package/esm/typings/conversion/prettify/prettifyPromptbookStringCli.d.ts +9 -0
  18. package/esm/typings/conversion/promptbookStringToJson.d.ts +13 -0
  19. package/esm/typings/conversion/utils/extractVariables.d.ts +10 -0
  20. package/esm/typings/conversion/utils/extractVariables.test.d.ts +1 -0
  21. package/esm/typings/conversion/utils/parseCommand.d.ts +8 -0
  22. package/esm/typings/conversion/utils/parseCommand.test.d.ts +4 -0
  23. package/esm/typings/conversion/utils/parseNumber.d.ts +12 -0
  24. package/esm/typings/conversion/utils/parseNumber.test.d.ts +1 -0
  25. package/esm/typings/conversion/validation/_importPromptbook.d.ts +12 -0
  26. package/esm/typings/conversion/validation/promptbookStringToJson-syntaxErrors.test.d.ts +1 -0
  27. package/esm/typings/conversion/validation/promptbookStringToJson.test.d.ts +1 -0
  28. package/esm/typings/conversion/validation/validatePromptbookJson-logicErrors.test.d.ts +1 -0
  29. package/esm/typings/conversion/validation/validatePromptbookJson.d.ts +26 -0
  30. package/esm/typings/conversion/validation/validatePromptbookJson.test.d.ts +1 -0
  31. package/esm/typings/errors/ExpectError.d.ts +9 -0
  32. package/esm/typings/errors/NotFoundError.d.ts +7 -0
  33. package/esm/typings/errors/PromptbookExecutionError.d.ts +7 -0
  34. package/esm/typings/errors/PromptbookLogicError.d.ts +7 -0
  35. package/esm/typings/errors/PromptbookReferenceError.d.ts +7 -0
  36. package/esm/typings/errors/PromptbookSyntaxError.d.ts +7 -0
  37. package/esm/typings/errors/UnexpectedError.d.ts +7 -0
  38. package/esm/typings/execution/CommonExecutionToolsOptions.d.ts +9 -0
  39. package/esm/typings/execution/ExecutionTools.d.ts +25 -0
  40. package/esm/typings/execution/NaturalExecutionTools.d.ts +23 -0
  41. package/esm/typings/execution/PromptResult.d.ts +74 -0
  42. package/esm/typings/execution/PromptbookExecutor.d.ts +39 -0
  43. package/esm/typings/execution/ScriptExecutionTools.d.ts +37 -0
  44. package/esm/typings/execution/UserInterfaceTools.d.ts +45 -0
  45. package/esm/typings/execution/assertsExecutionSuccessful.d.ts +11 -0
  46. package/esm/typings/execution/createPromptbookExecutor.d.ts +41 -0
  47. package/esm/typings/execution/plugins/natural-execution-tools/mocked/MockedEchoNaturalExecutionTools.d.ts +22 -0
  48. package/esm/typings/execution/plugins/natural-execution-tools/mocked/joker.test.d.ts +4 -0
  49. package/esm/typings/execution/plugins/natural-execution-tools/mocked/mocked-chat.test.d.ts +4 -0
  50. package/esm/typings/execution/plugins/natural-execution-tools/mocked/mocked-completion.test.d.ts +4 -0
  51. package/esm/typings/execution/plugins/natural-execution-tools/openai/OpenAiExecutionTools.d.ts +28 -0
  52. package/esm/typings/execution/plugins/natural-execution-tools/openai/OpenAiExecutionToolsOptions.d.ts +16 -0
  53. package/esm/typings/execution/plugins/natural-execution-tools/openai/computeOpenaiUsage.d.ts +3 -0
  54. package/esm/typings/execution/plugins/natural-execution-tools/remote/RemoteNaturalExecutionTools.d.ts +35 -0
  55. package/esm/typings/execution/plugins/natural-execution-tools/remote/RemoteNaturalExecutionToolsOptions.d.ts +23 -0
  56. package/esm/typings/execution/plugins/natural-execution-tools/remote/interfaces/Promptbook_Server_Error.d.ts +11 -0
  57. package/esm/typings/execution/plugins/natural-execution-tools/remote/interfaces/Promptbook_Server_Progress.d.ts +12 -0
  58. package/esm/typings/execution/plugins/natural-execution-tools/remote/interfaces/Promptbook_Server_Request.d.ts +17 -0
  59. package/esm/typings/execution/plugins/natural-execution-tools/remote/interfaces/Promptbook_Server_Response.d.ts +12 -0
  60. package/esm/typings/execution/plugins/natural-execution-tools/remote/interfaces/RemoteServerOptions.d.ts +27 -0
  61. package/esm/typings/execution/plugins/natural-execution-tools/remote/startRemoteServer.d.ts +17 -0
  62. package/esm/typings/execution/plugins/script-execution-tools/custom-function-async.test.ts.test.d.ts +1 -0
  63. package/esm/typings/execution/plugins/script-execution-tools/custom-function-missing.test.d.ts +1 -0
  64. package/esm/typings/execution/plugins/script-execution-tools/custom-function-with-dependencies.test.d.ts +1 -0
  65. package/esm/typings/execution/plugins/script-execution-tools/custom-function.test.d.ts +1 -0
  66. package/esm/typings/execution/plugins/script-execution-tools/javascript/JavascriptEvalExecutionTools.d.ts +20 -0
  67. package/esm/typings/execution/plugins/script-execution-tools/javascript/JavascriptEvalExecutionTools.test.d.ts +4 -0
  68. package/esm/typings/execution/plugins/script-execution-tools/javascript/JavascriptExecutionTools.d.ts +20 -0
  69. package/esm/typings/execution/plugins/script-execution-tools/javascript/JavascriptExecutionToolsOptions.d.ts +22 -0
  70. package/esm/typings/execution/plugins/script-execution-tools/javascript/utils/preserve.d.ts +11 -0
  71. package/esm/typings/execution/plugins/script-execution-tools/postprocessing.test.d.ts +1 -0
  72. package/esm/typings/execution/plugins/script-execution-tools/python/PythonExecutionTools.d.ts +15 -0
  73. package/esm/typings/execution/plugins/script-execution-tools/script-execution-errors.test.d.ts +1 -0
  74. package/esm/typings/execution/plugins/script-execution-tools/script-execution-tools.test.d.ts +1 -0
  75. package/esm/typings/execution/plugins/script-execution-tools/typescript/TypescriptExecutionTools.d.ts +15 -0
  76. package/esm/typings/execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceTools.d.ts +14 -0
  77. package/esm/typings/execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions.d.ts +12 -0
  78. package/esm/typings/execution/plugins/user-interface-execution-tools/simple-prompt/SimplePromptInterfaceTools.d.ts +16 -0
  79. package/esm/typings/execution/plugins/user-interface-execution-tools/user-interface-execution-tools.test.d.ts +1 -0
  80. package/esm/typings/execution/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts +4 -0
  81. package/esm/typings/execution/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +9 -0
  82. package/esm/typings/execution/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +5 -0
  83. package/esm/typings/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +11 -0
  84. package/esm/typings/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +4 -0
  85. package/esm/typings/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +1 -0
  86. package/esm/typings/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.test.d.ts +1 -0
  87. package/esm/typings/execution/translation/automatic-translate/translateMessages.d.ts +5 -0
  88. package/esm/typings/execution/utils/replaceParameters.d.ts +12 -0
  89. package/esm/typings/execution/utils/replaceParameters.test.d.ts +1 -0
  90. package/esm/typings/library/PromptbookLibrary.d.ts +25 -0
  91. package/esm/typings/library/SimplePromptbookLibrary.d.ts +35 -0
  92. package/esm/typings/library/constructors/createPromptbookLibraryFromDirectory.d.ts +5 -0
  93. package/esm/typings/library/constructors/createPromptbookLibraryFromList.d.ts +5 -0
  94. package/esm/typings/library/constructors/createPromptbookLibraryFromPromise.d.ts +7 -0
  95. package/esm/typings/library/constructors/createPromptbookLibraryFromSources.d.ts +16 -0
  96. package/esm/typings/library/constructors/createPromptbookSublibrary.d.ts +6 -0
  97. package/esm/typings/types/Command.d.ts +98 -0
  98. package/esm/typings/types/ExecutionTypes.d.ts +13 -0
  99. package/esm/typings/types/ModelRequirements.d.ts +41 -0
  100. package/esm/typings/types/Parameters.d.ts +14 -0
  101. package/esm/typings/types/Prompt.d.ts +41 -0
  102. package/esm/typings/types/PromptbookJson/PromptTemplateJson.d.ts +126 -0
  103. package/esm/typings/types/PromptbookJson/PromptTemplateParameterJson.d.ts +25 -0
  104. package/esm/typings/types/PromptbookJson/PromptbookJson.d.ts +51 -0
  105. package/esm/typings/types/PromptbookString.d.ts +12 -0
  106. package/esm/typings/types/ScriptLanguage.d.ts +9 -0
  107. package/esm/typings/types/TaskProgress.d.ts +42 -0
  108. package/esm/typings/types/execution-report/ExecutionReportJson.d.ts +56 -0
  109. package/esm/typings/types/execution-report/ExecutionReportString.d.ts +16 -0
  110. package/esm/typings/types/execution-report/ExecutionReportStringOptions.d.ts +21 -0
  111. package/esm/typings/types/execution-report/config.d.ts +8 -0
  112. package/esm/typings/types/execution-report/countWorkingDuration.d.ts +7 -0
  113. package/esm/typings/types/execution-report/countWorkingDuration.test.d.ts +1 -0
  114. package/esm/typings/types/execution-report/executionReportJsonToString.d.ts +11 -0
  115. package/esm/typings/types/execution-report/executionReportJsonToString.test.d.ts +1 -0
  116. package/esm/typings/types/typeAliasEmoji.d.ts +9 -0
  117. package/esm/typings/types/typeAliases.d.ts +432 -0
  118. package/esm/typings/utils/FromtoItems.d.ts +19 -0
  119. package/esm/typings/utils/emojis.d.ts +22 -0
  120. package/esm/typings/utils/expectation-counters/countCharacters.d.ts +5 -0
  121. package/esm/typings/utils/expectation-counters/countCharacters.test.d.ts +1 -0
  122. package/esm/typings/utils/expectation-counters/countLines.d.ts +5 -0
  123. package/esm/typings/utils/expectation-counters/countLines.test.d.ts +1 -0
  124. package/esm/typings/utils/expectation-counters/countPages.d.ts +5 -0
  125. package/esm/typings/utils/expectation-counters/countPages.test.d.ts +1 -0
  126. package/esm/typings/utils/expectation-counters/countParagraphs.d.ts +5 -0
  127. package/esm/typings/utils/expectation-counters/countParagraphs.test.d.ts +1 -0
  128. package/esm/typings/utils/expectation-counters/countSentences.d.ts +5 -0
  129. package/esm/typings/utils/expectation-counters/countSentences.test.d.ts +1 -0
  130. package/esm/typings/utils/expectation-counters/countWords.d.ts +5 -0
  131. package/esm/typings/utils/expectation-counters/countWords.test.d.ts +1 -0
  132. package/esm/typings/utils/expectation-counters/index.d.ts +5 -0
  133. package/esm/typings/utils/extractParameters.d.ts +10 -0
  134. package/esm/typings/utils/extractParameters.test.d.ts +1 -0
  135. package/esm/typings/utils/formatNumber.d.ts +6 -0
  136. package/esm/typings/utils/formatNumber.test.d.ts +1 -0
  137. package/esm/typings/utils/getCurrentIsoDate.d.ts +7 -0
  138. package/esm/typings/utils/isRunningInWhatever.d.ts +12 -0
  139. package/esm/typings/utils/isValidJsonString.d.ts +4 -0
  140. package/esm/typings/utils/isValidJsonString.test.d.ts +1 -0
  141. package/esm/typings/utils/just.d.ts +10 -0
  142. package/esm/typings/utils/markdown/addAutoGeneratedSection.d.ts +10 -0
  143. package/esm/typings/utils/markdown/addAutoGeneratedSection.test.d.ts +1 -0
  144. package/esm/typings/utils/markdown/createMarkdownChart.d.ts +41 -0
  145. package/esm/typings/utils/markdown/createMarkdownChart.test.d.ts +1 -0
  146. package/esm/typings/utils/markdown/createMarkdownTable.d.ts +7 -0
  147. package/esm/typings/utils/markdown/createMarkdownTable.test.d.ts +1 -0
  148. package/esm/typings/utils/markdown/escapeMarkdownBlock.d.ts +6 -0
  149. package/esm/typings/utils/markdown/escapeMarkdownBlock.test.d.ts +1 -0
  150. package/esm/typings/utils/markdown/extractAllBlocksFromMarkdown.d.ts +27 -0
  151. package/esm/typings/utils/markdown/extractAllBlocksFromMarkdown.test.d.ts +1 -0
  152. package/esm/typings/utils/markdown/extractAllListItemsFromMarkdown.d.ts +13 -0
  153. package/esm/typings/utils/markdown/extractAllListItemsFromMarkdown.test.d.ts +1 -0
  154. package/esm/typings/utils/markdown/extractOneBlockFromMarkdown.d.ts +19 -0
  155. package/esm/typings/utils/markdown/extractOneBlockFromMarkdown.test.d.ts +1 -0
  156. package/esm/typings/utils/markdown/prettifyMarkdown.d.ts +8 -0
  157. package/esm/typings/utils/markdown/prettifyMarkdown.test.d.ts +1 -0
  158. package/esm/typings/utils/markdown/removeContentComments.d.ts +8 -0
  159. package/esm/typings/utils/markdown/removeContentComments.test.d.ts +1 -0
  160. package/esm/typings/utils/markdown/removeMarkdownFormatting.d.ts +8 -0
  161. package/esm/typings/utils/markdown/removeMarkdownFormatting.test.d.ts +1 -0
  162. package/esm/typings/utils/markdown-json/MarkdownStructure.d.ts +25 -0
  163. package/esm/typings/utils/markdown-json/countMarkdownStructureDeepness.d.ts +7 -0
  164. package/esm/typings/utils/markdown-json/countMarkdownStructureDeepness.test.d.ts +1 -0
  165. package/esm/typings/utils/markdown-json/markdownToMarkdownStructure.d.ts +13 -0
  166. package/esm/typings/utils/markdown-json/markdownToMarkdownStructure.test.d.ts +1 -0
  167. package/esm/typings/utils/postprocessing/extractBlock.d.ts +12 -0
  168. package/esm/typings/utils/removeEmojis.d.ts +7 -0
  169. package/esm/typings/utils/removeEmojis.test.d.ts +1 -0
  170. package/esm/typings/utils/removeQuotes.d.ts +13 -0
  171. package/esm/typings/utils/removeQuotes.test.d.ts +1 -0
  172. package/esm/typings/utils/trimCodeBlock.d.ts +8 -0
  173. package/esm/typings/utils/trimCodeBlock.test.d.ts +1 -0
  174. package/esm/typings/utils/trimEndOfCodeBlock.d.ts +7 -0
  175. package/esm/typings/utils/trimEndOfCodeBlock.test.d.ts +1 -0
  176. package/esm/typings/utils/unwrapResult.d.ts +36 -0
  177. package/esm/typings/utils/unwrapResult.test.d.ts +1 -0
  178. package/esm/typings/utils/validators/url/isValidUrl.d.ts +7 -0
  179. package/esm/typings/utils/validators/url/isValidUrl.test.d.ts +1 -0
  180. package/esm/typings/version.d.ts +5 -0
  181. package/esm/typings/wizzard/Wizzard.d.ts +4 -0
  182. package/esm/typings/wizzard/sample.d.ts +6 -0
  183. package/package.json +54 -0
  184. package/umd/index.umd.js +1364 -0
  185. package/umd/index.umd.js.map +1 -0
  186. package/umd/typings/_packages/cli.index.d.ts +8 -0
  187. package/umd/typings/_packages/core.index.d.ts +20 -0
  188. package/umd/typings/_packages/execute-javascript.index.d.ts +3 -0
  189. package/umd/typings/_packages/openai.index.d.ts +3 -0
  190. package/umd/typings/_packages/remote-client.index.d.ts +4 -0
  191. package/umd/typings/_packages/remote-server.index.d.ts +3 -0
  192. package/umd/typings/_packages/types.index.d.ts +27 -0
  193. package/umd/typings/_packages/utils.index.d.ts +31 -0
  194. package/umd/typings/_packages/wizzard.index.d.ts +5 -0
  195. package/umd/typings/config.d.ts +4 -0
  196. package/umd/typings/conversion/prettify/PrettifyOptions.d.ts +7 -0
  197. package/umd/typings/conversion/prettify/prettifyPromptbookString.d.ts +10 -0
  198. package/umd/typings/conversion/prettify/prettifyPromptbookStringCli.d.ts +9 -0
  199. package/umd/typings/conversion/promptbookStringToJson.d.ts +13 -0
  200. package/umd/typings/conversion/utils/extractVariables.d.ts +10 -0
  201. package/umd/typings/conversion/utils/extractVariables.test.d.ts +1 -0
  202. package/umd/typings/conversion/utils/parseCommand.d.ts +8 -0
  203. package/umd/typings/conversion/utils/parseCommand.test.d.ts +4 -0
  204. package/umd/typings/conversion/utils/parseNumber.d.ts +12 -0
  205. package/umd/typings/conversion/utils/parseNumber.test.d.ts +1 -0
  206. package/umd/typings/conversion/validation/_importPromptbook.d.ts +12 -0
  207. package/umd/typings/conversion/validation/promptbookStringToJson-syntaxErrors.test.d.ts +1 -0
  208. package/umd/typings/conversion/validation/promptbookStringToJson.test.d.ts +1 -0
  209. package/umd/typings/conversion/validation/validatePromptbookJson-logicErrors.test.d.ts +1 -0
  210. package/umd/typings/conversion/validation/validatePromptbookJson.d.ts +26 -0
  211. package/umd/typings/conversion/validation/validatePromptbookJson.test.d.ts +1 -0
  212. package/umd/typings/errors/ExpectError.d.ts +9 -0
  213. package/umd/typings/errors/NotFoundError.d.ts +7 -0
  214. package/umd/typings/errors/PromptbookExecutionError.d.ts +7 -0
  215. package/umd/typings/errors/PromptbookLogicError.d.ts +7 -0
  216. package/umd/typings/errors/PromptbookReferenceError.d.ts +7 -0
  217. package/umd/typings/errors/PromptbookSyntaxError.d.ts +7 -0
  218. package/umd/typings/errors/UnexpectedError.d.ts +7 -0
  219. package/umd/typings/execution/CommonExecutionToolsOptions.d.ts +9 -0
  220. package/umd/typings/execution/ExecutionTools.d.ts +25 -0
  221. package/umd/typings/execution/NaturalExecutionTools.d.ts +23 -0
  222. package/umd/typings/execution/PromptResult.d.ts +74 -0
  223. package/umd/typings/execution/PromptbookExecutor.d.ts +39 -0
  224. package/umd/typings/execution/ScriptExecutionTools.d.ts +37 -0
  225. package/umd/typings/execution/UserInterfaceTools.d.ts +45 -0
  226. package/umd/typings/execution/assertsExecutionSuccessful.d.ts +11 -0
  227. package/umd/typings/execution/createPromptbookExecutor.d.ts +41 -0
  228. package/umd/typings/execution/plugins/natural-execution-tools/mocked/MockedEchoNaturalExecutionTools.d.ts +22 -0
  229. package/umd/typings/execution/plugins/natural-execution-tools/mocked/joker.test.d.ts +4 -0
  230. package/umd/typings/execution/plugins/natural-execution-tools/mocked/mocked-chat.test.d.ts +4 -0
  231. package/umd/typings/execution/plugins/natural-execution-tools/mocked/mocked-completion.test.d.ts +4 -0
  232. package/umd/typings/execution/plugins/natural-execution-tools/openai/OpenAiExecutionTools.d.ts +28 -0
  233. package/umd/typings/execution/plugins/natural-execution-tools/openai/OpenAiExecutionToolsOptions.d.ts +16 -0
  234. package/umd/typings/execution/plugins/natural-execution-tools/openai/computeOpenaiUsage.d.ts +3 -0
  235. package/umd/typings/execution/plugins/natural-execution-tools/remote/RemoteNaturalExecutionTools.d.ts +35 -0
  236. package/umd/typings/execution/plugins/natural-execution-tools/remote/RemoteNaturalExecutionToolsOptions.d.ts +23 -0
  237. package/umd/typings/execution/plugins/natural-execution-tools/remote/interfaces/Promptbook_Server_Error.d.ts +11 -0
  238. package/umd/typings/execution/plugins/natural-execution-tools/remote/interfaces/Promptbook_Server_Progress.d.ts +12 -0
  239. package/umd/typings/execution/plugins/natural-execution-tools/remote/interfaces/Promptbook_Server_Request.d.ts +17 -0
  240. package/umd/typings/execution/plugins/natural-execution-tools/remote/interfaces/Promptbook_Server_Response.d.ts +12 -0
  241. package/umd/typings/execution/plugins/natural-execution-tools/remote/interfaces/RemoteServerOptions.d.ts +27 -0
  242. package/umd/typings/execution/plugins/natural-execution-tools/remote/startRemoteServer.d.ts +17 -0
  243. package/umd/typings/execution/plugins/script-execution-tools/custom-function-async.test.ts.test.d.ts +1 -0
  244. package/umd/typings/execution/plugins/script-execution-tools/custom-function-missing.test.d.ts +1 -0
  245. package/umd/typings/execution/plugins/script-execution-tools/custom-function-with-dependencies.test.d.ts +1 -0
  246. package/umd/typings/execution/plugins/script-execution-tools/custom-function.test.d.ts +1 -0
  247. package/umd/typings/execution/plugins/script-execution-tools/javascript/JavascriptEvalExecutionTools.d.ts +20 -0
  248. package/umd/typings/execution/plugins/script-execution-tools/javascript/JavascriptEvalExecutionTools.test.d.ts +4 -0
  249. package/umd/typings/execution/plugins/script-execution-tools/javascript/JavascriptExecutionTools.d.ts +20 -0
  250. package/umd/typings/execution/plugins/script-execution-tools/javascript/JavascriptExecutionToolsOptions.d.ts +22 -0
  251. package/umd/typings/execution/plugins/script-execution-tools/javascript/utils/preserve.d.ts +11 -0
  252. package/umd/typings/execution/plugins/script-execution-tools/postprocessing.test.d.ts +1 -0
  253. package/umd/typings/execution/plugins/script-execution-tools/python/PythonExecutionTools.d.ts +15 -0
  254. package/umd/typings/execution/plugins/script-execution-tools/script-execution-errors.test.d.ts +1 -0
  255. package/umd/typings/execution/plugins/script-execution-tools/script-execution-tools.test.d.ts +1 -0
  256. package/umd/typings/execution/plugins/script-execution-tools/typescript/TypescriptExecutionTools.d.ts +15 -0
  257. package/umd/typings/execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceTools.d.ts +14 -0
  258. package/umd/typings/execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions.d.ts +12 -0
  259. package/umd/typings/execution/plugins/user-interface-execution-tools/simple-prompt/SimplePromptInterfaceTools.d.ts +16 -0
  260. package/umd/typings/execution/plugins/user-interface-execution-tools/user-interface-execution-tools.test.d.ts +1 -0
  261. package/umd/typings/execution/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts +4 -0
  262. package/umd/typings/execution/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +9 -0
  263. package/umd/typings/execution/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +5 -0
  264. package/umd/typings/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +11 -0
  265. package/umd/typings/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +4 -0
  266. package/umd/typings/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +1 -0
  267. package/umd/typings/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.test.d.ts +1 -0
  268. package/umd/typings/execution/translation/automatic-translate/translateMessages.d.ts +5 -0
  269. package/umd/typings/execution/utils/replaceParameters.d.ts +12 -0
  270. package/umd/typings/execution/utils/replaceParameters.test.d.ts +1 -0
  271. package/umd/typings/library/PromptbookLibrary.d.ts +25 -0
  272. package/umd/typings/library/SimplePromptbookLibrary.d.ts +35 -0
  273. package/umd/typings/library/constructors/createPromptbookLibraryFromDirectory.d.ts +5 -0
  274. package/umd/typings/library/constructors/createPromptbookLibraryFromList.d.ts +5 -0
  275. package/umd/typings/library/constructors/createPromptbookLibraryFromPromise.d.ts +7 -0
  276. package/umd/typings/library/constructors/createPromptbookLibraryFromSources.d.ts +16 -0
  277. package/umd/typings/library/constructors/createPromptbookSublibrary.d.ts +6 -0
  278. package/umd/typings/types/Command.d.ts +98 -0
  279. package/umd/typings/types/ExecutionTypes.d.ts +13 -0
  280. package/umd/typings/types/ModelRequirements.d.ts +41 -0
  281. package/umd/typings/types/Parameters.d.ts +14 -0
  282. package/umd/typings/types/Prompt.d.ts +41 -0
  283. package/umd/typings/types/PromptbookJson/PromptTemplateJson.d.ts +126 -0
  284. package/umd/typings/types/PromptbookJson/PromptTemplateParameterJson.d.ts +25 -0
  285. package/umd/typings/types/PromptbookJson/PromptbookJson.d.ts +51 -0
  286. package/umd/typings/types/PromptbookString.d.ts +12 -0
  287. package/umd/typings/types/ScriptLanguage.d.ts +9 -0
  288. package/umd/typings/types/TaskProgress.d.ts +42 -0
  289. package/umd/typings/types/execution-report/ExecutionReportJson.d.ts +56 -0
  290. package/umd/typings/types/execution-report/ExecutionReportString.d.ts +16 -0
  291. package/umd/typings/types/execution-report/ExecutionReportStringOptions.d.ts +21 -0
  292. package/umd/typings/types/execution-report/config.d.ts +8 -0
  293. package/umd/typings/types/execution-report/countWorkingDuration.d.ts +7 -0
  294. package/umd/typings/types/execution-report/countWorkingDuration.test.d.ts +1 -0
  295. package/umd/typings/types/execution-report/executionReportJsonToString.d.ts +11 -0
  296. package/umd/typings/types/execution-report/executionReportJsonToString.test.d.ts +1 -0
  297. package/umd/typings/types/typeAliasEmoji.d.ts +9 -0
  298. package/umd/typings/types/typeAliases.d.ts +432 -0
  299. package/umd/typings/utils/FromtoItems.d.ts +19 -0
  300. package/umd/typings/utils/emojis.d.ts +22 -0
  301. package/umd/typings/utils/expectation-counters/countCharacters.d.ts +5 -0
  302. package/umd/typings/utils/expectation-counters/countCharacters.test.d.ts +1 -0
  303. package/umd/typings/utils/expectation-counters/countLines.d.ts +5 -0
  304. package/umd/typings/utils/expectation-counters/countLines.test.d.ts +1 -0
  305. package/umd/typings/utils/expectation-counters/countPages.d.ts +5 -0
  306. package/umd/typings/utils/expectation-counters/countPages.test.d.ts +1 -0
  307. package/umd/typings/utils/expectation-counters/countParagraphs.d.ts +5 -0
  308. package/umd/typings/utils/expectation-counters/countParagraphs.test.d.ts +1 -0
  309. package/umd/typings/utils/expectation-counters/countSentences.d.ts +5 -0
  310. package/umd/typings/utils/expectation-counters/countSentences.test.d.ts +1 -0
  311. package/umd/typings/utils/expectation-counters/countWords.d.ts +5 -0
  312. package/umd/typings/utils/expectation-counters/countWords.test.d.ts +1 -0
  313. package/umd/typings/utils/expectation-counters/index.d.ts +5 -0
  314. package/umd/typings/utils/extractParameters.d.ts +10 -0
  315. package/umd/typings/utils/extractParameters.test.d.ts +1 -0
  316. package/umd/typings/utils/formatNumber.d.ts +6 -0
  317. package/umd/typings/utils/formatNumber.test.d.ts +1 -0
  318. package/umd/typings/utils/getCurrentIsoDate.d.ts +7 -0
  319. package/umd/typings/utils/isRunningInWhatever.d.ts +12 -0
  320. package/umd/typings/utils/isValidJsonString.d.ts +4 -0
  321. package/umd/typings/utils/isValidJsonString.test.d.ts +1 -0
  322. package/umd/typings/utils/just.d.ts +10 -0
  323. package/umd/typings/utils/markdown/addAutoGeneratedSection.d.ts +10 -0
  324. package/umd/typings/utils/markdown/addAutoGeneratedSection.test.d.ts +1 -0
  325. package/umd/typings/utils/markdown/createMarkdownChart.d.ts +41 -0
  326. package/umd/typings/utils/markdown/createMarkdownChart.test.d.ts +1 -0
  327. package/umd/typings/utils/markdown/createMarkdownTable.d.ts +7 -0
  328. package/umd/typings/utils/markdown/createMarkdownTable.test.d.ts +1 -0
  329. package/umd/typings/utils/markdown/escapeMarkdownBlock.d.ts +6 -0
  330. package/umd/typings/utils/markdown/escapeMarkdownBlock.test.d.ts +1 -0
  331. package/umd/typings/utils/markdown/extractAllBlocksFromMarkdown.d.ts +27 -0
  332. package/umd/typings/utils/markdown/extractAllBlocksFromMarkdown.test.d.ts +1 -0
  333. package/umd/typings/utils/markdown/extractAllListItemsFromMarkdown.d.ts +13 -0
  334. package/umd/typings/utils/markdown/extractAllListItemsFromMarkdown.test.d.ts +1 -0
  335. package/umd/typings/utils/markdown/extractOneBlockFromMarkdown.d.ts +19 -0
  336. package/umd/typings/utils/markdown/extractOneBlockFromMarkdown.test.d.ts +1 -0
  337. package/umd/typings/utils/markdown/prettifyMarkdown.d.ts +8 -0
  338. package/umd/typings/utils/markdown/prettifyMarkdown.test.d.ts +1 -0
  339. package/umd/typings/utils/markdown/removeContentComments.d.ts +8 -0
  340. package/umd/typings/utils/markdown/removeContentComments.test.d.ts +1 -0
  341. package/umd/typings/utils/markdown/removeMarkdownFormatting.d.ts +8 -0
  342. package/umd/typings/utils/markdown/removeMarkdownFormatting.test.d.ts +1 -0
  343. package/umd/typings/utils/markdown-json/MarkdownStructure.d.ts +25 -0
  344. package/umd/typings/utils/markdown-json/countMarkdownStructureDeepness.d.ts +7 -0
  345. package/umd/typings/utils/markdown-json/countMarkdownStructureDeepness.test.d.ts +1 -0
  346. package/umd/typings/utils/markdown-json/markdownToMarkdownStructure.d.ts +13 -0
  347. package/umd/typings/utils/markdown-json/markdownToMarkdownStructure.test.d.ts +1 -0
  348. package/umd/typings/utils/postprocessing/extractBlock.d.ts +12 -0
  349. package/umd/typings/utils/removeEmojis.d.ts +7 -0
  350. package/umd/typings/utils/removeEmojis.test.d.ts +1 -0
  351. package/umd/typings/utils/removeQuotes.d.ts +13 -0
  352. package/umd/typings/utils/removeQuotes.test.d.ts +1 -0
  353. package/umd/typings/utils/trimCodeBlock.d.ts +8 -0
  354. package/umd/typings/utils/trimCodeBlock.test.d.ts +1 -0
  355. package/umd/typings/utils/trimEndOfCodeBlock.d.ts +7 -0
  356. package/umd/typings/utils/trimEndOfCodeBlock.test.d.ts +1 -0
  357. package/umd/typings/utils/unwrapResult.d.ts +36 -0
  358. package/umd/typings/utils/unwrapResult.test.d.ts +1 -0
  359. package/umd/typings/utils/validators/url/isValidUrl.d.ts +7 -0
  360. package/umd/typings/utils/validators/url/isValidUrl.test.d.ts +1 -0
  361. package/umd/typings/version.d.ts +5 -0
  362. package/umd/typings/wizzard/Wizzard.d.ts +4 -0
  363. package/umd/typings/wizzard/sample.d.ts +6 -0
@@ -0,0 +1,5 @@
1
+ import { AutomaticTranslator } from './AutomaticTranslator';
2
+ export declare class FakeAutomaticTranslator implements AutomaticTranslator {
3
+ constructor();
4
+ translate(message: string): string;
5
+ }
@@ -0,0 +1,11 @@
1
+ import { AutomaticTranslator } from './AutomaticTranslator';
2
+ import { TranslatorOptions } from './TranslatorOptions';
3
+ interface LindatAutomaticTranslatorOptions extends TranslatorOptions {
4
+ apiUrl: URL;
5
+ }
6
+ export declare class LindatAutomaticTranslator implements AutomaticTranslator {
7
+ private readonly options;
8
+ constructor(options: LindatAutomaticTranslatorOptions);
9
+ translate(message: string): Promise<string>;
10
+ }
11
+ export {};
@@ -0,0 +1,4 @@
1
+ export type TranslatorOptions = {
2
+ from: string;
3
+ to: string;
4
+ };
@@ -0,0 +1 @@
1
+ export declare function extractMultiplicatedOccurrence(message: string): string;
@@ -0,0 +1,5 @@
1
+ import { AutomaticTranslator } from './automatic-translators/AutomaticTranslator';
2
+ import { TranslatorOptions } from './automatic-translators/TranslatorOptions';
3
+ export declare function translateMessages({ automaticTranslator, from, to, }: {
4
+ automaticTranslator: AutomaticTranslator;
5
+ } & TranslatorOptions): Promise<void>;
@@ -0,0 +1,12 @@
1
+ import { Parameters } from '../../types/Parameters';
2
+ import { string_template } from '../../types/typeAliases';
3
+ /**
4
+ * Replaces parameters in template with values from parameters object
5
+ *
6
+ * @param template the template with parameters in {curly} braces
7
+ * @param parameters the object with parameters
8
+ * @returns the template with replaced parameters
9
+ *
10
+ * @private within the createPromptbookExecutor
11
+ */
12
+ export declare function replaceParameters(template: string_template, parameters: Parameters): string;
@@ -0,0 +1,25 @@
1
+ import { Promisable } from 'type-fest';
2
+ import type { Prompt } from '../types/Prompt';
3
+ import type { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
4
+ import type { string_promptbook_url } from '../types/typeAliases';
5
+ /**
6
+ * Library of promptbooks that groups together promptbooks for an application.
7
+ *
8
+ * @see https://github.com/webgptorg/promptbook#promptbook-library
9
+ */
10
+ export type PromptbookLibrary = {
11
+ /**
12
+ * Gets all promptbooks in the library
13
+ */
14
+ listPromptbooks(): Promisable<Array<string_promptbook_url>>;
15
+ /**
16
+ * Gets promptbook by its URL
17
+ *
18
+ * Note: This is not a direct fetching from the URL, but a lookup in the library
19
+ */
20
+ getPromptbookByUrl(url: string_promptbook_url): Promisable<PromptbookJson>;
21
+ /**
22
+ * Checks whether given prompt was defined in any promptbook in the library
23
+ */
24
+ isResponsibleForPrompt(prompt: Prompt): Promisable<boolean>;
25
+ };
@@ -0,0 +1,35 @@
1
+ import type { Prompt } from '../types/Prompt';
2
+ import type { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
3
+ import type { string_promptbook_url } from '../types/typeAliases';
4
+ import { PromptbookLibrary } from './PromptbookLibrary';
5
+ /**
6
+ * Library of promptbooks that groups together promptbooks for an application.
7
+ * This implementation is a very thin wrapper around the Array / Map of promptbooks.
8
+ *
9
+ * @see https://github.com/webgptorg/promptbook#promptbook-library
10
+ */
11
+ export declare class SimplePromptbookLibrary implements PromptbookLibrary {
12
+ private library;
13
+ /**!!!
14
+ *
15
+ * @param promptbooks !!!
16
+ *
17
+ * Note: During the construction logic of all promptbooks are validated
18
+ * Note: It is not recommended to use this constructor directly, use `createPromptbookLibraryFromSources` *(or other variant)* instead
19
+ */
20
+ constructor(...promptbooks: Array<PromptbookJson>);
21
+ /**
22
+ * Gets all promptbooks in the library
23
+ */
24
+ listPromptbooks(): Array<string_promptbook_url>;
25
+ /**
26
+ * Gets promptbook by its URL
27
+ *
28
+ * Note: This is not a direct fetching from the URL, but a lookup in the library
29
+ */
30
+ getPromptbookByUrl(url: string_promptbook_url): PromptbookJson;
31
+ /**
32
+ * Checks whether given prompt was defined in any promptbook in the library
33
+ */
34
+ isResponsibleForPrompt(prompt: Prompt): boolean;
35
+ }
@@ -0,0 +1,5 @@
1
+ import { PromptbookLibrary } from '../PromptbookLibrary';
2
+ export declare function createPromptbookLibraryFromDirectory(): PromptbookLibrary;
3
+ /***
4
+ * TODO: !!! Annotate all + all to README and samples
5
+ */
@@ -0,0 +1,5 @@
1
+ import { PromptbookLibrary } from '../PromptbookLibrary';
2
+ export declare function createPromptbookLibraryFromList(): PromptbookLibrary;
3
+ /***
4
+ * TODO: !!! Annotate all + all to README and samples
5
+ */
@@ -0,0 +1,7 @@
1
+ import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
2
+ import { PromptbookString } from '../../types/PromptbookString';
3
+ import { PromptbookLibrary } from '../PromptbookLibrary';
4
+ export declare function createPromptbookLibraryFromPromise(promptbookSourcesPromiseOrFactory: Promise<Array<PromptbookJson | PromptbookString>> | (() => Promise<Array<PromptbookJson | PromptbookString>>)): PromptbookLibrary;
5
+ /***
6
+ * TODO: !!! Annotate all + all to README and samples
7
+ */
@@ -0,0 +1,16 @@
1
+ import { PromptbookJson, PromptbookString } from '../../_packages/types.index';
2
+ import { SimplePromptbookLibrary } from '../SimplePromptbookLibrary';
3
+ export declare function createPromptbookLibraryFromSources(...promptbookSources: Array<PromptbookJson | PromptbookString>): SimplePromptbookLibrary;
4
+ /**
5
+ * Constructs Promptbook from any sources
6
+ *
7
+ * Note: During the construction syntax and logic of all sources are validated
8
+ * Note: You can combine .ptbk.md and .ptbk.json files BUT it is not recommended
9
+ *
10
+ * @param promptbookSources contents of .ptbk.md or .ptbk.json files
11
+ * @param settings settings for creating executor functions
12
+ * @returns PromptbookLibrary
13
+ */
14
+ /***
15
+ * TODO: !!! Annotate all + all to README and samples
16
+ */
@@ -0,0 +1,6 @@
1
+ import type { string_promptbook_url } from '../../types/typeAliases';
2
+ import { PromptbookLibrary } from '../PromptbookLibrary';
3
+ export declare function createPromptbookSublibrary(library: PromptbookLibrary, predicate: (url: string_promptbook_url) => boolean): PromptbookLibrary;
4
+ /***
5
+ * TODO: !!! Annotate all + all to README and samples
6
+ */
@@ -0,0 +1,98 @@
1
+ import type { string_markdown_text, string_name, string_version } from '.././types/typeAliases';
2
+ import type { ExecutionType } from './ExecutionTypes';
3
+ import type { ModelRequirements } from './ModelRequirements';
4
+ import type { ExpectationAmount, ExpectationUnit } from './PromptbookJson/PromptTemplateJson';
5
+ /**
6
+ * Command is one piece of the prompt template which adds some logic to the prompt template or the whole pipeline.
7
+ * It is parsed from the markdown from ul/ol items - one command per one item.
8
+ */
9
+ export type Command = PromptbookUrlCommand | PromptbookVersionCommand | ExecuteCommand | ModelCommand | JokerCommand | ParameterCommand | PostprocessCommand | ExpectCommand;
10
+ /**
11
+ * PromptbookVersion command tells which version is .promptbook file using
12
+ *
13
+ * - It is used for backward compatibility
14
+ * - It is defined per whole .promptbook file in the header
15
+ */
16
+ export type PromptbookUrlCommand = {
17
+ readonly type: 'PROMPTBOOK_URL';
18
+ readonly promptbookUrl: URL;
19
+ };
20
+ /**
21
+ * PromptbookVersion command tells which version is .promptbook file using
22
+ *
23
+ * - It is used for backward compatibility
24
+ * - It is defined per whole .promptbook file in the header
25
+ */
26
+ export type PromptbookVersionCommand = {
27
+ readonly type: 'PROMPTBOOK_VERSION';
28
+ readonly promptbookVersion: string_version;
29
+ };
30
+ /**
31
+ * Execute command tells how to execute the section
32
+ * It can be either prompt template, script or SIMPLE TEMPLATE etc.
33
+ */
34
+ export type ExecuteCommand = {
35
+ readonly type: 'EXECUTE';
36
+ readonly executionType: ExecutionType;
37
+ };
38
+ /**
39
+ * Model command tells which model and modelRequirements to use for the prompt template. execution
40
+ */
41
+ export type ModelCommand = {
42
+ readonly type: 'MODEL';
43
+ readonly key: keyof ModelRequirements;
44
+ readonly value: any;
45
+ };
46
+ /**
47
+ * Joker parameter is used instead of executing the prompt template if it meet the expectations requirements
48
+ */
49
+ export type JokerCommand = {
50
+ readonly type: 'JOKER';
51
+ readonly parameterName: string_name;
52
+ };
53
+ /**
54
+ * Parameter command describes one parameter of the prompt template
55
+ *
56
+ * - It can tell if it is input or OUTPUT PARAMETER
57
+ * - It can have description
58
+ * - In description it can have simple formatting BUT not markdown structure or reference to other parameters
59
+ */
60
+ export type ParameterCommand = {
61
+ readonly type: 'PARAMETER';
62
+ readonly isInput: boolean;
63
+ readonly isOutput: boolean;
64
+ readonly parameterName: string_name;
65
+ readonly parameterDescription: string_markdown_text | null;
66
+ };
67
+ /**
68
+ * Postprocess command describes which function to use for postprocessing
69
+ * This will be created as separate EXECUTE SCRIPT block bellow
70
+ */
71
+ export type PostprocessCommand = {
72
+ readonly type: 'POSTPROCESS';
73
+ readonly functionName: string_name;
74
+ };
75
+ /**
76
+ * Expect command describes the desired output of the prompt template (after post-processing)
77
+ * It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs or some other shape of the output.
78
+ */
79
+ export type ExpectCommand = ExpectAmountCommand | ExpectFormatCommand;
80
+ /**
81
+ * Expect amount command describes the desired output of the prompt template (after post-processing)
82
+ * It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs,...
83
+ *
84
+ * Note: LLMs work with tokens, not characters, but in Promptbooks we want to use some human-recognisable and cross-model interoperable units.
85
+ */
86
+ export type ExpectAmountCommand = {
87
+ readonly type: 'EXPECT_AMOUNT';
88
+ readonly sign: 'EXACTLY' | 'MINIMUM' | 'MAXIMUM';
89
+ readonly unit: ExpectationUnit;
90
+ readonly amount: ExpectationAmount;
91
+ };
92
+ /**
93
+ * Represents a command that expects a specific format.
94
+ */
95
+ export type ExpectFormatCommand = {
96
+ readonly type: 'EXPECT_FORMAT';
97
+ readonly format: 'JSON';
98
+ };
@@ -0,0 +1,13 @@
1
+ import { TupleToUnion } from 'type-fest';
2
+ /**
3
+ * Execution type describes the way how the block is executed
4
+ *
5
+ * @see https://github.com/webgptorg/promptbook#execution-type
6
+ */
7
+ export type ExecutionType = TupleToUnion<typeof ExecutionTypes>;
8
+ /**
9
+ * Execution type describes the way how the block is executed
10
+ *
11
+ * @see https://github.com/webgptorg/promptbook#execution-type
12
+ */
13
+ export declare const ExecutionTypes: readonly ["PROMPT_TEMPLATE", "SIMPLE_TEMPLATE", "SCRIPT", "PROMPT_DIALOG"];
@@ -0,0 +1,41 @@
1
+ import { string_model_name } from './typeAliases';
2
+ export declare const MODEL_VARIANTS: readonly ["COMPLETION", "CHAT"];
3
+ /**
4
+ * Model variant describes the very general type of the model
5
+ *
6
+ * There are two variants:
7
+ * - **COMPLETION** - model that takes prompt and writes the rest of the text
8
+ * - **CHAT** - model that takes prompt and previous messages and returns response
9
+ */
10
+ export type ModelVariant = typeof MODEL_VARIANTS[number];
11
+ /**
12
+ * Abstract way to specify the LLM. It does not specify the LLM with concrete version itself, only the requirements for the LLM.
13
+ *
14
+ * @see https://github.com/webgptorg/promptbook#model-requirements
15
+ */
16
+ export type ModelRequirements = {
17
+ /**
18
+ * Model variant describes the very general type of the model
19
+ *
20
+ * There are two variants:
21
+ * - **COMPLETION** - model that takes prompt and writes the rest of the text
22
+ * - **CHAT** - model that takes prompt and previous messages and returns response
23
+ */
24
+ readonly modelVariant: ModelVariant;
25
+ /**
26
+ * The model for text prompt
27
+ *
28
+ * Note: Model must be compatible with the model variant
29
+ *
30
+ * @example 'gpt-4', 'gpt-4-32k-0314', 'gpt-3.5-turbo-instruct',...
31
+ */
32
+ readonly modelName: string_model_name;
33
+ /**
34
+ * Maximum number of tokens that can be generated by the model
35
+ */
36
+ readonly maxTokens?: number;
37
+ };
38
+ /**
39
+ * TODO: Maybe figure out better word than "variant"
40
+ * TODO: Add here more requirement options like max context size, max tokens, etc.
41
+ */
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Parameters of the prompt template (pipeline)
3
+ *
4
+ * There are three types of parameters:
5
+ * - **INPUT PARAMETERs** are required to execute the pipeline.
6
+ * - **Intermediate parameters** are used internally in the pipeline.
7
+ * - **OUTPUT PARAMETERs** are not used internally in the pipeline, but are returned as the result of the pipeline execution.
8
+ *
9
+ * @see https://github.com/webgptorg/promptbook#parameters
10
+ */
11
+ export type Parameters = object;
12
+ /**
13
+ * TODO: Constrain type to Simple key-value object, only string keys and string values and no index signature + only camelCase keys and spaceTrimmed values
14
+ */
@@ -0,0 +1,41 @@
1
+ import type { string_name, string_prompt, string_promptbook_url_with_hashtemplate, string_title } from '.././types/typeAliases';
2
+ import type { ModelRequirements } from './ModelRequirements';
3
+ /**
4
+ * Prompt in a text along with model requirements, but without any execution or templating logic.
5
+ *
6
+ * @see https://github.com/webgptorg/promptbook#prompt
7
+ */
8
+ export type Prompt = {
9
+ /**
10
+ * The title of the prompt
11
+ *
12
+ * Note: This has no effect on the model, it is just for the reporting
13
+ */
14
+ readonly title: string_title;
15
+ /**
16
+ * The text of the prompt
17
+ *
18
+ * Note: This is not a template, this is exactly the text that will be sent to the model
19
+ * @example "What is the capital of France?"
20
+ */
21
+ readonly content: string_prompt;
22
+ /**
23
+ * Requirements for the model
24
+ */
25
+ readonly modelRequirements: ModelRequirements;
26
+ /**
27
+ * Unique identifier of the promptbook with specific template name as hash
28
+ *
29
+ * @example https://promptbook.webgpt.com/cs/write-website-content.ptbk.md@v2.4.15#keywords
30
+ */
31
+ readonly promptbookUrl: string_promptbook_url_with_hashtemplate;
32
+ /**
33
+ * Parameters used in the prompt
34
+ *
35
+ * Note: This is redundant (same information is in promptbookUrl+content) but useful for logging and debugging
36
+ */
37
+ readonly parameters: Record<string_name, string>;
38
+ };
39
+ /**
40
+ * TODO: [✔] Check ModelRequirements in runtime
41
+ */
@@ -0,0 +1,126 @@
1
+ import { ExpectFormatCommand } from '../Command';
2
+ import { ExecutionType } from '../ExecutionTypes';
3
+ import { ModelRequirements } from '../ModelRequirements';
4
+ import { ScriptLanguage } from '../ScriptLanguage';
5
+ import { number_integer, number_positive_or_zero, string_javascript, string_javascript_name, string_markdown, string_name, string_prompt, string_template } from '../typeAliases';
6
+ /**
7
+ * Describes one prompt template in the promptbook
8
+ */
9
+ export type PromptTemplateJson = NaturalTemplateJson | SimpleTemplateJson | ScriptTemplateJson | PromptDialogJson;
10
+ /**
11
+ * Template for prompt to LLM
12
+ */
13
+ export type NaturalTemplateJson = PromptTemplateJsonCommon & {
14
+ readonly executionType: 'PROMPT_TEMPLATE';
15
+ /**
16
+ * Requirements for the model
17
+ * - This is required only for executionType PROMPT_TEMPLATE
18
+ */
19
+ readonly modelRequirements: ModelRequirements;
20
+ };
21
+ /**
22
+ * Units of text measurement
23
+ */
24
+ export declare const EXPECTATION_UNITS: readonly ["CHARACTERS", "WORDS", "SENTENCES", "PARAGRAPHS", "LINES", "PAGES"];
25
+ /**
26
+ * Unit of text measurement
27
+ */
28
+ export type ExpectationUnit = typeof EXPECTATION_UNITS[number];
29
+ /**
30
+ * Amount of text measurement
31
+ */
32
+ export type ExpectationAmount = number_integer & number_positive_or_zero;
33
+ /**
34
+ * Template for simple concatenation of strings
35
+ */
36
+ interface SimpleTemplateJson extends PromptTemplateJsonCommon {
37
+ readonly executionType: 'SIMPLE_TEMPLATE';
38
+ }
39
+ /**
40
+ * Template for script execution
41
+ */
42
+ interface ScriptTemplateJson extends PromptTemplateJsonCommon {
43
+ readonly executionType: 'SCRIPT';
44
+ /**
45
+ * Language of the script
46
+ * - This is required only for executionType SCRIPT
47
+ *
48
+ */
49
+ readonly contentLanguage?: ScriptLanguage;
50
+ }
51
+ /**
52
+ * Template for prompt to user
53
+ */
54
+ interface PromptDialogJson extends PromptTemplateJsonCommon {
55
+ readonly executionType: 'PROMPT_DIALOG';
56
+ }
57
+ /**
58
+ * Common properties of all prompt templates
59
+ */
60
+ interface PromptTemplateJsonCommon {
61
+ /**
62
+ * Name of the template
63
+ * - It must be unique across the pipeline
64
+ * - It should start uppercase and contain letters and numbers
65
+ * - The promptbookUrl together with hash and name are used to identify the prompt template in the pipeline
66
+ */
67
+ readonly name: string_name;
68
+ /**
69
+ * Title of the prompt template
70
+ * It can use simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
71
+ */
72
+ readonly title: string;
73
+ /**
74
+ * Description of the prompt template
75
+ * It can use multiple paragraphs of simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
76
+ */
77
+ readonly description?: string;
78
+ /**
79
+ * List of parameter names that are used in the prompt template and must be defined before the prompt template is executed
80
+ *
81
+ * Note: Joker is one of the dependent parameters
82
+ */
83
+ readonly dependentParameterNames: Array<string_name>;
84
+ /**
85
+ * If theese parameters meet the expectations requirements, they are used instead of executing this prompt template
86
+ */
87
+ readonly jokers?: Array<string>;
88
+ /**
89
+ * Type of the execution
90
+ * This determines if the prompt template is send to LLM, user or some scripting evaluation
91
+ */
92
+ readonly executionType: ExecutionType;
93
+ /**
94
+ * Content of the template with {placeholders} for parameters
95
+ */
96
+ readonly content: (string_prompt | string_javascript | string_markdown) & string_template;
97
+ /**
98
+ * List of postprocessing steps that are executed after the prompt template
99
+ */
100
+ readonly postprocessing?: Array<string_javascript_name>;
101
+ /**
102
+ * Expect this amount of each unit in the answer
103
+ *
104
+ * For example 5 words, 3 sentences, 2 paragraphs, ...
105
+ *
106
+ * Note: Expectations are performed after all postprocessing steps
107
+ */
108
+ readonly expectAmount?: Partial<Record<Lowercase<ExpectationUnit>, {
109
+ min?: ExpectationAmount;
110
+ max?: ExpectationAmount;
111
+ }>>;
112
+ /**
113
+ * Expect this format of the answer
114
+ *
115
+ * Note: Expectations are performed after all postprocessing steps
116
+ */
117
+ readonly expectFormat?: ExpectFormatCommand['format'];
118
+ /**
119
+ * Name of the parameter that is the result of the prompt template
120
+ */
121
+ readonly resultingParameterName: string_name;
122
+ }
123
+ export {};
124
+ /**
125
+ * TODO: use one helper type> (string_prompt | string_javascript | string_markdown) & string_template
126
+ */
@@ -0,0 +1,25 @@
1
+ import { string_name } from '../typeAliases';
2
+ /**
3
+ * Describes one parameter of the promptbook
4
+ */
5
+ export type PromptTemplateParameterJson = {
6
+ /**
7
+ * Name of the parameter
8
+ * - It must be unique across the pipeline
9
+ * - It should start lowercase and contain letters and numbers
10
+ */
11
+ readonly name: string_name;
12
+ /**
13
+ * The parameter is input of the pipeline
14
+ */
15
+ readonly isInput: boolean;
16
+ /**
17
+ * The parameter is output of the pipeline
18
+ */
19
+ readonly isOutput: boolean;
20
+ /**
21
+ * Description of the parameter
22
+ * - It can use simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
23
+ */
24
+ readonly description?: string;
25
+ };
@@ -0,0 +1,51 @@
1
+ import { string_promptbook_url, string_version } from '../typeAliases';
2
+ import { PromptTemplateJson } from './PromptTemplateJson';
3
+ import { PromptTemplateParameterJson } from './PromptTemplateParameterJson';
4
+ /**
5
+ * Promptbook is the **core concept of this library**.
6
+ * It represents a series of prompt templates chained together to form a pipeline / one big prompt template with input and result parameters.
7
+ *
8
+ * @see https://github.com/webgptorg/promptbook#promptbook
9
+ */
10
+ export type PromptbookJson = {
11
+ /**
12
+ * Unique identifier of the promptbook
13
+ *
14
+ * Note: It must be unique across all promptbooks libraries
15
+ * Note: It must use HTTPs URL
16
+ * Tip: You can do versioning in the URL
17
+ * For example: https://promptbook.webgpt.com/cs/write-website-content.ptbk.md@1.0.0
18
+ * Warning: Do not hash part of the URL, hash part is used for identification of the prompt template in the pipeline
19
+ */
20
+ readonly promptbookUrl?: string_promptbook_url;
21
+ /**
22
+ * Title of the promptbook
23
+ * -It can use simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
24
+ */
25
+ readonly title: string;
26
+ /**
27
+ * Version of the .ptbk.json file
28
+ */
29
+ readonly promptbookVersion: string_version;
30
+ /**
31
+ * Description of the promptbook
32
+ * It can use multiple paragraphs of simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
33
+ */
34
+ readonly description?: string;
35
+ /**
36
+ * Set of variables that are used across the pipeline
37
+ */
38
+ readonly parameters: Array<PromptTemplateParameterJson>;
39
+ /**
40
+ * Sequence of prompt templates that are chained together to form a pipeline
41
+ */
42
+ readonly promptTemplates: Array<PromptTemplateJson>;
43
+ };
44
+ /**
45
+ * TODO: [🧠] Best format of this code?
46
+ * There must be possible to make
47
+ * - Branching
48
+ * - Loops
49
+ * - Paralelization
50
+ * - ...and more
51
+ */
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Promptbook is the **core concept of this library**.
3
+ * It represents a series of prompt templates chained together to form a pipeline / one big prompt template with input and result parameters.
4
+ *
5
+ * @see https://github.com/webgptorg/promptbook#promptbook
6
+ */
7
+ export type PromptbookString = string & {
8
+ readonly _type: 'Promptbook';
9
+ };
10
+ /**
11
+ * TODO: !! Better validation (validatePromptbookString) or remove branded type and make it just string
12
+ */
@@ -0,0 +1,9 @@
1
+ import { TupleToUnion } from 'type-fest';
2
+ /**
3
+ * Supported script languages
4
+ */
5
+ export declare const SUPPORTED_SCRIPT_LANGUAGES: readonly ["javascript", "typescript", "python"];
6
+ /**
7
+ * Script language
8
+ */
9
+ export type ScriptLanguage = TupleToUnion<typeof SUPPORTED_SCRIPT_LANGUAGES>;
@@ -0,0 +1,42 @@
1
+ import { ExecutionType } from './ExecutionTypes';
2
+ import { string_markdown_text, string_name } from './typeAliases';
3
+ /**
4
+ * TaskProgress represents the progress of a Promptbook execution.
5
+ */
6
+ export type TaskProgress = {
7
+ /**
8
+ * The unique name of the task.
9
+ *
10
+ * Note: This is not supposed to be displayed to the user.
11
+ * It is used to identify the task in the code, for example as react key
12
+ */
13
+ readonly name: string_name;
14
+ /**
15
+ * Title of the task.
16
+ *
17
+ * Note: This is supposed to be displayed to the user.
18
+ * Note: This is trimmed and stripped of HTML tags and emojis
19
+ */
20
+ readonly title: string_markdown_text;
21
+ /**
22
+ * Does the task started?
23
+ */
24
+ readonly isStarted: boolean;
25
+ /**
26
+ * Is task done?
27
+ */
28
+ readonly isDone: boolean;
29
+ /**
30
+ * The type of the execution.
31
+ * Note: The Promptbook library reports everything, in the app level you can filter out the execution types that you don't want to show to the user.
32
+ */
33
+ readonly executionType: ExecutionType;
34
+ /**
35
+ * The parameter name that is being processed.
36
+ */
37
+ readonly parameterName: string_name;
38
+ /**
39
+ * The parameter value or null if the parameter is not yet processed.
40
+ */
41
+ readonly parameterValue: string | null;
42
+ };