@promptbook/node 0.92.0-26 → 0.92.0-28

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 (50) hide show
  1. package/esm/index.es.js +85 -39
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/core.index.d.ts +4 -4
  4. package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +0 -2
  5. package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -1
  6. package/esm/typings/src/constants.d.ts +35 -0
  7. package/esm/typings/src/executables/$provideExecutablesForNode.d.ts +1 -1
  8. package/esm/typings/src/executables/apps/locateLibreoffice.d.ts +2 -1
  9. package/esm/typings/src/executables/apps/locatePandoc.d.ts +2 -1
  10. package/esm/typings/src/executables/platforms/locateAppOnLinux.d.ts +2 -1
  11. package/esm/typings/src/executables/platforms/locateAppOnMacOs.d.ts +2 -1
  12. package/esm/typings/src/executables/platforms/locateAppOnWindows.d.ts +2 -1
  13. package/esm/typings/src/execution/AbstractTaskResult.d.ts +1 -1
  14. package/esm/typings/src/execution/LlmExecutionToolsConstructor.d.ts +2 -1
  15. package/esm/typings/src/execution/PipelineExecutorResult.d.ts +1 -1
  16. package/esm/typings/src/execution/createPipelineExecutor/$OngoingTaskResult.d.ts +12 -9
  17. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +20 -14
  18. package/esm/typings/src/execution/createPipelineExecutor/filterJustOutputParameters.d.ts +7 -6
  19. package/esm/typings/src/execution/createPipelineExecutor/getContextForTask.d.ts +5 -1
  20. package/esm/typings/src/execution/createPipelineExecutor/getExamplesForTask.d.ts +1 -1
  21. package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTask.d.ts +8 -11
  22. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +4 -4
  23. package/esm/typings/src/execution/utils/uncertainNumber.d.ts +3 -2
  24. package/esm/typings/src/formats/csv/CsvSettings.d.ts +2 -2
  25. package/esm/typings/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +16 -7
  26. package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +3 -1
  27. package/esm/typings/src/formfactors/chatbot/ChatbotFormfactorDefinition.d.ts +2 -2
  28. package/esm/typings/src/formfactors/completion/CompletionFormfactorDefinition.d.ts +1 -1
  29. package/esm/typings/src/formfactors/generator/GeneratorFormfactorDefinition.d.ts +2 -1
  30. package/esm/typings/src/formfactors/generic/GenericFormfactorDefinition.d.ts +2 -2
  31. package/esm/typings/src/formfactors/index.d.ts +5 -5
  32. package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +4 -2
  33. package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +3 -2
  34. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +4 -3
  35. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +17 -4
  36. package/esm/typings/src/llm-providers/_common/register/LlmToolsConfiguration.d.ts +11 -4
  37. package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +21 -42
  38. package/esm/typings/src/llm-providers/_common/register/LlmToolsOptions.d.ts +5 -1
  39. package/esm/typings/src/llm-providers/_common/register/createLlmToolsFromConfiguration.d.ts +12 -3
  40. package/esm/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +5 -0
  41. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  42. package/esm/typings/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
  43. package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
  44. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
  45. package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +2 -2
  46. package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +2 -2
  47. package/esm/typings/src/version.d.ts +1 -1
  48. package/package.json +2 -2
  49. package/umd/index.umd.js +85 -39
  50. package/umd/index.umd.js.map +1 -1
package/umd/index.umd.js CHANGED
@@ -46,7 +46,7 @@
46
46
  * @generated
47
47
  * @see https://github.com/webgptorg/promptbook
48
48
  */
49
- const PROMPTBOOK_ENGINE_VERSION = '0.92.0-26';
49
+ const PROMPTBOOK_ENGINE_VERSION = '0.92.0-28';
50
50
  /**
51
51
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
52
52
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -2550,7 +2550,7 @@
2550
2550
  }
2551
2551
 
2552
2552
  /**
2553
- * @@@
2553
+ * Contains configuration options for parsing and generating CSV files, such as delimiters and quoting rules.
2554
2554
  *
2555
2555
  * @public exported from `@promptbook/core`
2556
2556
  */
@@ -3737,8 +3737,12 @@
3737
3737
  */
