@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
@@ -11,11 +11,18 @@ import type { string_name } from '../typeAliases';
11
11
  */
12
12
  export type KnowledgeSourceJson = {
13
13
  /**
14
- * @@@
14
+ * Unique identifier of the knowledge source
15
15
  */
16
16
  readonly name: string_name;
17
17
  /**
18
- * @@@
18
+ * Source of one knowledge
19
+ *
20
+ * It can be a link, a relative path to file or direct text or combination of those
21
+ *
22
+ * For example `"https://pavolhejny.com/"`
23
+ * For example `"./pavol-hejny-cv.pdf"`
24
+ * For example `"Pavol Hejný has web https://pavolhejny.com/"`
25
+ * For example `"Pavol Hejný is web developer and creator of Promptbook and Collboard"`
19
26
  */
20
27
  readonly sourceContent: string_knowledge_source_content;
21
28
  };
@@ -33,6 +33,7 @@ export type ParameterJson = {
33
33
  readonly sampleValues?: Array<string_parameter_value>;
34
34
  };
35
35
  /**
36
+ * TODO: [🧠] Should be here registered subparameters from foreach or not?
36
37
  * TODO: [♈] Probbably move expectations from templates to parameters
37
38
  * TODO: [🍙] Make some standard order of json properties
38
39
  */
@@ -1,5 +1,5 @@
1
1
  import type { ModelRequirements } from '../ModelRequirements';
2
- import type { string_file_path } from '../typeAliases';
2
+ import type { string_filename } from '../typeAliases';
3
3
  import type { string_markdown_text } from '../typeAliases';
4
4
  import type { string_pipeline_url } from '../typeAliases';
5
5
  import type { string_semantic_version } from '../typeAliases';
