@promptbook/openai 0.60.0-0 → 0.60.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 (206) hide show
  1. package/README.md +8 -8
  2. package/esm/index.es.js +25 -25
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/core.index.d.ts +23 -23
  5. package/esm/typings/src/_packages/node.index.d.ts +2 -2
  6. package/esm/typings/src/_packages/types.index.d.ts +11 -11
  7. package/esm/typings/src/_packages/utils.index.d.ts +9 -11
  8. package/esm/typings/src/config.d.ts +1 -1
  9. package/esm/typings/src/conversion/pipelineJsonToString.d.ts +12 -0
  10. package/esm/typings/src/conversion/pipelineStringToJson.d.ts +32 -0
  11. package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +23 -0
  12. package/esm/typings/src/conversion/prettify/PrettifyOptions.d.ts +1 -1
  13. package/{umd/typings/src/conversion/prettify/prettifyPromptbookString.d.ts → esm/typings/src/conversion/prettify/prettifyPipelineString.d.ts} +2 -2
  14. package/esm/typings/src/conversion/prettify/{renderPromptbookMermaid.d.ts → renderPipelineMermaidOptions.d.ts} +4 -4
  15. package/esm/typings/src/conversion/utils/extractParametersFromPromptTemplate.d.ts +2 -2
  16. package/esm/typings/src/conversion/utils/extractVariables.d.ts +1 -1
  17. package/esm/typings/src/conversion/utils/parseCommand.d.ts +2 -2
  18. package/esm/typings/src/conversion/utils/parseNumber.d.ts +1 -1
  19. package/esm/typings/src/conversion/utils/renameParameter.d.ts +4 -4
  20. package/esm/typings/src/conversion/validation/_importPipeline.d.ts +13 -0
  21. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +27 -0
  22. package/{umd/typings/src/errors/PromptbookLibraryError.d.ts → esm/typings/src/errors/CollectionError.d.ts} +2 -2
  23. package/esm/typings/src/errors/{PromptbookExecutionError.d.ts → ExecutionError.d.ts} +2 -2
  24. package/{umd/typings/src/errors/PromptbookNotFoundError.d.ts → esm/typings/src/errors/NotFoundError.d.ts} +2 -2
  25. package/{umd/typings/src/errors/PromptbookLogicError.d.ts → esm/typings/src/errors/PipelineLogicError.d.ts} +2 -2
  26. package/{umd/typings/src/errors/PromptbookReferenceError.d.ts → esm/typings/src/errors/ReferenceError.d.ts} +2 -2
  27. package/esm/typings/src/errors/{PromptbookSyntaxError.d.ts → SyntaxError.d.ts} +2 -2
  28. package/esm/typings/src/errors/TemplateError.d.ts +1 -1
  29. package/esm/typings/src/errors/_ExpectError.d.ts +2 -2
  30. package/esm/typings/src/execution/ExecutionTools.d.ts +1 -1
  31. package/esm/typings/src/execution/LlmExecutionTools.d.ts +4 -4
  32. package/esm/typings/src/execution/PromptResult.d.ts +1 -1
  33. package/esm/typings/src/execution/assertsExecutionSuccessful.d.ts +1 -1
  34. package/esm/typings/src/execution/createPromptbookExecutor.d.ts +3 -3
  35. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +1 -1
  36. package/esm/typings/src/execution/utils/checkExpectations.d.ts +1 -1
  37. package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +1 -1
  38. package/esm/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +1 -1
  39. package/esm/typings/src/library/PipelineCollection.d.ts +25 -0
  40. package/esm/typings/src/library/{SimplePromptbookLibrary.d.ts → SimplePipelineCollection.d.ts} +11 -11
  41. package/{umd/typings/src/library/constructors/createLibraryFromDirectory.d.ts → esm/typings/src/library/constructors/createCollectionFromDirectory.d.ts} +5 -5
  42. package/esm/typings/src/library/constructors/createCollectionFromJson.d.ts +12 -0
  43. package/esm/typings/src/library/constructors/createCollectionFromPromise.d.ts +22 -0
  44. package/esm/typings/src/library/constructors/{createLibraryFromUrl.d.ts → createCollectionFromUrl.d.ts} +5 -5
  45. package/esm/typings/src/library/constructors/createSubcollection.d.ts +12 -0
  46. package/esm/typings/src/library/libraryToJson.d.ts +5 -5
  47. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +3 -3
  48. package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +3 -3
  49. package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +2 -2
  50. package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +3 -3
  51. package/esm/typings/src/llm-providers/mocked/fakeTextToExpectations.d.ts +1 -1
  52. package/esm/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +3 -3
  53. package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +3 -3
  54. package/esm/typings/src/llm-providers/openai/computeOpenaiUsage.d.ts +1 -1
  55. package/esm/typings/src/llm-providers/openai/computeUsage.d.ts +2 -2
  56. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +3 -3
  57. package/esm/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +2 -2
  58. package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -1
  59. package/esm/typings/src/types/Command.d.ts +4 -4
  60. package/esm/typings/src/types/Parameters.d.ts +1 -1
  61. package/esm/typings/src/types/{PromptbookJson/PromptbookJson.d.ts → PipelineJson/PipelineJson.d.ts} +4 -4
  62. package/{umd/typings/src/types/PromptbookString.d.ts → esm/typings/src/types/PipelineString.d.ts} +3 -3
  63. package/esm/typings/src/types/Prompt.d.ts +3 -3
  64. package/esm/typings/src/types/execution-report/ExecutionReportJson.d.ts +2 -2
  65. package/esm/typings/src/types/execution-report/countWorkingDuration.d.ts +1 -1
  66. package/esm/typings/src/types/typeAliases.d.ts +2 -2
  67. package/esm/typings/src/utils/emojis.d.ts +2 -2
  68. package/esm/typings/src/utils/expectation-counters/countCharacters.d.ts +1 -1
  69. package/esm/typings/src/utils/expectation-counters/countLines.d.ts +1 -1
  70. package/esm/typings/src/utils/expectation-counters/countPages.d.ts +1 -1
  71. package/esm/typings/src/utils/expectation-counters/countParagraphs.d.ts +1 -1
  72. package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +1 -1
  73. package/esm/typings/src/utils/expectation-counters/countWords.d.ts +1 -1
  74. package/esm/typings/src/utils/expectation-counters/index.d.ts +2 -2
  75. package/esm/typings/src/utils/formatNumber.d.ts +1 -1
  76. package/esm/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +1 -1
  77. package/esm/typings/src/utils/markdown/createMarkdownChart.d.ts +1 -1
  78. package/esm/typings/src/utils/markdown/createMarkdownTable.d.ts +1 -1
  79. package/esm/typings/src/utils/markdown-json/MarkdownStructure.d.ts +1 -1
  80. package/esm/typings/src/utils/markdown-json/countMarkdownStructureDeepness.d.ts +1 -1
  81. package/esm/typings/src/utils/markdown-json/markdownToMarkdownStructure.d.ts +1 -1
  82. package/package.json +3 -3
  83. package/umd/index.umd.js +25 -25
  84. package/umd/index.umd.js.map +1 -1
  85. package/umd/typings/src/_packages/core.index.d.ts +23 -23
  86. package/umd/typings/src/_packages/node.index.d.ts +2 -2
  87. package/umd/typings/src/_packages/types.index.d.ts +11 -11
  88. package/umd/typings/src/_packages/utils.index.d.ts +9 -11
  89. package/umd/typings/src/config.d.ts +1 -1
  90. package/umd/typings/src/conversion/pipelineJsonToString.d.ts +12 -0
  91. package/umd/typings/src/conversion/pipelineStringToJson.d.ts +32 -0
  92. package/umd/typings/src/conversion/pipelineStringToJsonSync.d.ts +23 -0
  93. package/umd/typings/src/conversion/prettify/PrettifyOptions.d.ts +1 -1
  94. package/{esm/typings/src/conversion/prettify/prettifyPromptbookString.d.ts → umd/typings/src/conversion/prettify/prettifyPipelineString.d.ts} +2 -2
  95. package/umd/typings/src/conversion/prettify/{renderPromptbookMermaid.d.ts → renderPipelineMermaidOptions.d.ts} +4 -4
  96. package/umd/typings/src/conversion/utils/extractParametersFromPromptTemplate.d.ts +2 -2
  97. package/umd/typings/src/conversion/utils/extractVariables.d.ts +1 -1
  98. package/umd/typings/src/conversion/utils/parseCommand.d.ts +2 -2
  99. package/umd/typings/src/conversion/utils/parseNumber.d.ts +1 -1
  100. package/umd/typings/src/conversion/utils/renameParameter.d.ts +4 -4
  101. package/umd/typings/src/conversion/validation/_importPipeline.d.ts +13 -0
  102. package/umd/typings/src/conversion/validation/validatePipeline.d.ts +27 -0
  103. package/{esm/typings/src/errors/PromptbookLibraryError.d.ts → umd/typings/src/errors/CollectionError.d.ts} +2 -2
  104. package/umd/typings/src/errors/{PromptbookExecutionError.d.ts → ExecutionError.d.ts} +2 -2
  105. package/{esm/typings/src/errors/PromptbookNotFoundError.d.ts → umd/typings/src/errors/NotFoundError.d.ts} +2 -2
  106. package/{esm/typings/src/errors/PromptbookLogicError.d.ts → umd/typings/src/errors/PipelineLogicError.d.ts} +2 -2
  107. package/{esm/typings/src/errors/PromptbookReferenceError.d.ts → umd/typings/src/errors/ReferenceError.d.ts} +2 -2
  108. package/umd/typings/src/errors/{PromptbookSyntaxError.d.ts → SyntaxError.d.ts} +2 -2
  109. package/umd/typings/src/errors/TemplateError.d.ts +1 -1
  110. package/umd/typings/src/errors/_ExpectError.d.ts +2 -2
  111. package/umd/typings/src/execution/ExecutionTools.d.ts +1 -1
  112. package/umd/typings/src/execution/LlmExecutionTools.d.ts +4 -4
  113. package/umd/typings/src/execution/PromptResult.d.ts +1 -1
  114. package/umd/typings/src/execution/assertsExecutionSuccessful.d.ts +1 -1
  115. package/umd/typings/src/execution/createPromptbookExecutor.d.ts +3 -3
  116. package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +1 -1
  117. package/umd/typings/src/execution/utils/checkExpectations.d.ts +1 -1
  118. package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +1 -1
  119. package/umd/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +1 -1
  120. package/umd/typings/src/library/PipelineCollection.d.ts +25 -0
  121. package/umd/typings/src/library/{SimplePromptbookLibrary.d.ts → SimplePipelineCollection.d.ts} +11 -11
  122. package/{esm/typings/src/library/constructors/createLibraryFromDirectory.d.ts → umd/typings/src/library/constructors/createCollectionFromDirectory.d.ts} +5 -5
  123. package/umd/typings/src/library/constructors/createCollectionFromJson.d.ts +12 -0
  124. package/umd/typings/src/library/constructors/createCollectionFromPromise.d.ts +22 -0
  125. package/umd/typings/src/library/constructors/{createLibraryFromUrl.d.ts → createCollectionFromUrl.d.ts} +5 -5
  126. package/umd/typings/src/library/constructors/createSubcollection.d.ts +12 -0
  127. package/umd/typings/src/library/libraryToJson.d.ts +5 -5
  128. package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +3 -3
  129. package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +3 -3
  130. package/umd/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +2 -2
  131. package/umd/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +3 -3
  132. package/umd/typings/src/llm-providers/mocked/fakeTextToExpectations.d.ts +1 -1
  133. package/umd/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +3 -3
  134. package/umd/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +3 -3
  135. package/umd/typings/src/llm-providers/openai/computeOpenaiUsage.d.ts +1 -1
  136. package/umd/typings/src/llm-providers/openai/computeUsage.d.ts +2 -2
  137. package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +3 -3
  138. package/umd/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +2 -2
  139. package/umd/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -1
  140. package/umd/typings/src/types/Command.d.ts +4 -4
  141. package/umd/typings/src/types/Parameters.d.ts +1 -1
  142. package/umd/typings/src/types/{PromptbookJson/PromptbookJson.d.ts → PipelineJson/PipelineJson.d.ts} +4 -4
  143. package/{esm/typings/src/types/PromptbookString.d.ts → umd/typings/src/types/PipelineString.d.ts} +3 -3
  144. package/umd/typings/src/types/Prompt.d.ts +3 -3
  145. package/umd/typings/src/types/execution-report/ExecutionReportJson.d.ts +2 -2
  146. package/umd/typings/src/types/execution-report/countWorkingDuration.d.ts +1 -1
  147. package/umd/typings/src/types/typeAliases.d.ts +2 -2
  148. package/umd/typings/src/utils/emojis.d.ts +2 -2
  149. package/umd/typings/src/utils/expectation-counters/countCharacters.d.ts +1 -1
  150. package/umd/typings/src/utils/expectation-counters/countLines.d.ts +1 -1
  151. package/umd/typings/src/utils/expectation-counters/countPages.d.ts +1 -1
  152. package/umd/typings/src/utils/expectation-counters/countParagraphs.d.ts +1 -1
  153. package/umd/typings/src/utils/expectation-counters/countSentences.d.ts +1 -1
  154. package/umd/typings/src/utils/expectation-counters/countWords.d.ts +1 -1
  155. package/umd/typings/src/utils/expectation-counters/index.d.ts +2 -2
  156. package/umd/typings/src/utils/formatNumber.d.ts +1 -1
  157. package/umd/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +1 -1
  158. package/umd/typings/src/utils/markdown/createMarkdownChart.d.ts +1 -1
  159. package/umd/typings/src/utils/markdown/createMarkdownTable.d.ts +1 -1
  160. package/umd/typings/src/utils/markdown-json/MarkdownStructure.d.ts +1 -1
  161. package/umd/typings/src/utils/markdown-json/countMarkdownStructureDeepness.d.ts +1 -1
  162. package/umd/typings/src/utils/markdown-json/markdownToMarkdownStructure.d.ts +1 -1
  163. package/esm/typings/src/conversion/promptbookJsonToString.d.ts +0 -12
  164. package/esm/typings/src/conversion/promptbookStringToJson.d.ts +0 -32
  165. package/esm/typings/src/conversion/promptbookStringToJsonSync.d.ts +0 -23
  166. package/esm/typings/src/conversion/validation/_importPromptbook.d.ts +0 -13
  167. package/esm/typings/src/conversion/validation/validatePromptbook.d.ts +0 -27
  168. package/esm/typings/src/library/PromptbookLibrary.d.ts +0 -25
  169. package/esm/typings/src/library/constructors/createLibraryFromJson.d.ts +0 -12
  170. package/esm/typings/src/library/constructors/createLibraryFromPromise.d.ts +0 -22
  171. package/esm/typings/src/library/constructors/createSublibrary.d.ts +0 -12
  172. package/umd/typings/src/conversion/promptbookJsonToString.d.ts +0 -12
  173. package/umd/typings/src/conversion/promptbookStringToJson.d.ts +0 -32
  174. package/umd/typings/src/conversion/promptbookStringToJsonSync.d.ts +0 -23
  175. package/umd/typings/src/conversion/validation/_importPromptbook.d.ts +0 -13
  176. package/umd/typings/src/conversion/validation/validatePromptbook.d.ts +0 -27
  177. package/umd/typings/src/library/PromptbookLibrary.d.ts +0 -25
  178. package/umd/typings/src/library/constructors/createLibraryFromJson.d.ts +0 -12
  179. package/umd/typings/src/library/constructors/createLibraryFromPromise.d.ts +0 -22
  180. package/umd/typings/src/library/constructors/createSublibrary.d.ts +0 -12
  181. /package/esm/typings/{promptbook-library → promptbook-collection}/index.d.ts +0 -0
  182. /package/esm/typings/src/conversion/{promptbookStringToJson.test.d.ts → pipelineStringToJson.test.d.ts} +0 -0
  183. /package/esm/typings/src/conversion/{promptbookStringToJsonSync.test.d.ts → pipelineStringToJsonSync.test.d.ts} +0 -0
  184. /package/esm/typings/src/conversion/validation/{promptbookStringToJson-syntaxErrors.test.d.ts → pipelineStringToJson-syntaxErrors.test.d.ts} +0 -0
  185. /package/esm/typings/src/conversion/validation/{validatePromptbook-logicErrors.test.d.ts → validatePipeline-logicErrors.test.d.ts} +0 -0
  186. /package/esm/typings/src/conversion/validation/{validatePromptbook.test.d.ts → validatePipeline.test.d.ts} +0 -0
  187. /package/esm/typings/src/library/constructors/{createLibraryFromDirectory.test.d.ts → createCollectionFromDirectory.test.d.ts} +0 -0
  188. /package/esm/typings/src/library/constructors/{createLibraryFromJson.test.d.ts → createCollectionFromJson.test.d.ts} +0 -0
  189. /package/esm/typings/src/library/constructors/{createLibraryFromPromise.test.d.ts → createCollectionFromPromise.test.d.ts} +0 -0
  190. /package/esm/typings/src/types/{PromptbookJson → PipelineJson}/KnowledgeJson.d.ts +0 -0
  191. /package/esm/typings/src/types/{PromptbookJson → PipelineJson}/MaterialKnowledgePieceJson.d.ts +0 -0
  192. /package/esm/typings/src/types/{PromptbookJson → PipelineJson}/PromptTemplateJson.d.ts +0 -0
  193. /package/esm/typings/src/types/{PromptbookJson → PipelineJson}/PromptTemplateParameterJson.d.ts +0 -0
  194. /package/umd/typings/{promptbook-library → promptbook-collection}/index.d.ts +0 -0
  195. /package/umd/typings/src/conversion/{promptbookStringToJson.test.d.ts → pipelineStringToJson.test.d.ts} +0 -0
  196. /package/umd/typings/src/conversion/{promptbookStringToJsonSync.test.d.ts → pipelineStringToJsonSync.test.d.ts} +0 -0
  197. /package/umd/typings/src/conversion/validation/{promptbookStringToJson-syntaxErrors.test.d.ts → pipelineStringToJson-syntaxErrors.test.d.ts} +0 -0
  198. /package/umd/typings/src/conversion/validation/{validatePromptbook-logicErrors.test.d.ts → validatePipeline-logicErrors.test.d.ts} +0 -0
  199. /package/umd/typings/src/conversion/validation/{validatePromptbook.test.d.ts → validatePipeline.test.d.ts} +0 -0
  200. /package/umd/typings/src/library/constructors/{createLibraryFromDirectory.test.d.ts → createCollectionFromDirectory.test.d.ts} +0 -0
  201. /package/umd/typings/src/library/constructors/{createLibraryFromJson.test.d.ts → createCollectionFromJson.test.d.ts} +0 -0
  202. /package/umd/typings/src/library/constructors/{createLibraryFromPromise.test.d.ts → createCollectionFromPromise.test.d.ts} +0 -0
  203. /package/umd/typings/src/types/{PromptbookJson → PipelineJson}/KnowledgeJson.d.ts +0 -0
  204. /package/umd/typings/src/types/{PromptbookJson → PipelineJson}/MaterialKnowledgePieceJson.d.ts +0 -0
  205. /package/umd/typings/src/types/{PromptbookJson → PipelineJson}/PromptTemplateJson.d.ts +0 -0
  206. /package/umd/typings/src/types/{PromptbookJson → PipelineJson}/PromptTemplateParameterJson.d.ts +0 -0