3738
3738
 
3739
3739
  /**
3740
- * @@@
3740
+ * Executes a pipeline task with multiple attempts, including joker and retry logic. Handles different task types
3741
+ * (prompt, script, dialog, etc.), applies postprocessing, checks expectations, and updates the execution report.
3742
+ * Throws errors if execution fails after all attempts.
3741
3743
  *
3744
+ * @param options - The options for execution, including task, parameters, pipeline, and configuration.
3745
+ * @returns The result string of the executed task.
3742
3746
  * @private internal utility of `createPipelineExecutor`
3743
3747
  */
3744
3748
  async function executeAttempts(options) {
@@ -4196,8 +4200,12 @@
4196
4200
  }
4197
4201
 
4198
4202
  /**
4199
- * @@@
4203
+ * Returns the context for a given task, typically used to provide additional information or variables
4204
+ * required for the execution of the task within a pipeline. The context is returned as a string value
4205
+ * that may include markdown formatting.
4200
4206
  *
4207
+ * @param task - The task for which the context is being generated. This should be a deeply immutable TaskJson object.
4208
+ * @returns The context as a string, formatted as markdown and parameter value.
4201
4209
  * @private internal utility of `createPipelineExecutor`
4202
4210
  */
4203
4211
  async function getContextForTask(task) {
@@ -4205,7 +4213,7 @@
4205
4213
  }
4206
4214
 
4207
4215
  /**
4208
- * @@@
4216
+ * Retrieves example values or templates for a given task, used to guide or validate pipeline execution.
4209
4217
  *
4210
4218
  * @private internal utility of `createPipelineExecutor`
4211
4219
  */
@@ -4252,9 +4260,8 @@
4252
4260
  }
4253
4261
 
4254
4262
  /**
4255
- * @@@
4256
- *
4257
- * Here is the place where RAG (retrieval-augmented generation) happens
4263
+ * Retrieves the most relevant knowledge pieces for a given task using embedding-based similarity search.
4264
+ * This is where retrieval-augmented generation (RAG) is performed to enhance the task with external knowledge.
4258
4265
  *
4259
4266
  * @private internal utility of `createPipelineExecutor`
4260
4267
  */
@@ -4473,7 +4480,8 @@
4473
4480
  */
4474
4481
 
4475
4482
  /**
4476
- * @@@
4483
+ * Filters and returns only the output parameters from the provided pipeline execution options.
4484
+ * Adds warnings for any expected output parameters that are missing.
4477
4485
  *
4478
4486
  * @private internal utility of `createPipelineExecutor`
4479
4487
  */
@@ -6239,7 +6247,7 @@
6239
6247
  /**
6240
6248
  * Parses the boilerplate command
6241
6249
  *
6242
- * Note: @@@ This command is used as boilerplate for new commands - it should NOT be used in any `.book` file
6250
+ * Note: @@ This command is used as boilerplate for new commands - it should NOT be used in any `.book` file
6243
6251
  *
6244
6252
  * @see `documentationUrl` for more details
6245
6253
  * @private within the commands folder
@@ -6777,8 +6785,6 @@
6777
6785
  /**
6778
6786
  * Parses the foreach command
6779
6787
  *
6780
- * Note: @@@ This command is used as foreach for new commands - it should NOT be used in any `.book` file
6781
- *
6782
6788
  * @see `documentationUrl` for more details
6783
6789
  * @public exported from `@promptbook/editable`
6784
6790
  */
@@ -7019,14 +7025,14 @@
7019
7025
  };
7020
7026
 
7021
7027
  /**
7022
- * @@@
7028
+ * Chatbot form factor definition for conversational interfaces that interact with users in a chat-like manner.
7023
7029
  *
7024
7030
  * @public exported from `@promptbook/core`
7025
7031
  */
