@promptbook/markdown-utils 0.92.0-22 → 0.92.0-24
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 +115 -55
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +6 -0
- 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/FOREACH/ForeachJson.d.ts +6 -6
- package/esm/typings/src/commands/FORMFACTOR/formfactorCommandParser.d.ts +1 -1
- package/esm/typings/src/config.d.ts +33 -11
- package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +12 -9
- package/esm/typings/src/execution/createPipelineExecutor/20-executeTask.d.ts +11 -8
- package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +8 -3
- package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTask.d.ts +10 -8
- package/esm/typings/src/formats/_common/FormatParser.d.ts +5 -3
- package/esm/typings/src/formats/_common/FormatSubvalueParser.d.ts +31 -6
- package/esm/typings/src/formats/csv/utils/isValidCsvString.d.ts +1 -1
- package/esm/typings/src/formats/json/utils/isValidJsonString.d.ts +1 -1
- package/esm/typings/src/formats/xml/utils/isValidXmlString.d.ts +1 -1
- 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/LlmToolsOptions.d.ts +4 -1
- package/esm/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +3 -3
- package/esm/typings/src/scrapers/_common/register/$scrapersMetadataRegister.d.ts +3 -3
- package/esm/typings/src/types/typeAliases.d.ts +9 -7
- package/esm/typings/src/utils/$Register.d.ts +8 -7
- package/esm/typings/src/utils/environment/$getGlobalScope.d.ts +2 -1
- package/esm/typings/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +7 -7
- package/esm/typings/src/utils/serialization/clonePipeline.d.ts +4 -3
- package/esm/typings/src/utils/serialization/deepClone.d.ts +5 -1
- package/esm/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +3 -3
- package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +5 -4
- package/package.json +1 -1
- package/umd/index.umd.js +115 -55
- package/umd/index.umd.js.map +1 -1
|
@@ -13,6 +13,9 @@ import { DEFAULT_TASK_TITLE } from '../config';
|
|
|
13
13
|
import { DEFAULT_PROMPT_TASK_TITLE } from '../config';
|
|
14
14
|
import { DEFAULT_BOOK_OUTPUT_PARAMETER_NAME } from '../config';
|
|
15
15
|
import { DEFAULT_MAX_FILE_SIZE } from '../config';
|
|
16
|
+
import { BIG_DATASET_TRESHOLD } from '../config';
|
|
17
|
+
import { FAILED_VALUE_PLACEHOLDER } from '../config';
|
|
18
|
+
import { PENDING_VALUE_PLACEHOLDER } from '../config';
|
|
16
19
|
import { MAX_FILENAME_LENGTH } from '../config';
|
|
17
20
|
import { DEFAULT_INTERMEDIATE_FILES_STRATEGY } from '../config';
|
|
18
21
|
import { DEFAULT_MAX_PARALLEL_COUNT } from '../config';
|
|
@@ -158,6 +161,9 @@ export { DEFAULT_TASK_TITLE };
|
|
|
158
161
|
export { DEFAULT_PROMPT_TASK_TITLE };
|
|
159
162
|
export { DEFAULT_BOOK_OUTPUT_PARAMETER_NAME };
|
|
160
163
|
export { DEFAULT_MAX_FILE_SIZE };
|
|
164
|
+
export { BIG_DATASET_TRESHOLD };
|
|
165
|
+
export { FAILED_VALUE_PLACEHOLDER };
|
|
166
|
+
export { PENDING_VALUE_PLACEHOLDER };
|
|
161
167
|
export { MAX_FILENAME_LENGTH };
|
|
162
168
|
export { DEFAULT_INTERMEDIATE_FILES_STRATEGY };
|
|
163
169
|
export { DEFAULT_MAX_PARALLEL_COUNT };
|
|
@@ -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
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import type { string_parameter_name } from '../../types/typeAliases';
|
|
2
2
|
import type { TODO_string } from '../../utils/organization/TODO_string';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Information for the FOREACH command, describing how to iterate over a parameter's subvalues in a pipeline task.
|
|
5
5
|
*/
|
|
6
6
|
export type ForeachJson = {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* The name of the format to use for parsing the parameter (e.g., 'CSV').
|
|
9
9
|
*/
|
|
10
10
|
readonly formatName: TODO_string;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* The name of the subformat to use (e.g., CSV Rows).
|
|
13
13
|
*/
|
|
14
14
|
readonly subformatName: TODO_string;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* The name of the parameter to iterate over.
|
|
17
17
|
*/
|
|
18
18
|
readonly parameterName: string_parameter_name;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* The names of the subparameters (e.g., name of the CSV rows)
|
|
21
21
|
*/
|
|
22
22
|
readonly inputSubparameterNames: Array<string_parameter_name>;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* The name of the subparameters (e.g., name of the CSV rows)
|
|
25
25
|
*/
|
|
26
26
|
readonly outputSubparameterName: string_parameter_name;
|
|
27
27
|
};
|
|
@@ -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`
|
|
@@ -68,6 +68,28 @@ export declare const DEFAULT_BOOK_OUTPUT_PARAMETER_NAME = "result";
|
|
|
68
68
|
* @public exported from `@promptbook/core`
|
|
69
69
|
*/
|
|
70
70
|
export declare const DEFAULT_MAX_FILE_SIZE: number;
|
|
71
|
+
/**
|
|
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
|
|
76
|
+
*
|
|
77
|
+
* @public exported from `@promptbook/core`
|
|
78
|
+
*/
|
|
79
|
+
export declare const BIG_DATASET_TRESHOLD = 50;
|
|
80
|
+
/**
|
|
81
|
+
* Placeholder text used to represent a placeholder value of failed operation
|
|
82
|
+
*
|
|
83
|
+
* @public exported from `@promptbook/core`
|
|
84
|
+
*/
|
|
85
|
+
export declare const FAILED_VALUE_PLACEHOLDER = "!?";
|
|
86
|
+
/**
|
|
87
|
+
* Placeholder text used to represent operations or values that are still in progress
|
|
88
|
+
* or awaiting completion in UI displays and logging
|
|
89
|
+
*
|
|
90
|
+
* @public exported from `@promptbook/core`
|
|
91
|
+
*/
|
|
92
|
+
export declare const PENDING_VALUE_PLACEHOLDER = "\u2026";
|
|
71
93
|
/**
|
|
72
94
|
* Warning message for the generated sections and files files
|
|
73
95
|
*
|
|
@@ -156,15 +178,15 @@ export declare const DEFAULT_MAX_PARALLEL_COUNT = 5;
|
|
|
156
178
|
*/
|
|
157
179
|
export declare const DEFAULT_MAX_EXECUTION_ATTEMPTS = 10;
|
|
158
180
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
181
|
+
* The maximum depth to which knowledge sources will be scraped when building a knowledge base.
|
|
182
|
+
* This prevents infinite recursion and limits resource usage.
|
|
161
183
|
*
|
|
162
184
|
* @public exported from `@promptbook/core`
|
|
163
185
|
*/
|
|
164
186
|
export declare const DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH = 3;
|
|
165
187
|
/**
|
|
166
|
-
*
|
|
167
|
-
*
|
|
188
|
+
* The maximum total number of knowledge sources that will be scraped in a single operation.
|
|
189
|
+
* This acts as a global limit to avoid excessive resource consumption.
|
|
168
190
|
*
|
|
169
191
|
* @public exported from `@promptbook/core`
|
|
170
192
|
*/
|
|
@@ -234,27 +256,27 @@ export declare const MOMENT_ARG_THRESHOLDS: {
|
|
|
234
256
|
*/
|
|
235
257
|
export declare const DEFAULT_REMOTE_SERVER_URL: string_promptbook_server_url;
|
|
236
258
|
/**
|
|
237
|
-
*
|
|
259
|
+
* Default settings for parsing and generating CSV files in Promptbook.
|
|
238
260
|
*
|
|
239
261
|
* @public exported from `@promptbook/core`
|
|
240
262
|
*/
|
|
241
263
|
export declare const DEFAULT_CSV_SETTINGS: CsvSettings;
|
|
242
264
|
/**
|
|
243
|
-
*
|
|
265
|
+
* Controls whether verbose logging is enabled by default throughout the application.
|
|
244
266
|
*
|
|
245
267
|
* @public exported from `@promptbook/core`
|
|
246
268
|
*/
|
|
247
269
|
export declare let DEFAULT_IS_VERBOSE: boolean;
|
|
248
270
|
/**
|
|
249
|
-
*
|
|
271
|
+
* Enables or disables verbose logging globally at runtime.
|
|
250
272
|
*
|
|
251
|
-
* Note: This is experimental feature
|
|
273
|
+
* Note: This is an experimental feature.
|
|
252
274
|
*
|
|
253
275
|
* @public exported from `@promptbook/core`
|
|
254
276
|
*/
|
|
255
277
|
export declare function SET_IS_VERBOSE(isVerbose: boolean): void;
|
|
256
278
|
/**
|
|
257
|
-
*
|
|
279
|
+
* Controls whether auto-installation of dependencies is enabled by default.
|
|
258
280
|
*
|
|
259
281
|
* @public exported from `@promptbook/core`
|
|
260
282
|
*/
|
|
@@ -274,13 +296,13 @@ export declare const DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME = "getPipelin
|
|
|
274
296
|
*/
|
|
275
297
|
export declare const DEFAULT_RPM = 60;
|
|
276
298
|
/**
|
|
277
|
-
*
|
|
299
|
+
* Indicates whether pipeline logic validation is enabled. When true, the pipeline logic is checked for consistency.
|
|
278
300
|
*
|
|
279
301
|
* @private within the repository
|
|
280
302
|
*/
|
|
281
303
|
export declare const IS_PIPELINE_LOGIC_VALIDATED: boolean;
|
|
282
304
|
/**
|
|
283
|
-
*
|
|
305
|
+
* Indicates whether cost-prevention is enabled. When true, real API keys are prevented from being used in tests.
|
|
284
306
|
*
|
|
285
307
|
* @private within the repository
|
|
286
308
|
*/
|
|
@@ -4,40 +4,43 @@ import type { InputParameters } from '../../types/typeAliases';
|
|
|
4
4
|
import type { PipelineExecutorResult } from '../PipelineExecutorResult';
|
|
5
5
|
import type { CreatePipelineExecutorOptions } from './00-CreatePipelineExecutorOptions';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Options for executing an entire pipeline, including input parameters, pipeline context, and progress callbacks.
|
|
8
8
|
*
|
|
9
9
|
* @private internal type of `executePipeline`
|
|
10
10
|
*/
|
|
11
11
|
type ExecutePipelineOptions = Required<CreatePipelineExecutorOptions> & {
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* The input parameters provided by the user for pipeline execution.
|
|
14
14
|
*/
|
|
15
15
|
readonly inputParameters: Readonly<InputParameters>;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Optional callback invoked with partial results as the pipeline execution progresses.
|
|
18
18
|
*/
|
|
19
19
|
onProgress?(newOngoingResult: PartialDeep<PipelineExecutorResult>): Promisable<void>;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* The pipeline definition to execute.
|
|
22
22
|
*/
|
|
23
23
|
readonly pipeline: PipelineJson;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* The prepared and validated pipeline, ready for execution.
|
|
26
26
|
*/
|
|
27
27
|
readonly preparedPipeline: ReadonlyDeep<PipelineJson>;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Callback to update the prepared pipeline reference after preparation.
|
|
30
30
|
*/
|
|
31
31
|
readonly setPreparedPipeline: (preparedPipeline: ReadonlyDeep<PipelineJson>) => void;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* String identifier for the pipeline, used in error messages and reporting.
|
|
34
34
|
*/
|
|
35
35
|
readonly pipelineIdentification: string;
|
|
36
36
|
};
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* Executes an entire pipeline, resolving tasks in dependency order, handling errors, and reporting progress.
|
|
39
39
|
*
|
|
40
|
-
* Note: This is not a `PipelineExecutor` (which is
|
|
40
|
+
* Note: This is not a `PipelineExecutor` (which is bound to a single pipeline), but a utility function used by `createPipelineExecutor` to create a `PipelineExecutor`.
|
|
41
|
+
*
|
|
42
|
+
* @param options - Options for execution, including input parameters, pipeline, and callbacks.
|
|
43
|
+
* @returns The result of the pipeline execution, including output parameters, errors, and usage statistics.
|
|
41
44
|
*
|
|
42
45
|
* @private internal utility of `createPipelineExecutor`
|
|
43
46
|
*/
|
|
@@ -6,38 +6,41 @@ import type { ExecutionReportJson } from '../execution-report/ExecutionReportJso
|
|
|
6
6
|
import type { PipelineExecutorResult } from '../PipelineExecutorResult';
|
|
7
7
|
import type { CreatePipelineExecutorOptions } from './00-CreatePipelineExecutorOptions';
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Options for executing a single pipeline task, including task details, pipeline context, parameters, and callbacks.
|
|
10
10
|
*
|
|
11
11
|
* @private internal type of `executeTask`
|
|
12
12
|
*/
|
|
13
13
|
type executeSingleTaskOptions = Required<CreatePipelineExecutorOptions> & {
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* The task to be executed.
|
|
16
16
|
*/
|
|
17
17
|
readonly currentTask: ReadonlyDeep<TaskJson>;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* The pipeline in which the task resides, fully prepared and validated.
|
|
20
20
|
*/
|
|
21
21
|
readonly preparedPipeline: ReadonlyDeep<PipelineJson>;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* The parameters to pass to the task execution.
|
|
24
24
|
*/
|
|
25
25
|
readonly parametersToPass: Readonly<Parameters>;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* Callback invoked with partial results as the execution progresses.
|
|
28
28
|
*/
|
|
29
29
|
readonly onProgress: (newOngoingResult: PartialDeep<PipelineExecutorResult>) => Promisable<void>;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* Mutable execution report object for tracking execution details.
|
|
32
32
|
*/
|
|
33
33
|
readonly $executionReport: WritableDeep<ExecutionReportJson>;
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* String identifier for the pipeline, used in error messages and reporting.
|
|
36
36
|
*/
|
|
37
37
|
readonly pipelineIdentification: string;
|
|
38
38
|
};
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
40
|
+
* Executes a single task within a pipeline, handling parameter validation, error checking, and progress reporting.
|
|
41
|
+
*
|
|
42
|
+
* @param options - Options for execution, including the task, pipeline, parameters, and callbacks.
|
|
43
|
+
* @returns The output parameters produced by the task.
|
|
41
44
|
*
|
|
42
45
|
* @private internal utility of `createPipelineExecutor`
|
|
43
46
|
*/
|
|
@@ -3,18 +3,23 @@ import type { TODO_any } from '../../utils/organization/TODO_any';
|
|
|
3
3
|
import type { PipelineExecutorResult } from '../PipelineExecutorResult';
|
|
4
4
|
import type { ExecuteAttemptsOptions } from './40-executeAttempts';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Options for executing a pipeline task that involves formatting subvalues (e.g., iterating over CSV rows).
|
|
7
|
+
* Extends ExecuteAttemptsOptions with a progress callback.
|
|
7
8
|
*
|
|
8
9
|
* @private internal type of `executeFormatSubvalues`
|
|
9
10
|
*/
|
|
10
11
|
type ExecuteFormatCellsOptions = ExecuteAttemptsOptions & {
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
+
* Callback invoked with partial results as the execution progresses.
|
|
13
14
|
*/
|
|
14
15
|
readonly onProgress: (newOngoingResult: PartialDeep<PipelineExecutorResult>) => Promisable<void>;
|
|
15
16
|
};
|
|
16
17
|
/**
|
|
17
|
-
*
|
|
18
|
+
* Executes a pipeline task that requires mapping or iterating over subvalues of a parameter (such as rows in a CSV).
|
|
19
|
+
* Handles format and subformat resolution, error handling, and progress reporting.
|
|
20
|
+
*
|
|
21
|
+
* @param options - Options for execution, including task details and progress callback.
|
|
22
|
+
* @returns The result of the subvalue mapping or execution attempts.
|
|
18
23
|
*
|
|
19
24
|
* @private internal utility of `createPipelineExecutor`
|
|
20
25
|
*/
|
|
@@ -5,7 +5,7 @@ import type { Parameters } from '../../types/typeAliases';
|
|
|
5
5
|
import type { ReservedParameters } from '../../types/typeAliases';
|
|
6
6
|
import type { ExecutionTools } from '../ExecutionTools';
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Options for retrieving reserved parameters for a pipeline task, including context, pipeline, and identification.
|
|
9
9
|
*
|
|
10
10
|
* @private internal type of `getReservedParametersForTask`
|
|
11
11
|
*/
|
|
@@ -15,26 +15,28 @@ type GetReservedParametersForTaskOptions = {
|
|
|
15
15
|
*/
|
|
16
16
|
readonly tools: ExecutionTools;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* The prepared and validated pipeline in which the task resides.
|
|
19
19
|
*/
|
|
20
20
|
readonly preparedPipeline: ReadonlyDeep<PipelineJson>;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* The task for which reserved parameters are being retrieved.
|
|
23
23
|
*/
|
|
24
24
|
readonly task: ReadonlyDeep<TaskJson>;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* Parameters to complete the content of the task for embedding
|
|
26
|
+
* Parameters to complete the content of the task for embedding and context.
|
|
29
27
|
*/
|
|
30
28
|
readonly parameters: Readonly<Parameters>;
|
|
31
29
|
/**
|
|
32
|
-
*
|
|
30
|
+
* String identifier for the pipeline, used in error messages and reporting.
|
|
33
31
|
*/
|
|
34
32
|
readonly pipelineIdentification: string;
|
|
35
33
|
};
|
|
36
34
|
/**
|
|
37
|
-
*
|
|
35
|
+
* Retrieves all reserved parameters for a given pipeline task, including context, knowledge, examples, and metadata.
|
|
36
|
+
* Ensures all reserved parameters are defined and throws if any are missing.
|
|
37
|
+
*
|
|
38
|
+
* @param options - Options including tools, pipeline, task, and context.
|
|
39
|
+
* @returns An object containing all reserved parameters for the task.
|
|
38
40
|
*
|
|
39
41
|
* @private internal utility of `createPipelineExecutor`
|
|
40
42
|
*/
|
|
@@ -4,9 +4,11 @@ import type { string_SCREAMING_CASE } from '../../utils/normalization/normalizeT
|
|
|
4
4
|
import type { empty_object } from '../../utils/organization/empty_object';
|
|
5
5
|
import type { FormatSubvalueParser } from './FormatSubvalueParser';
|
|
6
6
|
/**
|
|
7
|
-
* A format definition is a set of functions that define how to validate, heal and convert response from LLM
|
|
7
|
+
* A format definition is a set of functions that define how to validate, heal and convert response from LLM.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* - "settings" are runtime options that affect parsing (e.g., delimiter for CSV).
|
|
11
|
+
* - "schema" is a structural definition or contract for the data (e.g., expected fields in JSON).
|
|
10
12
|
*
|
|
11
13
|
* @see https://github.com/webgptorg/promptbook/discussions/36
|
|
12
14
|
* @private still in development [🏢]
|
|
@@ -56,7 +58,7 @@ export type FormatParser<TValue extends TPartialValue, TPartialValue extends str
|
|
|
56
58
|
*/
|
|
57
59
|
heal(value: string, settings?: TSettings, scheme?: TSchema): TValue;
|
|
58
60
|
/**
|
|
59
|
-
*
|
|
61
|
+
* Parsers for extracting or mapping subvalues from the main value (e.g., rows from CSV, items from JSON array).
|
|
60
62
|
*/
|
|
61
63
|
readonly subvalueParsers: ReadonlyArray<FormatSubvalueParser<TValue, TSettings>>;
|
|
62
64
|
};
|
|
@@ -5,7 +5,8 @@ import type { string_parameter_name } from '../../types/typeAliases';
|
|
|
5
5
|
import type { string_SCREAMING_CASE } from '../../utils/normalization/normalizeTo_SCREAMING_CASE';
|
|
6
6
|
import type { empty_object } from '../../utils/organization/empty_object';
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Defines how to extract or map subvalues from a main value in a specific format (e.g., cells from CSV, items from JSON array).
|
|
9
|
+
* Used for iterating or transforming structured data in pipeline tasks.
|
|
9
10
|
*/
|
|
10
11
|
export type FormatSubvalueParser<TValue extends string, TSettings extends empty_object> = {
|
|
11
12
|
/**
|
|
@@ -19,21 +20,45 @@ export type FormatSubvalueParser<TValue extends string, TSettings extends empty_
|
|
|
19
20
|
*/
|
|
20
21
|
readonly aliases?: ReadonlyArray<string_name & string_SCREAMING_CASE>;
|
|
21
22
|
/**
|
|
22
|
-
* Maps
|
|
23
|
+
* Maps or transforms subvalues from the main value. For example, iterates over all CSV cells or JSON array items.
|
|
23
24
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
25
|
+
* @param options - Options for mapping, including callbacks for progress and value transformation.
|
|
26
|
+
* @returns The final mapped string result.
|
|
26
27
|
*/
|
|
27
28
|
mapValues(options: FormatSubvalueParserMapValuesOptions<TValue, TSettings>): Promise<string>;
|
|
28
29
|
};
|
|
29
30
|
/**
|
|
30
|
-
*
|
|
31
|
+
* Options for mapping or extracting subvalues from a main value using a FormatSubvalueParser.
|
|
31
32
|
*/
|
|
32
33
|
export type FormatSubvalueParserMapValuesOptions<TValue extends string, TSettings extends empty_object> = {
|
|
34
|
+
/**
|
|
35
|
+
* The input string value to parse for subvalues
|
|
36
|
+
*/
|
|
33
37
|
readonly value: TValue;
|
|
38
|
+
/**
|
|
39
|
+
* The name of the output parameter where the processed value will be stored
|
|
40
|
+
*/
|
|
34
41
|
readonly outputParameterName: string_parameter_name;
|
|
42
|
+
/**
|
|
43
|
+
* Format-specific settings that control how subvalues are parsed or processed
|
|
44
|
+
*/
|
|
35
45
|
readonly settings: TSettings;
|
|
36
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Callback function that processes each subvalue and returns the transformed value
|
|
48
|
+
*
|
|
49
|
+
* @param subvalues Object containing the extracted subvalues
|
|
50
|
+
* @param index Current index of the subvalue which is being mapped
|
|
51
|
+
* @param length Full length of the subvalues
|
|
52
|
+
* @param number Total number of subvalues to process
|
|
53
|
+
* @returns Transformed value after processing
|
|
54
|
+
*/
|
|
55
|
+
mapCallback(subvalues: Parameters, index: number, length: number): Promisable<TValue>;
|
|
56
|
+
/**
|
|
57
|
+
* Progress callback that receives partial results during processing
|
|
58
|
+
*
|
|
59
|
+
* @param partialResultString The current partial result as processing progresses
|
|
60
|
+
* @returns Promise or void to continue execution
|
|
61
|
+
*/
|
|
37
62
|
onProgress(partialResultString: TValue): Promisable<void>;
|
|
38
63
|
};
|
|
39
64
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Function to check if a string is valid CSV
|
|
3
3
|
*
|
|
4
4
|
* @param value The string to check
|
|
5
|
-
* @returns
|
|
5
|
+
* @returns `true` if the string is a valid CSV string, false otherwise
|
|
6
6
|
*
|
|
7
7
|
* @public exported from `@promptbook/utils`
|
|
8
8
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
3
3
|
*
|
|
4
4
|
* @param value The string to check
|
|
5
|
-
* @returns
|
|
5
|
+
* @returns `true` if the string is a valid JSON string, false otherwise
|
|
6
6
|
*
|
|
7
7
|
* @public exported from `@promptbook/utils`
|
|
8
8
|
*/
|
|
@@ -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,6 +1,9 @@
|
|
|
1
1
|
import type { TODO_object } from '../../../utils/organization/TODO_object';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Options for configuring LLM (Large Language Model) tools.
|
|
4
|
+
*
|
|
5
|
+
* This type is used to pass provider-specific options to LLM execution tools.
|
|
6
|
+
*
|
|
4
7
|
*
|
|
5
8
|
* @@@ `LlmToolsMetadata` vs `LlmToolsConfiguration` vs `LlmToolsOptions` (vs `Registered`)
|
|
6
9
|
*/
|
|
@@ -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
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { $Register } from '../../../utils/$Register';
|
|
2
2
|
import type { ScraperAndConverterMetadata } from './ScraperAndConverterMetadata';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Global registry for storing metadata about all available scrapers and converters.
|
|
5
5
|
*
|
|
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
|
|
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 there can be more in different contexts (e.g., tests).
|
|
8
8
|
* @public exported from `@promptbook/core`
|
|
9
9
|
*/
|
|
10
10
|
export declare const $scrapersMetadataRegister: $Register<ScraperAndConverterMetadata>;
|
|
@@ -123,7 +123,8 @@ export type InputParameters = Exclude<Record<string_parameter_name, really_unkno
|
|
|
123
123
|
*/
|
|
124
124
|
export type string_reserved_parameter_name = TupleToUnion<typeof RESERVED_PARAMETER_NAMES>;
|
|
125
125
|
/**
|
|
126
|
-
*
|
|
126
|
+
* Represents a mapping of reserved parameter names to their values.
|
|
127
|
+
* Reserved parameters are used internally by the pipeline and should not be set by users.
|
|
127
128
|
*
|
|
128
129
|
* Note: [🚉] This is fully serializable as JSON
|
|
129
130
|
*/
|
|
@@ -233,7 +234,9 @@ export type string_markdown_text = string;
|
|
|
233
234
|
*/
|
|
234
235
|
export type string_markdown_codeblock_language = 'book' | 'markdown' | 'text' | 'javascript' | 'css' | 'json';
|
|
235
236
|
/**
|
|
236
|
-
*
|
|
237
|
+
* A URL pointing to Promptbook documentation or a specific discussion.
|
|
238
|
+
*
|
|
239
|
+
* For example: `https://github.com/webgptorg/promptbook/discussions/123`
|
|
237
240
|
*/
|
|
238
241
|
export type string_promptbook_documentation_url = `https://github.com/webgptorg/promptbook/discussions/${number | `@@${string}`}`;
|
|
239
242
|
/**
|
|
@@ -448,15 +451,14 @@ export type string_uuid = string & {
|
|
|
448
451
|
readonly _type: 'uuid';
|
|
449
452
|
};
|
|
450
453
|
/**
|
|
451
|
-
* Application identifier
|
|
454
|
+
* Application identifier, used to distinguish different apps or clients.
|
|
452
455
|
*
|
|
453
|
-
*
|
|
456
|
+
* For example: 'cli', 'playground', or a custom app id.
|
|
454
457
|
*/
|
|
455
458
|
export type string_app_id = id | 'app';
|
|
456
459
|
/**
|
|
457
|
-
* End user identifier
|
|
458
|
-
*
|
|
459
|
-
* @@@
|
|
460
|
+
* End user identifier, can be a user id or email address.
|
|
461
|
+
* Used for tracking and abuse prevention.
|
|
460
462
|
*/
|
|
461
463
|
export type string_user_id = id | string_email;
|
|
462
464
|
/**
|
|
@@ -2,33 +2,34 @@ import { type IDestroyable } from 'destroyable';
|
|
|
2
2
|
import type { string_name } from '../types/typeAliases';
|
|
3
3
|
import type { TODO_string } from './organization/TODO_string';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Represents an entity in a global registry.
|
|
6
|
+
* Contains identifying information about the package and class.
|
|
6
7
|
*/
|
|
7
8
|
export type Registered = {
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
+
* The name of the package where the registered entity is defined.
|
|
10
11
|
*/
|
|
11
12
|
readonly packageName: TODO_string;
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
+
* The name of the class being registered.
|
|
14
15
|
*/
|
|
15
16
|
readonly className: TODO_string;
|
|
16
17
|
};
|
|
17
18
|
/**
|
|
18
|
-
*
|
|
19
|
+
* Represents a registration record, including destroyable interface and registry name.
|
|
19
20
|
*/
|
|
20
21
|
export type Registration = Registered & IDestroyable & {
|
|
21
22
|
/**
|
|
22
|
-
*
|
|
23
|
+
* The name of the register this entity is registered in.
|
|
23
24
|
*/
|
|
24
25
|
readonly registerName: string_name;
|
|
25
26
|
};
|
|
26
27
|
/**
|
|
27
|
-
*
|
|
28
|
+
* Global registry for storing and managing registered entities of a given type.
|
|
28
29
|
*
|
|
29
30
|
* Note: `$` is used to indicate that this function is not a pure function - it accesses and adds variables in global scope.
|
|
30
31
|
*
|
|
31
|
-
* @private internal utility, exported are only
|
|
32
|
+
* @private internal utility, exported are only singleton instances of this class
|
|
32
33
|
*/
|
|
33
34
|
export declare class $Register<TRegistered extends Registered> {
|
|
34
35
|
private readonly registerName;
|