@promptbook/types 0.52.0-9 → 0.53.0

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 (166) hide show
  1. package/README.md +1 -13
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/_packages/core.index.d.ts +4 -2
  4. package/esm/typings/_packages/utils.index.d.ts +2 -0
  5. package/esm/typings/conversion/prettify/prettifyPromptbookString.d.ts +1 -1
  6. package/esm/typings/conversion/prettify/renderPromptbookMermaid.d.ts +2 -1
  7. package/esm/typings/conversion/utils/extractParametersFromPromptTemplate.d.ts +3 -3
  8. package/esm/typings/conversion/utils/extractVariables.d.ts +2 -1
  9. package/esm/typings/conversion/validation/_importPromptbook.d.ts +2 -2
  10. package/esm/typings/errors/PromptbookLibraryError.d.ts +7 -0
  11. package/esm/typings/execution/ExecutionTools.d.ts +5 -3
  12. package/esm/typings/execution/LlmExecutionTools.d.ts +4 -2
  13. package/esm/typings/execution/PromptResult.d.ts +5 -1
  14. package/esm/typings/execution/ScriptExecutionTools.d.ts +2 -1
  15. package/esm/typings/execution/UserInterfaceTools.d.ts +2 -1
  16. package/esm/typings/execution/createPromptbookExecutor.d.ts +3 -3
  17. package/esm/typings/execution/plugins/llm-execution-tools/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +4 -3
  18. package/esm/typings/execution/plugins/llm-execution-tools/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  19. package/esm/typings/execution/plugins/llm-execution-tools/azure-openai/AzureOpenAiExecutionTools.d.ts +4 -3
  20. package/esm/typings/execution/plugins/llm-execution-tools/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +2 -1
  21. package/esm/typings/execution/plugins/llm-execution-tools/langtail/LangtailExecutionTools.d.ts +0 -3
  22. package/esm/typings/execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools.d.ts +4 -2
  23. package/esm/typings/execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools.d.ts +4 -2
  24. package/esm/typings/execution/plugins/llm-execution-tools/mocked/fakeTextToExpectations.d.ts +1 -1
  25. package/esm/typings/execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionTools.d.ts +4 -2
  26. package/esm/typings/execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionToolsOptions.d.ts +2 -1
  27. package/esm/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionTools.d.ts +5 -3
  28. package/esm/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionToolsOptions.d.ts +1 -1
  29. package/esm/typings/execution/plugins/llm-execution-tools/openai/openai-models.d.ts +1 -1
  30. package/esm/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts +5 -3
  31. package/esm/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionToolsOptions.d.ts +2 -1
  32. package/esm/typings/execution/plugins/llm-execution-tools/remote/interfaces/Promptbook_Server_Progress.d.ts +1 -1
  33. package/esm/typings/execution/plugins/llm-execution-tools/remote/interfaces/Promptbook_Server_Response.d.ts +1 -1
  34. package/esm/typings/execution/plugins/llm-execution-tools/remote/interfaces/RemoteServerOptions.d.ts +2 -1
  35. package/esm/typings/execution/plugins/llm-execution-tools/remote/startRemoteServer.d.ts +2 -1
  36. package/esm/typings/execution/plugins/script-execution-tools/python/PythonExecutionTools.d.ts +3 -2
  37. package/esm/typings/execution/plugins/script-execution-tools/typescript/TypescriptExecutionTools.d.ts +3 -2
  38. package/esm/typings/execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceTools.d.ts +3 -2
  39. package/esm/typings/execution/plugins/user-interface-execution-tools/simple-prompt/SimplePromptInterfaceTools.d.ts +3 -2
  40. package/esm/typings/execution/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +1 -1
  41. package/esm/typings/execution/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +1 -1
  42. package/esm/typings/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +2 -2
  43. package/esm/typings/execution/translation/automatic-translate/translateMessages.d.ts +2 -2
  44. package/esm/typings/execution/utils/forEachAsync.d.ts +18 -0
  45. package/esm/typings/execution/utils/replaceParameters.d.ts +2 -2
  46. package/esm/typings/library/SimplePromptbookLibrary.d.ts +1 -1
  47. package/esm/typings/library/constructors/createPromptbookLibraryFromDirectory.d.ts +30 -6
  48. package/esm/typings/library/constructors/createPromptbookLibraryFromDirectory.test.d.ts +1 -0
  49. package/esm/typings/library/constructors/createPromptbookLibraryFromPromise.d.ts +4 -4
  50. package/esm/typings/library/constructors/createPromptbookLibraryFromPromise.test.d.ts +1 -0
  51. package/esm/typings/library/constructors/createPromptbookLibraryFromSources.d.ts +2 -1
  52. package/esm/typings/library/constructors/createPromptbookLibraryFromSources.test.d.ts +1 -0
  53. package/esm/typings/library/constructors/createPromptbookLibraryFromUrl.d.ts +23 -6
  54. package/esm/typings/library/constructors/createPromptbookSublibrary.d.ts +1 -1
  55. package/esm/typings/library/constructors/justTestFsImport.d.ts +7 -0
  56. package/esm/typings/types/Command.d.ts +5 -2
  57. package/esm/typings/types/Prompt.d.ts +5 -2
  58. package/esm/typings/types/PromptbookJson/PromptTemplateJson.d.ts +8 -1
  59. package/esm/typings/types/PromptbookJson/PromptbookJson.d.ts +2 -1
  60. package/esm/typings/types/TaskProgress.d.ts +2 -1
  61. package/esm/typings/types/execution-report/ExecutionReportJson.d.ts +2 -1
  62. package/esm/typings/types/execution-report/countWorkingDuration.d.ts +1 -1
  63. package/esm/typings/types/typeAliases.d.ts +2 -2
  64. package/esm/typings/utils/emojis.d.ts +1 -1
  65. package/esm/typings/utils/expectation-counters/index.d.ts +2 -1
  66. package/esm/typings/utils/extractParameters.d.ts +2 -1
  67. package/esm/typings/utils/markdown/addAutoGeneratedSection.d.ts +2 -1
  68. package/esm/typings/utils/markdown/createMarkdownChart.d.ts +2 -2
  69. package/esm/typings/utils/markdown/createMarkdownTable.d.ts +2 -1
  70. package/esm/typings/utils/markdown/escapeMarkdownBlock.d.ts +1 -1
  71. package/esm/typings/utils/markdown/extractAllListItemsFromMarkdown.d.ts +2 -1
  72. package/esm/typings/utils/markdown/extractOneBlockFromMarkdown.d.ts +2 -2
  73. package/esm/typings/utils/markdown/removeContentComments.d.ts +2 -1
  74. package/esm/typings/utils/markdown/removeMarkdownFormatting.d.ts +1 -1
  75. package/esm/typings/utils/markdown-json/countMarkdownStructureDeepness.d.ts +1 -1
  76. package/esm/typings/utils/markdown-json/markdownToMarkdownStructure.d.ts +1 -1
  77. package/esm/typings/utils/normalization/isValidKeyword.d.ts +1 -1
  78. package/esm/typings/utils/normalization/parseKeywords.d.ts +1 -1
  79. package/esm/typings/utils/normalization/parseKeywordsFromString.d.ts +1 -1
  80. package/esm/typings/utils/normalization/searchKeywords.d.ts +1 -1
  81. package/esm/typings/utils/postprocessing/extractBlock.d.ts +1 -1
  82. package/package.json +2 -2
  83. package/umd/index.umd.js.map +1 -1
  84. package/umd/typings/_packages/core.index.d.ts +4 -2
  85. package/umd/typings/_packages/utils.index.d.ts +2 -0
  86. package/umd/typings/conversion/prettify/prettifyPromptbookString.d.ts +1 -1
  87. package/umd/typings/conversion/prettify/renderPromptbookMermaid.d.ts +2 -1
  88. package/umd/typings/conversion/utils/extractParametersFromPromptTemplate.d.ts +3 -3
  89. package/umd/typings/conversion/utils/extractVariables.d.ts +2 -1
  90. package/umd/typings/conversion/validation/_importPromptbook.d.ts +2 -2
  91. package/umd/typings/errors/PromptbookLibraryError.d.ts +7 -0
  92. package/umd/typings/execution/ExecutionTools.d.ts +5 -3
  93. package/umd/typings/execution/LlmExecutionTools.d.ts +4 -2
  94. package/umd/typings/execution/PromptResult.d.ts +5 -1
  95. package/umd/typings/execution/ScriptExecutionTools.d.ts +2 -1
  96. package/umd/typings/execution/UserInterfaceTools.d.ts +2 -1
  97. package/umd/typings/execution/createPromptbookExecutor.d.ts +3 -3
  98. package/umd/typings/execution/plugins/llm-execution-tools/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +4 -3
  99. package/umd/typings/execution/plugins/llm-execution-tools/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  100. package/umd/typings/execution/plugins/llm-execution-tools/azure-openai/AzureOpenAiExecutionTools.d.ts +4 -3
  101. package/umd/typings/execution/plugins/llm-execution-tools/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +2 -1
  102. package/umd/typings/execution/plugins/llm-execution-tools/langtail/LangtailExecutionTools.d.ts +0 -3
  103. package/umd/typings/execution/plugins/llm-execution-tools/mocked/MockedEchoLlmExecutionTools.d.ts +4 -2
  104. package/umd/typings/execution/plugins/llm-execution-tools/mocked/MockedFackedLlmExecutionTools.d.ts +4 -2
  105. package/umd/typings/execution/plugins/llm-execution-tools/mocked/fakeTextToExpectations.d.ts +1 -1
  106. package/umd/typings/execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionTools.d.ts +4 -2
  107. package/umd/typings/execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionToolsOptions.d.ts +2 -1
  108. package/umd/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionTools.d.ts +5 -3
  109. package/umd/typings/execution/plugins/llm-execution-tools/openai/OpenAiExecutionToolsOptions.d.ts +1 -1
  110. package/umd/typings/execution/plugins/llm-execution-tools/openai/openai-models.d.ts +1 -1
  111. package/umd/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionTools.d.ts +5 -3
  112. package/umd/typings/execution/plugins/llm-execution-tools/remote/RemoteLlmExecutionToolsOptions.d.ts +2 -1
  113. package/umd/typings/execution/plugins/llm-execution-tools/remote/interfaces/Promptbook_Server_Progress.d.ts +1 -1
  114. package/umd/typings/execution/plugins/llm-execution-tools/remote/interfaces/Promptbook_Server_Response.d.ts +1 -1
  115. package/umd/typings/execution/plugins/llm-execution-tools/remote/interfaces/RemoteServerOptions.d.ts +2 -1
  116. package/umd/typings/execution/plugins/llm-execution-tools/remote/startRemoteServer.d.ts +2 -1
  117. package/umd/typings/execution/plugins/script-execution-tools/python/PythonExecutionTools.d.ts +3 -2
  118. package/umd/typings/execution/plugins/script-execution-tools/typescript/TypescriptExecutionTools.d.ts +3 -2
  119. package/umd/typings/execution/plugins/user-interface-execution-tools/callback/CallbackInterfaceTools.d.ts +3 -2
  120. package/umd/typings/execution/plugins/user-interface-execution-tools/simple-prompt/SimplePromptInterfaceTools.d.ts +3 -2
  121. package/umd/typings/execution/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +1 -1
  122. package/umd/typings/execution/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +1 -1
  123. package/umd/typings/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +2 -2
  124. package/umd/typings/execution/translation/automatic-translate/translateMessages.d.ts +2 -2
  125. package/umd/typings/execution/utils/forEachAsync.d.ts +18 -0
  126. package/umd/typings/execution/utils/replaceParameters.d.ts +2 -2
  127. package/umd/typings/library/SimplePromptbookLibrary.d.ts +1 -1
  128. package/umd/typings/library/constructors/createPromptbookLibraryFromDirectory.d.ts +30 -6
  129. package/umd/typings/library/constructors/createPromptbookLibraryFromDirectory.test.d.ts +1 -0
  130. package/umd/typings/library/constructors/createPromptbookLibraryFromPromise.d.ts +4 -4
  131. package/umd/typings/library/constructors/createPromptbookLibraryFromPromise.test.d.ts +1 -0
  132. package/umd/typings/library/constructors/createPromptbookLibraryFromSources.d.ts +2 -1
  133. package/umd/typings/library/constructors/createPromptbookLibraryFromSources.test.d.ts +1 -0
  134. package/umd/typings/library/constructors/createPromptbookLibraryFromUrl.d.ts +23 -6
  135. package/umd/typings/library/constructors/createPromptbookSublibrary.d.ts +1 -1
  136. package/umd/typings/library/constructors/justTestFsImport.d.ts +7 -0
  137. package/umd/typings/types/Command.d.ts +5 -2
  138. package/umd/typings/types/Prompt.d.ts +5 -2
  139. package/umd/typings/types/PromptbookJson/PromptTemplateJson.d.ts +8 -1
  140. package/umd/typings/types/PromptbookJson/PromptbookJson.d.ts +2 -1
  141. package/umd/typings/types/TaskProgress.d.ts +2 -1
  142. package/umd/typings/types/execution-report/ExecutionReportJson.d.ts +2 -1
  143. package/umd/typings/types/execution-report/countWorkingDuration.d.ts +1 -1
  144. package/umd/typings/types/typeAliases.d.ts +2 -2
  145. package/umd/typings/utils/emojis.d.ts +1 -1
  146. package/umd/typings/utils/expectation-counters/index.d.ts +2 -1
  147. package/umd/typings/utils/extractParameters.d.ts +2 -1
  148. package/umd/typings/utils/markdown/addAutoGeneratedSection.d.ts +2 -1
  149. package/umd/typings/utils/markdown/createMarkdownChart.d.ts +2 -2
  150. package/umd/typings/utils/markdown/createMarkdownTable.d.ts +2 -1
  151. package/umd/typings/utils/markdown/escapeMarkdownBlock.d.ts +1 -1
  152. package/umd/typings/utils/markdown/extractAllListItemsFromMarkdown.d.ts +2 -1
  153. package/umd/typings/utils/markdown/extractOneBlockFromMarkdown.d.ts +2 -2
  154. package/umd/typings/utils/markdown/removeContentComments.d.ts +2 -1
  155. package/umd/typings/utils/markdown/removeMarkdownFormatting.d.ts +1 -1
  156. package/umd/typings/utils/markdown-json/countMarkdownStructureDeepness.d.ts +1 -1
  157. package/umd/typings/utils/markdown-json/markdownToMarkdownStructure.d.ts +1 -1
  158. package/umd/typings/utils/normalization/isValidKeyword.d.ts +1 -1
  159. package/umd/typings/utils/normalization/parseKeywords.d.ts +1 -1
  160. package/umd/typings/utils/normalization/parseKeywordsFromString.d.ts +1 -1
  161. package/umd/typings/utils/normalization/searchKeywords.d.ts +1 -1
  162. package/umd/typings/utils/postprocessing/extractBlock.d.ts +1 -1
  163. package/esm/typings/wizzard/Wizzard.d.ts +0 -4
  164. package/esm/typings/wizzard/sample.d.ts +0 -6
  165. package/umd/typings/wizzard/Wizzard.d.ts +0 -4
  166. package/umd/typings/wizzard/sample.d.ts +0 -6