7026
7032
  const ChatbotFormfactorDefinition = {
7027
7033
  name: 'CHATBOT',
7028
7034
  aliasNames: ['CHAT'],
7029
- description: `@@@`,
7035
+ description: `A chatbot form factor for conversational user interfaces.`,
7030
7036
  documentationUrl: `https://github.com/webgptorg/promptbook/discussions/174`,
7031
7037
  pipelineInterface: {
7032
7038
  inputParameters: [
@@ -7059,7 +7065,7 @@
7059
7065
  */
7060
7066
  const CompletionFormfactorDefinition = {
7061
7067
  name: 'COMPLETION',
7062
- description: `@@@`,
7068
+ description: `Completion is formfactor that emulates completion models`,
7063
7069
  documentationUrl: `https://github.com/webgptorg/promptbook/discussions/@@`,
7064
7070
  // <- TODO: https://github.com/webgptorg/promptbook/discussions/new?category=concepts
7065
7071
  // "🔠 Completion Formfactor"
@@ -7090,7 +7096,8 @@
7090
7096
  };
7091
7097
 
7092
7098
  /**
7093
- * Generator is form of app that @@@
7099
+ * Generator form factor represents an application that generates content or data based on user input or predefined rules.
7100
+ * This form factor is used for apps that produce outputs, such as text, images, or other media, based on provided input.
7094
7101
  *
7095
7102
  * @public exported from `@promptbook/core`
7096
7103
  */
@@ -7134,13 +7141,13 @@
7134
7141
  */
7135
7142
 
7136
7143
  /**
7137
- * @@@
7144
+ * A generic pipeline
7138
7145
  *
7139
7146
  * @public exported from `@promptbook/core`
7140
7147
  */
7141
7148
  const GenericFormfactorDefinition = {
7142
7149
  name: 'GENERIC',
7143
- description: `@@@`,
7150
+ description: `A generic pipeline`,
7144
7151
  documentationUrl: `https://github.com/webgptorg/promptbook/discussions/173`,
7145
7152
  pipelineInterface: GENERIC_PIPELINE_INTERFACE,
7146
7153
  };
@@ -7175,17 +7182,20 @@
7175
7182
  };
7176
7183
 
7177
7184
  /**
7178
- * Matcher is form of app that @@@
7185
+ * Matcher is form of app that evaluates (spreadsheet) content against defined criteria or patterns,
7186
+ * determining if it matches or meets specific requirements. Used for classification,
7187
+ * validation, filtering, and quality assessment of inputs.
7179
7188
  *
7180
7189
  * @public exported from `@promptbook/core`
7181
7190
  */
7182
7191
  const MatcherFormfactorDefinition = {
7183
7192
  name: 'EXPERIMENTAL_MATCHER',
7184
- description: `@@@`,
7193
+ description: `An evaluation system that determines whether content meets specific criteria or patterns.
7194
+ Used for content validation, quality assessment, and intelligent filtering tasks. Currently in experimental phase.`,
7185
7195
  documentationUrl: `https://github.com/webgptorg/promptbook/discussions/177`,
7186
7196
  pipelineInterface: {
7187
7197
  inputParameters: [
7188
- /* @@@ */
7198
+ /* Input parameters for content to be matched and criteria to match against */
7189
7199
  {
7190
7200
  name: 'nonce',
7191
7201
  description: 'Just to prevent EXPERIMENTAL_MATCHER to be set as implicit formfactor',
@@ -7194,7 +7204,7 @@
7194
7204
  },
7195
7205
  ],
7196
7206
  outputParameters: [
7197
- /* @@@ */
7207
+ /* Output parameters containing match results, confidence scores, and relevant metadata */
7198
7208
  ],
7199
7209
  },
7200
7210
  };
@@ -7231,13 +7241,16 @@
7231
7241
  };
7232
7242
 
7233
7243
  /**
7234
- * Translator is form of app that @@@
7244
+ * Translator is form of app that transforms input text from one form to another,
7245
+ * such as language translation, style conversion, tone modification, or other text transformations.
7235
7246
  *
7236
7247
  * @public exported from `@promptbook/core`
7237
7248
  */
7238
7249
  const TranslatorFormfactorDefinition = {
7239
7250
  name: 'TRANSLATOR',
7240
- description: `@@@`,
7251
+ description: `A text transformation system that converts input content into different forms,
7252
+ including language translations, paraphrasing, style conversions, and tone adjustments.
7253
+ This form factor takes one input and produces one transformed output.`,
7241
7254
  documentationUrl: `https://github.com/webgptorg/promptbook/discussions/175`,
7242
7255
  pipelineInterface: {
7243
7256
  inputParameters: [
@@ -8364,7 +8377,10 @@
8364
8377
  `));
8365
8378
  }
8366
8379
  /**
8367
- * @@@
8380
+ * Generates a markdown-formatted message listing all supported commands
8381
+ * with their descriptions and documentation links
8382
+ *
8383
+ * @returns A formatted markdown string containing all available commands and their details
8368
8384
  */
8369
8385
  function getSupportedCommandsMessage() {
8370
8386
  return COMMANDS.flatMap(({ name, aliasNames, description, documentationUrl }) =>
@@ -8375,7 +8391,10 @@
8375
8391
  ]).join('\n');
8376
8392
  }
8377
8393
  /**
8378
- * @@@
8394
+ * Attempts to parse a command variant using the provided input parameters
8395
+ *
8396
+ * @param input Object containing command parsing information including raw command text and normalized values
8397
+ * @returns A parsed Command object if successful, or null if the command cannot be parsed
8379
8398
  */
8380
8399
  function parseCommandVariant(input) {
8381
8400
  const { commandNameRaw, usagePlace, normalized, args, raw, rawArgs } = input;
@@ -9594,7 +9613,8 @@
9594
9613
  */
9595
9614
 
9596
9615
  /**
9597
- * @@@
9616
+ * Attempts to locate the specified application on a Linux system using the 'which' command.
9617
+ * Returns the path to the executable if found, or null otherwise.
9598
9618
  *
9599
9619
  * @private within the repository
9600
9620
  */
@@ -9661,7 +9681,8 @@
9661
9681
  // eslint-disable-next-line @typescript-eslint/no-var-requires
9662
9682
  const userhome = require('userhome');
9663
9683
  /**
9664
- * @@@
9684
+ * Attempts to locate the specified application on a macOS system by checking standard application paths and using mdfind.
9685
+ * Returns the path to the executable if found, or null otherwise.
9665
9686
  *
9666
9687
  * @private within the repository
9667
9688
  */
@@ -9693,7 +9714,8 @@
9693
9714
  */
9694
9715
 
9695
9716
  /**
9696
- * @@@
9717
+ * Attempts to locate the specified application on a Windows system by searching common installation directories.
9718
+ * Returns the path to the executable if found, or null otherwise.
9697
9719
  *
9698
9720
  * @private within the repository
9699
9721
  */
@@ -9764,7 +9786,8 @@
9764
9786
  */
9765
9787
 
9766
9788
  /**
9767
- * @@@
9789
+ * Locates the LibreOffice executable on the current system by searching platform-specific paths.
9790
+ * Returns the path to the executable if found, or null otherwise.
9768
9791
  *
9769
9792
  * @private within the repository
9770
9793
  */
@@ -9782,7 +9805,8 @@
9782
9805
  */
9783
9806
 
9784
9807
  /**
9785
- * @@@
9808
+ * Locates the Pandoc executable on the current system by searching platform-specific paths.
9809
+ * Returns the path to the executable if found, or null otherwise.
9786
9810
  *
9787
9811
  * @private within the repository
9788
9812
  */
@@ -9800,7 +9824,7 @@
9800
9824
  */
9801
9825
 
9802
9826
  /**
9803
- * @@@
9827
+ * Provides paths to required executables (i.e. as Pandoc and LibreOffice) for Node.js environments.
9804
9828
  *
9805
9829
  * @public exported from `@promptbook/node`
9806
9830
  */
@@ -10079,11 +10103,16 @@
10079
10103
  */
10080
10104
 
10081
10105
  /**
10082
- * @@@
10106
+ * Creates LLM execution tools from provided configuration objects
10107
+ *
10108
+ * Instantiates and configures LLM tool instances for each configuration entry,
10109
+ * combining them into a unified interface via MultipleLlmExecutionTools.
10083
10110
  *
10084
10111
  * Note: This function is not cached, every call creates new instance of `MultipleLlmExecutionTools`
10085
10112
  *
10086
- * @returns @@@
10113
+ * @param configuration Array of LLM tool configurations to instantiate
10114
+ * @param options Additional options for configuring the LLM tools
10115
+ * @returns A unified interface combining all successfully instantiated LLM tools
10087
10116
  * @public exported from `@promptbook/core`
10088
10117
  */
10089
10118
  function createLlmToolsFromConfiguration(configuration, options = {}) {
@@ -10122,7 +10151,11 @@
10122
10151
  /**
10123
10152
  * TODO: [🎌] Together with `createLlmToolsFromConfiguration` + 'EXECUTION_TOOLS_CLASSES' gets to `@promptbook/core` ALL model providers, make this more efficient
10124
10153
  * TODO: [🧠][🎌] Dynamically install required providers
10125
- * TODO: @@@ write discussion about this - wizzard
10154
+ * TODO: We should implement an interactive configuration wizard that would:
10155
+ * 1. Detect which LLM providers are available in the environment
10156
+ * 2. Guide users through required configuration settings for each provider
10157
+ * 3. Allow testing connections before completing setup
10158
+ * 4. Generate appropriate configuration code for application integration
10126
10159
  * TODO: [🧠][🍛] Which name is better `createLlmToolsFromConfig` or `createLlmToolsFromConfiguration`?
10127
10160
  * TODO: [🧠] Is there some meaningfull way how to test this util
10128
10161
  * TODO: This should be maybe not under `_common` but under `utils`
@@ -10130,11 +10163,14 @@
10130
10163
  */
10131
10164
 
10132
10165
  /**
10133
- * @@@
10166
+ * Automatically configures LLM tools from environment variables in Node.js
10167
+ *
10168
+ * This utility function detects available LLM providers based on environment variables
10169
+ * and creates properly configured LLM execution tools for each detected provider.
10134
10170
  *
10135
10171
  * Note: This function is not cached, every call creates new instance of `MultipleLlmExecutionTools`
10136
10172
  *
10137
- * @@@ .env
10173
+ * Supports environment variables from .env files when dotenv is configured
10138
10174
  * Note: `$` is used to indicate that this function is not a pure function - it uses filesystem to access `.env` file
10139
10175
  *
10140
10176
  * It looks for environment variables:
@@ -10142,7 +10178,8 @@
10142
10178
  * - `process.env.ANTHROPIC_CLAUDE_API_KEY`
10143
10179
  * - ...
10144
10180
  *
10145
- * @returns @@@
10181
+ * @param options Configuration options for the LLM tools
10182
+ * @returns A unified interface containing all detected and configured LLM tools
10146
10183
  * @public exported from `@promptbook/node`
10147
10184
  */
10148
10185
  async function $provideLlmToolsFromEnv(options = {}) {
@@ -10168,7 +10205,16 @@
10168
10205
  return createLlmToolsFromConfiguration(configuration, options);
10169
10206
  }
10170
10207
  /**
10171
- * TODO: @@@ write `$provideLlmToolsFromEnv` vs `$provideLlmToolsConfigurationFromEnv` vs `createLlmToolsFromConfiguration`
10208
+ * TODO: The architecture for LLM tools configuration consists of three key functions:
10209
+ * 1. `$provideLlmToolsFromEnv` - High-level function that detects available providers from env vars and returns ready-to-use LLM tools
10210
+ * 2. `$provideLlmToolsConfigurationFromEnv` - Middle layer that extracts configuration objects from environment variables
10211
+ * 3. `createLlmToolsFromConfiguration` - Low-level function that instantiates LLM tools from explicit configuration
10212
+ *
10213
+ * This layered approach allows flexibility in how tools are configured:
10214
+ * - Use $provideLlmToolsFromEnv for automatic detection and setup in Node.js environments
10215
+ * - Use $provideLlmToolsConfigurationFromEnv to extract config objects for modification before instantiation
10216
+ * - Use createLlmToolsFromConfiguration for explicit control over tool configurations
10217
+ *
10172
10218
  * TODO: [🧠][🍛] Which name is better `$provideLlmToolsFromEnv` or `$provideLlmToolsFromEnvironment`?
10173
10219
  * TODO: [🧠] Is there some meaningfull way how to test this util
10174
10220
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment