@promptbook/node 0.92.0-26 → 0.92.0-27
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.
- package/esm/index.es.js +51 -17
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -1
- package/esm/typings/src/execution/utils/uncertainNumber.d.ts +3 -2
- package/esm/typings/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +16 -7
- package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +3 -1
- package/esm/typings/src/formfactors/index.d.ts +2 -2
- package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +4 -2
- package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +3 -2
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +4 -3
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +17 -4
- package/esm/typings/src/llm-providers/_common/register/LlmToolsConfiguration.d.ts +11 -4
- package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +17 -5
- package/esm/typings/src/llm-providers/_common/register/LlmToolsOptions.d.ts +5 -1
- package/esm/typings/src/llm-providers/_common/register/createLlmToolsFromConfiguration.d.ts +12 -3
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +5 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +51 -17
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -30,7 +30,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
30
30
|
* @generated
|
|
31
31
|
* @see https://github.com/webgptorg/promptbook
|
|
32
32
|
*/
|
|
33
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-
|
|
33
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-27';
|
|
34
34
|
/**
|
|
35
35
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
36
36
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -6223,7 +6223,7 @@ const sectionCommandParser = {
|
|
|
6223
6223
|
/**
|
|
6224
6224
|
* Parses the boilerplate command
|
|
6225
6225
|
*
|
|
6226
|
-
* Note:
|
|
6226
|
+
* Note: @@ This command is used as boilerplate for new commands - it should NOT be used in any `.book` file
|
|
6227
6227
|
*
|
|
6228
6228
|
* @see `documentationUrl` for more details
|
|
6229
6229
|
* @private within the commands folder
|
|
@@ -7159,17 +7159,20 @@ const ImageGeneratorFormfactorDefinition = {
|
|
|
7159
7159
|
};
|
|
7160
7160
|
|
|
7161
7161
|
/**
|
|
7162
|
-
* Matcher is form of app that
|
|
7162
|
+
* Matcher is form of app that evaluates (spreadsheet) content against defined criteria or patterns,
|
|
7163
|
+
* determining if it matches or meets specific requirements. Used for classification,
|
|
7164
|
+
* validation, filtering, and quality assessment of inputs.
|
|
7163
7165
|
*
|
|
7164
7166
|
* @public exported from `@promptbook/core`
|
|
7165
7167
|
*/
|
|
7166
7168
|
const MatcherFormfactorDefinition = {
|
|
7167
7169
|
name: 'EXPERIMENTAL_MATCHER',
|
|
7168
|
-
description:
|
|
7170
|
+
description: `An evaluation system that determines whether content meets specific criteria or patterns.
|
|
7171
|
+
Used for content validation, quality assessment, and intelligent filtering tasks. Currently in experimental phase.`,
|
|
7169
7172
|
documentationUrl: `https://github.com/webgptorg/promptbook/discussions/177`,
|
|
7170
7173
|
pipelineInterface: {
|
|
7171
7174
|
inputParameters: [
|
|
7172
|
-
/*
|
|
7175
|
+
/* Input parameters for content to be matched and criteria to match against */
|
|
7173
7176
|
{
|
|
7174
7177
|
name: 'nonce',
|
|
7175
7178
|
description: 'Just to prevent EXPERIMENTAL_MATCHER to be set as implicit formfactor',
|
|
@@ -7178,7 +7181,7 @@ const MatcherFormfactorDefinition = {
|
|
|
7178
7181
|
},
|
|
7179
7182
|
],
|
|
7180
7183
|
outputParameters: [
|
|
7181
|
-
/*
|
|
7184
|
+
/* Output parameters containing match results, confidence scores, and relevant metadata */
|
|
7182
7185
|
],
|
|
7183
7186
|
},
|
|
7184
7187
|
};
|
|
@@ -7215,13 +7218,16 @@ const SheetsFormfactorDefinition = {
|
|
|
7215
7218
|
};
|
|
7216
7219
|
|
|
7217
7220
|
/**
|
|
7218
|
-
* Translator is form of app that
|
|
7221
|
+
* Translator is form of app that transforms input text from one form to another,
|
|
7222
|
+
* such as language translation, style conversion, tone modification, or other text transformations.
|
|
7219
7223
|
*
|
|
7220
7224
|
* @public exported from `@promptbook/core`
|
|
7221
7225
|
*/
|
|
7222
7226
|
const TranslatorFormfactorDefinition = {
|
|
7223
7227
|
name: 'TRANSLATOR',
|
|
7224
|
-
description:
|
|
7228
|
+
description: `A text transformation system that converts input content into different forms,
|
|
7229
|
+
including language translations, paraphrasing, style conversions, and tone adjustments.
|
|
7230
|
+
This form factor takes one input and produces one transformed output.`,
|
|
7225
7231
|
documentationUrl: `https://github.com/webgptorg/promptbook/discussions/175`,
|
|
7226
7232
|
pipelineInterface: {
|
|
7227
7233
|
inputParameters: [
|
|
@@ -8348,7 +8354,10 @@ function parseCommand(raw, usagePlace) {
|
|
|
8348
8354
|
`));
|
|
8349
8355
|
}
|
|
8350
8356
|
/**
|
|
8351
|
-
*
|
|
8357
|
+
* Generates a markdown-formatted message listing all supported commands
|
|
8358
|
+
* with their descriptions and documentation links
|
|
8359
|
+
*
|
|
8360
|
+
* @returns A formatted markdown string containing all available commands and their details
|
|
8352
8361
|
*/
|
|
8353
8362
|
function getSupportedCommandsMessage() {
|
|
8354
8363
|
return COMMANDS.flatMap(({ name, aliasNames, description, documentationUrl }) =>
|
|
@@ -8359,7 +8368,10 @@ function getSupportedCommandsMessage() {
|
|
|
8359
8368
|
]).join('\n');
|
|
8360
8369
|
}
|
|
8361
8370
|
/**
|
|
8362
|
-
*
|
|
8371
|
+
* Attempts to parse a command variant using the provided input parameters
|
|
8372
|
+
*
|
|
8373
|
+
* @param input Object containing command parsing information including raw command text and normalized values
|
|
8374
|
+
* @returns A parsed Command object if successful, or null if the command cannot be parsed
|
|
8363
8375
|
*/
|
|
8364
8376
|
function parseCommandVariant(input) {
|
|
8365
8377
|
const { commandNameRaw, usagePlace, normalized, args, raw, rawArgs } = input;
|
|
@@ -10063,11 +10075,16 @@ async function $provideLlmToolsConfigurationFromEnv() {
|
|
|
10063
10075
|
*/
|
|
10064
10076
|
|
|
10065
10077
|
/**
|
|
10066
|
-
*
|
|
10078
|
+
* Creates LLM execution tools from provided configuration objects
|
|
10079
|
+
*
|
|
10080
|
+
* Instantiates and configures LLM tool instances for each configuration entry,
|
|
10081
|
+
* combining them into a unified interface via MultipleLlmExecutionTools.
|
|
10067
10082
|
*
|
|
10068
10083
|
* Note: This function is not cached, every call creates new instance of `MultipleLlmExecutionTools`
|
|
10069
10084
|
*
|
|
10070
|
-
* @
|
|
10085
|
+
* @param configuration Array of LLM tool configurations to instantiate
|
|
10086
|
+
* @param options Additional options for configuring the LLM tools
|
|
10087
|
+
* @returns A unified interface combining all successfully instantiated LLM tools
|
|
10071
10088
|
* @public exported from `@promptbook/core`
|
|
10072
10089
|
*/
|
|
10073
10090
|
function createLlmToolsFromConfiguration(configuration, options = {}) {
|
|
@@ -10106,7 +10123,11 @@ function createLlmToolsFromConfiguration(configuration, options = {}) {
|
|
|
10106
10123
|
/**
|
|
10107
10124
|
* TODO: [🎌] Together with `createLlmToolsFromConfiguration` + 'EXECUTION_TOOLS_CLASSES' gets to `@promptbook/core` ALL model providers, make this more efficient
|
|
10108
10125
|
* TODO: [🧠][🎌] Dynamically install required providers
|
|
10109
|
-
* TODO:
|
|
10126
|
+
* TODO: We should implement an interactive configuration wizard that would:
|
|
10127
|
+
* 1. Detect which LLM providers are available in the environment
|
|
10128
|
+
* 2. Guide users through required configuration settings for each provider
|
|
10129
|
+
* 3. Allow testing connections before completing setup
|
|
10130
|
+
* 4. Generate appropriate configuration code for application integration
|
|
10110
10131
|
* TODO: [🧠][🍛] Which name is better `createLlmToolsFromConfig` or `createLlmToolsFromConfiguration`?
|
|
10111
10132
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
10112
10133
|
* TODO: This should be maybe not under `_common` but under `utils`
|
|
@@ -10114,11 +10135,14 @@ function createLlmToolsFromConfiguration(configuration, options = {}) {
|
|
|
10114
10135
|
*/
|
|
10115
10136
|
|
|
10116
10137
|
/**
|
|
10117
|
-
*
|
|
10138
|
+
* Automatically configures LLM tools from environment variables in Node.js
|
|
10139
|
+
*
|
|
10140
|
+
* This utility function detects available LLM providers based on environment variables
|
|
10141
|
+
* and creates properly configured LLM execution tools for each detected provider.
|
|
10118
10142
|
*
|
|
10119
10143
|
* Note: This function is not cached, every call creates new instance of `MultipleLlmExecutionTools`
|
|
10120
10144
|
*
|
|
10121
|
-
*
|
|
10145
|
+
* Supports environment variables from .env files when dotenv is configured
|
|
10122
10146
|
* Note: `$` is used to indicate that this function is not a pure function - it uses filesystem to access `.env` file
|
|
10123
10147
|
*
|
|
10124
10148
|
* It looks for environment variables:
|
|
@@ -10126,7 +10150,8 @@ function createLlmToolsFromConfiguration(configuration, options = {}) {
|
|
|
10126
10150
|
* - `process.env.ANTHROPIC_CLAUDE_API_KEY`
|
|
10127
10151
|
* - ...
|
|
10128
10152
|
*
|
|
10129
|
-
* @
|
|
10153
|
+
* @param options Configuration options for the LLM tools
|
|
10154
|
+
* @returns A unified interface containing all detected and configured LLM tools
|
|
10130
10155
|
* @public exported from `@promptbook/node`
|
|
10131
10156
|
*/
|
|
10132
10157
|
async function $provideLlmToolsFromEnv(options = {}) {
|
|
@@ -10152,7 +10177,16 @@ async function $provideLlmToolsFromEnv(options = {}) {
|
|
|
10152
10177
|
return createLlmToolsFromConfiguration(configuration, options);
|
|
10153
10178
|
}
|
|
10154
10179
|
/**
|
|
10155
|
-
* TODO:
|
|
10180
|
+
* TODO: The architecture for LLM tools configuration consists of three key functions:
|
|
10181
|
+
* 1. `$provideLlmToolsFromEnv` - High-level function that detects available providers from env vars and returns ready-to-use LLM tools
|
|
10182
|
+
* 2. `$provideLlmToolsConfigurationFromEnv` - Middle layer that extracts configuration objects from environment variables
|
|
10183
|
+
* 3. `createLlmToolsFromConfiguration` - Low-level function that instantiates LLM tools from explicit configuration
|
|
10184
|
+
*
|
|
10185
|
+
* This layered approach allows flexibility in how tools are configured:
|
|
10186
|
+
* - Use $provideLlmToolsFromEnv for automatic detection and setup in Node.js environments
|
|
10187
|
+
* - Use $provideLlmToolsConfigurationFromEnv to extract config objects for modification before instantiation
|
|
10188
|
+
* - Use createLlmToolsFromConfiguration for explicit control over tool configurations
|
|
10189
|
+
*
|
|
10156
10190
|
* TODO: [🧠][🍛] Which name is better `$provideLlmToolsFromEnv` or `$provideLlmToolsFromEnvironment`?
|
|
10157
10191
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
10158
10192
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|