@@ -1,5 +1,5 @@
1
- import { string_folder_path } from '../../types/typeAliases';
2
- import { PromptbookLibrary } from '../PromptbookLibrary';
1
+ import type { string_folder_path } from '../../types/typeAliases';
2
+ import type { PromptbookLibrary } from '../PromptbookLibrary';
3
3
  /**
4
4
  * Options for `createPromptbookLibraryFromDirectory` function
5
5
  */
@@ -10,20 +10,44 @@ type CreatePromptbookLibraryFromDirectoryOptions = {
10
10
  * @default true
11
11
  */
12
12
  isRecursive?: boolean;
13
+ /**
14
+ * If true, the library creation outputs information about each file it reads
15
+ *
16
+ * @default false
17
+ */
18
+ isVerbose?: boolean;
19
+ /**
20
+ * If true, directory will be scanned only when needed not during the construction
21
+ *
22
+ * @default false
23
+ */
24
+ isLazyLoaded?: boolean;
25
+ /**
26
+ * If true, whole library creation crashes on error in any promptbook
27
+ * If true and isLazyLoaded is true, the error is thrown on first access to the promptbook
28
+ *
29
+ * @default true
30
+ */
31
+ isCrashOnError?: boolean;
13
32
  };
14
33
  /**
15
34
  * Constructs Promptbook from given directory
16
35
  *
17
36
  * Note: Works only in Node.js environment because it reads the file system
18
- * Note: The function does NOT return promise it returns the library directly which dynamically loads promptbooks when needed
19
- * SO during the construction syntax and logic sources IS NOT validated
20
37
  *
21
38
  * @param path - path to the directory with promptbooks
22
39
  * @param options - Misc options for the library
23
40
  * @returns PromptbookLibrary
24
41
  */
