@promptbook/markdown-utils 0.92.0-23 → 0.92.0-25
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 +65 -41
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +0 -2
- package/esm/typings/src/collection/PipelineCollection.d.ts +0 -2
- package/esm/typings/src/collection/SimplePipelineCollection.d.ts +1 -1
- package/esm/typings/src/commands/FORMFACTOR/formfactorCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +36 -28
- package/esm/typings/src/config.d.ts +8 -4
- package/esm/typings/src/constants.d.ts +2 -2
- package/esm/typings/src/errors/0-BoilerplateError.d.ts +2 -2
- package/esm/typings/src/execution/CommonToolsOptions.d.ts +3 -3
- package/esm/typings/src/formats/_common/FormatSubvalueParser.d.ts +10 -10
- package/esm/typings/src/formfactors/_boilerplate/BoilerplateFormfactorDefinition.d.ts +3 -2
- package/esm/typings/src/formfactors/_common/string_formfactor_name.d.ts +2 -1
- package/esm/typings/src/formfactors/index.d.ts +1 -1
- package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +3 -2
- package/esm/typings/src/llm-providers/_common/register/$llmToolsMetadataRegister.d.ts +3 -3
- package/esm/typings/src/llm-providers/_common/register/$llmToolsRegister.d.ts +3 -3
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +4 -4
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +5 -5
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +5 -3
- package/esm/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +5 -5
- package/esm/typings/src/other/templates/getBookTemplates.d.ts +2 -2
- package/esm/typings/src/pipeline/PipelineInterface/PipelineInterface.d.ts +3 -3
- package/esm/typings/src/pipeline/PipelineInterface/constants.d.ts +1 -1
- package/esm/typings/src/pipeline/PipelineInterface/getPipelineInterface.d.ts +1 -1
- package/esm/typings/src/pipeline/PipelineInterface/isPipelineImplementingInterface.d.ts +5 -4
- package/esm/typings/src/pipeline/PipelineInterface/isPipelineInterfacesEqual.d.ts +1 -1
- package/esm/typings/src/pipeline/PipelineJson/CommonTaskJson.d.ts +9 -6
- package/esm/typings/src/pipeline/PipelineJson/PipelineJson.d.ts +2 -2
- package/esm/typings/src/pipeline/PipelineString.d.ts +3 -1
- package/esm/typings/src/pipeline/book-notation.d.ts +2 -2
- package/esm/typings/src/prepare/prepareTasks.d.ts +7 -4
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +2 -1
- package/esm/typings/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +3 -3
- package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +1 -1
- package/esm/typings/src/scrapers/_common/Converter.d.ts +3 -1
- package/esm/typings/src/scrapers/_common/Scraper.d.ts +4 -3
- package/esm/typings/src/scrapers/_common/ScraperIntermediateSource.d.ts +4 -2
- package/esm/typings/src/scrapers/_common/register/$provideFilesystemForNode.d.ts +2 -1
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForBrowser.d.ts +6 -3
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForNode.d.ts +3 -5
- package/esm/typings/src/scrapers/_common/register/$scrapersRegister.d.ts +3 -2
- package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +8 -5
- package/esm/typings/src/scrapers/_common/register/ScraperConstructor.d.ts +2 -1
- package/esm/typings/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +6 -5
- package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +3 -1
- package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +2 -1
- package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +4 -1
- package/esm/typings/src/scrapers/markitdown/MarkitdownScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +2 -1
- package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +3 -4
- package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +5 -1
- package/esm/typings/src/storage/file-cache-storage/FileCacheStorage.d.ts +12 -5
- package/esm/typings/src/storage/file-cache-storage/FileCacheStorageOptions.d.ts +4 -2
- package/esm/typings/src/storage/file-cache-storage/utils/nameToSubfolderPath.d.ts +2 -1
- package/esm/typings/src/storage/local-storage/utils/makePromptbookStorageFromWebStorage.d.ts +2 -1
- package/esm/typings/src/types/IntermediateFilesStrategy.d.ts +2 -1
- package/esm/typings/src/types/ModelVariant.d.ts +5 -5
- package/esm/typings/src/types/typeAliases.d.ts +8 -6
- package/esm/typings/src/utils/editable/edit-pipeline-string/addPipelineCommand.d.ts +2 -2
- package/esm/typings/src/utils/editable/edit-pipeline-string/deflatePipeline.d.ts +4 -1
- package/esm/typings/src/utils/editable/utils/isFlatPipeline.d.ts +2 -1
- package/esm/typings/src/utils/environment/$getGlobalScope.d.ts +2 -1
- package/esm/typings/src/utils/markdown/extractAllListItemsFromMarkdown.d.ts +1 -1
- package/esm/typings/src/utils/normalization/nameToUriPart.d.ts +4 -4
- package/esm/typings/src/utils/normalization/nameToUriParts.d.ts +4 -4
- package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +3 -3
- package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +3 -3
- package/esm/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +4 -4
- package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +3 -3
- package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +3 -3
- package/esm/typings/src/utils/normalization/searchKeywords.d.ts +4 -1
- package/esm/typings/src/utils/normalization/titleToName.d.ts +4 -4
- package/esm/typings/src/utils/organization/empty_object.d.ts +2 -2
- package/esm/typings/src/utils/organization/just_empty_object.d.ts +4 -4
- package/esm/typings/src/version.d.ts +2 -1
- package/package.json +1 -1
- package/umd/index.umd.js +65 -41
- package/umd/index.umd.js.map +1 -1
|
@@ -122,7 +122,6 @@ import { EXPECTATION_UNITS } from '../pipeline/PipelineJson/Expectations';
|
|
|
122
122
|
import { validatePipelineString } from '../pipeline/validatePipelineString';
|
|
123
123
|
import { isPipelinePrepared } from '../prepare/isPipelinePrepared';
|
|
124
124
|
import { preparePipeline } from '../prepare/preparePipeline';
|
|
125
|
-
import { prepareTasks } from '../prepare/prepareTasks';
|
|
126
125
|
import { unpreparePipeline } from '../prepare/unpreparePipeline';
|
|
127
126
|
import { identificationToPromptbookToken } from '../remote-server/socket-types/_subtypes/identificationToPromptbookToken';
|
|
128
127
|
import { promptbookTokenToIdentification } from '../remote-server/socket-types/_subtypes/promptbookTokenToIdentification';
|
|
@@ -270,7 +269,6 @@ export { EXPECTATION_UNITS };
|
|
|
270
269
|
export { validatePipelineString };
|
|
271
270
|
export { isPipelinePrepared };
|
|
272
271
|
export { preparePipeline };
|
|
273
|
-
export { prepareTasks };
|
|
274
272
|
export { unpreparePipeline };
|
|
275
273
|
export { identificationToPromptbookToken };
|
|
276
274
|
export { promptbookTokenToIdentification };
|
|
@@ -4,8 +4,6 @@ import type { Prompt } from '../types/Prompt';
|
|
|
4
4
|
import type { string_pipeline_url } from '../types/typeAliases';
|
|
5
5
|
/**
|
|
6
6
|
* Collection that groups together pipelines, knowledge, personas, tools and actions
|
|
7
|
-
*
|
|
8
|
-
* @see @@@ https://github.com/webgptorg/pipeline#pipeline-collection
|
|
9
7
|
*/
|
|
10
8
|
export type PipelineCollection = {
|
|
11
9
|
/**
|
|
@@ -14,7 +14,7 @@ export declare class SimplePipelineCollection implements PipelineCollection {
|
|
|
14
14
|
/**
|
|
15
15
|
* Constructs a pipeline collection from pipelines
|
|
16
16
|
*
|
|
17
|
-
* @param pipelines
|
|
17
|
+
* @param pipelines Array of pipeline JSON objects to include in the collection
|
|
18
18
|
*
|
|
19
19
|
* Note: During the construction logic of all pipelines are validated
|
|
20
20
|
* Note: It is not recommended to use this constructor directly, use `createCollectionFromJson` *(or other variant)* instead
|
|
@@ -3,7 +3,7 @@ import type { FormfactorCommand } from './FormfactorCommand';
|
|
|
3
3
|
/**
|
|
4
4
|
* Parses the formfactor command
|
|
5
5
|
*
|
|
6
|
-
* Note:
|
|
6
|
+
* Note: This command is used as a formfactor for new commands and defines the app type format - it should NOT be used in any `.book` file
|
|
7
7
|
*
|
|
8
8
|
* @see `documentationUrl` for more details
|
|
9
9
|
* @public exported from `@promptbook/editable`
|
|
@@ -8,7 +8,8 @@ import type { string_SCREAMING_CASE } from '../../../utils/normalization/normali
|
|
|
8
8
|
import type { ___and___ } from '../../../utils/organization/___and___';
|
|
9
9
|
import type { CommandUsagePlace } from './CommandUsagePlaces';
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Base type for all command objects.
|
|
12
|
+
* Requires a `type` property which is a SCREAMING_CASE string.
|
|
12
13
|
*
|
|
13
14
|
* @private just abstract helper for command parsers
|
|
14
15
|
*/
|
|
@@ -16,47 +17,48 @@ export type CommandBase = {
|
|
|
16
17
|
type: string_name & string_SCREAMING_CASE;
|
|
17
18
|
};
|
|
18
19
|
/**
|
|
19
|
-
*
|
|
20
|
+
* Represents a parser for a specific command used within a Promptbook pipeline.
|
|
21
|
+
* It can parse commands used in the pipeline head, tasks, or both.
|
|
20
22
|
*
|
|
21
23
|
* @public exported from `@promptbook/editable`
|
|
22
24
|
*/
|
|
23
25
|
export type CommandParser<TCommand extends CommandBase> = PipelineHeadCommandParser<TCommand> | PipelineTaskCommandParser<TCommand> | PipelineBothCommandParser<TCommand>;
|
|
24
26
|
/**
|
|
25
|
-
*
|
|
27
|
+
* Common properties shared by all command parsers.
|
|
26
28
|
*
|
|
27
29
|
* @private just abstract the common properties of the command parsers
|
|
28
30
|
*/
|
|
29
31
|
export type CommonCommandParser<TCommand extends CommandBase> = {
|
|
30
32
|
/**
|
|
31
|
-
*
|
|
33
|
+
* The unique SCREAMING_CASE name of the command (e.g., 'MODEL', 'PARAMETER').
|
|
32
34
|
*/
|
|
33
35
|
readonly name: string_name & string_SCREAMING_CASE;
|
|
34
36
|
/**
|
|
35
|
-
*
|
|
37
|
+
* Indicates if the command can be used in the pipeline's head section.
|
|
36
38
|
*/
|
|
37
39
|
readonly isUsedInPipelineHead: boolean;
|
|
38
40
|
/**
|
|
39
|
-
*
|
|
41
|
+
* Indicates if the command can be used within a pipeline task.
|
|
40
42
|
*/
|
|
41
43
|
readonly isUsedInPipelineTask: boolean;
|
|
42
44
|
/**
|
|
43
|
-
*
|
|
45
|
+
* Optional alternative names (aliases) for the command, also in SCREAMING_CASE.
|
|
44
46
|
*/
|
|
45
47
|
readonly aliasNames?: ReadonlyArray<string_name & string_SCREAMING_CASE>;
|
|
46
48
|
/**
|
|
47
|
-
*
|
|
49
|
+
* Optional list of deprecated names for the command, used for backward compatibility.
|
|
48
50
|
*/
|
|
49
51
|
readonly deprecatedNames?: ReadonlyArray<string_name & string_SCREAMING_CASE>;
|
|
50
52
|
/**
|
|
51
|
-
*
|
|
53
|
+
* A brief description of the command's purpose, supporting simple Markdown.
|
|
52
54
|
*/
|
|
53
55
|
readonly description: string_markdown_text;
|
|
54
56
|
/**
|
|
55
|
-
*
|
|
57
|
+
* A URL pointing to the command's documentation.
|
|
56
58
|
*/
|
|
57
59
|
readonly documentationUrl: string_promptbook_documentation_url;
|
|
58
60
|
/**
|
|
59
|
-
*
|
|
61
|
+
* Examples demonstrating the usage of the command in Markdown format.
|
|
60
62
|
*/
|
|
61
63
|
readonly examples: ReadonlyArray<string_markdown_text>;
|
|
62
64
|
/**
|
|
@@ -72,23 +74,23 @@ export type CommonCommandParser<TCommand extends CommandBase> = {
|
|
|
72
74
|
stringify(command: TCommand): string_markdown_text;
|
|
73
75
|
};
|
|
74
76
|
/**
|
|
75
|
-
*
|
|
77
|
+
* Represents a command parser that can be used in both the pipeline head and tasks.
|
|
76
78
|
*
|
|
77
79
|
* @public exported from `@promptbook/editable`
|
|
78
80
|
*/
|
|
79
81
|
export type PipelineBothCommandParser<TCommand extends CommandBase> = ___and___ & Omit<PipelineHeadCommandParser<TCommand>, 'isUsedInPipelineTask'> & Omit<PipelineTaskCommandParser<TCommand>, 'isUsedInPipelineHead'>;
|
|
80
82
|
/**
|
|
81
|
-
*
|
|
83
|
+
* Represents a command parser specifically for the pipeline head section.
|
|
82
84
|
*
|
|
83
85
|
* @public exported from `@promptbook/editable`
|
|
84
86
|
*/
|
|
85
87
|
export type PipelineHeadCommandParser<TCommand extends CommandBase> = CommonCommandParser<TCommand> & {
|
|
86
88
|
/**
|
|
87
|
-
*
|
|
89
|
+
* Always true for pipeline head commands.
|
|
88
90
|
*/
|
|
89
91
|
readonly isUsedInPipelineHead: true;
|
|
90
92
|
/**
|
|
91
|
-
*
|
|
93
|
+
* Always false for pipeline head commands.
|
|
92
94
|
*/
|
|
93
95
|
readonly isUsedInPipelineTask: false;
|
|
94
96
|
/**
|
|
@@ -106,17 +108,17 @@ export type PipelineHeadCommandParser<TCommand extends CommandBase> = CommonComm
|
|
|
106
108
|
takeFromPipelineJson(pipelineJson: PipelineJson): ReadonlyArray<TCommand>;
|
|
107
109
|
};
|
|
108
110
|
/**
|
|
109
|
-
*
|
|
111
|
+
* Represents a command parser specifically for pipeline tasks.
|
|
110
112
|
*
|
|
111
113
|
* @public exported from `@promptbook/editable`
|
|
112
114
|
*/
|
|
113
115
|
export type PipelineTaskCommandParser<TCommand extends CommandBase> = CommonCommandParser<TCommand> & {
|
|
114
116
|
/**
|
|
115
|
-
*
|
|
117
|
+
* Always false for pipeline task commands.
|
|
116
118
|
*/
|
|
117
119
|
readonly isUsedInPipelineHead: false;
|
|
118
120
|
/**
|
|
119
|
-
*
|
|
121
|
+
* Always true for pipeline task commands.
|
|
120
122
|
*/
|
|
121
123
|
readonly isUsedInPipelineTask: true;
|
|
122
124
|
/**
|
|
@@ -133,58 +135,64 @@ export type PipelineTaskCommandParser<TCommand extends CommandBase> = CommonComm
|
|
|
133
135
|
takeFromTaskJson($taskJson: $TaskJson): ReadonlyArray<TCommand>;
|
|
134
136
|
};
|
|
135
137
|
/**
|
|
136
|
-
*
|
|
138
|
+
* Represents a mutable TaskJson object, used internally by command parsers during application.
|
|
137
139
|
*
|
|
138
|
-
* Note: `$`
|
|
140
|
+
* Note: `$` prefix indicates the object is intended for mutation.
|
|
139
141
|
*
|
|
140
142
|
* @private internal helper for command parsers
|
|
141
143
|
*/
|
|
142
144
|
export type $TaskJson = {
|
|
145
|
+
/**
|
|
146
|
+
* Flag indicating if the section type (e.g., `SIMPLE_TEMPLATE`) has been set for this task.
|
|
147
|
+
*/
|
|
143
148
|
isSectionTypeSet: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Flag indicating if this object represents a task (as opposed to other sections like parameters).
|
|
151
|
+
*/
|
|
144
152
|
isTask: boolean;
|
|
145
153
|
} & Partial<WritableDeep<TaskJson>>;
|
|
146
154
|
/**
|
|
147
|
-
*
|
|
155
|
+
* Represents a mutable PipelineJson object, used internally by command parsers during application.
|
|
148
156
|
*
|
|
149
|
-
*
|
|
157
|
+
* Note: `$` prefix indicates the object is intended for mutation.
|
|
150
158
|
*
|
|
151
159
|
* @private internal helper for command parsers
|
|
152
160
|
*/
|
|
153
161
|
export type $PipelineJson = WritableDeep<SetOptional<PipelineJson, 'formfactorName'>>;
|
|
154
162
|
/**
|
|
155
|
-
*
|
|
163
|
+
* Input object provided to the `parse` method of a CommandParser.
|
|
156
164
|
*/
|
|
157
165
|
export type CommandParserInput = {
|
|
158
166
|
/**
|
|
159
|
-
*
|
|
167
|
+
* Specifies where the command is being used (pipeline head or task).
|
|
160
168
|
*
|
|
161
169
|
* @example 'PIPELINE_HEAD'
|
|
162
170
|
* @example 'PIPELINE_TASK'
|
|
163
171
|
*/
|
|
164
172
|
readonly usagePlace: CommandUsagePlace;
|
|
165
173
|
/**
|
|
166
|
-
*
|
|
174
|
+
* The raw, unprocessed line containing the command and its arguments.
|
|
167
175
|
*
|
|
168
176
|
* @example 'promptbook version 0.62.0'
|
|
169
177
|
* @example 'FOREACH Text Line `{customers}` -> `{customer}`'
|
|
170
178
|
*/
|
|
171
179
|
readonly raw: string_markdown_text;
|
|
172
180
|
/**
|
|
173
|
-
*
|
|
181
|
+
* The arguments part of the raw command line, after the command name.
|
|
174
182
|
*
|
|
175
183
|
* @example '0.62.0'
|
|
176
184
|
* @example 'List Line `{customers}` -> `{customer}`'
|
|
177
185
|
*/
|
|
178
186
|
readonly rawArgs: string_markdown_text;
|
|
179
187
|
/**
|
|
180
|
-
*
|
|
188
|
+
* The normalized, SCREAMING_CASE representation of the command and its core arguments.
|
|
181
189
|
*
|
|
182
190
|
* @example 'PROMPTBOOK_ENGINE_VERSION_0_62_0'
|
|
183
191
|
* @example 'FOREACH_LIST_LINE_CUSTOMERS_CUSTOMER'
|
|
184
192
|
*/
|
|
185
193
|
readonly normalized: string_name & string_SCREAMING_CASE;
|
|
186
194
|
/**
|
|
187
|
-
*
|
|
195
|
+
* An array of arguments extracted from the line where the command is used.
|
|
188
196
|
*
|
|
189
197
|
* @example [ '0.62.0' ]
|
|
190
198
|
* @example [ 'List', 'Line', '{customers}', '', '{customer}' ]
|
|
@@ -69,19 +69,23 @@ export declare const DEFAULT_BOOK_OUTPUT_PARAMETER_NAME = "result";
|
|
|
69
69
|
*/
|
|
70
70
|
export declare const DEFAULT_MAX_FILE_SIZE: number;
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* Threshold value that determines when a dataset is considered "big"
|
|
73
|
+
* and may require special handling or optimizations
|
|
74
|
+
*
|
|
75
|
+
* For example, when error occurs in one item of the big dataset, it will not fail the whole pipeline
|
|
73
76
|
*
|
|
74
77
|
* @public exported from `@promptbook/core`
|
|
75
78
|
*/
|
|
76
79
|
export declare const BIG_DATASET_TRESHOLD = 50;
|
|
77
80
|
/**
|
|
78
|
-
*
|
|
81
|
+
* Placeholder text used to represent a placeholder value of failed operation
|
|
79
82
|
*
|
|
80
83
|
* @public exported from `@promptbook/core`
|
|
81
84
|
*/
|
|
82
|
-
export declare const FAILED_VALUE_PLACEHOLDER = "
|
|
85
|
+
export declare const FAILED_VALUE_PLACEHOLDER = "!?";
|
|
83
86
|
/**
|
|
84
|
-
*
|
|
87
|
+
* Placeholder text used to represent operations or values that are still in progress
|
|
88
|
+
* or awaiting completion in UI displays and logging
|
|
85
89
|
*
|
|
86
90
|
* @public exported from `@promptbook/core`
|
|
87
91
|
*/
|
|
@@ -13,13 +13,13 @@ export declare const ORDER_OF_PIPELINE_JSON: ExportJsonOptions<PipelineJson>['or
|
|
|
13
13
|
*/
|
|
14
14
|
export declare const REPLACING_NONCE = "ptbkauk42kV2dzao34faw7FudQUHYPtW";
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Placeholder value indicating a parameter is missing its value.
|
|
17
17
|
*
|
|
18
18
|
* @private within the repository
|
|
19
19
|
*/
|
|
20
20
|
export declare const RESERVED_PARAMETER_MISSING_VALUE: string;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Placeholder value indicating a parameter is restricted and cannot be used directly.
|
|
23
23
|
*
|
|
24
24
|
* @private within the repository
|
|
25
25
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This error indicates
|
|
2
|
+
* This error indicates @@
|
|
3
3
|
*
|
|
4
4
|
* @public exported from `@promptbook/core`
|
|
5
5
|
*/
|
|
@@ -8,5 +8,5 @@ export declare class BoilerplateError extends Error {
|
|
|
8
8
|
constructor(message: string);
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* TODO:
|
|
11
|
+
* TODO: @@ Do not forget to add the error into `0-index.ts` ERRORS
|
|
12
12
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { string_user_id } from '../types/typeAliases';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Common options shared across various execution tools.
|
|
4
4
|
*
|
|
5
5
|
* Note: Keep it public to allow people to make their own execution tools
|
|
6
6
|
*/
|
|
@@ -17,8 +17,8 @@ export type CommonToolsOptions = {
|
|
|
17
17
|
*/
|
|
18
18
|
readonly isVerbose?: boolean;
|
|
19
19
|
/**
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
* Maximum number of requests per minute
|
|
21
|
+
*/
|
|
22
22
|
readonly maxRequestsPerMinute?: number;
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
@@ -32,32 +32,32 @@ export type FormatSubvalueParser<TValue extends string, TSettings extends empty_
|
|
|
32
32
|
*/
|
|
33
33
|
export type FormatSubvalueParserMapValuesOptions<TValue extends string, TSettings extends empty_object> = {
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* The input string value to parse for subvalues
|
|
36
36
|
*/
|
|
37
37
|
readonly value: TValue;
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* The name of the output parameter where the processed value will be stored
|
|
40
40
|
*/
|
|
41
41
|
readonly outputParameterName: string_parameter_name;
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* Format-specific settings that control how subvalues are parsed or processed
|
|
44
44
|
*/
|
|
45
45
|
readonly settings: TSettings;
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
47
|
+
* Callback function that processes each subvalue and returns the transformed value
|
|
48
48
|
*
|
|
49
|
-
* @param subvalues
|
|
49
|
+
* @param subvalues Object containing the extracted subvalues
|
|
50
50
|
* @param index Current index of the subvalue which is being mapped
|
|
51
51
|
* @param length Full length of the subvalues
|
|
52
|
-
* @param number
|
|
53
|
-
* @returns
|
|
52
|
+
* @param number Total number of subvalues to process
|
|
53
|
+
* @returns Transformed value after processing
|
|
54
54
|
*/
|
|
55
55
|
mapCallback(subvalues: Parameters, index: number, length: number): Promisable<TValue>;
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
57
|
+
* Progress callback that receives partial results during processing
|
|
58
58
|
*
|
|
59
|
-
* @param partialResultString
|
|
60
|
-
* @returns
|
|
59
|
+
* @param partialResultString The current partial result as processing progresses
|
|
60
|
+
* @returns Promise or void to continue execution
|
|
61
61
|
*/
|
|
62
62
|
onProgress(partialResultString: TValue): Promisable<void>;
|
|
63
63
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Boilerplate is form of app that
|
|
2
|
+
* Boilerplate is form of app that serves as a template structure for creating other formfactors
|
|
3
|
+
* and should not be used directly in production.
|
|
3
4
|
*
|
|
4
5
|
* @public exported from `@promptbook/core`
|
|
5
6
|
*/
|
|
6
7
|
export declare const BoilerplateFormfactorDefinition: {
|
|
7
8
|
readonly name: "BOILERPLATE";
|
|
8
|
-
readonly description: "
|
|
9
|
+
readonly description: "A template structure for creating new formfactors, providing the base architecture and interfaces that should be implemented.";
|
|
9
10
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@";
|
|
10
11
|
readonly pipelineInterface: {
|
|
11
12
|
readonly inputParameters: readonly [];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { FormfactorDefinition } from './FormfactorDefinition';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* A type alias representing the name of a formfactor, used for type checking and validation
|
|
4
|
+
* in the formfactor registry and selection processes
|
|
4
5
|
*/
|
|
5
6
|
export type string_formfactor_name = FormfactorDefinition['name'];
|
|
@@ -71,7 +71,7 @@ export declare const FORMFACTOR_DEFINITIONS: readonly [{
|
|
|
71
71
|
}, {
|
|
72
72
|
readonly name: "SHEETS";
|
|
73
73
|
readonly aliasNames: readonly ["SHEETS", "SHEET"];
|
|
74
|
-
readonly description: "
|
|
74
|
+
readonly description: "A formfactor for processing spreadsheet-like data in CSV format, enabling AI transformations on tabular data";
|
|
75
75
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/176";
|
|
76
76
|
readonly pipelineInterface: {
|
|
77
77
|
readonly inputParameters: readonly [{
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Sheets is form of app that
|
|
2
|
+
* Sheets is form of app that processes tabular data in CSV format, allowing transformation
|
|
3
|
+
* and analysis of structured data through AI-powered operations
|
|
3
4
|
*
|
|
4
5
|
* @public exported from `@promptbook/core`
|
|
5
6
|
*/
|
|
6
7
|
export declare const SheetsFormfactorDefinition: {
|
|
7
8
|
readonly name: "SHEETS";
|
|
8
9
|
readonly aliasNames: readonly ["SHEETS", "SHEET"];
|
|
9
|
-
readonly description: "
|
|
10
|
+
readonly description: "A formfactor for processing spreadsheet-like data in CSV format, enabling AI transformations on tabular data";
|
|
10
11
|
readonly documentationUrl: "https://github.com/webgptorg/promptbook/discussions/176";
|
|
11
12
|
readonly pipelineInterface: {
|
|
12
13
|
readonly inputParameters: readonly [{
|
|
@@ -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
|
|
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
|
|
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
|
+
*/
|
package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts
CHANGED
|
@@ -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
|
-
* @
|
|
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,23 +3,23 @@ import type { Prompt } from '../../../../types/Prompt';
|
|
|
3
3
|
import type { string_date_iso8601 } from '../../../../types/typeAliases';
|
|
4
4
|
import type { string_promptbook_version } from '../../../../version';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Represents a single item stored in the LLM cache.
|
|
7
7
|
*/
|
|
8
8
|
export type CacheItem = {
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* The date and time when the cache item was created, in ISO 8601 format.
|
|
11
11
|
*/
|
|
12
12
|
date: string_date_iso8601;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* The version of the Promptbook library used when this cache item was created.
|
|
15
15
|
*/
|
|
16
16
|
promptbookVersion?: string_promptbook_version;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* The prompt that was sent to the LLM.
|
|
19
19
|
*/
|
|
20
20
|
prompt: Prompt;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* The response received from the LLM.
|
|
23
23
|
*/
|
|
24
24
|
promptResult: PromptResult;
|
|
25
25
|
};
|
|
@@ -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: [👷♂️]
|
|
17
|
-
*
|
|
18
|
-
*
|
|
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,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
|
-
*
|
|
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
|
|
@@ -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,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
|