@promptbook/node 0.92.0-3 → 0.92.0-31

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 (172) hide show
  1. package/esm/index.es.js +796 -426
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/browser.index.d.ts +2 -0
  4. package/esm/typings/src/_packages/core.index.d.ts +22 -6
  5. package/esm/typings/src/_packages/deepseek.index.d.ts +2 -0
  6. package/esm/typings/src/_packages/google.index.d.ts +2 -0
  7. package/esm/typings/src/_packages/types.index.d.ts +4 -2
  8. package/esm/typings/src/_packages/utils.index.d.ts +2 -0
  9. package/esm/typings/src/cli/common/$provideLlmToolsForCli.d.ts +1 -1
  10. package/esm/typings/src/collection/PipelineCollection.d.ts +0 -2
  11. package/esm/typings/src/collection/SimplePipelineCollection.d.ts +1 -1
  12. package/esm/typings/src/commands/FOREACH/ForeachJson.d.ts +6 -6
  13. package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +0 -2
  14. package/esm/typings/src/commands/FORMFACTOR/formfactorCommandParser.d.ts +1 -1
  15. package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -1
  16. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +36 -28
  17. package/esm/typings/src/config.d.ts +41 -11
  18. package/esm/typings/src/constants.d.ts +43 -2
  19. package/esm/typings/src/conversion/archive/loadArchive.d.ts +2 -2
  20. package/esm/typings/src/errors/0-BoilerplateError.d.ts +2 -2
  21. package/esm/typings/src/executables/$provideExecutablesForNode.d.ts +1 -1
  22. package/esm/typings/src/executables/apps/locateLibreoffice.d.ts +2 -1
  23. package/esm/typings/src/executables/apps/locatePandoc.d.ts +2 -1
  24. package/esm/typings/src/executables/locateApp.d.ts +2 -2
  25. package/esm/typings/src/executables/platforms/locateAppOnLinux.d.ts +2 -1
  26. package/esm/typings/src/executables/platforms/locateAppOnMacOs.d.ts +2 -1
  27. package/esm/typings/src/executables/platforms/locateAppOnWindows.d.ts +2 -1
  28. package/esm/typings/src/execution/AbstractTaskResult.d.ts +1 -1
  29. package/esm/typings/src/execution/CommonToolsOptions.d.ts +5 -1
  30. package/esm/typings/src/execution/LlmExecutionToolsConstructor.d.ts +2 -1
  31. package/esm/typings/src/execution/PipelineExecutorResult.d.ts +4 -2
  32. package/esm/typings/src/execution/createPipelineExecutor/$OngoingTaskResult.d.ts +12 -9
  33. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +13 -10
  34. package/esm/typings/src/execution/createPipelineExecutor/20-executeTask.d.ts +12 -9
  35. package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +15 -3
  36. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +20 -14
  37. package/esm/typings/src/execution/createPipelineExecutor/computeCosineSimilarity.d.ts +13 -0
  38. package/esm/typings/src/execution/createPipelineExecutor/filterJustOutputParameters.d.ts +7 -6
  39. package/esm/typings/src/execution/createPipelineExecutor/getContextForTask.d.ts +5 -1
  40. package/esm/typings/src/execution/createPipelineExecutor/getExamplesForTask.d.ts +1 -1
  41. package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTask.d.ts +21 -5
  42. package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTask.d.ts +19 -5
  43. package/esm/typings/src/execution/createPipelineExecutor/knowledgePiecesToString.d.ts +9 -0
  44. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +4 -4
  45. package/esm/typings/src/execution/utils/checkExpectations.d.ts +1 -1
  46. package/esm/typings/src/execution/utils/uncertainNumber.d.ts +3 -2
  47. package/esm/typings/src/formats/_common/{FormatDefinition.d.ts → FormatParser.d.ts} +8 -6
  48. package/esm/typings/src/formats/_common/FormatSubvalueParser.d.ts +66 -0
  49. package/esm/typings/src/formats/csv/CsvFormatParser.d.ts +17 -0
  50. package/esm/typings/src/formats/csv/CsvSettings.d.ts +2 -2
  51. package/esm/typings/src/formats/csv/utils/csvParse.d.ts +12 -0
  52. package/esm/typings/src/formats/csv/utils/isValidCsvString.d.ts +1 -1
  53. package/esm/typings/src/formats/index.d.ts +2 -2
  54. package/esm/typings/src/formats/json/{JsonFormatDefinition.d.ts → JsonFormatParser.d.ts} +6 -6
  55. package/esm/typings/src/formats/json/utils/isValidJsonString.d.ts +1 -1
  56. package/esm/typings/src/formats/json/utils/jsonParse.d.ts +8 -0
  57. package/esm/typings/src/formats/text/{TextFormatDefinition.d.ts → TextFormatParser.d.ts} +7 -7
  58. package/esm/typings/src/formats/xml/XmlFormatParser.d.ts +19 -0
  59. package/esm/typings/src/formats/xml/utils/isValidXmlString.d.ts +1 -1
  60. package/esm/typings/src/formfactors/_boilerplate/BoilerplateFormfactorDefinition.d.ts +3 -2
  61. package/esm/typings/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +16 -7
  62. package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +3 -1
  63. package/esm/typings/src/formfactors/_common/string_formfactor_name.d.ts +2 -1
  64. package/esm/typings/src/formfactors/chatbot/ChatbotFormfactorDefinition.d.ts +2 -2
  65. package/esm/typings/src/formfactors/completion/CompletionFormfactorDefinition.d.ts +29 -0
  66. package/esm/typings/src/formfactors/generator/GeneratorFormfactorDefinition.d.ts +2 -1
  67. package/esm/typings/src/formfactors/generic/GenericFormfactorDefinition.d.ts +2 -2
  68. package/esm/typings/src/formfactors/index.d.ts +33 -8
  69. package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +4 -2
  70. package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +3 -2
  71. package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +3 -2
  72. package/esm/typings/src/high-level-abstractions/index.d.ts +2 -2
  73. package/esm/typings/src/llm-providers/_common/register/$llmToolsMetadataRegister.d.ts +3 -3
  74. package/esm/typings/src/llm-providers/_common/register/$llmToolsRegister.d.ts +3 -3
  75. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +4 -4
  76. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +4 -3
  77. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +17 -4
  78. package/esm/typings/src/llm-providers/_common/register/LlmToolsConfiguration.d.ts +11 -4
  79. package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +27 -5
  80. package/esm/typings/src/llm-providers/_common/register/LlmToolsOptions.d.ts +9 -2
  81. package/esm/typings/src/llm-providers/_common/register/createLlmToolsFromConfiguration.d.ts +12 -3
  82. package/esm/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +10 -5
  83. package/esm/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +5 -3
  84. package/esm/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +3 -3
  85. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +5 -5
  86. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  87. package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +4 -0
  88. package/esm/typings/src/llm-providers/deepseek/deepseek-models.d.ts +23 -0
  89. package/esm/typings/src/llm-providers/google/google-models.d.ts +23 -0
  90. package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +4 -0
  91. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
  92. package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +2 -2
  93. package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +2 -2
  94. package/esm/typings/src/migrations/migratePipeline.d.ts +9 -0
  95. package/esm/typings/src/other/templates/getBookTemplates.d.ts +2 -2
  96. package/esm/typings/src/personas/preparePersona.d.ts +1 -1
  97. package/esm/typings/src/pipeline/PipelineInterface/PipelineInterface.d.ts +3 -3
  98. package/esm/typings/src/pipeline/PipelineInterface/constants.d.ts +1 -1
  99. package/esm/typings/src/pipeline/PipelineInterface/getPipelineInterface.d.ts +1 -1
  100. package/esm/typings/src/pipeline/PipelineInterface/isPipelineImplementingInterface.d.ts +5 -4
  101. package/esm/typings/src/pipeline/PipelineInterface/isPipelineInterfacesEqual.d.ts +1 -1
  102. package/esm/typings/src/pipeline/PipelineJson/CommonTaskJson.d.ts +9 -6
  103. package/esm/typings/src/pipeline/PipelineJson/PersonaJson.d.ts +4 -2
  104. package/esm/typings/src/pipeline/PipelineJson/PipelineJson.d.ts +3 -2
  105. package/esm/typings/src/pipeline/PipelineString.d.ts +3 -1
  106. package/esm/typings/src/pipeline/book-notation.d.ts +2 -2
  107. package/esm/typings/src/postprocessing/utils/extractJsonBlock.d.ts +1 -1
  108. package/esm/typings/src/prepare/prepareTasks.d.ts +7 -4
  109. package/esm/typings/src/remote-server/openapi-types.d.ts +348 -6
  110. package/esm/typings/src/remote-server/openapi.d.ts +398 -4
  111. package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +2 -1
  112. package/esm/typings/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +3 -3
  113. package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +1 -1
  114. package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +1 -1
  115. package/esm/typings/src/scrapers/_common/Converter.d.ts +3 -1
  116. package/esm/typings/src/scrapers/_common/Scraper.d.ts +4 -3
  117. package/esm/typings/src/scrapers/_common/ScraperIntermediateSource.d.ts +4 -2
  118. package/esm/typings/src/scrapers/_common/register/$provideFilesystemForNode.d.ts +2 -1
  119. package/esm/typings/src/scrapers/_common/register/$provideScrapersForBrowser.d.ts +6 -3
  120. package/esm/typings/src/scrapers/_common/register/$provideScrapersForNode.d.ts +3 -5
  121. package/esm/typings/src/scrapers/_common/register/$scrapersMetadataRegister.d.ts +3 -3
  122. package/esm/typings/src/scrapers/_common/register/$scrapersRegister.d.ts +3 -2
  123. package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +8 -5
  124. package/esm/typings/src/scrapers/_common/register/ScraperConstructor.d.ts +2 -1
  125. package/esm/typings/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +6 -5
  126. package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +3 -1
  127. package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -1
  128. package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +2 -1
  129. package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +4 -1
  130. package/esm/typings/src/scrapers/markitdown/MarkitdownScraper.d.ts +1 -1
  131. package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +2 -1
  132. package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +3 -4
  133. package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +5 -1
  134. package/esm/typings/src/storage/file-cache-storage/FileCacheStorage.d.ts +12 -5
  135. package/esm/typings/src/storage/file-cache-storage/FileCacheStorageOptions.d.ts +4 -2
  136. package/esm/typings/src/storage/file-cache-storage/utils/nameToSubfolderPath.d.ts +2 -1
  137. package/esm/typings/src/storage/local-storage/getIndexedDbStorage.d.ts +10 -0
  138. package/esm/typings/src/storage/local-storage/utils/makePromptbookStorageFromIndexedDb.d.ts +7 -0
  139. package/esm/typings/src/storage/local-storage/utils/makePromptbookStorageFromWebStorage.d.ts +2 -1
  140. package/esm/typings/src/types/IntermediateFilesStrategy.d.ts +2 -1
  141. package/esm/typings/src/types/ModelVariant.d.ts +5 -5
  142. package/esm/typings/src/types/typeAliases.d.ts +17 -13
  143. package/esm/typings/src/utils/$Register.d.ts +8 -7
  144. package/esm/typings/src/utils/editable/edit-pipeline-string/addPipelineCommand.d.ts +2 -2
  145. package/esm/typings/src/utils/editable/edit-pipeline-string/deflatePipeline.d.ts +4 -1
  146. package/esm/typings/src/utils/editable/utils/isFlatPipeline.d.ts +2 -1
  147. package/esm/typings/src/utils/environment/$getGlobalScope.d.ts +2 -1
  148. package/esm/typings/src/utils/expectation-counters/index.d.ts +1 -1
  149. package/esm/typings/src/utils/markdown/extractAllListItemsFromMarkdown.d.ts +1 -1
  150. package/esm/typings/src/utils/normalization/nameToUriPart.d.ts +4 -4
  151. package/esm/typings/src/utils/normalization/nameToUriParts.d.ts +4 -4
  152. package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +3 -3
  153. package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +3 -3
  154. package/esm/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +4 -4
  155. package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +3 -3
  156. package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +3 -3
  157. package/esm/typings/src/utils/normalization/searchKeywords.d.ts +4 -1
  158. package/esm/typings/src/utils/normalization/titleToName.d.ts +4 -4
  159. package/esm/typings/src/utils/organization/empty_object.d.ts +2 -2
  160. package/esm/typings/src/utils/organization/just_empty_object.d.ts +4 -4
  161. package/esm/typings/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +7 -7
  162. package/esm/typings/src/utils/serialization/clonePipeline.d.ts +4 -3
  163. package/esm/typings/src/utils/serialization/deepClone.d.ts +5 -1
  164. package/esm/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +3 -3
  165. package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +5 -4
  166. package/esm/typings/src/version.d.ts +2 -1
  167. package/package.json +2 -2
  168. package/umd/index.umd.js +799 -429
  169. package/umd/index.umd.js.map +1 -1
  170. package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +0 -31
  171. package/esm/typings/src/formats/csv/CsvFormatDefinition.d.ts +0 -17
  172. package/esm/typings/src/formats/xml/XmlFormatDefinition.d.ts +0 -19