25
- export declare function createPromptbookLibraryFromDirectory(path: string_folder_path, options?: CreatePromptbookLibraryFromDirectoryOptions): PromptbookLibrary;
42
+ export declare function createPromptbookLibraryFromDirectory(path: string_folder_path, options?: CreatePromptbookLibraryFromDirectoryOptions): Promise<PromptbookLibrary>;
26
43
  export {};
27
44
  /***
28
- * TODO: [🍓][🚯] !!! Add to README and samples + maybe make `@promptbook/library` package
45
+ * TODO: [🧠] Maybe do not do hacks like [1] and just create package @promptbook/node
46
+ * [🍓][🚯] maybe make `@promptbook/library` package
47
+ * TODO: Fix the dynamic import issue in Webpack (! Not working !)
48
+ * > ./node_modules/@promptbook/core/esm/index.es.js
49
+ * > Critical dependency: the request of a dependency is an expression
50
+ *
51
+ * Note: [1] Using require(just('fs/promises')) to allow
52
+ * the `@promptbook/core` work for both Node.js and browser environments
29
53
  */
@@ -1,6 +1,6 @@
1
1
  import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
2
- import { PromptbookString } from '../../types/PromptbookString';
3
- import { PromptbookLibrary } from '../PromptbookLibrary';
2
+ import type { PromptbookString } from '../../types/PromptbookString';
3
+ import type { PromptbookLibrary } from '../PromptbookLibrary';
4
4
  /**
5
5
  * Constructs Promptbook from async sources
6
6
  * It can be one of the following:
@@ -14,11 +14,11 @@ import { PromptbookLibrary } from '../PromptbookLibrary';
14
14
  * Note: The function does NOT return promise it returns the library directly which waits for the sources to be resolved
15
15
  * when error occurs in given promise or factory function, it is thrown during `listPromptbooks` or `getPromptbookByUrl` call
16
16
  *
17
+ * Note: Consider using `createPromptbookLibraryFromDirectory` or `createPromptbookLibraryFromUrl`
17
18
  *
18
19
  * @param promptbookSourcesPromiseOrFactory
19
20
  * @returns PromptbookLibrary
20
- *
21
- * @deprecated Consider using `createPromptbookLibraryFromUrl` or `createPromptbookLibraryFromDirectory`
21
+ * @private Just internal tool for other constructor functions
22
22
  */