@@ -1,12 +0,0 @@
1
- import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
2
- import type { PromptbookLibrary } from '../PromptbookLibrary';
3
- /**
4
- * Creates PromptbookLibrary from array of PromptbookJson or PromptbookString
5
- *
6
- * Note: Functions `libraryToJson` and `createLibraryFromJson` are complementary
7
- * Note: During the construction syntax and logic of all sources are validated
8
- *
9
- * @param promptbookSources
10
- * @returns PromptbookLibrary
11
- */
12
- export declare function createLibraryFromJson(...promptbooks: Array<PromptbookJson>): PromptbookLibrary;
@@ -1,22 +0,0 @@
1
- import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
2
- import type { PromptbookLibrary } from '../PromptbookLibrary';
3
- /**
4
- * Constructs Promptbook from async sources
5
- * It can be one of the following:
6
- * - Promise of array of PromptbookJson or PromptbookString
7
- * - Factory function that returns Promise of array of PromptbookJson or PromptbookString
8
- *
9
- * Note: This is useful as internal tool for other constructor functions like
10
- * `createLibraryFromUrl` or `createLibraryFromDirectory`
11
- * Consider using those functions instead of this one
12
- *
13
- * Note: The function does NOT return promise it returns the library directly which waits for the sources to be resolved
14
- * when error occurs in given promise or factory function, it is thrown during `listPromptbooks` or `getPromptbookByUrl` call
15
- *
16
- * Note: Consider using `createLibraryFromDirectory` or `createLibraryFromUrl`
17
- *
18
- * @param promptbookSourcesPromiseOrFactory
19
- * @returns PromptbookLibrary
20
- * @deprecated Do not use, it will became internal tool for other constructor functions
21
- */
22
- export declare function createLibraryFromPromise(promptbookSourcesPromiseOrFactory: Promise<Array<PromptbookJson>> | (() => Promise<Array<PromptbookJson>>)): PromptbookLibrary;
@@ -1,12 +0,0 @@
1
- import type { string_promptbook_url } from '../../types/typeAliases';
2
- import type { PromptbookLibrary } from '../PromptbookLibrary';
3
- /**
4
- * Creates PromptbookLibrary as a subset of another PromptbookLibrary
5
- *
6
- * Note: You can use any type of library as a parent library - local, remote, etc.
7
- * Note: This is just a thin wrapper / proxy around the parent library
8
- *
9
- * @param promptbookSources
10
- * @returns PromptbookLibrary
11
- */
12
- export declare function createSublibrary(library: PromptbookLibrary, predicate: (url: string_promptbook_url) => boolean): PromptbookLibrary;
@@ -1,12 +0,0 @@
1
- import type { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
2
- import type { PromptbookString } from '../types/PromptbookString';
3
- /**
4
- * Converts promptbook in JSON format to string format
5
- *
6
- * @param promptbookJson Promptbook in JSON format (.ptbk.json)
7
- * @returns Promptbook in string format (.ptbk.md)
8
- */
9
- export declare function promptbookJsonToString(promptbookJson: PromptbookJson): PromptbookString;
10
- /**
11
- * TODO: Escape all
12
- */
@@ -1,32 +0,0 @@
1
- import type { LlmExecutionTools } from '../execution/LlmExecutionTools';
2
- import type { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
3
- import type { PromptbookString } from '../types/PromptbookString';
4
- /**
5
- * Options for promptbookStringToJson
6
- */
7
- type PromptbookStringToJsonOptions = {
8
- /**
9
- * Tools for processing required for knowledge processing *(not for actual execution)*
10
- */
11
- llmTools?: LlmExecutionTools;
12
- };
13
- /**
14
- * Compile promptbook from string (markdown) format to JSON format
15
- *
16
- * Note: There are two similar functions:
17
- * - `promptbookStringToJson` **(preferred)** - which propperly compiles the promptbook and use embedding for external knowledge
18
- * - `promptbookStringToJsonSync` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
19
- *
20
- * @param promptbookString {Promptbook} in string markdown format (.ptbk.md)
21
- * @param options - Options and tools for the compilation
22
- * @returns {Promptbook} compiled in JSON format (.ptbk.json)
23
- * @throws {PromptbookSyntaxError} if the promptbook string is not valid
24
- *
25
- * Note: This function does not validate logic of the pipeline only the syntax
26
- * Note: This function acts as compilation process
27
- */
28
- export declare function promptbookStringToJson(promptbookString: PromptbookString, options?: PromptbookStringToJsonOptions): Promise<PromptbookJson>;
29
- export {};
30
- /**
31
- * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
32
- */
@@ -1,23 +0,0 @@
1
- import type { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
2
- import type { PromptbookString } from '../types/PromptbookString';
3
- /**
4
- * Compile promptbook from string (markdown) format to JSON format synchronously
5
- *
6
- * Note: There are two similar functions:
7
- * - `promptbookStringToJson` **(preferred)** - which propperly compiles the promptbook and use embedding for external knowledge
8
- * - `promptbookStringToJsonSync` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
9
- *
10
- * @param promptbookString {Promptbook} in string markdown format (.ptbk.md)
11
- * @param options - Options and tools for the compilation
12
- * @returns {Promptbook} compiled in JSON format (.ptbk.json)
13
- * @throws {PromptbookSyntaxError} if the promptbook string is not valid
14
- *
15
- * Note: This function does not validate logic of the pipeline only the syntax
16
- * Note: This function acts as compilation process
17
- */
18
- export declare function promptbookStringToJsonSync(promptbookString: PromptbookString): PromptbookJson;
19
- /**
20
- * TODO: Report here line/column of error
21
- * TODO: Use spaceTrim more effectively
22
- * TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
23
- */
@@ -1,13 +0,0 @@
1
- import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
2
- import type { PromptbookString } from '../../types/PromptbookString';
3
- /**
4
- * Import the text file
5
- *
6
- * Note: Using here custom import to work in jest tests
7
- * Note: Using sync version is 💩 in the production code, but it's ok here in tests
8
- *
9
- * @param path - The path to the file relative to samples/templates directory
10
- * @private
11
- */
12
- export declare function importPromptbook(path: `${string}.ptbk.md`): PromptbookString;
13
- export declare function importPromptbook(path: `${string}.ptbk.json`): PromptbookJson;
@@ -1,27 +0,0 @@
1
- import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
2
- /**
3
- * Validates PromptbookJson if it is logically valid
4
- *
5
- * It checks:
6
- * - if it has correct parameters dependency
7
- *
8
- * It does NOT check:
9
- * - if it is valid json
10
- * - if it is meaningful
11
- *
12
- * @param promptbook valid or invalid PromptbookJson
13
- * @returns the same promptbook if it is logically valid
14
- * @throws {PromptbookLogicError} on logical error in the promptbook
15
- */
16
- export declare function validatePromptbook(promptbook: PromptbookJson): PromptbookJson;
17
- /**
18
- * TODO: [🧠] Work with promptbookVersion
19
- * TODO: Use here some json-schema, Zod or something similar and change it to:
20
- * > /**
21
- * > * Validates PromptbookJson if it is logically valid.
22
- * > *
23
- * > * It checks:
24
- * > * - it has a valid structure
25
- * > * - ...
26
- * > ex port function validatePromptbook(promptbook: unknown): asserts promptbook is PromptbookJson {
27
- */
@@ -1,25 +0,0 @@
1
- import type { Promisable } from 'type-fest';
2
- import type { Prompt } from '../types/Prompt';
3
- import type { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
4
- import type { string_promptbook_url } from '../types/typeAliases';
5
- /**
6
- * Library of promptbooks that groups together promptbooks for an application.
7
- *
8
- * @see https://github.com/webgptorg/promptbook#promptbook-library
9
- */
10
- export type PromptbookLibrary = {
11
- /**
12
- * Gets all promptbooks in the library
13
- */
14
- listPromptbooks(): Promisable<Array<string_promptbook_url>>;
15
- /**
16
- * Gets promptbook by its URL
17
- *
18
- * Note: This is not a direct fetching from the URL, but a lookup in the library
19
- */
20
- getPromptbookByUrl(url: string_promptbook_url): Promisable<PromptbookJson>;
21
- /**
22
- * Checks whether given prompt was defined in any promptbook in the library
23
- */
24
- isResponsibleForPrompt(prompt: Prompt): Promisable<boolean>;
25
- };
@@ -1,12 +0,0 @@
1
- import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
2
- import type { PromptbookLibrary } from '../PromptbookLibrary';
3
- /**
4
- * Creates PromptbookLibrary from array of PromptbookJson or PromptbookString
5
- *
6
- * Note: Functions `libraryToJson` and `createLibraryFromJson` are complementary
7
- * Note: During the construction syntax and logic of all sources are validated
8
- *
9
- * @param promptbookSources
10
- * @returns PromptbookLibrary
11
- */
12
- export declare function createLibraryFromJson(...promptbooks: Array<PromptbookJson>): PromptbookLibrary;
@@ -1,22 +0,0 @@
1
- import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
2
- import type { PromptbookLibrary } from '../PromptbookLibrary';
3
- /**
4
- * Constructs Promptbook from async sources
5
- * It can be one of the following:
6
- * - Promise of array of PromptbookJson or PromptbookString
7
- * - Factory function that returns Promise of array of PromptbookJson or PromptbookString
8
- *
9
- * Note: This is useful as internal tool for other constructor functions like
10
- * `createLibraryFromUrl` or `createLibraryFromDirectory`
11
- * Consider using those functions instead of this one
12
- *
13
- * Note: The function does NOT return promise it returns the library directly which waits for the sources to be resolved
14
- * when error occurs in given promise or factory function, it is thrown during `listPromptbooks` or `getPromptbookByUrl` call
15
- *
16
- * Note: Consider using `createLibraryFromDirectory` or `createLibraryFromUrl`
17
- *
18
- * @param promptbookSourcesPromiseOrFactory
19
- * @returns PromptbookLibrary
20
- * @deprecated Do not use, it will became internal tool for other constructor functions
21
- */
22
- export declare function createLibraryFromPromise(promptbookSourcesPromiseOrFactory: Promise<Array<PromptbookJson>> | (() => Promise<Array<PromptbookJson>>)): PromptbookLibrary;
@@ -1,12 +0,0 @@
1
- import type { string_promptbook_url } from '../../types/typeAliases';
2
- import type { PromptbookLibrary } from '../PromptbookLibrary';
3
- /**
4
- * Creates PromptbookLibrary as a subset of another PromptbookLibrary
5
- *
6
- * Note: You can use any type of library as a parent library - local, remote, etc.
7
- * Note: This is just a thin wrapper / proxy around the parent library
8
- *
9
- * @param promptbookSources
10
- * @returns PromptbookLibrary
11
- */
12
- export declare function createSublibrary(library: PromptbookLibrary, predicate: (url: string_promptbook_url) => boolean): PromptbookLibrary;