@@ -23,7 +23,7 @@ export declare const HIGH_LEVEL_ABSTRACTIONS: readonly [{
23
23
  path: string | null;
24
24
  content: import("../pipeline/PipelineString").PipelineString;
25
25
  }[];
26
- readonly formfactorName?: "CHATBOT" | "GENERATOR" | "GENERIC" | "IMAGE_GENERATOR" | "EXPERIMENTAL_MATCHER" | "SHEETS" | "TRANSLATOR" | undefined;
26
+ readonly formfactorName?: "CHATBOT" | "COMPLETION" | "GENERATOR" | "GENERIC" | "IMAGE_GENERATOR" | "EXPERIMENTAL_MATCHER" | "SHEETS" | "TRANSLATOR" | undefined;
27
27
  }>): void;
28
28
  }, {
29
29
  type: "SYNC";
@@ -45,7 +45,7 @@ export declare const HIGH_LEVEL_ABSTRACTIONS: readonly [{
45
45
  path: string | null;
46
46
  content: import("../pipeline/PipelineString").PipelineString;
47
47
  }[];
48
- readonly formfactorName?: "CHATBOT" | "GENERATOR" | "GENERIC" | "IMAGE_GENERATOR" | "EXPERIMENTAL_MATCHER" | "SHEETS" | "TRANSLATOR" | undefined;
48
+ readonly formfactorName?: "CHATBOT" | "COMPLETION" | "GENERATOR" | "GENERIC" | "IMAGE_GENERATOR" | "EXPERIMENTAL_MATCHER" | "SHEETS" | "TRANSLATOR" | undefined;
49
49
  }>): void;