23
23
  export declare function createPromptbookLibraryFromPromise(promptbookSourcesPromiseOrFactory: Promise<Array<PromptbookJson | PromptbookString>> | (() => Promise<Array<PromptbookJson | PromptbookString>>)): PromptbookLibrary;
24
24
  /***
@@ -1,4 +1,5 @@
1
- import { PromptbookJson, PromptbookString } from '../../_packages/types.index';
1
+ import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
2
+ import type { PromptbookString } from '../../types/PromptbookString';
2
3
  import { SimplePromptbookLibrary } from '../SimplePromptbookLibrary';
3
4
  /**
4
5
  * Creates PromptbookLibrary from array of PromptbookJson or PromptbookString
@@ -1,13 +1,30 @@
1
- import { PromptbookLibrary } from '../PromptbookLibrary';
1
+ import type { string_url } from '../../types/typeAliases';
2
+ import type { PromptbookLibrary } from '../PromptbookLibrary';
3
+ /**
4
+ * Options for `createPromptbookLibraryFromDirectory` function
5
+ */
6
+ type CreatePromptbookLibraryFromUrlyOptions = {
7
+ /**
8
+ * If true, the library creation outputs information about each file it reads
9
+ *
10
+ * @default false
11
+ */
12
+ isVerbose?: boolean;
13
+ /**
14
+ * If true, directory will be scanned only when needed not during the construction
15
+ *
16
+ * @default false
17
+ */
18
+ isLazyLoaded?: boolean;
19
+ };
2
20
  /**
3
21
  * Constructs Promptbook from remote Promptbase URL
4
- *
5
- * Note: The function does NOT return promise it returns the library directly which dynamically loads promptbooks when needed
6
- * SO during the construction syntax and logic sources IS NOT validated
7
- *
22
+
8
23
  * @returns PromptbookLibrary
9
24
  */
10
- export declare function createPromptbookLibraryFromUrl(): PromptbookLibrary;
25
+ export declare function createPromptbookLibraryFromUrl(url: string_url | URL, options: CreatePromptbookLibraryFromUrlyOptions): Promise<PromptbookLibrary>;
26
+ export {};
11
27
  /***
28
+ * TODO: [⚖] Compatible with remote server
12
29
  * TODO: [🍓][🚯] !!! Add to README and samples + maybe make `@promptbook/library` package
13
30
  */
@@ -1,5 +1,5 @@
1
1
  import type { string_promptbook_url } from '../../types/typeAliases';
