@promptbook/node 0.56.0-3

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 (534) hide show
  1. package/README.md +706 -0
  2. package/esm/index.es.js +2491 -0
  3. package/esm/index.es.js.map +1 -0
  4. package/esm/typings/_packages/anthropic-claude.index.d.ts +5 -0
  5. package/esm/typings/_packages/azure-openai.index.d.ts +5 -0
  6. package/esm/typings/_packages/cli.index.d.ts +10 -0
  7. package/esm/typings/_packages/core.index.d.ts +41 -0
  8. package/esm/typings/_packages/execute-javascript.index.d.ts +48 -0
  9. package/esm/typings/_packages/fake-llm.index.d.ts +7 -0
  10. package/esm/typings/_packages/langtail.index.d.ts +5 -0
  11. package/esm/typings/_packages/node.index.d.ts +4 -0
  12. package/esm/typings/_packages/openai.index.d.ts +6 -0
  13. package/esm/typings/_packages/remote-client.index.d.ts +6 -0
  14. package/esm/typings/_packages/remote-server.index.d.ts +5 -0
  15. package/esm/typings/_packages/types.index.d.ts +28 -0
  16. package/esm/typings/_packages/utils.index.d.ts +71 -0
  17. package/esm/typings/config.d.ts +8 -0
  18. package/esm/typings/conversion/prettify/PrettifyOptions.d.ts +13 -0
  19. package/esm/typings/conversion/prettify/prettifyPromptbookString.d.ts +10 -0
  20. package/esm/typings/conversion/prettify/prettifyPromptbookStringCli.d.ts +9 -0
  21. package/esm/typings/conversion/prettify/renderPromptbookMermaid.d.ts +25 -0
  22. package/esm/typings/conversion/promptbookJsonToString.d.ts +12 -0
  23. package/esm/typings/conversion/promptbookStringToJson.d.ts +15 -0
  24. package/esm/typings/conversion/promptbookStringToJson.test.d.ts +1 -0
  25. package/esm/typings/conversion/utils/extractParametersFromPromptTemplate.d.ts +13 -0
  26. package/esm/typings/conversion/utils/extractParametersFromPromptTemplate.test.d.ts +1 -0
  27. package/esm/typings/conversion/utils/extractVariables.d.ts +13 -0
  28. package/esm/typings/conversion/utils/extractVariables.test.d.ts +1 -0
  29. package/esm/typings/conversion/utils/parseCommand.d.ts +11 -0
  30. package/esm/typings/conversion/utils/parseCommand.test.d.ts +4 -0
  31. package/esm/typings/conversion/utils/parseNumber.d.ts +15 -0
  32. package/esm/typings/conversion/utils/parseNumber.test.d.ts +1 -0
  33. package/esm/typings/conversion/utils/renameParameter.d.ts +25 -0
  34. package/esm/typings/conversion/utils/renameParameter.test.d.ts +1 -0
  35. package/esm/typings/conversion/utils/titleToName.d.ts +4 -0
  36. package/esm/typings/conversion/utils/titleToName.test.d.ts +1 -0
  37. package/esm/typings/conversion/validation/_importPromptbook.d.ts +13 -0
  38. package/esm/typings/conversion/validation/promptbookStringToJson-syntaxErrors.test.d.ts +1 -0
  39. package/esm/typings/conversion/validation/validatePromptbookJson-logicErrors.test.d.ts +1 -0
  40. package/esm/typings/conversion/validation/validatePromptbookJson.d.ts +27 -0
  41. package/esm/typings/conversion/validation/validatePromptbookJson.test.d.ts +1 -0
  42. package/esm/typings/errors/PromptbookExecutionError.d.ts +7 -0
  43. package/esm/typings/errors/PromptbookLibraryError.d.ts +7 -0
  44. package/esm/typings/errors/PromptbookLogicError.d.ts +7 -0
  45. package/esm/typings/errors/PromptbookNotFoundError.d.ts +7 -0
  46. package/esm/typings/errors/PromptbookReferenceError.d.ts +7 -0
  47. package/esm/typings/errors/PromptbookSyntaxError.d.ts +7 -0
  48. package/esm/typings/errors/TemplateError.d.ts +9 -0
  49. package/esm/typings/errors/UnexpectedError.d.ts +7 -0
  50. package/esm/typings/errors/_ExpectError.d.ts +10 -0
  51. package/esm/typings/execution/CommonExecutionToolsOptions.d.ts +9 -0
  52. package/esm/typings/execution/ExecutionTools.d.ts +32 -0
  53. package/esm/typings/execution/LlmExecutionTools.d.ts +50 -0
  54. package/esm/typings/execution/PromptResult.d.ts +103 -0
  55. package/esm/typings/execution/PromptbookExecutor.d.ts +42 -0
  56. package/esm/typings/execution/ScriptExecutionTools.d.ts +38 -0
  57. package/esm/typings/execution/UserInterfaceTools.d.ts +46 -0
  58. package/esm/typings/execution/addPromptResultUsage.test.d.ts +1 -0
  59. package/esm/typings/execution/assertsExecutionSuccessful.d.ts +11 -0
  60. package/esm/typings/execution/createPromptbookExecutor.d.ts +42 -0
  61. package/esm/typings/execution/plugins/llm-execution-tools/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +43 -0
  62. package/esm/typings/execution/plugins/llm-execution-tools/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +8 -0
  63. package/esm/typings/execution/plugins/llm-execution-tools/anthropic-claude/anthropic-claude-models.d.ts +20 -0
  64. package/esm/typings/execution/plugins/llm-execution-tools/anthropic-claude/playground/playground.d.ts +2 -0
  65. package/esm/typings/execution/plugins/llm-execution-tools/azure-openai/AzureOpenAiExecutionTools.d.ts +42 -0
  66. package/esm/typings/execution/plugins/llm-execution-tools/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +35 -0
  67. package/esm/typings/execution/plugins/llm-execution-tools/azure-openai/playground/playground.d.ts +2 -0
  68. package/esm/typings/execution/plugins/llm-execution-tools/langtail/LangtailExecutionTools.d.ts +7 -0
  69. package/esm/typings/execution/plugins/llm-execution-tools/langtail/LangtailExecutionToolsOptions.d.ts +11 -0
  70. package/esm/typings/execution/plugins/llm-execution-tools/langtail/playground/playground.d.ts +2 -0
  71. package/esm/typings/execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools.d.ts +28 -0
  72. package/esm/typings/execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools.d.ts +25 -0
  73. package/esm/typings/execution/plugins/llm-execution-tools/mocked/fakeTextToExpectations.d.ts +14 -0
  74. package/esm/typings/execution/plugins/llm-execution-tools/mocked/fakeTextToExpectations.test.d.ts +1 -0
  75. package/esm/typings/execution/plugins/llm-execution-tools/mocked/faked-completion.test.d.ts +1 -0
  76. package/esm/typings/execution/plugins/llm-execution-tools/mocked/joker.test.d.ts +4 -0
  77. package/esm/typings/execution/plugins/llm-execution-tools/mocked/mocked-chat.test.d.ts +4 -0
  78. package/esm/typings/execution/plugins/llm-execution-tools/mocked/mocked-completion.test.d.ts +4 -0
  79. package/esm/typings/execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionTools.d.ts +37 -0
  80. package/esm/typings/execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionToolsOptions.d.ts +24 -0
  81. package/esm/typings/execution/plugins/llm-execution-tools/multiple/playground/playground.d.ts +2 -0
  82. package/esm/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionTools.d.ts +47 -0
  83. package/esm/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionToolsOptions.d.ts +18 -0
  84. package/esm/typings/execution/plugins/llm-execution-tools/openai/computeOpenaiUsage.d.ts +12 -0
  85. package/esm/typings/execution/plugins/llm-execution-tools/openai/computeUsage.d.ts +16 -0
  86. package/esm/typings/execution/plugins/llm-execution-tools/openai/computeUsage.test.d.ts +1 -0
  87. package/esm/typings/execution/plugins/llm-execution-tools/openai/openai-models.d.ts +26 -0
  88. package/esm/typings/execution/plugins/llm-execution-tools/openai/playground/playground.d.ts +2 -0
  89. package/esm/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts +42 -0
  90. package/esm/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionToolsOptions.d.ts +24 -0
  91. package/esm/typings/execution/plugins/llm-execution-tools/remote/interfaces/Promptbook_Server_Error.d.ts +11 -0
  92. package/esm/typings/execution/plugins/llm-execution-tools/remote/interfaces/Promptbook_Server_Progress.d.ts +12 -0
  93. package/esm/typings/execution/plugins/llm-execution-tools/remote/interfaces/Promptbook_Server_Request.d.ts +17 -0
  94. package/esm/typings/execution/plugins/llm-execution-tools/remote/interfaces/Promptbook_Server_Response.d.ts +12 -0
  95. package/esm/typings/execution/plugins/llm-execution-tools/remote/interfaces/RemoteServerOptions.d.ts +28 -0
  96. package/esm/typings/execution/plugins/llm-execution-tools/remote/startRemoteServer.d.ts +18 -0
  97. package/esm/typings/execution/plugins/script-execution-tools/custom-function-async.test.ts.test.d.ts +1 -0
  98. package/esm/typings/execution/plugins/script-execution-tools/custom-function-missing.test.d.ts +1 -0
  99. package/esm/typings/execution/plugins/script-execution-tools/custom-function-with-dependencies.test.d.ts +1 -0
  100. package/esm/typings/execution/plugins/script-execution-tools/custom-function.test.d.ts +1 -0
  101. package/esm/typings/execution/plugins/script-execution-tools/javascript/JavascriptEvalExecutionTools.d.ts +20 -0
  102. package/esm/typings/execution/plugins/script-execution-tools/javascript/JavascriptEvalExecutionTools.test.d.ts +4 -0
  103. package/esm/typings/execution/plugins/script-execution-tools/javascript/JavascriptExecutionTools.d.ts +7 -0
  104. package/esm/typings/execution/plugins/script-execution-tools/javascript/JavascriptExecutionToolsOptions.d.ts +26 -0
  105. package/esm/typings/execution/plugins/script-execution-tools/javascript/utils/preserve.d.ts +11 -0
  106. package/esm/typings/execution/plugins/script-execution-tools/javascript/utils/unknownToString.d.ts +7 -0
  107. package/esm/typings/execution/plugins/script-execution-tools/postprocessing.test.d.ts +1 -0
  108. package/esm/typings/execution/plugins/script-execution-tools/python/PythonExecutionTools.d.ts +16 -0
  109. package/esm/typings/execution/plugins/script-execution-tools/script-execution-errors.test.d.ts +1 -0
  110. package/esm/typings/execution/plugins/script-execution-tools/script-execution-tools.test.d.ts +1 -0
  111. package/esm/typings/execution/plugins/script-execution-tools/typescript/TypescriptExecutionTools.d.ts +16 -0
  112. package/esm/typings/execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceTools.d.ts +15 -0
  113. package/esm/typings/execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions.d.ts +12 -0
  114. package/esm/typings/execution/plugins/user-interface-execution-tools/simple-prompt/SimplePromptInterfaceTools.d.ts +17 -0
  115. package/esm/typings/execution/plugins/user-interface-execution-tools/user-interface-execution-tools.test.d.ts +1 -0
  116. package/esm/typings/execution/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts +4 -0
  117. package/esm/typings/execution/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +9 -0
  118. package/esm/typings/execution/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +5 -0
  119. package/esm/typings/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +11 -0
  120. package/esm/typings/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +4 -0
  121. package/esm/typings/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +7 -0
  122. package/esm/typings/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.test.d.ts +1 -0
  123. package/esm/typings/execution/translation/automatic-translate/translateMessages.d.ts +5 -0
  124. package/esm/typings/execution/utils/addUsage.d.ts +7 -0
  125. package/esm/typings/execution/utils/addUsage.test.d.ts +1 -0
  126. package/esm/typings/execution/utils/checkExpectations.d.ts +25 -0
  127. package/esm/typings/execution/utils/checkExpectations.test.d.ts +1 -0
  128. package/esm/typings/execution/utils/computeUsageCounts.d.ts +10 -0
  129. package/esm/typings/execution/utils/forEachAsync.d.ts +18 -0
  130. package/esm/typings/execution/utils/replaceParameters.d.ts +13 -0
  131. package/esm/typings/execution/utils/replaceParameters.test.d.ts +1 -0
  132. package/esm/typings/execution/utils/uncertainNumber.d.ts +9 -0
  133. package/esm/typings/execution/utils/usageToWorktime.d.ts +10 -0
  134. package/esm/typings/execution/utils/usageToWorktime.test.d.ts +1 -0
  135. package/esm/typings/library/PromptbookLibrary.d.ts +25 -0
  136. package/esm/typings/library/SimplePromptbookLibrary.d.ts +36 -0
  137. package/esm/typings/library/constructors/createPromptbookLibraryFromDirectory.d.ts +43 -0
  138. package/esm/typings/library/constructors/createPromptbookLibraryFromDirectory.test.d.ts +1 -0
  139. package/esm/typings/library/constructors/createPromptbookLibraryFromPromise.d.ts +23 -0
  140. package/esm/typings/library/constructors/createPromptbookLibraryFromPromise.test.d.ts +1 -0
  141. package/esm/typings/library/constructors/createPromptbookLibraryFromSources.d.ts +13 -0
  142. package/esm/typings/library/constructors/createPromptbookLibraryFromSources.test.d.ts +1 -0
  143. package/esm/typings/library/constructors/createPromptbookLibraryFromUrl.d.ts +26 -0
  144. package/esm/typings/library/constructors/createPromptbookSublibrary.d.ts +12 -0
  145. package/esm/typings/library/constructors/justTestFsImport.d.ts +7 -0
  146. package/esm/typings/types/Command.d.ts +101 -0
  147. package/esm/typings/types/ExecutionTypes.d.ts +13 -0
  148. package/esm/typings/types/ModelRequirements.d.ts +43 -0
  149. package/esm/typings/types/Parameters.d.ts +14 -0
  150. package/esm/typings/types/Prompt.d.ts +57 -0
  151. package/esm/typings/types/PromptbookJson/PromptTemplateJson.d.ts +145 -0
  152. package/esm/typings/types/PromptbookJson/PromptTemplateParameterJson.d.ts +26 -0
  153. package/esm/typings/types/PromptbookJson/PromptbookJson.d.ts +53 -0
  154. package/esm/typings/types/PromptbookString.d.ts +12 -0
  155. package/esm/typings/types/ScriptLanguage.d.ts +9 -0
  156. package/esm/typings/types/TaskProgress.d.ts +43 -0
  157. package/esm/typings/types/execution-report/ExecutionReportJson.d.ts +58 -0
  158. package/esm/typings/types/execution-report/ExecutionReportString.d.ts +16 -0
  159. package/esm/typings/types/execution-report/ExecutionReportStringOptions.d.ts +21 -0
  160. package/esm/typings/types/execution-report/config.d.ts +8 -0
  161. package/esm/typings/types/execution-report/countWorkingDuration.d.ts +7 -0
  162. package/esm/typings/types/execution-report/countWorkingDuration.test.d.ts +1 -0
  163. package/esm/typings/types/execution-report/executionReportJsonToString.d.ts +11 -0
  164. package/esm/typings/types/execution-report/executionReportJsonToString.test.d.ts +1 -0
  165. package/esm/typings/types/typeAliasEmoji.d.ts +9 -0
  166. package/esm/typings/types/typeAliases.d.ts +430 -0
  167. package/esm/typings/utils/FromtoItems.d.ts +19 -0
  168. package/esm/typings/utils/emojis.d.ts +22 -0
  169. package/esm/typings/utils/expectation-counters/countCharacters.d.ts +5 -0
  170. package/esm/typings/utils/expectation-counters/countCharacters.test.d.ts +1 -0
  171. package/esm/typings/utils/expectation-counters/countLines.d.ts +5 -0
  172. package/esm/typings/utils/expectation-counters/countLines.test.d.ts +1 -0
  173. package/esm/typings/utils/expectation-counters/countPages.d.ts +5 -0
  174. package/esm/typings/utils/expectation-counters/countPages.test.d.ts +1 -0
  175. package/esm/typings/utils/expectation-counters/countParagraphs.d.ts +5 -0
  176. package/esm/typings/utils/expectation-counters/countParagraphs.test.d.ts +1 -0
  177. package/esm/typings/utils/expectation-counters/countSentences.d.ts +9 -0
  178. package/esm/typings/utils/expectation-counters/countSentences.test.d.ts +1 -0
  179. package/esm/typings/utils/expectation-counters/countWords.d.ts +5 -0
  180. package/esm/typings/utils/expectation-counters/countWords.test.d.ts +1 -0
  181. package/esm/typings/utils/expectation-counters/index.d.ts +6 -0
  182. package/esm/typings/utils/extractParameters.d.ts +9 -0
  183. package/esm/typings/utils/extractParameters.test.d.ts +1 -0
  184. package/esm/typings/utils/formatNumber.d.ts +6 -0
  185. package/esm/typings/utils/formatNumber.test.d.ts +1 -0
  186. package/esm/typings/utils/getCurrentIsoDate.d.ts +7 -0
  187. package/esm/typings/utils/isRunningInWhatever.d.ts +12 -0
  188. package/esm/typings/utils/isValidJsonString.d.ts +4 -0
  189. package/esm/typings/utils/isValidJsonString.test.d.ts +1 -0
  190. package/esm/typings/utils/just.d.ts +10 -0
  191. package/esm/typings/utils/markdown/addAutoGeneratedSection.d.ts +11 -0
  192. package/esm/typings/utils/markdown/addAutoGeneratedSection.test.d.ts +1 -0
  193. package/esm/typings/utils/markdown/createMarkdownChart.d.ts +41 -0
  194. package/esm/typings/utils/markdown/createMarkdownChart.test.d.ts +1 -0
  195. package/esm/typings/utils/markdown/createMarkdownTable.d.ts +8 -0
  196. package/esm/typings/utils/markdown/createMarkdownTable.test.d.ts +1 -0
  197. package/esm/typings/utils/markdown/escapeMarkdownBlock.d.ts +6 -0
  198. package/esm/typings/utils/markdown/escapeMarkdownBlock.test.d.ts +1 -0
  199. package/esm/typings/utils/markdown/extractAllBlocksFromMarkdown.d.ts +27 -0
  200. package/esm/typings/utils/markdown/extractAllBlocksFromMarkdown.test.d.ts +1 -0
  201. package/esm/typings/utils/markdown/extractAllListItemsFromMarkdown.d.ts +14 -0
  202. package/esm/typings/utils/markdown/extractAllListItemsFromMarkdown.test.d.ts +1 -0
  203. package/esm/typings/utils/markdown/extractOneBlockFromMarkdown.d.ts +19 -0
  204. package/esm/typings/utils/markdown/extractOneBlockFromMarkdown.test.d.ts +1 -0
  205. package/esm/typings/utils/markdown/prettifyMarkdown.d.ts +8 -0
  206. package/esm/typings/utils/markdown/prettifyMarkdown.test.d.ts +1 -0
  207. package/esm/typings/utils/markdown/removeContentComments.d.ts +9 -0
  208. package/esm/typings/utils/markdown/removeContentComments.test.d.ts +1 -0
  209. package/esm/typings/utils/markdown/removeMarkdownFormatting.d.ts +8 -0
  210. package/esm/typings/utils/markdown/removeMarkdownFormatting.test.d.ts +1 -0
  211. package/esm/typings/utils/markdown-json/MarkdownStructure.d.ts +25 -0
  212. package/esm/typings/utils/markdown-json/countMarkdownStructureDeepness.d.ts +7 -0
  213. package/esm/typings/utils/markdown-json/countMarkdownStructureDeepness.test.d.ts +1 -0
  214. package/esm/typings/utils/markdown-json/markdownToMarkdownStructure.d.ts +13 -0
  215. package/esm/typings/utils/markdown-json/markdownToMarkdownStructure.test.d.ts +1 -0
  216. package/esm/typings/utils/normalization/DIACRITIC_VARIANTS_LETTERS.d.ts +10 -0
  217. package/esm/typings/utils/normalization/IKeywords.d.ts +18 -0
  218. package/esm/typings/utils/normalization/capitalize.d.ts +5 -0
  219. package/esm/typings/utils/normalization/capitalize.test.d.ts +1 -0
  220. package/esm/typings/utils/normalization/decapitalize.d.ts +5 -0
  221. package/esm/typings/utils/normalization/decapitalize.test.d.ts +1 -0
  222. package/esm/typings/utils/normalization/isValidKeyword.d.ts +8 -0
  223. package/esm/typings/utils/normalization/isValidKeyword.test.d.ts +1 -0
  224. package/esm/typings/utils/normalization/nameToUriPart.d.ts +1 -0
  225. package/esm/typings/utils/normalization/nameToUriPart.test.d.ts +1 -0
  226. package/esm/typings/utils/normalization/nameToUriParts.d.ts +1 -0
  227. package/esm/typings/utils/normalization/nameToUriParts.test.d.ts +1 -0
  228. package/esm/typings/utils/normalization/normalize-to-kebab-case.d.ts +1 -0
  229. package/esm/typings/utils/normalization/normalize-to-kebab-case.test.d.ts +1 -0
  230. package/esm/typings/utils/normalization/normalizeTo_PascalCase.d.ts +1 -0
  231. package/esm/typings/utils/normalization/normalizeTo_PascalCase.test.d.ts +1 -0
  232. package/esm/typings/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +4 -0
  233. package/esm/typings/utils/normalization/normalizeTo_SCREAMING_CASE.test.d.ts +1 -0
  234. package/esm/typings/utils/normalization/normalizeTo_camelCase.d.ts +4 -0
  235. package/esm/typings/utils/normalization/normalizeTo_camelCase.test.d.ts +1 -0
  236. package/esm/typings/utils/normalization/normalizeTo_snake_case.d.ts +1 -0
  237. package/esm/typings/utils/normalization/normalizeTo_snake_case.test.d.ts +1 -0
  238. package/esm/typings/utils/normalization/normalizeWhitespaces.d.ts +4 -0
  239. package/esm/typings/utils/normalization/normalizeWhitespaces.test.d.ts +1 -0
  240. package/esm/typings/utils/normalization/parseKeywords.d.ts +14 -0
  241. package/esm/typings/utils/normalization/parseKeywords.test.d.ts +1 -0
  242. package/esm/typings/utils/normalization/parseKeywordsFromString.d.ts +8 -0
  243. package/esm/typings/utils/normalization/parseKeywordsFromString.test.d.ts +1 -0
  244. package/esm/typings/utils/normalization/removeDiacritics.d.ts +4 -0
  245. package/esm/typings/utils/normalization/removeDiacritics.test.d.ts +1 -0
  246. package/esm/typings/utils/normalization/searchKeywords.d.ts +5 -0
  247. package/esm/typings/utils/normalization/searchKeywords.test.d.ts +1 -0
  248. package/esm/typings/utils/postprocessing/extractBlock.d.ts +12 -0
  249. package/esm/typings/utils/removeEmojis.d.ts +7 -0
  250. package/esm/typings/utils/removeEmojis.test.d.ts +1 -0
  251. package/esm/typings/utils/removeQuotes.d.ts +13 -0
  252. package/esm/typings/utils/removeQuotes.test.d.ts +1 -0
  253. package/esm/typings/utils/sets/difference.d.ts +4 -0
  254. package/esm/typings/utils/sets/difference.test.d.ts +1 -0
  255. package/esm/typings/utils/sets/intersection.d.ts +4 -0
  256. package/esm/typings/utils/sets/intersection.test.d.ts +1 -0
  257. package/esm/typings/utils/sets/union.d.ts +4 -0
  258. package/esm/typings/utils/sets/union.test.d.ts +1 -0
  259. package/esm/typings/utils/trimCodeBlock.d.ts +8 -0
  260. package/esm/typings/utils/trimCodeBlock.test.d.ts +1 -0
  261. package/esm/typings/utils/trimEndOfCodeBlock.d.ts +7 -0
  262. package/esm/typings/utils/trimEndOfCodeBlock.test.d.ts +1 -0
  263. package/esm/typings/utils/unwrapResult.d.ts +36 -0
  264. package/esm/typings/utils/unwrapResult.test.d.ts +1 -0
  265. package/esm/typings/utils/validators/url/isValidUrl.d.ts +7 -0
  266. package/esm/typings/utils/validators/url/isValidUrl.test.d.ts +1 -0
  267. package/esm/typings/version.d.ts +5 -0
  268. package/package.json +56 -0
  269. package/umd/index.umd.js +2501 -0
  270. package/umd/index.umd.js.map +1 -0
  271. package/umd/typings/_packages/anthropic-claude.index.d.ts +5 -0
  272. package/umd/typings/_packages/azure-openai.index.d.ts +5 -0
  273. package/umd/typings/_packages/cli.index.d.ts +10 -0
  274. package/umd/typings/_packages/core.index.d.ts +41 -0
  275. package/umd/typings/_packages/execute-javascript.index.d.ts +48 -0
  276. package/umd/typings/_packages/fake-llm.index.d.ts +7 -0
  277. package/umd/typings/_packages/langtail.index.d.ts +5 -0
  278. package/umd/typings/_packages/node.index.d.ts +4 -0
  279. package/umd/typings/_packages/openai.index.d.ts +6 -0
  280. package/umd/typings/_packages/remote-client.index.d.ts +6 -0
  281. package/umd/typings/_packages/remote-server.index.d.ts +5 -0
  282. package/umd/typings/_packages/types.index.d.ts +28 -0
  283. package/umd/typings/_packages/utils.index.d.ts +71 -0
  284. package/umd/typings/config.d.ts +8 -0
  285. package/umd/typings/conversion/prettify/PrettifyOptions.d.ts +13 -0
  286. package/umd/typings/conversion/prettify/prettifyPromptbookString.d.ts +10 -0
  287. package/umd/typings/conversion/prettify/prettifyPromptbookStringCli.d.ts +9 -0
  288. package/umd/typings/conversion/prettify/renderPromptbookMermaid.d.ts +25 -0
  289. package/umd/typings/conversion/promptbookJsonToString.d.ts +12 -0
  290. package/umd/typings/conversion/promptbookStringToJson.d.ts +15 -0
  291. package/umd/typings/conversion/promptbookStringToJson.test.d.ts +1 -0
  292. package/umd/typings/conversion/utils/extractParametersFromPromptTemplate.d.ts +13 -0
  293. package/umd/typings/conversion/utils/extractParametersFromPromptTemplate.test.d.ts +1 -0
  294. package/umd/typings/conversion/utils/extractVariables.d.ts +13 -0
  295. package/umd/typings/conversion/utils/extractVariables.test.d.ts +1 -0
  296. package/umd/typings/conversion/utils/parseCommand.d.ts +11 -0
  297. package/umd/typings/conversion/utils/parseCommand.test.d.ts +4 -0
  298. package/umd/typings/conversion/utils/parseNumber.d.ts +15 -0
  299. package/umd/typings/conversion/utils/parseNumber.test.d.ts +1 -0
  300. package/umd/typings/conversion/utils/renameParameter.d.ts +25 -0
  301. package/umd/typings/conversion/utils/renameParameter.test.d.ts +1 -0
  302. package/umd/typings/conversion/utils/titleToName.d.ts +4 -0
  303. package/umd/typings/conversion/utils/titleToName.test.d.ts +1 -0
  304. package/umd/typings/conversion/validation/_importPromptbook.d.ts +13 -0
  305. package/umd/typings/conversion/validation/promptbookStringToJson-syntaxErrors.test.d.ts +1 -0
  306. package/umd/typings/conversion/validation/validatePromptbookJson-logicErrors.test.d.ts +1 -0
  307. package/umd/typings/conversion/validation/validatePromptbookJson.d.ts +27 -0
  308. package/umd/typings/conversion/validation/validatePromptbookJson.test.d.ts +1 -0
  309. package/umd/typings/errors/PromptbookExecutionError.d.ts +7 -0
  310. package/umd/typings/errors/PromptbookLibraryError.d.ts +7 -0
  311. package/umd/typings/errors/PromptbookLogicError.d.ts +7 -0
  312. package/umd/typings/errors/PromptbookNotFoundError.d.ts +7 -0
  313. package/umd/typings/errors/PromptbookReferenceError.d.ts +7 -0
  314. package/umd/typings/errors/PromptbookSyntaxError.d.ts +7 -0
  315. package/umd/typings/errors/TemplateError.d.ts +9 -0
  316. package/umd/typings/errors/UnexpectedError.d.ts +7 -0
  317. package/umd/typings/errors/_ExpectError.d.ts +10 -0
  318. package/umd/typings/execution/CommonExecutionToolsOptions.d.ts +9 -0
  319. package/umd/typings/execution/ExecutionTools.d.ts +32 -0
  320. package/umd/typings/execution/LlmExecutionTools.d.ts +50 -0
  321. package/umd/typings/execution/PromptResult.d.ts +103 -0
  322. package/umd/typings/execution/PromptbookExecutor.d.ts +42 -0
  323. package/umd/typings/execution/ScriptExecutionTools.d.ts +38 -0
  324. package/umd/typings/execution/UserInterfaceTools.d.ts +46 -0
  325. package/umd/typings/execution/addPromptResultUsage.test.d.ts +1 -0
  326. package/umd/typings/execution/assertsExecutionSuccessful.d.ts +11 -0
  327. package/umd/typings/execution/createPromptbookExecutor.d.ts +42 -0
  328. package/umd/typings/execution/plugins/llm-execution-tools/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +43 -0
  329. package/umd/typings/execution/plugins/llm-execution-tools/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +8 -0
  330. package/umd/typings/execution/plugins/llm-execution-tools/anthropic-claude/anthropic-claude-models.d.ts +20 -0
  331. package/umd/typings/execution/plugins/llm-execution-tools/anthropic-claude/playground/playground.d.ts +2 -0
  332. package/umd/typings/execution/plugins/llm-execution-tools/azure-openai/AzureOpenAiExecutionTools.d.ts +42 -0
  333. package/umd/typings/execution/plugins/llm-execution-tools/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +35 -0
  334. package/umd/typings/execution/plugins/llm-execution-tools/azure-openai/playground/playground.d.ts +2 -0
  335. package/umd/typings/execution/plugins/llm-execution-tools/langtail/LangtailExecutionTools.d.ts +7 -0
  336. package/umd/typings/execution/plugins/llm-execution-tools/langtail/LangtailExecutionToolsOptions.d.ts +11 -0
  337. package/umd/typings/execution/plugins/llm-execution-tools/langtail/playground/playground.d.ts +2 -0
  338. package/umd/typings/execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools.d.ts +28 -0
  339. package/umd/typings/execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools.d.ts +25 -0
  340. package/umd/typings/execution/plugins/llm-execution-tools/mocked/fakeTextToExpectations.d.ts +14 -0
  341. package/umd/typings/execution/plugins/llm-execution-tools/mocked/fakeTextToExpectations.test.d.ts +1 -0
  342. package/umd/typings/execution/plugins/llm-execution-tools/mocked/faked-completion.test.d.ts +1 -0
  343. package/umd/typings/execution/plugins/llm-execution-tools/mocked/joker.test.d.ts +4 -0
  344. package/umd/typings/execution/plugins/llm-execution-tools/mocked/mocked-chat.test.d.ts +4 -0
  345. package/umd/typings/execution/plugins/llm-execution-tools/mocked/mocked-completion.test.d.ts +4 -0
  346. package/umd/typings/execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionTools.d.ts +37 -0
  347. package/umd/typings/execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionToolsOptions.d.ts +24 -0
  348. package/umd/typings/execution/plugins/llm-execution-tools/multiple/playground/playground.d.ts +2 -0
  349. package/umd/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionTools.d.ts +47 -0
  350. package/umd/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionToolsOptions.d.ts +18 -0
  351. package/umd/typings/execution/plugins/llm-execution-tools/openai/computeOpenaiUsage.d.ts +12 -0
  352. package/umd/typings/execution/plugins/llm-execution-tools/openai/computeUsage.d.ts +16 -0
  353. package/umd/typings/execution/plugins/llm-execution-tools/openai/computeUsage.test.d.ts +1 -0
  354. package/umd/typings/execution/plugins/llm-execution-tools/openai/openai-models.d.ts +26 -0
  355. package/umd/typings/execution/plugins/llm-execution-tools/openai/playground/playground.d.ts +2 -0
  356. package/umd/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts +42 -0
  357. package/umd/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionToolsOptions.d.ts +24 -0
  358. package/umd/typings/execution/plugins/llm-execution-tools/remote/interfaces/Promptbook_Server_Error.d.ts +11 -0
  359. package/umd/typings/execution/plugins/llm-execution-tools/remote/interfaces/Promptbook_Server_Progress.d.ts +12 -0
  360. package/umd/typings/execution/plugins/llm-execution-tools/remote/interfaces/Promptbook_Server_Request.d.ts +17 -0
  361. package/umd/typings/execution/plugins/llm-execution-tools/remote/interfaces/Promptbook_Server_Response.d.ts +12 -0
  362. package/umd/typings/execution/plugins/llm-execution-tools/remote/interfaces/RemoteServerOptions.d.ts +28 -0
  363. package/umd/typings/execution/plugins/llm-execution-tools/remote/startRemoteServer.d.ts +18 -0
  364. package/umd/typings/execution/plugins/script-execution-tools/custom-function-async.test.ts.test.d.ts +1 -0
  365. package/umd/typings/execution/plugins/script-execution-tools/custom-function-missing.test.d.ts +1 -0
  366. package/umd/typings/execution/plugins/script-execution-tools/custom-function-with-dependencies.test.d.ts +1 -0
  367. package/umd/typings/execution/plugins/script-execution-tools/custom-function.test.d.ts +1 -0
  368. package/umd/typings/execution/plugins/script-execution-tools/javascript/JavascriptEvalExecutionTools.d.ts +20 -0
  369. package/umd/typings/execution/plugins/script-execution-tools/javascript/JavascriptEvalExecutionTools.test.d.ts +4 -0
  370. package/umd/typings/execution/plugins/script-execution-tools/javascript/JavascriptExecutionTools.d.ts +7 -0
  371. package/umd/typings/execution/plugins/script-execution-tools/javascript/JavascriptExecutionToolsOptions.d.ts +26 -0
  372. package/umd/typings/execution/plugins/script-execution-tools/javascript/utils/preserve.d.ts +11 -0
  373. package/umd/typings/execution/plugins/script-execution-tools/javascript/utils/unknownToString.d.ts +7 -0
  374. package/umd/typings/execution/plugins/script-execution-tools/postprocessing.test.d.ts +1 -0
  375. package/umd/typings/execution/plugins/script-execution-tools/python/PythonExecutionTools.d.ts +16 -0
  376. package/umd/typings/execution/plugins/script-execution-tools/script-execution-errors.test.d.ts +1 -0
  377. package/umd/typings/execution/plugins/script-execution-tools/script-execution-tools.test.d.ts +1 -0
  378. package/umd/typings/execution/plugins/script-execution-tools/typescript/TypescriptExecutionTools.d.ts +16 -0
  379. package/umd/typings/execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceTools.d.ts +15 -0
  380. package/umd/typings/execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceToolsOptions.d.ts +12 -0
  381. package/umd/typings/execution/plugins/user-interface-execution-tools/simple-prompt/SimplePromptInterfaceTools.d.ts +17 -0
  382. package/umd/typings/execution/plugins/user-interface-execution-tools/user-interface-execution-tools.test.d.ts +1 -0
  383. package/umd/typings/execution/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts +4 -0
  384. package/umd/typings/execution/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +9 -0
  385. package/umd/typings/execution/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +5 -0
  386. package/umd/typings/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +11 -0
  387. package/umd/typings/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +4 -0
  388. package/umd/typings/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +7 -0
  389. package/umd/typings/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.test.d.ts +1 -0
  390. package/umd/typings/execution/translation/automatic-translate/translateMessages.d.ts +5 -0
  391. package/umd/typings/execution/utils/addUsage.d.ts +7 -0
  392. package/umd/typings/execution/utils/addUsage.test.d.ts +1 -0
  393. package/umd/typings/execution/utils/checkExpectations.d.ts +25 -0
  394. package/umd/typings/execution/utils/checkExpectations.test.d.ts +1 -0
  395. package/umd/typings/execution/utils/computeUsageCounts.d.ts +10 -0
  396. package/umd/typings/execution/utils/forEachAsync.d.ts +18 -0
  397. package/umd/typings/execution/utils/replaceParameters.d.ts +13 -0
  398. package/umd/typings/execution/utils/replaceParameters.test.d.ts +1 -0
  399. package/umd/typings/execution/utils/uncertainNumber.d.ts +9 -0
  400. package/umd/typings/execution/utils/usageToWorktime.d.ts +10 -0
  401. package/umd/typings/execution/utils/usageToWorktime.test.d.ts +1 -0
  402. package/umd/typings/library/PromptbookLibrary.d.ts +25 -0
  403. package/umd/typings/library/SimplePromptbookLibrary.d.ts +36 -0
  404. package/umd/typings/library/constructors/createPromptbookLibraryFromDirectory.d.ts +43 -0
  405. package/umd/typings/library/constructors/createPromptbookLibraryFromDirectory.test.d.ts +1 -0
  406. package/umd/typings/library/constructors/createPromptbookLibraryFromPromise.d.ts +23 -0
  407. package/umd/typings/library/constructors/createPromptbookLibraryFromPromise.test.d.ts +1 -0
  408. package/umd/typings/library/constructors/createPromptbookLibraryFromSources.d.ts +13 -0
  409. package/umd/typings/library/constructors/createPromptbookLibraryFromSources.test.d.ts +1 -0
  410. package/umd/typings/library/constructors/createPromptbookLibraryFromUrl.d.ts +26 -0
  411. package/umd/typings/library/constructors/createPromptbookSublibrary.d.ts +12 -0
  412. package/umd/typings/library/constructors/justTestFsImport.d.ts +7 -0
  413. package/umd/typings/types/Command.d.ts +101 -0
  414. package/umd/typings/types/ExecutionTypes.d.ts +13 -0
  415. package/umd/typings/types/ModelRequirements.d.ts +43 -0
  416. package/umd/typings/types/Parameters.d.ts +14 -0
  417. package/umd/typings/types/Prompt.d.ts +57 -0
  418. package/umd/typings/types/PromptbookJson/PromptTemplateJson.d.ts +145 -0
  419. package/umd/typings/types/PromptbookJson/PromptTemplateParameterJson.d.ts +26 -0
  420. package/umd/typings/types/PromptbookJson/PromptbookJson.d.ts +53 -0
  421. package/umd/typings/types/PromptbookString.d.ts +12 -0
  422. package/umd/typings/types/ScriptLanguage.d.ts +9 -0
  423. package/umd/typings/types/TaskProgress.d.ts +43 -0
  424. package/umd/typings/types/execution-report/ExecutionReportJson.d.ts +58 -0
  425. package/umd/typings/types/execution-report/ExecutionReportString.d.ts +16 -0
  426. package/umd/typings/types/execution-report/ExecutionReportStringOptions.d.ts +21 -0
  427. package/umd/typings/types/execution-report/config.d.ts +8 -0
  428. package/umd/typings/types/execution-report/countWorkingDuration.d.ts +7 -0
  429. package/umd/typings/types/execution-report/countWorkingDuration.test.d.ts +1 -0
  430. package/umd/typings/types/execution-report/executionReportJsonToString.d.ts +11 -0
  431. package/umd/typings/types/execution-report/executionReportJsonToString.test.d.ts +1 -0
  432. package/umd/typings/types/typeAliasEmoji.d.ts +9 -0
  433. package/umd/typings/types/typeAliases.d.ts +430 -0
  434. package/umd/typings/utils/FromtoItems.d.ts +19 -0
  435. package/umd/typings/utils/emojis.d.ts +22 -0
  436. package/umd/typings/utils/expectation-counters/countCharacters.d.ts +5 -0
  437. package/umd/typings/utils/expectation-counters/countCharacters.test.d.ts +1 -0
  438. package/umd/typings/utils/expectation-counters/countLines.d.ts +5 -0
  439. package/umd/typings/utils/expectation-counters/countLines.test.d.ts +1 -0
  440. package/umd/typings/utils/expectation-counters/countPages.d.ts +5 -0
  441. package/umd/typings/utils/expectation-counters/countPages.test.d.ts +1 -0
  442. package/umd/typings/utils/expectation-counters/countParagraphs.d.ts +5 -0
  443. package/umd/typings/utils/expectation-counters/countParagraphs.test.d.ts +1 -0
  444. package/umd/typings/utils/expectation-counters/countSentences.d.ts +9 -0
  445. package/umd/typings/utils/expectation-counters/countSentences.test.d.ts +1 -0
  446. package/umd/typings/utils/expectation-counters/countWords.d.ts +5 -0
  447. package/umd/typings/utils/expectation-counters/countWords.test.d.ts +1 -0
  448. package/umd/typings/utils/expectation-counters/index.d.ts +6 -0
  449. package/umd/typings/utils/extractParameters.d.ts +9 -0
  450. package/umd/typings/utils/extractParameters.test.d.ts +1 -0
  451. package/umd/typings/utils/formatNumber.d.ts +6 -0
  452. package/umd/typings/utils/formatNumber.test.d.ts +1 -0
  453. package/umd/typings/utils/getCurrentIsoDate.d.ts +7 -0
  454. package/umd/typings/utils/isRunningInWhatever.d.ts +12 -0
  455. package/umd/typings/utils/isValidJsonString.d.ts +4 -0
  456. package/umd/typings/utils/isValidJsonString.test.d.ts +1 -0
  457. package/umd/typings/utils/just.d.ts +10 -0
  458. package/umd/typings/utils/markdown/addAutoGeneratedSection.d.ts +11 -0
  459. package/umd/typings/utils/markdown/addAutoGeneratedSection.test.d.ts +1 -0
  460. package/umd/typings/utils/markdown/createMarkdownChart.d.ts +41 -0
  461. package/umd/typings/utils/markdown/createMarkdownChart.test.d.ts +1 -0
  462. package/umd/typings/utils/markdown/createMarkdownTable.d.ts +8 -0
  463. package/umd/typings/utils/markdown/createMarkdownTable.test.d.ts +1 -0
  464. package/umd/typings/utils/markdown/escapeMarkdownBlock.d.ts +6 -0
  465. package/umd/typings/utils/markdown/escapeMarkdownBlock.test.d.ts +1 -0
  466. package/umd/typings/utils/markdown/extractAllBlocksFromMarkdown.d.ts +27 -0
  467. package/umd/typings/utils/markdown/extractAllBlocksFromMarkdown.test.d.ts +1 -0
  468. package/umd/typings/utils/markdown/extractAllListItemsFromMarkdown.d.ts +14 -0
  469. package/umd/typings/utils/markdown/extractAllListItemsFromMarkdown.test.d.ts +1 -0
  470. package/umd/typings/utils/markdown/extractOneBlockFromMarkdown.d.ts +19 -0
  471. package/umd/typings/utils/markdown/extractOneBlockFromMarkdown.test.d.ts +1 -0
  472. package/umd/typings/utils/markdown/prettifyMarkdown.d.ts +8 -0
  473. package/umd/typings/utils/markdown/prettifyMarkdown.test.d.ts +1 -0
  474. package/umd/typings/utils/markdown/removeContentComments.d.ts +9 -0
  475. package/umd/typings/utils/markdown/removeContentComments.test.d.ts +1 -0
  476. package/umd/typings/utils/markdown/removeMarkdownFormatting.d.ts +8 -0
  477. package/umd/typings/utils/markdown/removeMarkdownFormatting.test.d.ts +1 -0
  478. package/umd/typings/utils/markdown-json/MarkdownStructure.d.ts +25 -0
  479. package/umd/typings/utils/markdown-json/countMarkdownStructureDeepness.d.ts +7 -0
  480. package/umd/typings/utils/markdown-json/countMarkdownStructureDeepness.test.d.ts +1 -0
  481. package/umd/typings/utils/markdown-json/markdownToMarkdownStructure.d.ts +13 -0
  482. package/umd/typings/utils/markdown-json/markdownToMarkdownStructure.test.d.ts +1 -0
  483. package/umd/typings/utils/normalization/DIACRITIC_VARIANTS_LETTERS.d.ts +10 -0
  484. package/umd/typings/utils/normalization/IKeywords.d.ts +18 -0
  485. package/umd/typings/utils/normalization/capitalize.d.ts +5 -0
  486. package/umd/typings/utils/normalization/capitalize.test.d.ts +1 -0
  487. package/umd/typings/utils/normalization/decapitalize.d.ts +5 -0
  488. package/umd/typings/utils/normalization/decapitalize.test.d.ts +1 -0
  489. package/umd/typings/utils/normalization/isValidKeyword.d.ts +8 -0
  490. package/umd/typings/utils/normalization/isValidKeyword.test.d.ts +1 -0
  491. package/umd/typings/utils/normalization/nameToUriPart.d.ts +1 -0
  492. package/umd/typings/utils/normalization/nameToUriPart.test.d.ts +1 -0
  493. package/umd/typings/utils/normalization/nameToUriParts.d.ts +1 -0
  494. package/umd/typings/utils/normalization/nameToUriParts.test.d.ts +1 -0
  495. package/umd/typings/utils/normalization/normalize-to-kebab-case.d.ts +1 -0
  496. package/umd/typings/utils/normalization/normalize-to-kebab-case.test.d.ts +1 -0
  497. package/umd/typings/utils/normalization/normalizeTo_PascalCase.d.ts +1 -0
  498. package/umd/typings/utils/normalization/normalizeTo_PascalCase.test.d.ts +1 -0
  499. package/umd/typings/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +4 -0
  500. package/umd/typings/utils/normalization/normalizeTo_SCREAMING_CASE.test.d.ts +1 -0
  501. package/umd/typings/utils/normalization/normalizeTo_camelCase.d.ts +4 -0
  502. package/umd/typings/utils/normalization/normalizeTo_camelCase.test.d.ts +1 -0
  503. package/umd/typings/utils/normalization/normalizeTo_snake_case.d.ts +1 -0
  504. package/umd/typings/utils/normalization/normalizeTo_snake_case.test.d.ts +1 -0
  505. package/umd/typings/utils/normalization/normalizeWhitespaces.d.ts +4 -0
  506. package/umd/typings/utils/normalization/normalizeWhitespaces.test.d.ts +1 -0
  507. package/umd/typings/utils/normalization/parseKeywords.d.ts +14 -0
  508. package/umd/typings/utils/normalization/parseKeywords.test.d.ts +1 -0
  509. package/umd/typings/utils/normalization/parseKeywordsFromString.d.ts +8 -0
  510. package/umd/typings/utils/normalization/parseKeywordsFromString.test.d.ts +1 -0
  511. package/umd/typings/utils/normalization/removeDiacritics.d.ts +4 -0
  512. package/umd/typings/utils/normalization/removeDiacritics.test.d.ts +1 -0
  513. package/umd/typings/utils/normalization/searchKeywords.d.ts +5 -0
  514. package/umd/typings/utils/normalization/searchKeywords.test.d.ts +1 -0
  515. package/umd/typings/utils/postprocessing/extractBlock.d.ts +12 -0
  516. package/umd/typings/utils/removeEmojis.d.ts +7 -0
  517. package/umd/typings/utils/removeEmojis.test.d.ts +1 -0
  518. package/umd/typings/utils/removeQuotes.d.ts +13 -0
  519. package/umd/typings/utils/removeQuotes.test.d.ts +1 -0
  520. package/umd/typings/utils/sets/difference.d.ts +4 -0
  521. package/umd/typings/utils/sets/difference.test.d.ts +1 -0
  522. package/umd/typings/utils/sets/intersection.d.ts +4 -0
  523. package/umd/typings/utils/sets/intersection.test.d.ts +1 -0
  524. package/umd/typings/utils/sets/union.d.ts +4 -0
  525. package/umd/typings/utils/sets/union.test.d.ts +1 -0
  526. package/umd/typings/utils/trimCodeBlock.d.ts +8 -0
  527. package/umd/typings/utils/trimCodeBlock.test.d.ts +1 -0
  528. package/umd/typings/utils/trimEndOfCodeBlock.d.ts +7 -0
  529. package/umd/typings/utils/trimEndOfCodeBlock.test.d.ts +1 -0
  530. package/umd/typings/utils/unwrapResult.d.ts +36 -0
  531. package/umd/typings/utils/unwrapResult.test.d.ts +1 -0
  532. package/umd/typings/utils/validators/url/isValidUrl.d.ts +7 -0
  533. package/umd/typings/utils/validators/url/isValidUrl.test.d.ts +1 -0
  534. package/umd/typings/version.d.ts +5 -0