50
50
  }];
51
51
  /**
@@ -1,13 +1,13 @@
1
1
  import { $Register } from '../../../utils/$Register';
2
2
  import type { LlmToolsMetadata } from './LlmToolsMetadata';
3
3
  /**
4
- * @@@
4
+ * Register for LLM tools metadata.
5
5
  *
6
6
  * Note: `$` is used to indicate that this interacts with the global scope
7
- * @singleton Only one instance of each register is created per build, but thare can be more @@@
7
+ * @singleton Only one instance of each register is created per build, but there can be more instances across different builds or environments.
8
8
  * @public exported from `@promptbook/core`
9
9
  */
10
10
  export declare const $llmToolsMetadataRegister: $Register<LlmToolsMetadata>;
11
11
  /**
12
12
  * TODO: [®] DRY Register logic
13
- */
13
+ */
@@ -1,13 +1,13 @@
1
1
  import type { LlmExecutionToolsConstructor } from '../../../execution/LlmExecutionToolsConstructor';
2
2
  import { $Register } from '../../../utils/$Register';
3
3
  /**
4
- * @@@
4
+ * Register for LLM tools.
5
5
  *
6
6
  * Note: `$` is used to indicate that this interacts with the global scope
7
- * @singleton Only one instance of each register is created per build, but thare can be more @@@
7
+ * @singleton Only one instance of each register is created per build, but there can be more instances across different builds or environments.
8
8
  * @public exported from `@promptbook/core`
9
9
  */
10
10
  export declare const $llmToolsRegister: $Register<LlmExecutionToolsConstructor>;