2
- import { PromptbookLibrary } from '../PromptbookLibrary';
2
+ import type { PromptbookLibrary } from '../PromptbookLibrary';
3
3
  /**
4
4
  * Creates PromptbookLibrary as a subset of another PromptbookLibrary
5
5
  *
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Just testing imports and compatibility
3
+ */
4
+ export declare function justTestFsImport(): Promise<void>;
5
+ /**
6
+ * TODO: !!! Remove this file
7
+ */
@@ -1,7 +1,10 @@
1
- import type { string_markdown_text, string_name, string_version } from '.././types/typeAliases';
1
+ import type { string_markdown_text } from './typeAliases';
2
+ import type { string_name } from './typeAliases';
3
+ import type { string_version } from './typeAliases';
2
4
  import type { ExecutionType } from './ExecutionTypes';
3
5
  import type { ModelRequirements } from './ModelRequirements';
4
- import type { ExpectationAmount, ExpectationUnit } from './PromptbookJson/PromptTemplateJson';
6
+ import type { ExpectationAmount } from './PromptbookJson/PromptTemplateJson';
7
+ import type { ExpectationUnit } from './PromptbookJson/PromptTemplateJson';
5
8
  /**
6
9
  * Command is one piece of the prompt template which adds some logic to the prompt template or the whole pipeline.
7
10
  * It is parsed from the markdown from ul/ol items - one command per one item.
@@ -1,4 +1,7 @@
1
- import type { string_name, string_prompt, string_promptbook_url_with_hashtemplate, string_title } from '.././types/typeAliases';
1
+ import type { string_name } from './typeAliases';
2
+ import type { string_prompt } from './typeAliases';
3
+ import type { string_promptbook_url_with_hashtemplate } from './typeAliases';
4
+ import type { string_title } from './typeAliases';
2
5
  import type { PostprocessingFunction } from '../execution/plugins/script-execution-tools/javascript/JavascriptExecutionToolsOptions';
3
6
  import type { ModelRequirements } from './ModelRequirements';
4
7
  import type { Expectations } from './PromptbookJson/PromptTemplateJson';
@@ -39,7 +42,7 @@ export type Prompt = {
39
42
  /**
40
43
  * Unique identifier of the promptbook with specific template name as hash
41
44
  *
42
- * @example https://promptbook.webgpt.com/cs/write-website-content.ptbk.md@v2.4.15#keywords
45
+ * @example https://promptbook.webgpt.com/cs/write-website-content.ptbk.md#keywords
43
46
  */
44
47
  readonly promptbookUrl: string_promptbook_url_with_hashtemplate;
45
48
  /**
@@ -2,7 +2,14 @@ import type { ExpectFormatCommand } from '../Command';
2
2
  import type { ExecutionType } from '../ExecutionTypes';
3
3
  import type { ModelRequirements } from '../ModelRequirements';
4
4
  import type { ScriptLanguage } from '../ScriptLanguage';
5
- import type { number_integer, number_positive_or_zero, string_javascript, string_javascript_name, string_markdown, string_name, string_prompt, string_template } from '../typeAliases';
5
+ import type { number_integer } from '../typeAliases';
6
+ import type { number_positive_or_zero } from '../typeAliases';
7
+ import type { string_javascript } from '../typeAliases';
8
+ import type { string_javascript_name } from '../typeAliases';
9
+ import type { string_markdown } from '../typeAliases';
10
+ import type { string_name } from '../typeAliases';
11
+ import type { string_prompt } from '../typeAliases';
12
+ import type { string_template } from '../typeAliases';
6
13
  /**
7
14
  * Describes one prompt template in the promptbook
8
15
  */
@@ -1,4 +1,5 @@
1
- import type { string_promptbook_url, string_version } from '../typeAliases';
1
+ import type { string_promptbook_url } from '../typeAliases';
2
+ import type { string_version } from '../typeAliases';
2
3
  import type { PromptTemplateJson } from './PromptTemplateJson';
3
4
  import type { PromptTemplateParameterJson } from './PromptTemplateParameterJson';
4
5
  /**
@@ -1,5 +1,6 @@
1
1
  import type { ExecutionType } from './ExecutionTypes';
2
- import type { string_markdown_text, string_name } from './typeAliases';
2
+ import type { string_markdown_text } from './typeAliases';
3
+ import type { string_name } from './typeAliases';
3
4
  /**
4
5
  * TaskProgress represents the progress of a Promptbook execution.
5
6
  */
@@ -1,6 +1,7 @@
1
1
  import type { PromptResult } from '../../execution/PromptResult';
2
2
  import type { Prompt } from '../Prompt';
3
- import type { string_promptbook_url, string_version } from '../typeAliases';
3
+ import type { string_promptbook_url } from '../typeAliases';
4
+ import type { string_version } from '../typeAliases';
4
5
  /**
5
6
  * ExecutionReport is result of executing one promptbook
6
7
  * It is kind of a variant of the promptbook usefull for debugging, logging and transparency for users.
@@ -1,4 +1,4 @@
1
- import { FromtoItems } from '../../utils/FromtoItems';
1
+ import type { FromtoItems } from '../../utils/FromtoItems';
2
2
  /**
3
3
  * Count the duration of working time
4
4
  *
@@ -179,13 +179,13 @@ export type string_url = string;
179
179
  /**
180
180
  * Semantic helper
181
181
  *
182
- * For example `"https://promptbook.webgpt.com/cs/write-website-content.ptbk.md@v2.4.15"`
182
+ * For example `"https://promptbook.webgpt.com/cs/write-website-content.ptbk.md"`
183
183
  */
184
184
  export type string_promptbook_url = string;
185
185
  /**
186
186
  * Semantic helper
187
187
  *
188
- * For example `"https://promptbook.webgpt.com/cs/write-website-content.ptbk.md@v2.4.15#keywords"`
188
+ * For example `"https://promptbook.webgpt.com/cs/write-website-content.ptbk.md#keywords"`
189
189
  */