package/README.md ADDED
@@ -0,0 +1,706 @@
1
+ # ![Promptbook logo - cube with letters P and B](./other/design/logo-h1.png) Promptbook
2
+
3
+ Library to supercharge your use of large language models
4
+
5
+
6
+
7
+
8
+ [![NPM Version of ![Promptbook logo - cube with letters P and B](./other/design/logo-h1.png) Promptbook](https://badge.fury.io/js/promptbook.svg)](https://www.npmjs.com/package/promptbook)
9
+ [![Quality of package ![Promptbook logo - cube with letters P and B](./other/design/logo-h1.png) Promptbook](https://packagequality.com/shield/promptbook.svg)](https://packagequality.com/#?package=promptbook)
10
+ [![Known Vulnerabilities](https://snyk.io/test/github/webgptorg/promptbook/badge.svg)](https://snyk.io/test/github/webgptorg/promptbook)
11
+ [![Issues](https://img.shields.io/github/issues/webgptorg/promptbook.svg?style=flat)](https://github.com/webgptorg/promptbook/issues)
12
+
13
+
14
+
15
+
16
+
17
+ ## 📦 Package `@promptbook/node`
18
+
19
+ - Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
20
+ - This package `@promptbook/node` is one part of the promptbook ecosystem.
21
+
22
+ To install this package, run:
23
+
24
+ ```bash
25
+ # Install entire promptbook ecosystem
26
+ npm i ptbk
27
+
28
+ # Install just this package to save space
29
+ npm i @promptbook/node
30
+ ```
31
+
32
+ Core of the library for Node.js, it contains the main logic for promptbooks which uses filesystem.
33
+
34
+
35
+
36
+ > 💡 This package does not make sense by itself, look at [all promptbook packages](#-packages) or just install all by `npm i ptbk`
37
+
38
+
39
+ ---
40
+
41
+ Rest of the documentation is common for **entire promptbook ecosystem**:
42
+
43
+
44
+
45
+ ## 🤍 The Promptbook Whitepaper
46
+
47
+ When you have a simple, single prompt for ChatGPT, GPT-4, Anthropic Claude, Google Gemini, Llama 2, or whatever, it doesn't matter how it is integrated. Whether it's the direct calling of a REST API, using the SDK, hardcoding the prompt in the source code, or importing a text file, the process remains the same.
48
+
49
+ If you need something more advanced or want to extend the capabilities of LLMs, you generally have three ways to proceed:
50
+
51
+ 1. **Fine-tune** the model to your specifications or even train your own.
52
+ 2. **Prompt-engineer** the prompt to the best shape you can achieve.
53
+ 3. Use **multiple prompts** in a pipeline to get the best result.
54
+
55
+ In any of these situations, but especially in (3), the Promptbook library can make your life easier and make **orchestraror for your prompts**.
56
+
57
+ - **Separation of concerns** between prompt engineer and programmer; between code files and prompt files; and between prompts, templates, templating pipelines, and their execution logic.
58
+ - Set up a **common format** for prompts that is interchangeable between projects and language/technology stacks.
59
+ - **Preprocessing** and cleaning the input data from the user.
60
+ - Use default values - **Jokers** to bypass some parts of the pipeline.
61
+ - **Expect** some specific output from the model.
62
+ - **Retry** mismatched outputs.
63
+ - **Combine** multiple models together.
64
+ - Interactive **User interaction** with the model and the user.
65
+ - Leverage **external** sources (like ChatGPT plugins or OpenAI's GPTs).
66
+ - Simplify your code to be **DRY** and not repeat all the boilerplate code for each prompt.
67
+ - **Versioning** of promptbooks
68
+ - **Reuse** parts of promptbooks in/between projects.
69
+ - Run the LLM **optimally** in parallel, with the best _cost/quality_ ratio or _speed/quality_ ratio.
70
+ - **Execution report** to see what happened during the execution.
71
+ - **Logging** the results of the promptbooks.
72
+ - _(Not ready yet)_ **Caching** calls to LLMs to save money and time.
73
+ - _(Not ready yet)_ Extend one prompt book from another one.
74
+ - _(Not ready yet)_ Leverage the **streaming** to make super cool UI/UX.
75
+ - _(Not ready yet)_ **A/B testing** to determine which prompt works best for the job.
76
+
77
+
78
+
79
+ ### Sample:
80
+
81
+ File `write-website-content.ptbk.md`:
82
+
83
+
84
+
85
+ > # 🌍 Create website content
86
+ >
87
+ > Instructions for creating web page content.
88
+ >
89
+ > - PROMPTBOOK URL https://promptbook.webgpt.com/en/write-website-content.ptbk.md
90
+ > - PROMPTBOOK VERSION 0.0.1
91
+ > - INPUT  PARAM `{rawTitle}` Automatically suggested a site name or empty text
92
+ > - INPUT  PARAM `{rawAssigment}` Automatically generated site entry from image recognition
93
+ > - OUTPUT PARAM `{content}` Web content
94
+ > - OUTPUT PARAM `{keywords}` Keywords
95
+ >
96
+ > ## 👤 Specifying the assigment
97
+ >
98
+ > What is your web about?
99
+ >
100
+ > - PROMPT DIALOG
101
+ >
102
+ > ```
103
+ > {rawAssigment}
104
+ > ```
105
+ >
106
+ > `-> {assigment}` Website assignment and specification
107
+ >
108
+ > ## ✨ Improving the title
109
+ >
110
+ > - MODEL VARIANT Chat
111
+ > - MODEL NAME `gpt-4`
112
+ > - POSTPROCESSING `unwrapResult`
113
+ >
114
+ > ```
115
+ > As an experienced marketing specialist, you have been entrusted with improving the name of your client's business.
116
+ >
117
+ > A suggested name from a client:
118
+ > "{rawTitle}"
119
+ >
120
+ > Assignment from customer:
121
+ >
122
+ > > {assigment}
123
+ >
124
+ > ## Instructions:
125
+ >
126
+ > - Write only one name suggestion
127
+ > - The name will be used on the website, business cards, visuals, etc.
128
+ > ```
129
+ >
130
+ > `-> {enhancedTitle}` Enhanced title
131
+ >
132
+ > ## 👤 Website title approval
133
+ >
134
+ > Is the title for your website okay?
135
+ >
136
+ > - PROMPT DIALOG
137
+ >
138
+ > ```
139
+ > {enhancedTitle}
140
+ > ```
141
+ >
142
+ > `-> {title}` Title for the website
143
+ >
144
+ > ## 🐰 Cunning subtitle
145
+ >
146
+ > - MODEL VARIANT Chat
147
+ > - MODEL NAME `gpt-4`
148
+ > - POSTPROCESSING `unwrapResult`
149
+ >
150
+ > ```
151
+ > As an experienced copywriter, you have been entrusted with creating a claim for the "{title}" web page.
152
+ >
153
+ > A website assignment from a customer:
154
+ >
155
+ > > {assigment}
156
+ >
157
+ > ## Instructions:
158
+ >
159
+ > - Write only one name suggestion
160
+ > - Claim will be used on website, business cards, visuals, etc.
161
+ > - Claim should be punchy, funny, original
162
+ > ```
163
+ >
164
+ > `-> {claim}` Claim for the web
165
+ >
166
+ > ## 🚦 Keyword analysis
167
+ >
168
+ > - MODEL VARIANT Chat
169
+ > - MODEL NAME `gpt-4`
170
+ >
171
+ > ```
172
+ > As an experienced SEO specialist, you have been entrusted with creating keywords for the website "{title}".
173
+ >
174
+ > Website assignment from the customer:
175
+ >
176
+ > > {assigment}
177
+ >
178
+ > ## Instructions:
179
+ >
180
+ > - Write a list of keywords
181
+ > - Keywords are in basic form
182
+ >
183
+ > ## Example:
184
+ >
185
+ > - Ice cream
186
+ > - Olomouc
187
+ > - Quality
188
+ > - Family
189
+ > - Tradition
190
+ > - Italy
191
+ > - Craft
192
+ >
193
+ > ```
194
+ >
195
+ > `-> {keywords}` Keywords
196
+ >
197
+ > ## 🔗 Combine the beginning
198
+ >
199
+ > - SIMPLE TEMPLATE
200
+ >
201
+ > ```
202
+ >
203
+ > # {title}
204
+ >
205
+ > > {claim}
206
+ >
207
+ > ```
208
+ >
209
+ > `-> {contentBeginning}` Beginning of web content
210
+ >
211
+ > ## 🖋 Write the content
212
+ >
213
+ > - MODEL VARIANT Completion
214
+ > - MODEL NAME `gpt-3.5-turbo-instruct`
215
+ >
216
+ > ```
217
+ > As an experienced copywriter and web designer, you have been entrusted with creating text for a new website {title}.
218
+ >
219
+ > A website assignment from a customer:
220
+ >
221
+ > > {assigment}
222
+ >
223
+ > ## Instructions:
224
+ >
225
+ > - Text formatting is in Markdown
226
+ > - Be concise and to the point
227
+ > - Use keywords, but they should be naturally in the text
228
+ > - This is the complete content of the page, so don't forget all the important information and elements the page should contain
229
+ > - Use headings, bullets, text formatting
230
+ >
231
+ > ## Keywords:
232
+ >
233
+ > {keywords}
234
+ >
235
+ > ## Web Content:
236
+ >
237
+ > {contentBeginning}
238
+ > ```
239
+ >
240
+ > `-> {contentBody}` Middle of the web content
241
+ >
242
+ > ## 🔗 Combine the content
243
+ >
244
+ > - SIMPLE TEMPLATE
245
+ >
246
+ > ```markdown
247
+ > {contentBeginning}
248
+ >
249
+ > {contentBody}
250
+ > ```
251
+ >
252
+ > `-> {content}`
253
+
254
+
255
+
256
+ Following is the scheme how the promptbook above is executed:
257
+
258
+ ```mermaid
259
+ %% 🔮 Tip: Open this on GitHub or in the VSCode website to see the Mermaid graph visually
260
+
261
+ flowchart LR
262
+ subgraph "🌍 Create website content"
263
+
264
+ direction TB
265
+
266
+ input((Input)):::input
267
+ templateSpecifyingTheAssigment(👤 Specifying the assigment)
268
+ input--"{rawAssigment}"-->templateSpecifyingTheAssigment
269
+ templateImprovingTheTitle(✨ Improving the title)
270
+ input--"{rawTitle}"-->templateImprovingTheTitle
271
+ templateSpecifyingTheAssigment--"{assigment}"-->templateImprovingTheTitle
272
+ templateWebsiteTitleApproval(👤 Website title approval)
273
+ templateImprovingTheTitle--"{enhancedTitle}"-->templateWebsiteTitleApproval
274
+ templateCunningSubtitle(🐰 Cunning subtitle)
275
+ templateWebsiteTitleApproval--"{title}"-->templateCunningSubtitle
276
+ templateSpecifyingTheAssigment--"{assigment}"-->templateCunningSubtitle
277
+ templateKeywordAnalysis(🚦 Keyword analysis)
278
+ templateWebsiteTitleApproval--"{title}"-->templateKeywordAnalysis
279
+ templateSpecifyingTheAssigment--"{assigment}"-->templateKeywordAnalysis
280
+ templateCombineTheBeginning(🔗 Combine the beginning)
281
+ templateWebsiteTitleApproval--"{title}"-->templateCombineTheBeginning
282
+ templateCunningSubtitle--"{claim}"-->templateCombineTheBeginning
283
+ templateWriteTheContent(🖋 Write the content)
284
+ templateWebsiteTitleApproval--"{title}"-->templateWriteTheContent
285
+ templateSpecifyingTheAssigment--"{assigment}"-->templateWriteTheContent
286
+ templateKeywordAnalysis--"{keywords}"-->templateWriteTheContent
287
+ templateCombineTheBeginning--"{contentBeginning}"-->templateWriteTheContent
288
+ templateCombineTheContent(🔗 Combine the content)
289
+ templateCombineTheBeginning--"{contentBeginning}"-->templateCombineTheContent
290
+ templateWriteTheContent--"{contentBody}"-->templateCombineTheContent
291
+
292
+ templateCombineTheContent--"{content}"-->output
293
+ output((Output)):::output
294
+
295
+ classDef input color: grey;
296
+ classDef output color: grey;
297
+
298
+ end;
299
+ ```
300
+
301
+ [More template samples](./samples/templates/)
302
+
303
+ _Note: We are using [postprocessing functions](#postprocessing-functions) like `unwrapResult` that can be used to postprocess the result._
304
+
305
+ ## 📦 Packages
306
+
307
+ This library is divided into several packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
308
+ You can install all of them at once:
309
+
310
+ ```bash
311
+ npm i ptbk
312
+ ```
313
+
314
+ Or you can install them separately:
315
+
316
+ > ⭐ Marked packages are worth to try first
317
+
318
+
319
+
320
+ - ⭐ **[ptbk](https://www.npmjs.com/package/ptbk)** - Bundle of all packages, when you want to install everything and you don't care about the size
321
+ - **[promptbook](https://www.npmjs.com/package/promptbook)** - Same as `ptbk`
322
+ - **[@promptbook/core](https://www.npmjs.com/package/@promptbook/core)** - Core of the library, it contains the main logic for promptbooks
323
+ - **[@promptbook/node](https://www.npmjs.com/package/@promptbook/node)** - Core of the library for Node.js
324
+ - ⭐ **[@promptbook/utils](https://www.npmjs.com/package/@promptbook/utils)** - Utility functions used in the library but also useful for individual use in preprocessing and postprocessing LLM inputs and outputs
325
+ - _(Not finished)_ **[@promptbook/wizzard](https://www.npmjs.com/package/@promptbook/wizzard)** - Wizard for creating+running promptbooks in single line
326
+ - **[@promptbook/execute-javascript](https://www.npmjs.com/package/@promptbook/execute-javascript)** - Execution tools for javascript inside promptbooks
327
+ - **[@promptbook/openai](https://www.npmjs.com/package/@promptbook/openai)** - Execution tools for OpenAI API, wrapper around OpenAI SDK
328
+ - **[@promptbook/anthropic-claude](https://www.npmjs.com/package/@promptbook/anthropic-claude)** - Execution tools for Anthropic Claude API, wrapper around Anthropic Claude SDK
329
+ - **[@promptbook/azure-openai](https://www.npmjs.com/package/@promptbook/azure-openai)** - Execution tools for Azure OpenAI API
330
+ - **[@promptbook/langtail](https://www.npmjs.com/package/@promptbook/langtail)** - Execution tools for Langtail API, wrapper around Langtail SDK
331
+ - **[@promptbook/fake-llm](https://www.npmjs.com/package/@promptbook/fake-llm)** - Mocked execution tools for testing the library and saving the tokens
332
+ - **[@promptbook/remote-client](https://www.npmjs.com/package/@promptbook/remote-client)** - Remote client for remote execution of promptbooks
333
+ - **[@promptbook/remote-server](https://www.npmjs.com/package/@promptbook/remote-server)** - Remote server for remote execution of promptbooks
334
+ - **[@promptbook/types](https://www.npmjs.com/package/@promptbook/types)** - Just typescript types used in the library
335
+ - **[@promptbook/cli](https://www.npmjs.com/package/@promptbook/cli)** - Command line interface utilities for promptbooks
336
+
337
+
338
+
339
+ ## 📚 Dictionary
340
+
341
+ The following glossary is used to clarify certain basic concepts:
342
+
343
+ ### Prompt
344
+
345
+ Prompt in a text along with model requirements, but without any execution or templating logic.
346
+
347
+ For example:
348
+
349
+ ```json
350
+ {
351
+ "request": "Which sound does a cat make?",
352
+ "modelRequirements": {
353
+ "variant": "CHAT"
354
+ }
355
+ }
356
+ ```
357
+
358
+ ```json
359
+ {
360
+ "request": "I am a cat.\nI like to eat fish.\nI like to sleep.\nI like to play with a ball.\nI l",
361
+ "modelRequirements": {
362
+ "variant": "COMPLETION"
363
+ }
364
+ }
365
+ ```
366
+
367
+ ### Prompt Template
368
+
369
+ Similar concept to Prompt, but with templating logic.
370
+
371
+ For example:
372
+
373
+ ```json
374
+ {
375
+ "request": "Which sound does a {animalName} make?",
376
+ "modelRequirements": {
377
+ "variant": "CHAT"
378
+ }
379
+ }
380
+ ```
381
+
382
+ ### Model Requirements
383
+
384
+ Abstract way to specify the LLM.
385
+ It does not specify the LLM with concrete version itself, only the requirements for the LLM.
386
+ _NOT chatgpt-3.5-turbo BUT CHAT variant of GPT-3.5._
387
+
388
+ For example:
389
+
390
+ ```json
391
+ {
392
+ "variant": "CHAT",
393
+ "version": "GPT-3.5",
394
+ "temperature": 0.7
395
+ }
396
+ ```
397
+
398
+ ### Execution type
399
+
400
+ Each block of promptbook can have a different execution type.
401
+ It is specified in list of requirements for the block.
402
+ By default, it is `Prompt template`
403
+
404
+ - _(default)_ `Prompt template` The block is a prompt template and is executed by LLM (OpenAI, Azure,...)
405
+ - `SIMPLE TEMPLATE` The block is a simple text template which is just filled with parameters
406
+ - `Script` The block is a script that is executed by some script runtime, the runtime is determined by block type, currently only `javascript` is supported but we plan to add `python` and `typescript` in the future.
407
+ - `PROMPT DIALOG` Ask user for input
408
+
409
+ ### Parameters
410
+
411
+ Parameters that are placed in the prompt template and replaced to create the prompt.
412
+ It is a simple key-value object.
413
+
414
+ ```json
415
+ {
416
+ "animalName": "cat",
417
+ "animalSound": "Meow!"
418
+ }
419
+ ```
420
+
421
+ There are three types of template parameters, depending on how they are used in the promptbook:
422
+
423
+ - **INPUT PARAMETER**s are required to execute the promptbook.
424
+ - **Intermediate parameters** are used internally in the promptbook.
425
+ - **OUTPUT PARAMETER**s are explicitelly marked and they are returned as the result of the promptbook execution.
426
+
427
+ _Note: Parameter can be both intermedite and output at the same time._
428
+
429
+ ### Promptbook
430
+
431
+ Promptbook is **core concept of this library**.
432
+ It represents a series of prompt templates chained together to form a **pipeline** / one big prompt template with input and result parameters.
433
+
434
+ Internally it can have multiple formats:
435
+
436
+ - **.ptbk.md file** in custom markdown format described above
437
+ - _(concept)_ **.ptbk** format, custom fileextension based on markdown
438
+ - _(internal)_ **JSON** format, parsed from the .ptbk.md file
439
+
440
+ ### Promptbook **Library**
441
+
442
+ Library of all promptbooks used in your application.
443
+ Each promptbook is a separate `.ptbk.md` file with unique `PROMPTBOOK URL`. Theese urls are used to reference promptbooks in other promptbooks or in the application code.
444
+
445
+ ### Prompt Result
446
+
447
+ Prompt result is the simplest concept of execution.
448
+ It is the result of executing one prompt _(NOT a template)_.
449
+
450
+ For example:
451
+
452
+ ```json
453
+ {
454
+ "response": "Meow!",
455
+ "model": "chatgpt-3.5-turbo"
456
+ }
457
+ ```
458
+
459
+ ### Execution Tools
460
+
461
+
462
+
463
+ `ExecutionTools` is an interface which contains all the tools needed to execute prompts.
464
+ It contais 3 subtools:
465
+
466
+ - `LlmExecutionTools`
467
+ - `ScriptExecutionTools`
468
+ - `UserInterfaceTools`
469
+
470
+ Which are described below:
471
+
472
+ #### LLM Execution Tools
473
+
474
+ `LlmExecutionTools` is a container for all the tools needed to execute prompts to large language models like GPT-4.
475
+ On its interface it exposes common methods for prompt execution.
476
+ Internally it calls OpenAI, Azure, GPU, proxy, cache, logging,...
477
+
478
+ `LlmExecutionTools` an abstract interface that is implemented by concrete execution tools:
479
+
480
+ - `OpenAiExecutionTools`
481
+ - `AnthropicClaudeExecutionTools`
482
+ - `AzureOpenAiExecutionTools`
483
+ - `LangtailExecutionTools`
484
+ - _(Not implemented yet)_ `BardExecutionTools`
485
+ - _(Not implemented yet)_ `LamaExecutionTools`
486
+ - _(Not implemented yet)_ `GpuExecutionTools`
487
+ - And a special case are `MultipleLlmExecutionTools` that combines multiple execution tools together and tries to execute the prompt on the best one.
488
+ - Another special case are `RemoteLlmExecutionTools` that connect to a remote server and run one of the above execution tools on that server.
489
+ - The another special case is `MockedEchoLlmExecutionTools` that is used for testing and mocking.
490
+ - The another special case is `LogLlmExecutionToolsWrapper` that is technically also an execution tools but it is more proxy wrapper around other execution tools that logs all calls to execution tools.
491
+
492
+ #### Script Execution Tools
493
+
494
+ `ScriptExecutionTools` is an abstract container that represents all the tools needed to EXECUTE SCRIPTs. It is implemented by concrete execution tools:
495
+
496
+ - `JavascriptExecutionTools` is a wrapper around `vm2` module that executes javascript code in a sandbox.
497
+ - `JavascriptEvalExecutionTools` is wrapper around `eval` function that executes javascript. It is used for testing and mocking **NOT intended to use in the production** due to its unsafe nature, use `JavascriptExecutionTools` instead.
498
+ - _(Not implemented yet)_ `TypescriptExecutionTools` executes typescript code in a sandbox.
499
+ - _(Not implemented yet)_ `PythonExecutionTools` executes python code in a sandbox.
500
+
501
+ There are [postprocessing functions](#postprocessing-functions) that can be used to postprocess the result.
502
+
503
+ #### User Interface Tools
504
+
505
+ `UserInterfaceTools` is an abstract container that represents all the tools needed to interact with the user. It is implemented by concrete execution tools:
506
+
507
+ - _(Not implemented yet)_ `ConsoleInterfaceTools` is a wrapper around `readline` module that interacts with the user via console.
508
+ - `SimplePromptInterfaceTools` is a wrapper around `window.prompt` synchronous function that interacts with the user via browser prompt. It is used for testing and mocking **NOT intended to use in the production** due to its synchronous nature.
509
+ - `CallbackInterfaceTools` delagates the user interaction to a async callback function. You need to provide your own implementation of this callback function and its bind to UI.
510
+
511
+ ### Executor
512
+
513
+ Executor is a simple async function that takes **input parameters** and returns **output parameters**.
514
+ It is constructed by combining execution tools and promptbook to execute together.
515
+
516
+ ### 🃏 Jokers (conditions)
517
+
518
+ Joker is a previously defined parameter that is used to bypass some parts of the pipeline.
519
+ If the joker is present in the template, it is checked to see if it meets the requirements (without postprocessing), and if so, it is used instead of executing that prompt template. There can be multiple wildcards in a prompt template, if so they are checked in order and the first one that meets the requirements is used.
520
+
521
+ If none of the jokers meet the requirements, the prompt template is executed as usual.
522
+
523
+ This can be useful, for example, if you want to use some predefined data, or if you want to use some data from the user, but you are not sure if it is suitable form.
524
+
525
+ When using wildcards, you must have at least one minimum expectation. If you do not have a minimum expectation, the joker will always fulfil the expectation because it has none, so it makes no logical sense.
526
+
527
+ Look at [jokers.ptbk.md](samples/templates/41-jokers.ptbk.md) sample.
528
+
529
+ ### Postprocessing functions
530
+
531
+ You can define postprocessing functions when creating `JavascriptEvalExecutionTools`:
532
+
533
+ ```
534
+
535
+ ```
536
+
537
+ Additionally there are some usefull string-manipulation build-in functions, which are [listed here](src/execution/plugins/script-execution-tools/javascript/JavascriptEvalExecutionTools.ts).
538
+
539
+ ### Expectations
540
+
541
+ `Expect` command describes the desired output of the prompt template (after post-processing)
542
+ It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs,...
543
+
544
+ _Note: LLMs work with tokens, not characters, but in Promptbooks we want to use some human-recognisable and cross-model interoperable units._
545
+
546
+ ```markdown
547
+ # ✨ Sample: Expectations
548
+
549
+ - INPUT  PARAMETER {yourName} Name of the hero
550
+
551
+ ## 💬 Question
552
+
553
+ - EXPECT MAX 30 CHARACTERS
554
+ - EXPECT MIN 2 CHARACTERS
555
+ - EXPECT MAX 3 WORDS
556
+ - EXPECT EXACTLY 1 SENTENCE
557
+ - EXPECT EXACTLY 1 LINE
558
+
559
+ ...
560
+ ```
561
+
562
+ There are two types of expectations which are not strictly symmetrical:
563
+
564
+ #### Minimal expectations
565
+
566
+ - `EXPECT MIN 0 ...` is not valid minimal expectation. It makes no sense.
567
+ - `EXPECT JSON` is both minimal and maximal expectation
568
+ - When you are using `JOKER` in same prompt template, you need to have at least one minimal expectation
569
+
570
+ #### Maximal expectations
571
+
572
+ - `EXPECT MAX 0 ...` is valid maximal expectation. For example, you can expect 0 pages and 2 sentences.
573
+ - `EXPECT JSON` is both minimal and maximal expectation
574
+
575
+ Look at [expectations.ptbk.md](samples/templates/45-expectations.ptbk.md) and [expect-json.ptbk.md](samples/templates/45-expect-json.ptbk.md) samples for more.
576
+
577
+
578
+
579
+ ### Execution report
580
+
581
+ Execution report is a simple object or markdown that contains information about the execution of the promptbook.
582
+
583
+ [See the example of such a report](/samples/templates/50-advanced.report.md)
584
+
585
+
586
+
587
+
588
+
589
+ ### Remote server
590
+
591
+ Remote server is a proxy server that uses its execution tools internally and exposes the executor interface externally.
592
+
593
+ You can simply use `RemoteExecutionTools` on client-side javascript and connect to your remote server.
594
+ This is useful to make all logic on browser side but not expose your API keys or no need to use customer's GPU.
595
+
596
+ ## 👨‍💻 Usage and integration _(for developers)_
597
+
598
+
599
+
600
+ ### 🔌 Usage in Typescript / Javascript
601
+
602
+ - [Simple usage](./samples/usage/simple-script)
603
+ - [Usage with client and remote server](./samples/usage/remote)
604
+
605
+ ## ➕➖ When to use Promptbook?
606
+
607
+ ### ➕ When to use
608
+
609
+ - When you are writing app that generates complex things via LLM - like **websites, articles, presentations, code, stories, songs**,...
610
+ - When you want to **separate code from text prompts**
611
+ - When you want to describe **complex prompt pipelines** and don't want to do it in the code
612
+ - When you want to **orchestrate multiple prompts** together
613
+ - When you want to **reuse** parts of prompts in multiple places
614
+ - When you want to **version** your prompts and **test multiple versions**
615
+ - When you want to **log** the execution of prompts and backtrace the issues
616
+
617
+ ### ➖ When not to use
618
+
619
+ - When you are writing just a simple chatbot without any extra logic, just system messages
620
+
621
+ ## 🐜 Known issues
622
+
623
+
624
+
625
+ ## 🧼 Intentionally not implemented features
626
+
627
+
628
+
629
+ ## ❔ FAQ
630
+
631
+ If you have a question [start a discussion](https://github.com/webgptorg/promptbook/discussions/), [open an issue](https://github.com/webgptorg/promptbook/issues) or [write me an email](https://www.pavolhejny.com/contact).
632
+
633
+ ### Why not just use the OpenAI SDK / Anthropic Claude SDK / ...?
634
+
635
+ Different levels of abstraction. OpenAI library is for direct use of OpenAI API. This library is for a higher level of abstraction. It is for creating prompt templates and promptbooks that are independent of the underlying library, LLM model, or even LLM provider.
636
+
637
+ ### How is it different from the Langchain library?
638
+
639
+ Langchain is primarily aimed at ML developers working in Python. This library is for developers working in javascript/typescript and creating applications for end users.
640
+
641
+ We are considering creating a bridge/converter between these two libraries.
642
+
643
+
644
+
645
+ ### Promptbooks vs. OpenAI`s GPTs
646
+
647
+ GPTs are chat assistants that can be assigned to specific tasks and materials. But they are still chat assistants. Promptbooks are a way to orchestrate many more predefined tasks to have much tighter control over the process. Promptbooks are not a good technology for creating human-like chatbots, GPTs are not a good technology for creating outputs with specific requirements.
648
+
649
+
650
+
651
+
652
+
653
+
654
+
655
+
656
+
657
+
658
+
659
+
660
+
661
+
662
+
663
+ ### Where should I store my promptbooks?
664
+
665
+ If you use raw SDKs, you just put prompts in the sourcecode, mixed in with typescript, javascript, python or whatever programming language you use.
666
+
667
+ If you use promptbooks, you can store them in several places, each with its own advantages and disadvantages:
668
+
669
+ 1. As **source code**, typically git-committed. In this case you can use the versioning system and the promptbooks will be tightly coupled with the version of the application. You still get the power of promptbooks, as you separate the concerns of the prompt-engineer and the programmer.
670
+
671
+ 2. As data in a **database** In this case, promptbooks are like posts / articles on the blog. They can be modified independently of the application. You don't need to redeploy the application to change the promptbooks. You can have multiple versions of promptbooks for each user. You can have a web interface for non-programmers to create and modify promptbooks. But you lose the versioning system and you still have to consider the interface between the promptbooks and the application _(= input and output parameters)_.
672
+
673
+ 3. In a **configuration** in environment variables. This is a good way to store promptbooks if you have an application with multiple deployments and you want to have different but simple promptbooks for each deployment and you don't need to change them often.
674
+
675
+ ### What should I do when I need same promptbook in multiple human languages?
676
+
677
+ A single promptbook can be written for several _(human)_ languages at once. However, we recommend that you have separate promptbooks for each language.
678
+
679
+ In large language models, you will get better results if you have prompts in the same language as the user input.
680
+
681
+ The best way to manage this is to have suffixed promptbooks like `write-website-content.en.ptbk.md` and `write-website-content.cs.ptbk.md` for each supported language.
682
+
683
+
684
+
685
+
686
+
687
+ ## ⌚ Changelog
688
+
689
+ See [CHANGELOG.md](./CHANGELOG.md)
690
+
691
+ ## 📜 License
692
+
693
+ <p xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/"><a property="dct:title" rel="cc:attributionURL" href="https://github.com/webgptorg/promptbook">Promptbook</a> by <a rel="cc:attributionURL dct:creator" property="cc:attributionName" href="https://github.com/hejny/">Pavol Hejný</a> is licensed under <a href="https://creativecommons.org/licenses/by/4.0/?ref=chooser-v1" target="_blank" rel="license noopener noreferrer" style="display:inline-block;">CC BY 4.0</a></p>
694
+
695
+ ## 🎯 Todos
696
+
697
+ See [TODO.md](./TODO.md)
698
+
699
+
700
+
701
+
702
+ ## 🖋️ Contributing
703
+
704
+ I am open to pull requests, feedback, and suggestions. Or if you like this utility, you can [☕ buy me a coffee](https://www.buymeacoffee.com/hejny) or [donate via cryptocurrencies](https://github.com/hejny/hejny/blob/main/documents/crypto.md).
705
+
706
+ You can also ⭐ star the promptbook package, [follow me on GitHub](https://github.com/hejny) or [various other social networks](https://www.pavolhejny.com/contact/).