11
11
  /**
12
12
  * TODO: [®] DRY Register logic
13
- */
13
+ */
@@ -1,8 +1,7 @@
1
1
  import type { LlmToolsConfiguration } from './LlmToolsConfiguration';
2
2
  /**
3
- * @@@
3
+ * Provides LLM tools configuration by reading environment variables.
4
4
  *
5
- * @@@ .env
6
5
  * Note: `$` is used to indicate that this function is not a pure function - it uses filesystem to access `.env` file
7
6
  *
8
7
  * It looks for environment variables:
@@ -10,10 +9,11 @@ import type { LlmToolsConfiguration } from './LlmToolsConfiguration';
10
9
  * - `process.env.ANTHROPIC_CLAUDE_API_KEY`
11
10
  * - ...
12
11
  *
13
- * @returns @@@
12
+ * @see Environment variables documentation or .env file for required variables.
13
+ * @returns A promise that resolves to the LLM tools configuration, or null if configuration is incomplete or missing.
14
14
  * @public exported from `@promptbook/node`
15
15
  */
16
16
  export declare function $provideLlmToolsConfigurationFromEnv(): Promise<LlmToolsConfiguration>;
17
17
  /**
18
18
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
19
- */
19
+ */
@@ -3,7 +3,8 @@ import type { LlmExecutionToolsWithTotalUsage } from '../utils/count-total-usage
3
3
  import type { CreateLlmToolsFromConfigurationOptions } from './createLlmToolsFromConfiguration';