190
190
  export type string_promptbook_url_with_hashtemplate = string;
191
191
  /**
@@ -1,4 +1,4 @@
1
- import { string_char_emoji } from '../types/typeAliasEmoji';
1
+ import type { string_char_emoji } from '../types/typeAliasEmoji';
2
2
  /**
3
3
  * All possible emoji chars like "🍆", "🍡", "🍤"...
4
4
  * Note: this will be needed to update annually - now updated at 2022-01-19
@@ -1,4 +1,5 @@
1
- import type { ExpectationAmount, ExpectationUnit } from '../../types/PromptbookJson/PromptTemplateJson';
1
+ import type { ExpectationAmount } from '../../types/PromptbookJson/PromptTemplateJson';
2
+ import type { ExpectationUnit } from '../../types/PromptbookJson/PromptTemplateJson';
2
3
  /**
3
4
  * Index of all counter functions
4
5
  */
@@ -1,4 +1,5 @@
1
- import { string_name, string_template } from '../types/typeAliases';
1
+ import type { string_name } from '../types/typeAliases';
2
+ import type { string_template } from '../types/typeAliases';
2
3
  /**
3
4
  * Parses the template and returns the list of all parameter names
4
5
  *
@@ -1,4 +1,5 @@
1
- import type { string_markdown, string_name } from '../../types/typeAliases';
1
+ import type { string_markdown } from '../../types/typeAliases';
2
+ import type { string_name } from '../../types/typeAliases';
2
3
  /**
3
4
  * Add or modify an auto-generated section in a markdown file
4
5
  *
@@ -1,5 +1,5 @@
1
- import { string_markdown } from '../../types/typeAliases';
2
- import { FromtoItems } from '../FromtoItems';
1
+ import type { string_markdown } from '../../types/typeAliases';
2
+ import type { FromtoItems } from '../FromtoItems';
3
3
  /**
4
4
  * Options for creating a markdown chart
5
5
  */
@@ -1,4 +1,5 @@
1
- import { string_markdown, string_markdown_text } from '../../types/typeAliases';
1
+ import type { string_markdown } from '../../types/typeAliases';
2
+ import type { string_markdown_text } from '../../types/typeAliases';
2
3
  /**
3
4
  * Create a markdown table from a 2D array of strings
4
5
  *
@@ -1,4 +1,4 @@
1
- import { string_markdown_text } from '../../types/typeAliases';
1
+ import type { string_markdown_text } from '../../types/typeAliases';
2
2
  /**
3
3
  * Function escapeMarkdownBlock will escape markdown block if needed
4
4
  * It is useful when you want have block in block
@@ -1,4 +1,5 @@
1
- import { string_markdown, string_markdown_text } from '../.././types/typeAliases';
1
+ import type { string_markdown } from '../../types/typeAliases';
2
+ import type { string_markdown_text } from '../../types/typeAliases';
2
3
  /**
3
4
  * Utility function to extract all list items from markdown
4
5
  *
@@ -1,5 +1,5 @@
1
- import { string_markdown } from '../.././types/typeAliases';
2
- import { CodeBlock } from './extractAllBlocksFromMarkdown';
1
+ import type { string_markdown } from '../../types/typeAliases';
2
+ import type { CodeBlock } from './extractAllBlocksFromMarkdown';
3
3
  /**
4
4
  * Extracts exactly ONE code block from markdown.
5
5
  *
@@ -1,4 +1,5 @@
1
- import { string_html, string_markdown } from '../../types/typeAliases';
1
+ import type { string_html } from '../../types/typeAliases';
2
+ import type { string_markdown } from '../../types/typeAliases';
2
3
  /**
3
4
  * Removes HTML or Markdown comments from a string.
4
5
  *
@@ -1,4 +1,4 @@
1
- import { string_markdown_text } from '../../types/typeAliases';
1
+ import type { string_markdown_text } from '../../types/typeAliases';
2
2
  /**
3
3
  * Removes Markdown formatting tags from a string.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { MarkdownStructure } from './MarkdownStructure';
1
+ import type { MarkdownStructure } from './MarkdownStructure';
2
2
  /**
3
3
  * Computes the deepness of the markdown structure.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { MarkdownStructure } from './MarkdownStructure';
1
+ import type { MarkdownStructure } from './MarkdownStructure';
2
2
  /**
3
3
  * Parse a markdown string into a MarkdownStructure object.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { string_keyword } from './IKeywords';
1
+ import type { string_keyword } from './IKeywords';
2
2
  /**
3
3
  * Tests if keyword is valid
4
4
  *
@@ -1,4 +1,4 @@
1
- import { IKeywords } from './IKeywords';
1
+ import type { IKeywords } from './IKeywords';
2
2
  /**
3
3
  * Parses keywords from any object and recursively walks through
4
4
  *
@@ -1,4 +1,4 @@
1
- import { IKeywords } from './IKeywords';
1
+ import type { IKeywords } from './IKeywords';
2
2
  /**
3
3
  * Parses keywords from a string
4
4
  *
@@ -1,4 +1,4 @@
1
- import { IKeywords } from './IKeywords';
1
+ import type { IKeywords } from './IKeywords';
2
2
  /**
3
3
  *
4
4
  */
