@promptbook/openai 0.70.0-1 → 0.71.0-12

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 (237) hide show
  1. package/README.md +87 -121
  2. package/esm/index.es.js +203 -16
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/promptbook-collection/index.d.ts +0 -3
  5. package/esm/typings/src/_packages/browser.index.d.ts +3 -1
  6. package/esm/typings/src/_packages/cli.index.d.ts +20 -0
  7. package/esm/typings/src/_packages/core.index.d.ts +45 -15
  8. package/esm/typings/src/_packages/documents.index.d.ts +8 -0
  9. package/esm/typings/src/_packages/legacy-documents.index.d.ts +8 -0
  10. package/esm/typings/src/_packages/markdown-utils.index.d.ts +6 -0
  11. package/esm/typings/src/_packages/node.index.d.ts +14 -6
  12. package/esm/typings/src/_packages/pdf.index.d.ts +8 -0
  13. package/esm/typings/src/_packages/types.index.d.ts +53 -25
  14. package/esm/typings/src/_packages/utils.index.d.ts +4 -4
  15. package/esm/typings/src/_packages/website-crawler.index.d.ts +8 -0
  16. package/esm/typings/src/cli/cli-commands/about.d.ts +1 -1
  17. package/esm/typings/src/cli/cli-commands/hello.d.ts +2 -1
  18. package/esm/typings/src/cli/cli-commands/make.d.ts +2 -2
  19. package/esm/typings/src/cli/cli-commands/prettify.d.ts +2 -1
  20. package/esm/typings/src/cli/cli-commands/test-command.d.ts +13 -0
  21. package/esm/typings/src/cli/main.d.ts +1 -1
  22. package/esm/typings/src/cli/promptbookCli.d.ts +1 -1
  23. package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +11 -6
  24. package/esm/typings/src/collection/constructors/createCollectionFromUrl.d.ts +1 -1
  25. package/esm/typings/src/commands/EXPECT/expectCommandParser.d.ts +1 -1
  26. package/esm/typings/src/commands/FOREACH/ForeachCommand.d.ts +3 -7
  27. package/esm/typings/src/commands/FOREACH/ForeachJson.d.ts +27 -0
  28. package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +2 -3
  29. package/esm/typings/src/commands/FORMAT/formatCommandParser.d.ts +1 -1
  30. package/esm/typings/src/commands/JOKER/jokerCommandParser.d.ts +1 -1
  31. package/esm/typings/src/commands/KNOWLEDGE/knowledgeCommandParser.d.ts +1 -1
  32. package/esm/typings/src/commands/KNOWLEDGE/utils/sourceContentToName.d.ts +11 -0
  33. package/esm/typings/src/commands/KNOWLEDGE/utils/sourceContentToName.test.d.ts +4 -0
  34. package/esm/typings/src/commands/MODEL/modelCommandParser.d.ts +1 -1
  35. package/esm/typings/src/commands/PARAMETER/parameterCommandParser.d.ts +1 -1
  36. package/esm/typings/src/commands/PERSONA/personaCommandParser.d.ts +1 -1
  37. package/esm/typings/src/commands/POSTPROCESS/postprocessCommandParser.d.ts +1 -1
  38. package/esm/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommandParser.d.ts +1 -1
  39. package/esm/typings/src/commands/TEMPLATE/templateCommandParser.d.ts +1 -1
  40. package/esm/typings/src/commands/URL/urlCommandParser.d.ts +1 -1
  41. package/esm/typings/src/commands/X_ACTION/actionCommandParser.d.ts +1 -1
  42. package/esm/typings/src/commands/X_INSTRUMENT/instrumentCommandParser.d.ts +1 -1
  43. package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -1
  44. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +4 -4
  45. package/esm/typings/src/config.d.ts +32 -3
  46. package/esm/typings/src/conversion/pipelineStringToJson.d.ts +4 -15
  47. package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +1 -1
  48. package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +3 -0
  49. package/esm/typings/src/conversion/utils/extractParameterNamesFromTemplate.d.ts +2 -1
  50. package/esm/typings/src/conversion/validation/_importPipeline.d.ts +1 -1
  51. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +10 -5
  52. package/esm/typings/src/{knowledge/dialogs → dialogs}/callback/CallbackInterfaceTools.d.ts +2 -2
  53. package/esm/typings/src/{knowledge/dialogs → dialogs}/callback/CallbackInterfaceToolsOptions.d.ts +3 -3
  54. package/esm/typings/src/{knowledge/dialogs → dialogs}/simple-prompt/SimplePromptInterfaceTools.d.ts +5 -5
  55. package/esm/typings/src/errors/AbstractFormatError.d.ts +11 -0
  56. package/esm/typings/src/errors/KnowledgeScrapeError.d.ts +9 -0
  57. package/esm/typings/src/errors/MissingToolsError.d.ts +9 -0
  58. package/esm/typings/src/execution/{CommonExecutionToolsOptions.d.ts → CommonToolsOptions.d.ts} +1 -1
  59. package/esm/typings/src/execution/ExecutionTools.d.ts +20 -8
  60. package/esm/typings/src/execution/PipelineExecutor.d.ts +1 -0
  61. package/esm/typings/src/execution/PipelineExecutorResult.d.ts +9 -8
  62. package/esm/typings/src/execution/createPipelineExecutor/$OngoingTemplateResult.d.ts +45 -0
  63. package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorOptions.d.ts +23 -0
  64. package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorSettings.d.ts +29 -0
  65. package/esm/typings/src/execution/createPipelineExecutor/00-createPipelineExecutor.d.ts +13 -0
  66. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +58 -0
  67. package/esm/typings/src/execution/createPipelineExecutor/20-executeTemplate.d.ts +60 -0
  68. package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +15 -0
  69. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +69 -0
  70. package/esm/typings/src/execution/createPipelineExecutor/filterJustOutputParameters.d.ts +34 -0
  71. package/esm/typings/src/execution/createPipelineExecutor/getContextForTemplate.d.ts +10 -0
  72. package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTemplate.d.ts +27 -0
  73. package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTemplate.d.ts +30 -0
  74. package/esm/typings/src/execution/createPipelineExecutor/getSamplesForTemplate.d.ts +10 -0
  75. package/esm/typings/src/execution/embeddingVectorToString.d.ts +1 -1
  76. package/esm/typings/src/execution/translation/automatic-translate/translateMessages.d.ts +3 -0
  77. package/esm/typings/src/execution/utils/$provideExecutionToolsForNode.d.ts +13 -0
  78. package/esm/typings/src/execution/utils/checkExpectations.d.ts +2 -0
  79. package/esm/typings/src/execution/utils/forEachAsync.d.ts +1 -0
  80. package/esm/typings/src/execution/utils/usageToHuman.d.ts +3 -4
  81. package/esm/typings/src/formats/_common/FormatDefinition.d.ts +14 -15
  82. package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +31 -0
  83. package/esm/typings/src/formats/csv/{ListFormatDefinition.d.ts → CsvFormatDefinition.d.ts} +6 -3
  84. package/esm/typings/src/formats/csv/CsvFormatError.d.ts +10 -0
  85. package/esm/typings/src/formats/csv/CsvSettings.d.ts +13 -0
  86. package/esm/typings/src/formats/index.d.ts +1 -1
  87. package/esm/typings/src/formats/json/JsonFormatDefinition.d.ts +4 -3
  88. package/esm/typings/src/formats/text/TextFormatDefinition.d.ts +19 -0
  89. package/esm/typings/src/formats/xml/XmlFormatDefinition.d.ts +4 -3
  90. package/esm/typings/src/llm-providers/_common/{$llmToolsMetadataRegister.d.ts → register/$llmToolsMetadataRegister.d.ts} +4 -1
  91. package/esm/typings/src/llm-providers/_common/{$llmToolsRegister.d.ts → register/$llmToolsRegister.d.ts} +5 -2
  92. package/esm/typings/src/llm-providers/_common/{createLlmToolsFromConfigurationFromEnv.d.ts → register/$provideLlmToolsConfigurationFromEnv.d.ts} +3 -3
  93. package/esm/typings/src/llm-providers/_common/{getLlmToolsForCli.d.ts → register/$provideLlmToolsForCli.d.ts} +4 -3
  94. package/esm/typings/src/llm-providers/_common/{getLlmToolsForTestingAndScriptsAndPlayground.d.ts → register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts} +4 -3
  95. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +27 -0
  96. package/esm/typings/src/llm-providers/_common/{$registeredLlmToolsMessage.d.ts → register/$registeredLlmToolsMessage.d.ts} +5 -2
  97. package/esm/typings/src/llm-providers/_common/{LlmToolsConfiguration.d.ts → register/LlmToolsConfiguration.d.ts} +5 -4
  98. package/esm/typings/src/llm-providers/_common/{LlmToolsMetadata.d.ts → register/LlmToolsMetadata.d.ts} +5 -4
  99. package/esm/typings/src/llm-providers/_common/{LlmToolsOptions.d.ts → register/LlmToolsOptions.d.ts} +4 -1
  100. package/esm/typings/src/llm-providers/_common/{createLlmToolsFromConfiguration.d.ts → register/createLlmToolsFromConfiguration.d.ts} +5 -4
  101. package/esm/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +1 -1
  102. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +2 -1
  103. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +3 -3
  104. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  105. package/esm/typings/src/llm-providers/anthropic-claude/createAnthropicClaudeExecutionTools.d.ts +2 -2
  106. package/esm/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +3 -2
  107. package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +4 -3
  108. package/esm/typings/src/llm-providers/anthropic-claude/register-constructor.d.ts +4 -3
  109. package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +8 -1
  110. package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +2 -2
  111. package/esm/typings/src/llm-providers/azure-openai/playground/playground.d.ts +1 -0
  112. package/esm/typings/src/llm-providers/azure-openai/register-configuration.d.ts +4 -3
  113. package/esm/typings/src/llm-providers/azure-openai/register-constructor.d.ts +4 -3
  114. package/esm/typings/src/llm-providers/langtail/playground/playground.d.ts +3 -0
  115. package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +2 -2
  116. package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +2 -2
  117. package/esm/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +1 -0
  118. package/esm/typings/src/llm-providers/multiple/playground/playground.d.ts +3 -0
  119. package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +2 -1
  120. package/esm/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +2 -2
  121. package/esm/typings/src/llm-providers/openai/playground/playground.d.ts +2 -1
  122. package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +4 -3
  123. package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +4 -3
  124. package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_ListModels_Request.d.ts +1 -1
  125. package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_Prompt_Request.d.ts +1 -1
  126. package/esm/typings/src/llm-providers/remote/interfaces/RemoteLlmExecutionToolsOptions.d.ts +3 -3
  127. package/esm/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +2 -2
  128. package/esm/typings/src/llm-providers/remote/playground/playground.d.ts +3 -0
  129. package/esm/typings/src/personas/preparePersona.d.ts +4 -3
  130. package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +68 -0
  131. package/esm/typings/src/prepare/isPipelinePrepared.d.ts +1 -1
  132. package/esm/typings/src/prepare/preparePipeline.d.ts +3 -2
  133. package/esm/typings/src/prepare/prepareTemplates.d.ts +4 -3
  134. package/esm/typings/src/scrapers/_common/Converter.d.ts +22 -0
  135. package/esm/typings/src/scrapers/_common/Scraper.d.ts +66 -0
  136. package/esm/typings/src/scrapers/_common/ScraperIntermediateSource.d.ts +11 -0
  137. package/esm/typings/src/{knowledge/prepare-knowledge → scrapers}/_common/prepareKnowledgePieces.d.ts +5 -4
  138. package/esm/typings/src/scrapers/_common/register/$provideScrapersForBrowser.d.ts +12 -0
  139. package/esm/typings/src/scrapers/_common/register/$provideScrapersForNode.d.ts +15 -0
  140. package/esm/typings/src/scrapers/_common/register/$registeredScrapersMessage.d.ts +12 -0
  141. package/esm/typings/src/scrapers/_common/register/$scrapersMetadataRegister.d.ts +13 -0
  142. package/esm/typings/src/scrapers/_common/register/$scrapersRegister.d.ts +13 -0
  143. package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +41 -0
  144. package/esm/typings/src/scrapers/_common/register/ScraperConstructor.d.ts +12 -0
  145. package/esm/typings/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +33 -0
  146. package/esm/typings/src/scrapers/_common/utils/getScraperIntermediateSource.test.d.ts +4 -0
  147. package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +13 -0
  148. package/esm/typings/src/scrapers/document/DocumentScraper.d.ts +43 -0
  149. package/esm/typings/src/scrapers/document/DocumentScraper.test.d.ts +4 -0
  150. package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +20 -0
  151. package/esm/typings/src/scrapers/document/playground/document-scraper-playground.d.ts +5 -0
  152. package/esm/typings/src/scrapers/document/register-constructor.d.ts +13 -0
  153. package/esm/typings/src/scrapers/document/register-metadata.d.ts +24 -0
  154. package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +43 -0
  155. package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.test.d.ts +4 -0
  156. package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +20 -0
  157. package/esm/typings/src/scrapers/document-legacy/playground/legacy-document-scraper-playground.d.ts +5 -0
  158. package/esm/typings/src/scrapers/document-legacy/register-constructor.d.ts +13 -0
  159. package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +24 -0
  160. package/esm/typings/src/scrapers/markdown/MarkdownScraper.d.ts +29 -0
  161. package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +20 -0
  162. package/esm/typings/src/scrapers/markdown/playground/markdown-scraper-playground.d.ts +5 -0
  163. package/esm/typings/src/scrapers/markdown/register-constructor.d.ts +13 -0
  164. package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +24 -0
  165. package/esm/typings/src/scrapers/pdf/PdfScraper.d.ts +40 -0
  166. package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +20 -0
  167. package/esm/typings/src/scrapers/pdf/playground/pdf-scraper-playground.d.ts +5 -0
  168. package/esm/typings/src/scrapers/pdf/register-constructor.d.ts +13 -0
  169. package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +24 -0
  170. package/esm/typings/src/scrapers/website/WebsiteScraper.d.ts +47 -0
  171. package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +20 -0
  172. package/esm/typings/src/scrapers/website/playground/website-scraper-playground.d.ts +5 -0
  173. package/esm/typings/src/scrapers/website/register-constructor.d.ts +13 -0
  174. package/esm/typings/src/scrapers/website/register-metadata.d.ts +24 -0
  175. package/esm/typings/src/scrapers/website/utils/markdownConverter.d.ts +12 -0
  176. package/esm/typings/src/scripting/javascript/JavascriptExecutionToolsOptions.d.ts +2 -2
  177. package/esm/typings/src/scripting/python/PythonExecutionTools.d.ts +2 -2
  178. package/esm/typings/src/scripting/typescript/TypescriptExecutionTools.d.ts +2 -2
  179. package/esm/typings/src/storage/{files-storage/FilesStorage.d.ts → file-cache-storage/FileCacheStorage.d.ts} +4 -4
  180. package/esm/typings/src/storage/file-cache-storage/FileCacheStorageOptions.d.ts +10 -0
  181. package/esm/typings/src/storage/{files-storage → file-cache-storage}/utils/nameToSubfolderPath.d.ts +1 -1
  182. package/esm/typings/src/storage/local-storage/getLocalStorage.d.ts +1 -1
  183. package/esm/typings/src/storage/local-storage/getSessionStorage.d.ts +1 -1
  184. package/esm/typings/src/storage/{utils → memory/utils}/PrefixStorage.d.ts +1 -1
  185. package/esm/typings/src/storage/{utils → memory/utils}/makePromptbookStorageFromWebStorage.d.ts +1 -1
  186. package/esm/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +9 -2
  187. package/esm/typings/src/types/PipelineJson/ParameterJson.d.ts +1 -0
  188. package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +3 -3
  189. package/esm/typings/src/types/PipelineJson/TemplateJsonCommon.d.ts +5 -0
  190. package/esm/typings/src/types/execution-report/executionReportJsonToString.d.ts +2 -1
  191. package/esm/typings/src/types/typeAliases.d.ts +16 -12
  192. package/esm/typings/src/utils/$Register.d.ts +19 -6
  193. package/esm/typings/src/utils/execCommand/$execCommand.d.ts +14 -0
  194. package/esm/typings/src/utils/execCommand/$execCommands.d.ts +17 -0
  195. package/esm/typings/src/utils/execCommand/IExecCommandOptions.d.ts +23 -0
  196. package/esm/typings/src/utils/execCommand/execCommandNormalizeOptions.d.ts +10 -0
  197. package/esm/typings/src/utils/expectation-counters/index.d.ts +3 -0
  198. package/esm/typings/src/utils/files/$isDirectoryExisting.d.ts +3 -3
  199. package/esm/typings/src/utils/files/$isFileExisting.d.ts +3 -3
  200. package/esm/typings/src/utils/files/$listAllFiles.d.ts +5 -4
  201. package/esm/typings/src/utils/files/extensionToMimeType.d.ts +8 -0
  202. package/esm/typings/src/utils/files/getFileExtension.d.ts +8 -0
  203. package/esm/typings/src/utils/files/getFileExtension.test.d.ts +1 -0
  204. package/esm/typings/src/utils/organization/{f.d.ts → empty_object.d.ts} +5 -1
  205. package/esm/typings/src/utils/organization/just_empty_object.d.ts +12 -0
  206. package/esm/typings/src/utils/{extractParameterNames.d.ts → parameters/extractParameterNames.d.ts} +2 -2
  207. package/esm/typings/src/utils/parameters/extractParameterNames.test.d.ts +1 -0
  208. package/esm/typings/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +27 -0
  209. package/esm/typings/src/utils/parameters/mapAvailableToExpectedParameters.test.d.ts +1 -0
  210. package/esm/typings/src/utils/{replaceParameters.d.ts → parameters/replaceParameters.d.ts} +2 -2
  211. package/esm/typings/src/utils/parameters/replaceParameters.test.d.ts +1 -0
  212. package/esm/typings/src/utils/serialization/checkSerializableAsJson.d.ts +1 -1
  213. package/esm/typings/src/utils/serialization/isSerializableAsJson.d.ts +1 -1
  214. package/esm/typings/src/utils/validators/filePath/isValidFilePath.d.ts +2 -2
  215. package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +10 -0
  216. package/esm/typings/src/utils/validators/parameterName/validateParameterName.test.d.ts +1 -0
  217. package/package.json +17 -13
  218. package/umd/index.umd.js +203 -16
  219. package/umd/index.umd.js.map +1 -1
  220. package/esm/typings/src/execution/createPipelineExecutor.d.ts +0 -72
  221. package/esm/typings/src/formats/list/ListFormatDefinition.d.ts +0 -16
  222. package/esm/typings/src/knowledge/prepare-knowledge/_common/Scraper.d.ts +0 -37
  223. package/esm/typings/src/knowledge/prepare-knowledge/markdown/playground/markdown-knowledge-playground.d.ts +0 -2
  224. package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +0 -14
  225. package/esm/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +0 -15
  226. package/esm/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +0 -25
  227. package/esm/typings/src/prepare/PrepareOptions.d.ts +0 -22
  228. package/esm/typings/src/storage/files-storage/FilesStorageOptions.d.ts +0 -10
  229. /package/esm/typings/src/{knowledge/dialogs → dialogs}/user-interface-execution-tools.test.d.ts +0 -0
  230. /package/esm/typings/src/{knowledge/prepare-knowledge → scrapers}/_common/prepareKnowledgePieces.test.d.ts +0 -0
  231. /package/esm/typings/src/{knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.test.d.ts → scrapers/markdown/MarkdownScraper.test.d.ts} +0 -0
  232. /package/esm/typings/src/{execution/utils/usageToHuman.test.d.ts → scrapers/website/WebsiteScraper.test.d.ts} +0 -0
  233. /package/esm/typings/src/{knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.test.d.ts → scrapers/website/utils/markdownConverter.test.d.ts} +0 -0
  234. /package/esm/typings/src/storage/{files-storage → file-cache-storage}/utils/nameToSubfolderPath.test.d.ts +0 -0
  235. /package/esm/typings/src/{personas/preparePersona.test.d.ts → utils/execCommand/execCommand.test.d.ts} +0 -0
  236. /package/esm/typings/src/utils/{extractParameterNames.test.d.ts → execCommand/execCommandNormalizeOptions.test.d.ts} +0 -0
  237. /package/esm/typings/src/utils/{replaceParameters.test.d.ts → files/extensionToMimeType.test.d.ts} +0 -0