4
4
  type GetLlmToolsForTestingAndScriptsAndPlaygroundOptions = CreateLlmToolsFromConfigurationOptions & {
5
5
  /**
6
- * @@@
6
+ * Flag indicating whether the cache should be reloaded or reused
7
+ * When set to true, the existing cache will not be used but thinks will be still saved to the cache
7
8
  *
8
9
  * @default false
9
10
  */
@@ -22,5 +23,5 @@ export {};
22
23
  * Note: [⚪] This should never be in any released package
23
24
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
24
25
  * TODO: This should be maybe not under `_common` but under `utils-internal` / `utils/internal`
25
- * TODO: [®] DRY Register logic
26
- */
26
+ * TODO: [®] DRY Register logi
27
+ */
@@ -1,11 +1,14 @@
1
1
  import { MultipleLlmExecutionTools } from '../../multiple/MultipleLlmExecutionTools';
2
2
  import type { CreateLlmToolsFromConfigurationOptions } from './createLlmToolsFromConfiguration';
3
3
  /**
4
- * @@@
4
+ * Automatically configures LLM tools from environment variables in Node.js
5
+ *
6
+ * This utility function detects available LLM providers based on environment variables
7
+ * and creates properly configured LLM execution tools for each detected provider.
5
8
  *
6
9
  * Note: This function is not cached, every call creates new instance of `MultipleLlmExecutionTools`
7
10
  *
8
- * @@@ .env
11
+ * Supports environment variables from .env files when dotenv is configured
9
12
  * Note: `$` is used to indicate that this function is not a pure function - it uses filesystem to access `.env` file
10
13
  *
11
14
  * It looks for environment variables:
@@ -13,12 +16,22 @@ import type { CreateLlmToolsFromConfigurationOptions } from './createLlmToolsFro
13
16
  * - `process.env.ANTHROPIC_CLAUDE_API_KEY`
14
17
  * - ...
15
18
  *
16
- * @returns @@@
19
+ * @param options Configuration options for the LLM tools
20
+ * @returns A unified interface containing all detected and configured LLM tools
17
21
  * @public exported from `@promptbook/node`
18
22
  */
19
23
  export declare function $provideLlmToolsFromEnv(options?: CreateLlmToolsFromConfigurationOptions): Promise<MultipleLlmExecutionTools>;
20
24
  /**
21
- * TODO: @@@ write `$provideLlmToolsFromEnv` vs `$provideLlmToolsConfigurationFromEnv` vs `createLlmToolsFromConfiguration`
25
+ * TODO: The architecture for LLM tools configuration consists of three key functions:
26
+ * 1. `$provideLlmToolsFromEnv` - High-level function that detects available providers from env vars and returns ready-to-use LLM tools
27
+ * 2. `$provideLlmToolsConfigurationFromEnv` - Middle layer that extracts configuration objects from environment variables
28
+ * 3. `createLlmToolsFromConfiguration` - Low-level function that instantiates LLM tools from explicit configuration
29
+ *
30
+ * This layered approach allows flexibility in how tools are configured:
31
+ * - Use $provideLlmToolsFromEnv for automatic detection and setup in Node.js environments
32
+ * - Use $provideLlmToolsConfigurationFromEnv to extract config objects for modification before instantiation
33
+ * - Use createLlmToolsFromConfiguration for explicit control over tool configurations
34
+ *
22
35
  * TODO: [🧠][🍛] Which name is better `$provideLlmToolsFromEnv` or `$provideLlmToolsFromEnvironment`?
23
36
  * TODO: [🧠] Is there some meaningfull way how to test this util
24
37
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
@@ -2,17 +2,24 @@ import type { string_title } from '../../../types/typeAliases';
2
2
  import type { Registered } from '../../../utils/$Register';
3
3
  import type { LlmToolsOptions } from './LlmToolsOptions';
4
4
  /**
5
- * @@@
5
+ * Configuration definition for LLM execution tools, containing provider-specific settings
6
+ * that can be passed during runtime to instantiate and configure LLM tools properly.
6
7
  *
7
- * @@@ `LlmToolsMetadata` vs `LlmToolsConfiguration` vs `LlmToolsOptions` (vs `Registered`)
8
+ * The Promptbook LLM tools architecture involves several related types:
9
+ * - `LlmToolsMetadata`: Contains static metadata about the tool, such as name, version, and capabilities
10
+ * - `LlmToolsConfiguration`: Runtime configuration from environment variables or settings
11
+ * - `LlmToolsOptions`: Provider-specific options for instantiating tools
12
+ * - `Registered`: The record of a registered tool in the global registry
8
13
  */
9
14
  export type LlmToolsConfiguration = ReadonlyArray<Registered & {
10
15
  /**
11
- * @@@
16
+ * Human-readable name for this specific provider configuration
17
+ * Used in UI components and logs for identifying this particular configuration
12
18
  */
13
19
  readonly title: string_title;
14
20
  /**
15
- * @@@
21
+ * Provider-specific configuration options used for instantiating and configuring LLM tools
22
+ * Contains values like API keys, model preferences, endpoint URLs, and other settings
16
23
  */
17
24
  readonly options: LlmToolsOptions;
18
25
  }>;
@@ -1,18 +1,34 @@
1
+ import { MODEL_ORDERS } from '../../../constants';
2
+ import { MODEL_TRUST_LEVELS } from '../../../constants';
1
3
  import type { string_name } from '../../../types/typeAliases';
2
4
  import type { string_title } from '../../../types/typeAliases';
3
5
  import type { Registered } from '../../../utils/$Register';
4
6
  import type { string_SCREAMING_CASE } from '../../../utils/normalization/normalizeTo_SCREAMING_CASE';
5
7
  import type { LlmToolsConfiguration } from './LlmToolsConfiguration';
6
8
  /**
7
- * @@@
9
+ * Metadata definition for LLM execution tools that provides information about a provider's capabilities,
10
+ * configuration options, and relationships within the registry system.
8
11
  *
9
- * @@@ `LlmToolsMetadata` vs `LlmToolsConfiguration` vs `LlmToolsOptions` (vs `Registered`)
12
+ * The Promptbook LLM tools architecture involves several related types:
13
+ * - `LlmToolsMetadata`: Contains static metadata about the tool, such as name, version, and capabilities
14
+ * - `LlmToolsConfiguration`: Runtime configuration from environment variables or settings
15
+ * - `LlmToolsOptions`: Provider-specific options for instantiating tools
16
+ * - `Registered`: The record of a registered tool in the global registry
10
17
  */
11
18
  export type LlmToolsMetadata = Registered & {
12
19
  /**
13
- * @@@
20
+ * Human-readable display name for the LLM provider
21
+ * Used in UI components and documentation references
14
22
  */
15
23
  readonly title: string_title;
24
+ /**
25
+ * How is the model is trusted?
26
+ */
27
+ readonly trustLevel: keyof typeof MODEL_TRUST_LEVELS;
28
+ /**
29
+ * How is the model provider important and should be sorted in the list of available providers?
30
+ */
31
+ readonly order: typeof MODEL_ORDERS[keyof typeof MODEL_ORDERS] | number;
16
32
  /**
17
33
  * List of environment variables that can be used to configure the provider
18
34
  *
@@ -21,11 +37,17 @@ export type LlmToolsMetadata = Registered & {
21
37
  */
22
38
  readonly envVariables: ReadonlyArray<string_name & string_SCREAMING_CASE> | null;
23
39
  /**
24
- * @@@
40
+ * Provides a default configuration template for this LLM provider
41
+ * Used to generate example configurations or as fallback when no specific configuration is provided
42
+ * @returns A standardized configuration object for this LLM provider
25
43
  */
26
44
  getBoilerplateConfiguration(): LlmToolsConfiguration[number];
27
45
  /**
28
- * @@@
46
+ * Creates a provider-specific configuration object from environment variables
47
+ * Used to automatically configure LLM tools based on available environment settings
48
+ *
49
+ * @param env Dictionary of environment variables (key-value pairs)
50
+ * @returns Configuration object for this LLM provider if required variables are present, or null if configuration is not possible
29
51
  */
30
52
  createConfigurationFromEnv(env: Record<string_name, string>): LlmToolsConfiguration[number] | null;
31
53
  };
@@ -1,8 +1,15 @@
1
1
  import type { TODO_object } from '../../../utils/organization/TODO_object';
2
2
  /**
3
- * @@@
3
+ * Options for configuring LLM (Large Language Model) tools.
4
4
  *
5
- * @@@ `LlmToolsMetadata` vs `LlmToolsConfiguration` vs `LlmToolsOptions` (vs `Registered`)
5
+ * This type is used to pass provider-specific options to LLM execution tools.
6
+ *
7
+ *
8
+ * The Promptbook LLM tools architecture involves several related types:
9
+ * - `LlmToolsMetadata`: Contains static metadata about the tool, such as name, version, and capabilities
10
+ * - `LlmToolsConfiguration`: Runtime configuration from environment variables or settings
11
+ * - `LlmToolsOptions`: Provider-specific options for instantiating tools
12
+ * - `Registered`: The record of a registered tool in the global registry
6
13
  */
7
14
  export type LlmToolsOptions = TODO_object;
8
15
  /**
@@ -21,18 +21,27 @@ export type CreateLlmToolsFromConfigurationOptions = {
21
21
  readonly userId?: string_user_id;
22
22
  };
23
23
  /**
24
- * @@@
24
+ * Creates LLM execution tools from provided configuration objects
25
+ *
26
+ * Instantiates and configures LLM tool instances for each configuration entry,
27
+ * combining them into a unified interface via MultipleLlmExecutionTools.
25
28
  *
26
29
  * Note: This function is not cached, every call creates new instance of `MultipleLlmExecutionTools`
27
30
  *
28
- * @returns @@@
31
+ * @param configuration Array of LLM tool configurations to instantiate
32
+ * @param options Additional options for configuring the LLM tools
33
+ * @returns A unified interface combining all successfully instantiated LLM tools
29
34
  * @public exported from `@promptbook/core`
30
35
  */
31
36
  export declare function createLlmToolsFromConfiguration(configuration: LlmToolsConfiguration, options?: CreateLlmToolsFromConfigurationOptions): MultipleLlmExecutionTools;
32
37
  /**
33
38
  * TODO: [🎌] Together with `createLlmToolsFromConfiguration` + 'EXECUTION_TOOLS_CLASSES' gets to `@promptbook/core` ALL model providers, make this more efficient
34
39
  * TODO: [🧠][🎌] Dynamically install required providers
35
- * TODO: @@@ write discussion about this - wizzard
40
+ * TODO: We should implement an interactive configuration wizard that would:
41
+ * 1. Detect which LLM providers are available in the environment
42
+ * 2. Guide users through required configuration settings for each provider
43
+ * 3. Allow testing connections before completing setup
44
+ * 4. Generate appropriate configuration code for application integration
36
45
  * TODO: [🧠][🍛] Which name is better `createLlmToolsFromConfig` or `createLlmToolsFromConfiguration`?
37
46
  * TODO: [🧠] Is there some meaningfull way how to test this util
38
47
  * TODO: This should be maybe not under `_common` but under `utils`
@@ -1,25 +1,30 @@
1
1
  import type { PromptResult } from '../../../../execution/PromptResult';
2
2
  import type { Prompt } from '../../../../types/Prompt';
3
3
  import type { string_date_iso8601 } from '../../../../types/typeAliases';
4
+ import type { string_semantic_version } from '../../../../types/typeAliases';
4
5
  import type { string_promptbook_version } from '../../../../version';
5
6
  /**
6
- * @@@
7
+ * Represents a single item stored in the LLM cache.
7
8
  */
8
9
  export type CacheItem = {
9
10
  /**
10
- * @@@
11
+ * The date and time when the cache item was created, in ISO 8601 format.
11
12
  */
12
13
  date: string_date_iso8601;
13
14
  /**
14
- * @@@
15
+ * The version of the Promptbook library used when this cache item was created.
15
16
  */
16
17
  promptbookVersion?: string_promptbook_version;
17
18
  /**
18
- * @@@
19
+ * The version of the Book language used when this cache item was created.
20
+ */
21
+ bookVersion?: string_semantic_version;
22
+ /**
23
+ * The prompt that was sent to the LLM.
19
24
  */
20
25
  prompt: Prompt;
21
26
  /**
22
- * @@@
27
+ * The response received from the LLM.
23
28
  */
24
29
  promptResult: PromptResult;
25
30
  };
@@ -1,17 +1,19 @@
1
1
  import type { PromptbookStorage } from '../../../../storage/_common/PromptbookStorage';
2
2
  import type { CacheItem } from './CacheItem';
3
3
  /**
4
- * @@@
4
+ * Options for configuring caching behavior for LlmExecutionTools.
5
5
  */
6
6
  export type CacheLlmToolsOptions = {
7
7
  /**
8
- * @@@
8
+ * The cache provider instance to use for storing and retrieving cached data.
9
9
  *
10
10
  * @default MemoryStorage
11
11
  */
12
12
  storage: PromptbookStorage<CacheItem>;
13
13
  /**
14
- * @@@
14
+ * When set to `true`, the cache will be reloaded regardless of whether the data is already present in the cache.
15
+ * This can be useful for debugging or when you want to ensure that the latest data is always fetched.
16
+ * Data will ne still saved to the cache.
15
17
  *
16
18
  * @default false
17
19
  */
@@ -13,7 +13,7 @@ export declare function cacheLlmTools<TLlmTools extends LlmExecutionTools>(llmTo
13
13
  /**
14
14
  * TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
15
15
  * TODO: [🧠] Is there some meaningfull way how to test this util
16
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
17
- * @@@ write discussion about this and storages
18
- * @@@ write how to combine multiple interceptors
16
+ * TODO: [👷‍♂️] Comprehensive manual about construction of llmTools
17
+ * Detailed explanation about caching strategies and appropriate storage selection for different use cases
18
+ * Examples of how to combine multiple interceptors for advanced caching, logging, and usage tracking
19
19
  */
@@ -4,24 +4,24 @@ import type { PromptbookStorage } from '../../../../storage/_common/PromptbookSt
4
4
  import type { TODO_any } from '../../../../utils/organization/TODO_any';
5
5
  import type { LlmExecutionToolsWithTotalUsage } from './LlmExecutionToolsWithTotalUsage';
6
6
  /**
7
- * Options for `limitTotalUsage`
7
+ * Options for the `limitTotalUsage` function.
8
8
  */
9
9
  type LimitTotalUsageOptions = {
10
10
  /**
11
- * @@@
11
+ * The usage limits to apply.
12
12
  *
13
13
  * @default ZERO_USAGE
14
14
  */
15
15
  maxTotalUsage: Usage;
16
16
  /**
17
- * @@@
17
+ * The storage mechanism to use for tracking usage across multiple executions or instances.
18
18
  *
19
- * @default MemoryStorage
19
+ * @default MemoryStorage which will not persist when the process ends
20
20
  */
21
21
  storage: PromptbookStorage<TODO_any>;
22
22
  };
23
23
  /**
24
- * @@@
24
+ * Wraps LlmExecutionTools to limit the total usage based on provided limits.
25
25
  *
26
26
  * @public exported from `@promptbook/core`
27
27
  */
@@ -3,7 +3,7 @@ import type { number_usd } from '../../types/typeAliases';
3
3
  /**
4
4
  * List of available Anthropic Claude models with pricing
5
5
  *
6
- * Note: Done at 2024-08-16
6
+ * Note: Done at 2025-05-06
7
7
  *
8
8
  * @see https://docs.anthropic.com/en/docs/models-overview
9
9
  * @public exported from `@promptbook/anthropic-claude`
@@ -19,6 +19,10 @@ export declare class AzureOpenAiExecutionTools implements LlmExecutionTools {
19
19
  * OpenAI Azure API client.
20
20
  */
21
21
  private client;
22
+ /**
23
+ * Rate limiter instance
24
+ */
25
+ private limiter;
22
26
  /**
23
27
  * Creates OpenAI Execution Tools.
24
28
  *
@@ -0,0 +1,23 @@
1
+ import type { AvailableModel } from '../../execution/AvailableModel';
2
+ import type { number_usd } from '../../types/typeAliases';
3
+ /**
4
+ * List of available Deepseek models with descriptions
5
+ *
6
+ * Note: Done at 2025-05-06
7
+ *
8
+ * @see https://www.deepseek.com/models
9
+ * @public exported from `@promptbook/deepseek`
10
+ */
11
+ export declare const DEEPSEEK_MODELS: ReadonlyArray<AvailableModel & {
12
+ modelDescription?: string;
13
+ pricing?: {
14
+ readonly prompt: number_usd;
15
+ readonly output: number_usd;
16
+ };
17
+ }>;
18
+ /**
19
+ * TODO: [🧠] Add information about context window sizes, capabilities, and relative performance characteristics
20
+ * TODO: [🎰] Some mechanism to auto-update available models
21
+ * TODO: [🧠] Verify pricing information is current with Deepseek's official documentation
22
+ * Note: [💞] Ignore a discrepancy between file name and entity name
23
+ */
@@ -0,0 +1,23 @@
1
+ import type { AvailableModel } from '../../execution/AvailableModel';
2
+ import type { number_usd } from '../../types/typeAliases';
3
+ /**
4
+ * List of available Google models with descriptions
5
+ *
6
+ * Note: Done at 2025-05-06
7
+ *
8
+ * @see https://ai.google.dev/models/gemini
9
+ * @public exported from `@promptbook/google`
10
+ */
11
+ export declare const GOOGLE_MODELS: ReadonlyArray<AvailableModel & {
12
+ modelDescription?: string;
13
+ pricing?: {
14
+ readonly prompt: number_usd;
15
+ readonly output: number_usd;
16
+ };
17
+ }>;
18
+ /**
19
+ * TODO: [🧠] Add information about context window sizes, capabilities, and relative performance characteristics
20
+ * TODO: [🎰] Some mechanism to auto-update available models
21
+ * TODO: [🧠] Verify pricing information is current with Google's official documentation
22
+ * Note: [💞] Ignore a discrepancy between file name and entity name
23
+ */
@@ -20,6 +20,10 @@ export declare class OpenAiExecutionTools implements LlmExecutionTools {
20
20
  * OpenAI API client.
21
21
  */
22
22
  private client;
23
+ /**
24
+ * Rate limiter instance
25
+ */
26
+ private limiter;
23
27
  /**
24
28
  * Creates OpenAI Execution Tools.
25
29
  *
@@ -3,7 +3,7 @@ import type { number_usd } from '../../types/typeAliases';
3
3
  /**
4
4
  * List of available OpenAI models with pricing
5
5
  *
6
- * Note: Done at 2024-05-20
6
+ * Note: Done at 2025-05-06
7
7
  *
8
8
  * @see https://platform.openai.com/docs/models/
9
9
  * @see https://openai.com/api/pricing/
@@ -10,9 +10,9 @@ import type { Registration } from '../../utils/$Register';
10
10
  */
11
11
  export declare const _OpenAiMetadataRegistration: Registration;
12
12
  /**
13
- * @@@ registration1 of default configuration for Open AI
13
+ * Registration of the OpenAI Assistant metadata
14
14
  *
15
- * Note: [🏐] Configurations registrations are done in @@@ BUT constructor @@@
15
+ * Note: [🏐] Configurations registrations are done in the metadata registration section, but the constructor registration is handled separately.
16
16
  *
17
17
  * @public exported from `@promptbook/core`
18
18
  * @public exported from `@promptbook/wizzard`
@@ -10,9 +10,9 @@ import type { Registration } from '../../utils/$Register';
10
10
  */
11
11
  export declare const _OpenAiRegistration: Registration;
12
12
  /**
13
- * @@@ registration2
13
+ * Registration of the OpenAI Assistant provider
14
14
  *
15
- * Note: [🏐] Configurations registrations are done in @@@ BUT constructor @@@
15
+ * Note: [🏐] Configurations registrations are done in register-constructor.ts BUT constructor register-constructor.ts
16
16
  *
17
17
  * @public exported from `@promptbook/openai`
18
18
  * @public exported from `@promptbook/wizzard`
@@ -0,0 +1,9 @@
1
+ import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
2
+ /**
3
+ * Migrates the pipeline to the latest version
4
+ *
5
+ * Note: Migration does not do heavy lifting like calling the LLMs, just lightweight changes of the structure
6
+ *
7
+ * @public exported from `@promptbook/core`
8
+ */
9
+ export declare function migratePipeline(deprecatedPipeline: PipelineJson): PipelineJson;
@@ -3,14 +3,14 @@ import type { string_formfactor_name } from '../../formfactors/_common/string_fo
3
3
  import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
4
4
  import type { NonEmptyReadonlyArray } from '../../types/NonEmptyArray';
5
5
  /**
6
- * @@@
6
+ * Internal cache for the `getBookTemplates` function, storing retrieved pipelines.
7
7
  *
8
8
  * @singleton
9
9
  * @private internal cache of `getBookTemplate`
10
10
  */
11
11
  export declare let pipelines: Array<SetRequired<PipelineJson, 'pipelineUrl'>> | null;
12
12
  /**
13
- * Get template for new book
13
+ * Retrieves a collection of Promptbook templates.
14
14
  *
15
15
  * @param formfactorName - optional filter for FORMFACTOR - get only pipelines for this formfactor
16
16
  * @returns list of pipelines
@@ -8,7 +8,7 @@ import type { string_persona_description } from '../types/typeAliases';
8
8
  * @see https://github.com/webgptorg/promptbook/discussions/22
9
9
  * @public exported from `@promptbook/core`
10
10
  */
11
- export declare function preparePersona(personaDescription: string_persona_description, tools: Pick<ExecutionTools, 'llm'>, options: PrepareAndScrapeOptions): Promise<PersonaPreparedJson['modelRequirements']>;
11
+ export declare function preparePersona(personaDescription: string_persona_description, tools: Pick<ExecutionTools, 'llm'>, options: PrepareAndScrapeOptions): Promise<Pick<PersonaPreparedJson, 'modelsRequirements'>>;
12
12
  /**
13
13
  * TODO: [🔃][main] If the persona was prepared with different version or different set of models, prepare it once again
14
14
  * TODO: [🏢] Check validity of `modelName` in pipeline
@@ -1,20 +1,20 @@
1
1
  import type { InputParameterJson } from '../PipelineJson/ParameterJson';
2
2
  import type { OutputParameterJson } from '../PipelineJson/ParameterJson';
3
3
  /**
4
- * @@@
4
+ * Defines the interface of a Promptbook pipeline, specifying its input and output parameters.
5
5
  *
6
6
  * Note: [🚉] This is fully serializable as JSON
7
7
  * @see https://github.com/webgptorg/promptbook/discussions/171
8
8
  */
9
9
  export type PipelineInterface = {
10
10
  /**
11
- * @@@
11
+ * Input parameters required by the pipeline.
12
12
  *
13
13
  * Note: Sorted alphabetically
14
14
  */
15
15
  readonly inputParameters: ReadonlyArray<InputParameterJson>;
16
16
  /**
17
- * @@@
17
+ * Output parameters produced by the pipeline.
18
18
  *
19
19
  * Note: Sorted alphabetically
20
20
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @@@
2
+ * Pipeline interface which is equivalent to `any`
3
3
  *
4
4
  * @see https://github.com/webgptorg/promptbook/discussions/171
5
5
  *
@@ -1,7 +1,7 @@
1
1
  import type { PipelineJson } from '../PipelineJson/PipelineJson';
2
2
  import type { PipelineInterface } from './PipelineInterface';
3
3
  /**
4
- * @@@
4
+ * Extracts the interface (input and output parameters) from a pipeline.
5
5
  *
6
6
  * @deprecated https://github.com/webgptorg/promptbook/pull/186
7
7
  * @see https://github.com/webgptorg/promptbook/discussions/171
@@ -1,25 +1,26 @@
1
1
  import type { PipelineJson } from '../PipelineJson/PipelineJson';
2
2
  import type { PipelineInterface } from './PipelineInterface';
3
3
  /**
4
- * @@@
4
+ * Options for the `isPipelineImplementingInterface` function.
5
5
  *
6
6
  * @see https://github.com/webgptorg/promptbook/discussions/171
7
7
  */
8
8
  export type IsPipelineImplementingInterfaceOptions = {
9
9
  /**
10
- * @@@
10
+ * @param pipeline The pipeline to check.
11
11
  */
12
12
  pipeline: PipelineJson;
13
13
  /**
14
- * @@@
14
+ * @param pipelineInterface The interface to check against.
15
15
  */
16
16
  pipelineInterface: PipelineInterface;
17
17
  };
18
18
  /**
19
- * @@@
19
+ * Checks if a given pipeline satisfies the requirements of a specified pipeline interface.
20
20
  *
21
21
  * @deprecated https://github.com/webgptorg/promptbook/pull/186
22
22
  * @see https://github.com/webgptorg/promptbook/discussions/171
23
+ * @returns `true` if the pipeline implements the interface, `false` otherwise.
23
24
  *
24
25
  * @public exported from `@promptbook/core`
25
26
  */
@@ -1,6 +1,6 @@
1
1
  import type { PipelineInterface } from './PipelineInterface';
2
2
  /**
3
- * @@@
3
+ * Checks if two pipeline interfaces are structurally identical.
4
4
  *
5
5
  * @deprecated https://github.com/webgptorg/promptbook/pull/186
6
6
  * @see https://github.com/webgptorg/promptbook/discussions/171