@@ -1,4 +1,4 @@
1
- import { string_markdown } from '../../types/typeAliases';
1
+ import type { string_markdown } from '../../types/typeAliases';
2
2
  /**
3
3
  * Extracts code block from markdown.
4
4
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/types",
3
- "version": "0.52.0-9",
3
+ "version": "0.53.0",
4
4
  "description": "Library to supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -45,7 +45,7 @@
45
45
  }
46
46
  ],
47
47
  "peerDependencies": {
48
- "@promptbook/core": "0.52.0-9"
48
+ "@promptbook/core": "0.53.0"
49
49
  },
50
50
  "main": "./umd/index.umd.js",
51
51
  "module": "./esm/index.es.js",
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","sources":["../../../src/types/PromptbookJson/PromptTemplateJson.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;IA4CA;;;QAGa,iBAAiB,GAAG,CAAC,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAW;IAmH/G;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.umd.js","sources":["../../../src/types/PromptbookJson/PromptTemplateJson.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;IA0CA;;;QAGa,iBAAiB,GAAG,CAAC,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAW;IAmH/G;;;;;;;;;;;;;;"}
@@ -10,17 +10,19 @@ import { CallbackInterfaceToolsOptions } from '../execution/plugins/user-interfa
10
10
  import { SimplePromptInterfaceTools } from '../execution/plugins/user-interface-execution-tools/simple-prompt/SimplePromptInterfaceTools';
11
11
  import { checkExpectations, isPassingExpectations } from '../execution/utils/checkExpectations';
12
12
  import { createPromptbookLibraryFromDirectory } from '../library/constructors/createPromptbookLibraryFromDirectory';
13
- import { createPromptbookLibraryFromPromise } from '../library/constructors/createPromptbookLibraryFromPromise';
14
13
  import { createPromptbookLibraryFromSources } from '../library/constructors/createPromptbookLibraryFromSources';
14
+ import { createPromptbookLibraryFromUrl } from '../library/constructors/createPromptbookLibraryFromUrl';
15
15
  import { createPromptbookSublibrary } from '../library/constructors/createPromptbookSublibrary';
16
+ import { justTestFsImport } from '../library/constructors/justTestFsImport';
16
17
  import { SimplePromptbookLibrary } from '../library/SimplePromptbookLibrary';
17
18
  import { executionReportJsonToString } from '../types/execution-report/executionReportJsonToString';
18
19
  import { ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults } from '../types/execution-report/ExecutionReportStringOptions';
19
20
  import { ExecutionTypes } from '../types/ExecutionTypes';
20
21
  import { PROMPTBOOK_VERSION } from '../version';
22
+ export { justTestFsImport };
21
23
  export { ExecutionTypes, PROMPTBOOK_VERSION };
22
24
  export { assertsExecutionSuccessful, checkExpectations, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, isPassingExpectations, prettifyPromptbookString, };
23
- export { createPromptbookLibraryFromDirectory, createPromptbookLibraryFromPromise, createPromptbookLibraryFromSources, createPromptbookSublibrary, SimplePromptbookLibrary, };
25
+ export { createPromptbookLibraryFromDirectory, createPromptbookLibraryFromSources, createPromptbookLibraryFromUrl, createPromptbookSublibrary, SimplePromptbookLibrary, };
24
26
  export { SimplePromptInterfaceTools };
25
27
  export { promptbookJsonToString, promptbookStringToJson, validatePromptbookJson };
26
28
  export { createPromptbookExecutor, MultipleLlmExecutionTools };
@@ -5,6 +5,7 @@ import { extractVariables } from '../conversion/utils/extractVariables';
5
5
  import { parseNumber } from '../conversion/utils/parseNumber';
6
6
  import { renameParameter } from '../conversion/utils/renameParameter';
7
7
  import { titleToName } from '../conversion/utils/titleToName';
8
+ import { forEachAsync } from '../execution/utils/forEachAsync';
8
9
  import { replaceParameters } from '../execution/utils/replaceParameters';
9
10
  import { CountUtils } from '../utils/expectation-counters';
10
11
  import { countCharacters } from '../utils/expectation-counters/countCharacters';
@@ -46,6 +47,7 @@ import { union } from '../utils/sets/union';
46
47
  import { trimCodeBlock } from '../utils/trimCodeBlock';
47
48
  import { trimEndOfCodeBlock } from '../utils/trimEndOfCodeBlock';
48
49
  import { unwrapResult } from '../utils/unwrapResult';
50
+ export { forEachAsync };
49
51
  export { extractAllBlocksFromMarkdown, // <- [🌻]
50
52
  extractAllListItemsFromMarkdown, extractBlock, // <- [🌻]
51
53
  extractOneBlockFromMarkdown, extractParameters, extractVariables, isValidJsonString, parseNumber, // <- [🌻]
@@ -1,4 +1,4 @@
1
- import { PromptbookString } from '../../types/PromptbookString';
1
+ import type { PromptbookString } from '../../types/PromptbookString';
2
2
  import type { PrettifyOptions } from './PrettifyOptions';
3
3
  /**
4
4
  * Prettyfies Promptbook string and adds Mermaid graph
@@ -1,4 +1,5 @@
1
- import type { PromptbookJson, PromptTemplateJson } from '../../_packages/types.index';
1
+ import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
2
+ import type { PromptTemplateJson } from '../../types/PromptbookJson/PromptTemplateJson';
2
3
  import type { string_href } from '../../types/typeAliases';
3
4
  /**
4
5
  * Addtional options for rendering Mermaid graph
@@ -1,5 +1,5 @@
1
- import { PromptTemplateJson } from '../../types/PromptbookJson/PromptTemplateJson';
2
- import { string_name } from '../../types/typeAliases';
1
+ import type { PromptTemplateJson } from '../../types/PromptbookJson/PromptTemplateJson';
2
+ import type { string_name } from '../../types/typeAliases';
3
3
  /**
4
4
  * Parses the prompt template and returns the set of all used parameters
5
5
  *
@@ -10,4 +10,4 @@ import { string_name } from '../../types/typeAliases';
10
10
  export declare function extractParametersFromPromptTemplate(promptTemplate: Pick<PromptTemplateJson, 'title' | 'description' | 'executionType' | 'content'>): Set<string_name>;
11
11
  /**
12
12
  * TODO: [🔣] If script require contentLanguage
13
- */
13
+ */
@@ -1,4 +1,5 @@
1
- import { string_javascript, string_javascript_name } from '../../types/typeAliases';
1
+ import type { string_javascript } from '../../types/typeAliases';
2
+ import type { string_javascript_name } from '../../types/typeAliases';
2
3
  /**
3
4
  * Parses the given script and returns the list of all used variables that are not defined in the script
4
5
  *
@@ -1,5 +1,5 @@
1
- import { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
2
- import { PromptbookString } from '../../types/PromptbookString';
1
+ import type { PromptbookJson } from '../../types/PromptbookJson/PromptbookJson';
2
+ import type { PromptbookString } from '../../types/PromptbookString';
3
3
  /**
4
4
  * Import the text file
5
5
  *
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This error indicates that the promptbook library cannot be propperly loaded
3
+ */
4
+ export declare class PromptbookLibraryError extends Error {
5
+ readonly name = "PromptbookLibraryError";
6
+ constructor(message: string);
7
+ }
@@ -9,6 +9,9 @@ import type { UserInterfaceTools } from './UserInterfaceTools';
9
9
  export type ExecutionTools = {
10
10
  /**
11
11
  * Tools for executing prompts to large language models like GPT-4
12
+ *
13
+ * Tip: Combine multiple LLM execution tools with `MultipleLlmExecutionTools`
14
+ * @see https://github.com/webgptorg/promptbook/?tab=readme-ov-file#llm-execution-tools
12
15
  */
13
16
  llm: LlmExecutionTools;
14
17
  /**
@@ -16,15 +19,14 @@ export type ExecutionTools = {
16
19
  *
17
20
  * Note: You can pass multiple ScriptExecutionTools, they will be tried one by one until one of them supports the script
18
21
  * If none of them supports the script, an error is thrown
22
+ * @see https://github.com/webgptorg/promptbook/?tab=readme-ov-file#script-execution-tools
19
23
  */
20
24
  script: Array<ScriptExecutionTools>;
21
25
  /**
22
26
  * Tools for interacting with the user
23
27
  *
24
28
  * Note: When undefined, the user interface is disabled and promptbook which requires user interaction will fail
29
+ * @see https://github.com/webgptorg/promptbook/?tab=readme-ov-file#user-interface-tools
25
30
  */
26
31
  userInterface?: UserInterfaceTools;
27
32
  };