@@ -33,7 +33,7 @@ export type PipelineJson = {
33
33
  /**
34
34
  * Internal helper for tracking the source `.ptbk.md` file of the pipeline
35
35
  */
36
- readonly sourceFile?: string_file_path;
36
+ readonly sourceFile?: string_filename;
37
37
  /**
38
38
  * Title of the promptbook
39
39
  * -It can use simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
@@ -42,7 +42,7 @@ export type PipelineJson = {
42
42
  /**
43
43
  * Version of the .ptbk.json file
44
44
  */
45
- readonly promptbookVersion: string_semantic_version;
45
+ readonly promptbookVersion?: string_semantic_version;
46
46
  /**
47
47
  * Description of the promptbook
48
48
  * It can use multiple paragraphs of simple markdown formatting like **bold**, *italic*, [link](https://example.com), ... BUT not code blocks and structure
@@ -1,3 +1,4 @@
1
+ import type { ForeachJson } from '../../commands/FOREACH/ForeachJson';
1
2
  import type { FormatCommand } from '../../commands/FORMAT/FormatCommand';
2
3
  import type { TemplateType } from '../../commands/TEMPLATE/TemplateTypes';
3
4
  import type { string_javascript } from '../typeAliases';
@@ -42,6 +43,10 @@ export interface TemplateJsonCommon {
42
43
  * @see https://github.com/webgptorg/promptbook/discussions/66
43
44
  */
44
45
  readonly jokerParameterNames?: Array<string_parameter_name>;
46
+ /**
47
+ * @@@
48
+ */
49
+ readonly foreach?: ForeachJson;
45
50
  /**
46
51
  * Type of the execution
47
52
  * This determines if the template is send to LLM, user or some scripting evaluation
@@ -1,3 +1,4 @@
1
+ import type { ReadonlyDeep } from 'type-fest';
1
2
  import type { ExecutionReportJson } from './ExecutionReportJson';
2
3
  import type { ExecutionReportString } from './ExecutionReportString';
3
4
  import type { ExecutionReportStringOptions } from './ExecutionReportStringOptions';
@@ -6,7 +7,7 @@ import type { ExecutionReportStringOptions } from './ExecutionReportStringOption
6
7
  *
7
8
  * @public exported from `@promptbook/core`
8
9
  */
9
- export declare function executionReportJsonToString(executionReportJson: ExecutionReportJson, options?: Partial<ExecutionReportStringOptions>): ExecutionReportString;
10
+ export declare function executionReportJsonToString(executionReportJson: ReadonlyDeep<ExecutionReportJson>, options?: Partial<ExecutionReportStringOptions>): ExecutionReportString;
10
11
  /**
11
12
  * TODO: Add mermaid chart for every report
12
13
  * TODO: [🧠] Allow to filter out some parts of the report by options
@@ -156,7 +156,7 @@ export type string_knowledge_source_content = string_knowledge_source_link | str
156
156
  *
157
157
  * @@@ string_knowledge_source vs string_knowledge_source_link
158
158
  */
159
- export type string_knowledge_source_link = string_url | string_file_path;
159
+ export type string_knowledge_source_link = string_url | string_filename;
160
160
  /**
161
161
  * Semantic helper
162
162
  *
@@ -331,6 +331,13 @@ export type string_href = string;
331
331
  * For example `"https://collboard.com/9SeSQTupmQHwuSrLi.png?width=1200&height=630"`
332
332
  */
333
333
  export type string_url_image = string;
334
+ /**
335
+ * Semantic helper
336
+ *
337
+ * For example `"C:/Users/me/AppData/Local/Pandoc/pandoc.exe"`
338
+ * For example `"C:/Program Files/LibreOffice/program/swriter.exe"`
339
+ */
340
+ export type string_executable_path = string;
334
341
  /**
335
342
  * Semantic helper
336
343
  *
@@ -386,6 +393,7 @@ export type string_emails = string;
386
393
  * - `isValidUuid to check validity
387
394
  *
388
395
  * For example `"5a0a153d-7be9-4018-9eda-e0e2e2b89bd9"`
396
+ * TODO: [🥬] Make some system for hashes and ids of promptbook
389
397
  */
390
398
  export type string_uuid = string & {
391
399
  readonly _type: 'uuid';
@@ -423,37 +431,33 @@ export type string_file_extension = string;
423
431
  *
424
432
  * For example `"C:/Users/me/work/collboard/modules-sdk/src/colldev/commands/develop/ColldevDevelop.tsx"`
425
433
  */
426
- export type string_file_absolute_path = string;
434
+ export type string_absolute_filename = string;
427
435
  /**
428
436
  * Semantic helper
429
437
  *
430
438
  * For example `"./src/colldev/commands/develop/ColldevDevelop.tsx"`
431
439
  */
432
- export type string_file_relative_path = string;
440
+ export type string_relative_filename = string;
433
441
  /**
434
442
  * Semantic helper
435
443
  */
436
- export type string_file_path = string_file_absolute_path | string_file_relative_path;
444
+ export type string_filename = string_absolute_filename | string_relative_filename;
437
445
  /**
438
446
  * Semantic helper
439
447
  *
440
448
  * For example `"C:/Users/me/work/collboard/modules-sdk/src/colldev/commands/develop/ColldevDevelop.tsx"`
441
449
  */
442
- export type string_folder_absolute_path = string;
450
+ export type string_absolute_dirname = string;
443
451
  /**
444
452
  * Semantic helper
445
453
  *
446
454
  * For example `"./src/colldev/commands/develop/ColldevDevelop.tsx"`
447
455
  */
448
- export type string_folder_relative_path = string;
449
- /**
450
- * Semantic helper
451
- */
452
- export type string_folder_path = string_file_absolute_path | string_file_relative_path;
456
+ export type string_relative_dirname = string;
453
457
  /**
454
458
  * Semantic helper
455
459
  */
456
- export type string_filename = string;
460
+ export type string_dirname = string_absolute_dirname | string_relative_dirname;
457
461
  /**
458
462
  * Semantic helper
459
463
  *
@@ -592,7 +596,7 @@ export type number_megabytes = number_positive;
592
596
  export type number_gigabytes = number_positive;
593
597
  export type number_terabytes = number_positive;
594
598
  /**.
595
- * TODO: !!! Change "For example" to @example
599
+ * TODO: [main] !!! Change "For example" to @example
596
600
  * TODO: !! Change to branded types
597
601
  * TODO: Delete type aliases that are not exported or used internally
598
602
  */
@@ -1,14 +1,27 @@
1
- import type { string_javascript_name } from '../types/typeAliases';
1
+ import { type IDestroyable } from 'destroyable';
2
+ import type { string_name } from '../types/typeAliases';
2
3
  import type { TODO_string } from './organization/TODO_string';
4
+ /**
5
+ * @@@
6
+ */
3
7
  export type Registered = {
4
8
  /**
5
9
  * @@@
6
10
  */
7
- packageName: TODO_string;
11
+ readonly packageName: TODO_string;
12
+ /**
13
+ * @@@
14
+ */
15
+ readonly className: TODO_string;
16
+ };
17
+ /**
18
+ * @@@
19
+ */
20
+ export type Registration = Registered & IDestroyable & {
8
21
  /**
9
22
  * @@@
10
23
  */
11
- className: TODO_string;
24
+ readonly registerName: string_name;
12
25
  };
13
26
  /**
14
27
  * Register is @@@
@@ -18,9 +31,9 @@ export type Registered = {
18
31
  * @private internal utility, exported are only signleton instances of this class
19
32
  */
20
33
  export declare class $Register<TRegistered extends Registered> {
21
- private readonly storageName;
34
+ private readonly registerName;
22
35
  private readonly storage;
23
- constructor(storageName: string_javascript_name);
36
+ constructor(registerName: string_name);
24
37
  list(): Array<TRegistered>;
25
- register(registered: TRegistered): void;
38
+ register(registered: TRegistered): Registration;
26
39
  }
@@ -0,0 +1,14 @@
1
+ import type { IExecCommandOptions } from './IExecCommandOptions';
2
+ /**
3
+ * Run one command in a shell
4
+ *
5
+ * Note: There are 2 similar functions in the codebase:
6
+ * - `$execCommand` which runs a single command
7
+ * - `$execCommands` which runs multiple commands
8
+ *
9
+ * @public exported from `@promptbook/node`
10
+ */
11
+ export declare function $execCommand(options: IExecCommandOptions): Promise<string>;
12
+ /**
13
+ * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
14
+ */
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Run multiple commands in a shell in sequence
3
+ *
4
+ * Note: There are 2 similar functions in the codebase:
5
+ * - `$execCommand` which runs a single command
6
+ * - `$execCommands` which runs multiple commands
7
+ *
8
+ * @public exported from `@promptbook/node`
9
+ */
10
+ export declare function $execCommands({ commands, cwd, crashOnError, }: {
11
+ readonly commands: string[];
12
+ readonly cwd: string;
13
+ readonly crashOnError?: boolean;
14
+ }): Promise<void>;
15
+ /**
16
+ * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
17
+ */
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @deprecated Use sth from type-fest or move this to type helpers
3
+ */
4
+ type RequiredAndOptional<TBase, TRequired extends keyof TBase, TOptional extends keyof TBase> = Pick<TBase, TRequired> & Partial<Pick<TBase, TOptional>>;
5
+ /**
6
+ * Simple options for `execCommand`
7
+ *
8
+ * TODO: !!!!!! Rename - remove I prefix
9
+ */
10
+ export type IExecCommandOptions = string | RequiredAndOptional<IExecCommandOptionsAdvanced, 'command', 'args' | 'cwd' | 'crashOnError' | 'timeout'>;
11
+ /**
12
+ * Advanced options for `execCommand`
13
+ *
14
+ * TODO: !!!!!! Rename - remove I prefix
15
+ */
16
+ export type IExecCommandOptionsAdvanced = {
17
+ readonly command: string;
18
+ readonly args: string[];
19
+ readonly cwd: string;
20
+ readonly crashOnError: boolean;
21
+ readonly timeout: number;
22
+ };
23
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { IExecCommandOptions } from './IExecCommandOptions';
2
+ import type { IExecCommandOptionsAdvanced } from './IExecCommandOptions';
3
+ /**
4
+ * Normalize options for `execCommand` and `execCommands`
5
+ *
6
+ * @private internal utility of `execCommand` and `execCommands`
7
+ */
8
+ export declare function execCommandNormalizeOptions(options: IExecCommandOptions): Pick<IExecCommandOptionsAdvanced, 'command' | 'args' | 'cwd' | 'crashOnError' | 'timeout'> & {
9
+ humanReadableCommand: string;
10
+ };
@@ -6,3 +6,6 @@ import type { ExpectationUnit } from '../../types/PipelineJson/Expectations';
6
6
  * @public exported from `@promptbook/utils`
7
7
  */
8
8
  export declare const CountUtils: Record<ExpectationUnit, (text: string) => ExpectationAmount>;
9
+ /**
10
+ * TODO: [🧠][🤠] This should be probbably as part of `TextFormatDefinition`
11
+ */
@@ -1,4 +1,4 @@
1
- import type { string_folder_path } from '../../types/typeAliases';
1
+ import type { string_dirname } from '../../types/typeAliases';
2
2
  /**
3
3
  * Checks if the directory exists
4
4
  *
@@ -6,9 +6,9 @@ import type { string_folder_path } from '../../types/typeAliases';
6
6
  *
7
7
  * @private within the repository
8
8
  */
9
- export declare function $isDirectoryExisting(directoryPath: string_folder_path): Promise<boolean>;
9
+ export declare function $isDirectoryExisting(directoryPath: string_dirname): Promise<boolean>;
10
10
  /**
11
- * Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
11
+ * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
12
12
  * TODO: [🐠] This can be a validator - with variants that return true/false and variants that throw errors with meaningless messages
13
13
  * TODO: [🧠][📂] "directory" vs "folder"
14
14
  * TODO: [🖇] What about symlinks?
@@ -1,4 +1,4 @@
1
- import type { string_file_path } from '../../types/typeAliases';
1
+ import type { string_filename } from '../../types/typeAliases';
2
2
  /**
3
3
  * Checks if the file exists
4
4
  *
@@ -6,9 +6,9 @@ import type { string_file_path } from '../../types/typeAliases';
6
6
  *
7
7
  * @private within the repository
8
8
  */
9
- export declare function $isFileExisting(filePath: string_file_path): Promise<boolean>;
9
+ export declare function $isFileExisting(filename: string_filename): Promise<boolean>;
10
10
  /**
11
- * Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
11
+ * Note: [🟢 !!!!!! After fix makeKnowledgeSourceHandler] Code in this file should never be published outside of `@promptbook/node` and `@promptbook/cli`
12
12
  * TODO: [🐠] This can be a validator - with variants that return true/false and variants that throw errors with meaningless messages
13
13
  * TODO: [🖇] What about symlinks?
14
14
  */
@@ -1,5 +1,5 @@
1
- import type { string_file_path } from '../../types/typeAliases';
2
- import type { string_folder_path } from '../../types/typeAliases';
1
+ import type { string_dirname } from '../../types/typeAliases';
2
+ import type { string_filename } from '../../types/typeAliases';
3
3
  /**
4
4
  * Reads all files in the directory
5
5
  *
@@ -10,8 +10,9 @@ import type { string_folder_path } from '../../types/typeAliases';
10
10
  * @returns List of all files in the directory
11
11
  * @private internal function of `createCollectionFromDirectory`
12
12
  */
13
- export declare function $listAllFiles(path: string_folder_path, isRecursive: boolean): Promise<Array<string_file_path>>;
13
+ export declare function $listAllFiles(path: string_dirname, isRecursive: boolean): Promise<Array<string_filename>>;
14
14
  /**
15
- * Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
15
+ * TODO: [😶] Unite floder listing
16
+ * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
16
17
  * TODO: [🖇] What about symlinks?
17
18
  */
@@ -0,0 +1,8 @@
1
+ import type { string_file_extension } from '../../types/typeAliases';
2
+ import type { string_mime_type } from '../../types/typeAliases';
3
+ /**
4
+ * Convert file extension to mime type
5
+ *
6
+ * @private within the repository
7
+ */
8
+ export declare function extensionToMimeType(value: string_file_extension): string_mime_type;
@@ -0,0 +1,8 @@
1
+ import type { string_filename } from '../../types/typeAliases';
2
+ import type { string_mime_type } from '../../types/typeAliases';
3
+ /**
4
+ * Get the file extension from a file name
5
+ *
6
+ * @private within the repository
7
+ */
8
+ export declare function getFileExtension(value: string_filename): string_mime_type | null;
@@ -1,6 +1,10 @@
1
1
  /**
2
2
  * Organizational helper to better mark the place where to really use empty object `{}`
3
3
  *
4
+ * Note: There are 2 similar types>
5
+ * - `empty_object` @@@
6
+ * - `just_empty_object` @@@
7
+ *
4
8
  * @private within the repository
5
9
  */
6
- export type really_empty_object = Record<string, never>;
10
+ export type empty_object = {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Organizational helper to better @@@@
3
+ *
4
+ * Note: There are 2 similar types>
5
+ * - `empty_object` @@@
6
+ * - `just_empty_object` @@@
7
+ *
8
+ * Note: In most cases, you should use `empty_object`
9
+ *
10
+ * @private within the repository
11
+ */
12
+ export type just_empty_object = Record<string, never>;
@@ -1,5 +1,5 @@
1
- import type { string_parameter_name } from '../types/typeAliases';
2
- import type { string_template } from '../types/typeAliases';
1
+ import type { string_parameter_name } from '../../types/typeAliases';
2
+ import type { string_template } from '../../types/typeAliases';
3
3
  /**
4
4
  * Parses the template and returns the list of all parameter names
5
5
  *
@@ -0,0 +1,27 @@
1
+ import type { string_parameter_name } from '../../types/typeAliases';
2
+ import type { string_parameter_value } from '../../types/typeAliases';
3
+ /**
4
+ * @@@
5
+ */
6
+ type MakeapAvailableToExpectedParametersOptions = {
7
+ /**
8
+ * @@@
9
+ */
10
+ readonly expectedParameters: Readonly<Record<string_parameter_name, null>>;
11
+ /**
12
+ * @@@
13
+ */
14
+ readonly availableParameters: Readonly<Record<string_parameter_name, string_parameter_value>>;
15
+ };
16
+ /**
17
+ * Maps available parameters to expected parameters
18
+ *
19
+ * The strategy is:
20
+ * 1) @@@
21
+ * 2) @@@
22
+ *
23
+ * @throws {PipelineExecutionError} @@@
24
+ * @private within the repository used in `createPipelineExecutor`
25
+ */
26
+ export declare function mapAvailableToExpectedParameters(options: MakeapAvailableToExpectedParametersOptions): Readonly<Record<string_parameter_name, string_parameter_value>>;
27
+ export {};
@@ -1,5 +1,5 @@
1
- import type { Parameters } from '../types/typeAliases';
2
- import type { string_template } from '../types/typeAliases';
1
+ import type { Parameters } from '../../types/typeAliases';
2
+ import type { string_template } from '../../types/typeAliases';
3
3
  /**
4
4
  * Replaces parameters in template with values from parameters object
5
5
  *
@@ -22,6 +22,6 @@ import type { string_name } from '../../types/typeAliases';
22
22
  export declare function checkSerializableAsJson(name: string_name, value: unknown): void;
23
23
  /**
24
24
  * TODO: [🧠][🛣] More elegant way to tracking than passing `name`
25
- * TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
25
+ * TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
26
26
  * Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
27
27
  */
@@ -19,6 +19,6 @@
19
19
  */
20
20
  export declare function isSerializableAsJson(value: unknown): boolean;
21
21
  /**
22
- * TODO: [🧠] !!! In-memory cache of same values to prevent multiple checks
22
+ * TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
23
23
  * TODO: [🧠][💺] Can be done this on type-level?
24
24
  */
@@ -1,4 +1,4 @@
1
- import type { string_file_path } from '../../../types/typeAliases';
1
+ import type { string_filename } from '../../../types/typeAliases';
2
2
  import type { really_unknown } from '../../organization/really_unknown';
3
3
  /**
4
4
  * Tests if given string is valid URL.
@@ -6,4 +6,4 @@ import type { really_unknown } from '../../organization/really_unknown';
6
6
  * Note: This does not check if the file exists only if the path is valid
7
7
  * @public exported from `@promptbook/utils`
8
8
  */
9
- export declare function isValidFilePath(filePath: really_unknown): filePath is string_file_path;
9
+ export declare function isValidFilePath(filename: really_unknown): filename is string_filename;
@@ -0,0 +1,10 @@
1
+ import type { string_parameter_name } from '../../../types/typeAliases';
2
+ /**
3
+ * Function `validateParameterName` will @@@
4
+ *
5
+ * @param parameterName @@@
6
+ * @returns @@@
7
+ * @throws {ParseError} @@@
8
+ * @private within the repository
9
+ */
10
+ export declare function validateParameterName(parameterName: string): string_parameter_name;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/openai",
3
- "version": "0.70.0-1",
3
+ "version": "0.71.0-12",
4
4
  "description": "Supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -12,21 +12,25 @@
12
12
  "Pavol Hejný <me@pavolhejny.com> (https://www.pavolhejny.com/)"
13
13
  ],
14
14
  "keywords": [
15
- "autogpt",
16
- "openai",
17
- "gpt-3",
18
- "gpt-4",
19
- "chatgpt",
20
15
  "ai",
16
+ "llm",
17
+ "prompt",
18
+ "template",
19
+ "language-model",
20
+ "chatgpt",
21
+ "autogpt",
21
22
  "machine-learning",
22
23
  "natural-language-processing",
23
24
  "nlp",
24
- "prompt",
25
- "template",
26
- "pipeline",
27
- "automation",
28
- "text-generation",
29
- "language-model"
25
+ "openai",
26
+ "gpt-3",
27
+ "gpt-4",
28
+ "gpt-4o",
29
+ "gpt-4o-mini",
30
+ "o1",
31
+ "o1-mini",
32
+ "o1-preview",
33
+ "anthropic"
30
34
  ],
31
35
  "license": "CC-BY-4.0",
32
36
  "bugs": {
@@ -47,7 +51,7 @@
47
51
  "module": "./esm/index.es.js",
48
52
  "typings": "./esm/typings/src/_packages/openai.index.d.ts",
49
53
  "peerDependencies": {
50
- "@promptbook/core": "0.70.0-1"
54
+ "@promptbook/core": "0.71.0-12"
51
55
  },
52
56
  "dependencies": {
53
57
  "colors": "1.4.0",