package/README.md CHANGED
@@ -16,6 +16,16 @@ Supercharge your use of large language models
16
16
 
17
17
 
18
18
 
19
+ ## ✨ New Features
20
+
21
+ - ✨ **Support of [OpenAI o1 model](https://openai.com/o1/)**
22
+
23
+ <blockquote style="color: #ff8811">
24
+ <b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
25
+ </blockquote>
26
+
27
+
28
+
19
29
  ## 📦 Package `@promptbook/openai`
20
30
 
21
31
  - Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
@@ -28,7 +38,7 @@ To install this package, run:
28
38
  npm i ptbk
29
39
 
30
40
  # Install just this package to save space
31
- npm i @promptbook/openai
41
+ npm install @promptbook/openai
32
42
  ```
33
43
 
34
44
  `@promptbook/openai` integrates [OpenAI's API](https://openai.com/) with [Promptbook](https://github.com/webgptorg/promptbook). It allows to execute Promptbooks with OpenAI GPT models.
@@ -38,30 +48,30 @@ npm i @promptbook/openai
38
48
  ```typescript
39
49
  import { createPipelineExecutor, assertsExecutionSuccessful } from '@promptbook/core';
40
50
  import { createCollectionFromDirectory } from '@promptbook/node';
51
+ import { $provideExecutionToolsForNode } from '@promptbook/node';
41
52
  import { JavascriptExecutionTools } from '@promptbook/execute-javascript';
42
53
  import { OpenAiExecutionTools } from '@promptbook/openai';
43
54
 
55
+ // ▶ Prepare tools
56
+ const llm = new OpenAiExecutionTools(
57
+ // <- TODO: [🧱] Implement in a functional (not new Class) way
58
+ {
59
+ isVerbose: true,
60
+ apiKey: process.env.OPENAI_API_KEY,
61
+ },
62
+ );
63
+ const tools = {
64
+ llm,
65
+ scrapers: await $provideScrapersForNode({ llm }),
66
+ script: [new JavascriptExecutionTools()],
67
+ };
68
+
44
69
  // ▶ Create whole pipeline collection
45
- const collection = await createCollectionFromDirectory('./promptbook-collection');
70
+ const collection = await createCollectionFromDirectory('./promptbook-collection', tools);
46
71
 
47
72
  // ▶ Get single Pipeline
48
73
  const pipeline = await collection.getPipelineByUrl(`https://promptbook.studio/my-collection/write-article.ptbk.md`);
49
74
 
50
- // ▶ Prepare tools
51
- const tools = {
52
- llm: new OpenAiExecutionTools(
53
- // <- TODO: [🧱] Implement in a functional (not new Class) way
54
- {
55
- isVerbose: true,
56
- apiKey: process.env.OPENAI_API_KEY,
57
- },
58
- ),
59
- script: [
60
- new JavascriptExecutionTools(),
61
- // <- TODO: [🧱] Implement in a functional (not new Class) way
62
- ],
63
- };
64
-
65
75
  // ▶ Create executor - the function that will execute the Pipeline
66
76
  const pipelineExecutor = createPipelineExecutor({ pipeline, tools });
67
77
 
@@ -81,29 +91,22 @@ console.info(outputParameters);
81
91
 
82
92
  ## 🧙‍♂️ Connect to LLM providers automatically
83
93
 
84
- You can just use `createLlmToolsFromEnv` function to create LLM tools from environment variables like `OPENAI_API_KEY` and `ANTHROPIC_CLAUDE_API_KEY` automatically.
94
+ You can just use `$provideExecutionToolsForNode` function to create all required tools from environment variables like `OPENAI_API_KEY` and `ANTHROPIC_CLAUDE_API_KEY` automatically.
85
95
 
86
96
  ```typescript
87
97
  import { createPipelineExecutor, createCollectionFromDirectory, assertsExecutionSuccessful } from '@promptbook/core';
88
98
  import { JavascriptExecutionTools } from '@promptbook/execute-javascript';
89
- import { createLlmToolsFromEnv } from '@promptbook/node';
99
+ import { $provideExecutionToolsForNode } from '@promptbook/node';
100
+
101
+ // ▶ Prepare tools
102
+ const tools = await $provideExecutionToolsForNode();
90
103
 
91
104
  // ▶ Create whole pipeline collection
92
- const collection = await createCollectionFromDirectory('./promptbook-collection');
105
+ const collection = await createCollectionFromDirectory('./promptbook-collection', tools);
93
106
 
94
107
  // ▶ Get single Pipeline
95
108
  const pipeline = await collection.getPipelineByUrl(`https://promptbook.studio/my-collection/write-article.ptbk.md`);
96
109
 
97
- // ▶ Prepare multiple tools
98
- const tools = {
99
- // Note: 🧙‍♂️ Just call `createLlmToolsFromEnv` to automatically connect to all configured providers
100
- llm: createLlmToolsFromEnv(),
101
- script: [
102
- new JavascriptExecutionTools(),
103
- // <- TODO: [🧱] Implement in a functional (not new Class) way
104
- ],
105
- };
106
-
107
110
  // ▶ Create executor - the function that will execute the Pipeline
108
111
  const pipelineExecutor = createPipelineExecutor({ pipeline, tools });
109
112
 
@@ -128,49 +131,49 @@ You can use multiple LLM providers in one Promptbook execution. The best model w
128
131
  ```typescript
129
132
  import { createPipelineExecutor, assertsExecutionSuccessful } from '@promptbook/core';
130
133
  import { createCollectionFromDirectory } from '@promptbook/node';
134
+ import { $provideExecutionToolsForNode } from '@promptbook/node';
131
135
  import { JavascriptExecutionTools } from '@promptbook/execute-javascript';
132
136
  import { OpenAiExecutionTools } from '@promptbook/openai';
133
137
  import { AnthropicClaudeExecutionTools } from '@promptbook/anthropic-claude';
134
138
  import { AzureOpenAiExecutionTools } from '@promptbook/azure-openai';
135
139
 
140
+ // ▶ Prepare multiple tools
141
+ const llm = [
142
+ // Note: You can use multiple LLM providers in one Promptbook execution.
143
+ // The best model will be chosen automatically according to the prompt and the model's capabilities.
144
+ new OpenAiExecutionTools(
145
+ // <- TODO: [🧱] Implement in a functional (not new Class) way
146
+ {
147
+ apiKey: process.env.OPENAI_API_KEY,
148
+ },
149
+ ),
150
+ new AnthropicClaudeExecutionTools(
151
+ // <- TODO: [🧱] Implement in a functional (not new Class) way
152
+ {
153
+ apiKey: process.env.ANTHROPIC_CLAUDE_API_KEY,
154
+ },
155
+ ),
156
+ new AzureOpenAiExecutionTools(
157
+ // <- TODO: [🧱] Implement in a functional (not new Class) way
158
+ {
159
+ resourceName: process.env.AZUREOPENAI_RESOURCE_NAME,
160
+ deploymentName: process.env.AZUREOPENAI_DEPLOYMENT_NAME,
161
+ apiKey: process.env.AZUREOPENAI_API_KEY,
162
+ },
163
+ ),
164
+ ];
165
+ const tools = {
166
+ llm,
167
+ scrapers: await $provideScrapersForNode({ llm }),
168
+ script: [new JavascriptExecutionTools()],
169
+ };
170
+
136
171
  // ▶ Create whole pipeline collection
137
- const collection = await createCollectionFromDirectory('./promptbook-collection');
172
+ const collection = await createCollectionFromDirectory('./promptbook-collection', tools);
138
173
 
139
174
  // ▶ Get single Pipeline
140
175
  const pipeline = await collection.getPipelineByUrl(`https://promptbook.studio/my-collection/write-article.ptbk.md`);
141
176
 
142
- // ▶ Prepare multiple tools
143
- const tools = {
144
- llm: [
145
- // Note: You can use multiple LLM providers in one Promptbook execution.
146
- // The best model will be chosen automatically according to the prompt and the model's capabilities.
147
- new OpenAiExecutionTools(
148
- // <- TODO: [🧱] Implement in a functional (not new Class) way
149
- {
150
- apiKey: process.env.OPENAI_API_KEY,
151
- },
152
- ),
153
- new AnthropicClaudeExecutionTools(
154
- // <- TODO: [🧱] Implement in a functional (not new Class) way
155
- {
156
- apiKey: process.env.ANTHROPIC_CLAUDE_API_KEY,
157
- },
158
- ),
159
- new AzureOpenAiExecutionTools(
160
- // <- TODO: [🧱] Implement in a functional (not new Class) way
161
- {
162
- resourceName: process.env.AZUREOPENAI_RESOURCE_NAME,
163
- deploymentName: process.env.AZUREOPENAI_DEPLOYMENT_NAME,
164
- apiKey: process.env.AZUREOPENAI_API_KEY,
165
- },
166
- ),
167
- ],
168
- script: [
169
- new JavascriptExecutionTools(),
170
- // <- TODO: [🧱] Implement in a functional (not new Class) way
171
- ],
172
- };
173
-
174
177
  // ▶ Create executor - the function that will execute the Pipeline
175
178
  const pipelineExecutor = createPipelineExecutor({ pipeline, tools });
176
179
 
@@ -204,13 +207,15 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
204
207
 
205
208
  ## 🤍 The Promptbook Whitepaper
206
209
 
210
+
211
+
207
212
  If you have a simple, single prompt for ChatGPT, GPT-4, Anthropic Claude, Google Gemini, Llama 2, or whatever, it doesn't matter how you integrate it. Whether it's calling a REST API directly, using the SDK, hardcoding the prompt into the source code, or importing a text file, the process remains the same.
208
213
 
209
214
  But often you will struggle with the limitations of LLMs, such as hallucinations, off-topic responses, poor quality output, language drift, word repetition repetition repetition repetition or misuse, lack of context, or just plain w𝒆𝐢rd responses. When this happens, you generally have three options:
210
215
 
211
216
  1. **Fine-tune** the model to your specifications or even train your own.
212
217
  2. **Prompt-engineer** the prompt to the best shape you can achieve.
213
- 3. Use **multiple prompts** in a [pipeline](https://github.com/webgptorg/promptbook/discussions/64) to get the best result.
218
+ 3. Orchestrate **multiple prompts** in a [pipeline](https://github.com/webgptorg/promptbook/discussions/64) to get the best result.
214
219
 
215
220
  In all of these situations, but especially in 3., the Promptbook library can make your life easier.
216
221
 
@@ -222,7 +227,9 @@ In all of these situations, but especially in 3., the Promptbook library can mak
222
227
  - Promptbook has built in versioning. You can test multiple **A/B versions** of pipelines and see which one works best.
223
228
  - Promptbook is designed to do [**RAG** (Retrieval-Augmented Generation)](https://github.com/webgptorg/promptbook/discussions/41) and other advanced techniques. You can use **knowledge** to improve the quality of the output.
224
229
 
225
- ## 🧔 Promptbook _(for prompt-engeneers)_
230
+
231
+
232
+ ## 🧔 Pipeline _(for prompt-engeneers)_
226
233
 
227
234
  **P**romp**t** **b**oo**k** markdown file (or `.ptbk.md` file) is document that describes a **pipeline** - a series of prompts that are chained together to form somewhat reciepe for transforming natural language input.
228
235
 
@@ -244,7 +251,6 @@ File `write-website-content.ptbk.md`:
244
251
  > Instructions for creating web page content.
245
252
  >
246
253
  > - PIPELINE URL https://promptbook.studio/webgpt/write-website-content.ptbk.md
247
- > - PROMPTBOOK VERSION 0.0.1
248
254
  > - INPUT  PARAM `{rawTitle}` Automatically suggested a site name or empty text
249
255
  > - INPUT  PARAM `{rawAssigment}` Automatically generated site entry from image recognition
250
256
  > - OUTPUT PARAM `{websiteContent}` Web content
@@ -483,6 +489,10 @@ Or you can install them separately:
483
489
  - **[@promptbook/fake-llm](https://www.npmjs.com/package/@promptbook/fake-llm)** - Mocked execution tools for testing the library and saving the tokens
484
490
  - **[@promptbook/remote-client](https://www.npmjs.com/package/@promptbook/remote-client)** - Remote client for remote execution of promptbooks
485
491
  - **[@promptbook/remote-server](https://www.npmjs.com/package/@promptbook/remote-server)** - Remote server for remote execution of promptbooks
492
+ - **[@promptbook/pdf](https://www.npmjs.com/package/@promptbook/pdf)** - Read knowledge from `.pdf` documents
493
+ - **[@promptbook/documents](https://www.npmjs.com/package/@promptbook/documents)** - Read knowledge from documents like `.docx`, `.odt`,…
494
+ - **[@promptbook/legacy-documents](https://www.npmjs.com/package/@promptbook/legacy-documents)** - Read knowledge from legacy documents like `.doc`, `.rtf`,…
495
+ - **[@promptbook/website-crawler](https://www.npmjs.com/package/@promptbook/website-crawler)** - Crawl knowledge from the web
486
496
  - **[@promptbook/types](https://www.npmjs.com/package/@promptbook/types)** - Just typescript types used in the library
487
497
  - **[@promptbook/cli](https://www.npmjs.com/package/@promptbook/cli)** - Command line interface utilities for promptbooks
488
498
 
@@ -539,6 +549,8 @@ The following glossary is used to clarify certain concepts:
539
549
  - When you want to **version** your prompts and **test multiple versions**
540
550
  - When you want to **log** the execution of prompts and backtrace the issues
541
551
 
552
+ [See more](https://github.com/webgptorg/promptbook/discussions/111)
553
+
542
554
  ### ➖ When not to use
543
555
 
544
556
  - When you have already implemented single simple prompt and it works fine for your job
@@ -548,6 +560,8 @@ The following glossary is used to clarify certain concepts:
548
560
  - When your main focus is on something other than text - like images, audio, video, spreadsheets _(other media types may be added in the future, [see discussion](https://github.com/webgptorg/promptbook/discussions/103))_
549
561
  - When you need to use recursion _([see the discussion](https://github.com/webgptorg/promptbook/discussions/38))_
550
562
 
563
+ [See more](https://github.com/webgptorg/promptbook/discussions/112)
564
+
551
565
  ## 🐜 Known issues
552
566
 
553
567
  - [🤸‍♂️ Iterations not working yet](https://github.com/webgptorg/promptbook/discussions/55)
@@ -560,63 +574,15 @@ The following glossary is used to clarify certain concepts:
560
574
 
561
575
  ## ❔ FAQ
562
576
 
563
-
564
-
565
577
  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).
566
578
 
567
- ### Why not just use the OpenAI SDK / Anthropic Claude SDK / ...?
568
-
569
- Different levels of abstraction. OpenAI library is for direct use of OpenAI API. This library is for a higher level of abstraction. It define pipelines that are independent of the underlying library, LLM model, or even LLM provider.
570
-
571
- ### How is it different from the Langchain library?
572
-
573
- 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.
574
-
575
- We are considering creating a bridge/converter between these two libraries.
576
-
577
-
578
-
579
- ### Promptbooks vs. OpenAI`s GPTs
580
-
581
- 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.
582
-
583
-
584
-
585
-
586
-
587
-
588
-
589
-
590
-
591
-
592
-
593
-
594
-
595
-
596
-
597
- ### Where should I store my promptbooks?
598
-
599
- If you use raw SDKs, you just put prompts in the sourcecode, mixed in with typescript, javascript, python or whatever programming language you use.
600
-
601
- If you use promptbooks, you can store them in several places, each with its own advantages and disadvantages:
602
-
603
- 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.
604
-
605
- 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)_.
606
-
607
- 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.
608
-
609
- ### What should I do when I need same promptbook in multiple human languages?
610
-
611
- A single promptbook can be written for several _(human)_ languages at once. However, we recommend that you have separate promptbooks for each language.
612
-
613
- In large language models, you will get better results if you have prompts in the same language as the user input.
614
-
615
- 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.
616
-
617
-
618
-
619
-
579
+ - [❔ Why not just use the OpenAI SDK / Anthropic Claude SDK / ...?](https://github.com/webgptorg/promptbook/discussions/114)
580
+ - [❔ How is it different from the OpenAI`s GPTs?](https://github.com/webgptorg/promptbook/discussions/118)
581
+ - [❔ How is it different from the Langchain?](https://github.com/webgptorg/promptbook/discussions/115)
582
+ - [❔ How is it different from the DSPy?](https://github.com/webgptorg/promptbook/discussions/117)
583
+ - [❔ How is it different from _anything_?](https://github.com/webgptorg/promptbook/discussions?discussions_q=is%3Aopen+label%3A%22Promptbook+vs%22)
584
+ - [❔ Is Promptbook using RAG _(Retrieval-Augmented Generation)_?](https://github.com/webgptorg/promptbook/discussions/123)
585
+ - [❔ Is Promptbook using function calling?](https://github.com/webgptorg/promptbook/discussions/124)
620
586
 
621
587
  ## ⌚ Changelog
622
588