28
- /**
29
- * TODO: [🍓] !!!! Allow to have more LlmExecutionTools
30
- */
@@ -1,8 +1,10 @@
1
1
  import type { Promisable } from 'type-fest';
2
2
  import type { ModelVariant } from '../types/ModelRequirements';
3
3
  import type { Prompt } from '../types/Prompt';
4
- import type { string_model_name, string_title } from '../types/typeAliases';
5
- import type { PromptChatResult, PromptCompletionResult } from './PromptResult';
4
+ import type { string_model_name } from '../types/typeAliases';
5
+ import type { string_title } from '../types/typeAliases';
6
+ import type { PromptChatResult } from './PromptResult';
7
+ import type { PromptCompletionResult } from './PromptResult';
6
8
  /**
7
9
  * Container for all the tools needed to execute prompts to large language models like GPT-4
8
10
  * On its interface it exposes common methods for prompt execution.
@@ -1,4 +1,8 @@
1
- import type { number_positive_or_zero, number_tokens, number_usd, string_date_iso8601, string_model_name } from '.././types/typeAliases';
1
+ import type { number_positive_or_zero } from '../types/typeAliases';
2
+ import type { number_tokens } from '../types/typeAliases';
3
+ import type { number_usd } from '../types/typeAliases';
4
+ import type { string_date_iso8601 } from '../types/typeAliases';
5
+ import type { string_model_name } from '../types/typeAliases';
2
6
  /**
3
7
  * Prompt result is the simplest concept of execution.
4
8
  * It is the result of executing one prompt _(NOT a template)_.
@@ -1,4 +1,5 @@
1
- import type { string_name, string_script } from '.././types/typeAliases';
1
+ import type { string_name } from '../types/typeAliases';
2
+ import type { string_script } from '../types/typeAliases';
2
3
  import type { ScriptLanguage } from '../types/ScriptLanguage';
3
4
  /**
4
5
  * Represents all the tools needed to EXECUTE SCRIPTs
@@ -1,4 +1,5 @@
1
- import type { number_integer, number_positive } from '../types/typeAliases';
1
+ import type { number_integer } from '../types/typeAliases';
2
+ import type { number_positive } from '../types/typeAliases';
2
3
  /**
3
4
  * Represents all the tools needed to interact with the user.
4
5
  *
@@ -1,6 +1,6 @@
1
- import { PromptbookJson } from '../_packages/types.index';
2
- import { ExecutionTools } from './ExecutionTools';
3
- import { PromptbookExecutor } from './PromptbookExecutor';
1
+ import type { PromptbookJson } from '../types/PromptbookJson/PromptbookJson';
2
+ import type { ExecutionTools } from './ExecutionTools';
3
+ import type { PromptbookExecutor } from './PromptbookExecutor';
4
4
  type CreatePromptbookExecutorSettings = {
5
5
  /**
6
6
  * When executor does not satisfy expectations it will be retried this amount of times