@promptbook/core 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 +105 -81
- 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 +104 -81
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -27,7 +27,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
27
27
|
* @generated
|
|
28
28
|
* @see https://github.com/webgptorg/promptbook
|
|
29
29
|
*/
|
|
30
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-
|
|
30
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.92.0-25';
|
|
31
31
|
/**
|
|
32
32
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
33
33
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -275,20 +275,23 @@ const DEFAULT_BOOK_OUTPUT_PARAMETER_NAME = 'result';
|
|
|
275
275
|
*/
|
|
276
276
|
const DEFAULT_MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB
|
|
277
277
|
/**
|
|
278
|
-
*
|
|
278
|
+
* Threshold value that determines when a dataset is considered "big"
|
|
279
|
+
* and may require special handling or optimizations
|
|
280
|
+
*
|
|
281
|
+
* For example, when error occurs in one item of the big dataset, it will not fail the whole pipeline
|
|
279
282
|
*
|
|
280
283
|
* @public exported from `@promptbook/core`
|
|
281
284
|
*/
|
|
282
285
|
const BIG_DATASET_TRESHOLD = 50;
|
|
283
286
|
/**
|
|
284
|
-
*
|
|
287
|
+
* Placeholder text used to represent a placeholder value of failed operation
|
|
285
288
|
*
|
|
286
289
|
* @public exported from `@promptbook/core`
|
|
287
290
|
*/
|
|
288
|
-
const FAILED_VALUE_PLACEHOLDER = '
|
|
289
|
-
// <- TODO: !!!! Use
|
|
291
|
+
const FAILED_VALUE_PLACEHOLDER = '!?';
|
|
290
292
|
/**
|
|
291
|
-
*
|
|
293
|
+
* Placeholder text used to represent operations or values that are still in progress
|
|
294
|
+
* or awaiting completion in UI displays and logging
|
|
292
295
|
*
|
|
293
296
|
* @public exported from `@promptbook/core`
|
|
294
297
|
*/
|
|
@@ -1123,13 +1126,13 @@ const ORDER_OF_PIPELINE_JSON = [
|
|
|
1123
1126
|
*/
|
|
1124
1127
|
const REPLACING_NONCE = 'ptbkauk42kV2dzao34faw7FudQUHYPtW';
|
|
1125
1128
|
/**
|
|
1126
|
-
*
|
|
1129
|
+
* Placeholder value indicating a parameter is missing its value.
|
|
1127
1130
|
*
|
|
1128
1131
|
* @private within the repository
|
|
1129
1132
|
*/
|
|
1130
1133
|
const RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
|
|
1131
1134
|
/**
|
|
1132
|
-
*
|
|
1135
|
+
* Placeholder value indicating a parameter is restricted and cannot be used directly.
|
|
1133
1136
|
*
|
|
1134
1137
|
* @private within the repository
|
|
1135
1138
|
*/
|
|
@@ -1628,7 +1631,7 @@ class SimplePipelineCollection {
|
|
|
1628
1631
|
/**
|
|
1629
1632
|
* Constructs a pipeline collection from pipelines
|
|
1630
1633
|
*
|
|
1631
|
-
* @param pipelines
|
|
1634
|
+
* @param pipelines Array of pipeline JSON objects to include in the collection
|
|
1632
1635
|
*
|
|
1633
1636
|
* Note: During the construction logic of all pipelines are validated
|
|
1634
1637
|
* Note: It is not recommended to use this constructor directly, use `createCollectionFromJson` *(or other variant)* instead
|
|
@@ -1882,8 +1885,8 @@ class MissingToolsError extends Error {
|
|
|
1882
1885
|
* @public exported from `@promptbook/core`
|
|
1883
1886
|
*/
|
|
1884
1887
|
function isPipelinePrepared(pipeline) {
|
|
1885
|
-
// Note: Ignoring `pipeline.preparations`
|
|
1886
|
-
// Note: Ignoring `pipeline.knowledgePieces`
|
|
1888
|
+
// Note: Ignoring `pipeline.preparations`
|
|
1889
|
+
// Note: Ignoring `pipeline.knowledgePieces`
|
|
1887
1890
|
if (pipeline.title === undefined || pipeline.title === '' || pipeline.title === DEFAULT_BOOK_TITLE) {
|
|
1888
1891
|
// TODO: !!! Comment this out
|
|
1889
1892
|
console.log('Pipeline is not prepared because title is undefined or empty', pipeline);
|
|
@@ -2878,6 +2881,15 @@ const CsvFormatParser = {
|
|
|
2878
2881
|
mappedData.push(mappedRow);
|
|
2879
2882
|
if (onProgress) {
|
|
2880
2883
|
// Note: Report the CSV with all rows mapped so far
|
|
2884
|
+
/*
|
|
2885
|
+
!!!!
|
|
2886
|
+
// Report progress with updated value
|
|
2887
|
+
const progressData = mappedData.map((row, i) =>
|
|
2888
|
+
i > index ? { ...row, [outputParameterName]: PENDING_VALUE_PLACEHOLDER } : row,
|
|
2889
|
+
);
|
|
2890
|
+
|
|
2891
|
+
|
|
2892
|
+
*/
|
|
2881
2893
|
await onProgress(unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
|
|
2882
2894
|
}
|
|
2883
2895
|
}
|
|
@@ -3094,7 +3106,7 @@ function mapAvailableToExpectedParameters(options) {
|
|
|
3094
3106
|
else if (!availableParametersNames.has(parameterName) && expectedParameterNames.has(parameterName)) ;
|
|
3095
3107
|
}
|
|
3096
3108
|
if (expectedParameterNames.size === 0) {
|
|
3097
|
-
// Note: [👨👨👧] Now we can freeze `mappedParameters` to prevent
|
|
3109
|
+
// Note: [👨👨👧] Now we can freeze `mappedParameters` to prevent accidental modifications after mapping
|
|
3098
3110
|
Object.freeze(mappedParameters);
|
|
3099
3111
|
return mappedParameters;
|
|
3100
3112
|
}
|
|
@@ -3125,7 +3137,7 @@ function mapAvailableToExpectedParameters(options) {
|
|
|
3125
3137
|
for (let i = 0; i < expectedParameterNames.size; i++) {
|
|
3126
3138
|
mappedParameters[expectedParameterNamesArray[i]] = availableParameters[availableParametersNamesArray[i]];
|
|
3127
3139
|
}
|
|
3128
|
-
// Note: [👨👨👧] Now we can freeze `mappedParameters` to prevent
|
|
3140
|
+
// Note: [👨👨👧] Now we can freeze `mappedParameters` to prevent accidental modifications after mapping
|
|
3129
3141
|
Object.freeze(mappedParameters);
|
|
3130
3142
|
return mappedParameters;
|
|
3131
3143
|
}
|
|
@@ -3876,10 +3888,10 @@ for (let i = 0; i < defaultDiacriticsRemovalMap.length; i++) {
|
|
|
3876
3888
|
*/
|
|
3877
3889
|
|
|
3878
3890
|
/**
|
|
3879
|
-
*
|
|
3891
|
+
* Removes diacritic marks (accents) from characters in a string.
|
|
3880
3892
|
*
|
|
3881
|
-
* @param input
|
|
3882
|
-
* @returns
|
|
3893
|
+
* @param input The string containing diacritics to be normalized.
|
|
3894
|
+
* @returns The string with diacritics removed or normalized.
|
|
3883
3895
|
* @public exported from `@promptbook/utils`
|
|
3884
3896
|
*/
|
|
3885
3897
|
function removeDiacritics(input) {
|
|
@@ -4389,15 +4401,14 @@ async function executeFormatSubvalues(options) {
|
|
|
4389
4401
|
const highLevelError = new PipelineExecutionError(spaceTrim((block) => `
|
|
4390
4402
|
${error.message}
|
|
4391
4403
|
|
|
4392
|
-
This is error in FOREACH command when mapping data
|
|
4404
|
+
This is error in FOREACH command when mapping ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
|
|
4393
4405
|
You have probbably passed wrong data to pipeline or wrong data was generated which are processed by FOREACH command
|
|
4394
4406
|
|
|
4395
4407
|
${block(pipelineIdentification)}
|
|
4396
|
-
Subparameter index: ${index}
|
|
4397
4408
|
`));
|
|
4398
4409
|
if (length > BIG_DATASET_TRESHOLD) {
|
|
4399
4410
|
console.error(highLevelError);
|
|
4400
|
-
return
|
|
4411
|
+
return FAILED_VALUE_PLACEHOLDER;
|
|
4401
4412
|
}
|
|
4402
4413
|
throw highLevelError;
|
|
4403
4414
|
}
|
|
@@ -4421,14 +4432,13 @@ async function executeFormatSubvalues(options) {
|
|
|
4421
4432
|
catch (error) {
|
|
4422
4433
|
if (length > BIG_DATASET_TRESHOLD) {
|
|
4423
4434
|
console.error(spaceTrim((block) => `
|
|
4424
|
-
|
|
4435
|
+
${error.message}
|
|
4425
4436
|
|
|
4426
|
-
${
|
|
4437
|
+
This is error in FOREACH command when processing ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
|
|
4427
4438
|
|
|
4428
4439
|
${block(pipelineIdentification)}
|
|
4429
|
-
Subparameter index: ${index}
|
|
4430
4440
|
`));
|
|
4431
|
-
return
|
|
4441
|
+
return FAILED_VALUE_PLACEHOLDER;
|
|
4432
4442
|
}
|
|
4433
4443
|
throw error;
|
|
4434
4444
|
}
|
|
@@ -5267,7 +5277,8 @@ async function preparePersona(personaDescription, tools, options) {
|
|
|
5267
5277
|
*/
|
|
5268
5278
|
|
|
5269
5279
|
/**
|
|
5270
|
-
*
|
|
5280
|
+
* Safely retrieves the global scope object (window in browser, global in Node.js)
|
|
5281
|
+
* regardless of the JavaScript environment in which the code is running
|
|
5271
5282
|
*
|
|
5272
5283
|
* Note: `$` is used to indicate that this function is not a pure function - it access global scope
|
|
5273
5284
|
*
|
|
@@ -5278,10 +5289,10 @@ function $getGlobalScope() {
|
|
|
5278
5289
|
}
|
|
5279
5290
|
|
|
5280
5291
|
/**
|
|
5281
|
-
*
|
|
5292
|
+
* Normalizes a text string to SCREAMING_CASE (all uppercase with underscores).
|
|
5282
5293
|
*
|
|
5283
|
-
* @param text
|
|
5284
|
-
* @returns
|
|
5294
|
+
* @param text The text string to be converted to SCREAMING_CASE format.
|
|
5295
|
+
* @returns The normalized text in SCREAMING_CASE format.
|
|
5285
5296
|
* @example 'HELLO_WORLD'
|
|
5286
5297
|
* @example 'I_LOVE_PROMPTBOOK'
|
|
5287
5298
|
* @public exported from `@promptbook/utils`
|
|
@@ -5333,10 +5344,10 @@ function normalizeTo_SCREAMING_CASE(text) {
|
|
|
5333
5344
|
*/
|
|
5334
5345
|
|
|
5335
5346
|
/**
|
|
5336
|
-
*
|
|
5347
|
+
* Normalizes a text string to snake_case format.
|
|
5337
5348
|
*
|
|
5338
|
-
* @param text
|
|
5339
|
-
* @returns
|
|
5349
|
+
* @param text The text string to be converted to snake_case format.
|
|
5350
|
+
* @returns The normalized text in snake_case format.
|
|
5340
5351
|
* @example 'hello_world'
|
|
5341
5352
|
* @example 'i_love_promptbook'
|
|
5342
5353
|
* @public exported from `@promptbook/utils`
|
|
@@ -5412,10 +5423,11 @@ const $scrapersMetadataRegister = new $Register('scrapers_metadata');
|
|
|
5412
5423
|
*/
|
|
5413
5424
|
|
|
5414
5425
|
/**
|
|
5415
|
-
*
|
|
5426
|
+
* Registry for all available scrapers in the system.
|
|
5427
|
+
* Central point for registering and accessing different types of content scrapers.
|
|
5416
5428
|
*
|
|
5417
5429
|
* Note: `$` is used to indicate that this interacts with the global scope
|
|
5418
|
-
* @singleton Only one instance of each register is created per build, but
|
|
5430
|
+
* @singleton Only one instance of each register is created per build, but there can be more than one in different build modules
|
|
5419
5431
|
* @public exported from `@promptbook/core`
|
|
5420
5432
|
*/
|
|
5421
5433
|
const $scrapersRegister = new $Register('scraper_constructors');
|
|
@@ -5511,10 +5523,10 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
5511
5523
|
*/
|
|
5512
5524
|
|
|
5513
5525
|
/**
|
|
5514
|
-
*
|
|
5526
|
+
* Converts a given text to kebab-case format.
|
|
5515
5527
|
*
|
|
5516
|
-
* @param text
|
|
5517
|
-
* @returns
|
|
5528
|
+
* @param text The text to be converted.
|
|
5529
|
+
* @returns The kebab-case formatted string.
|
|
5518
5530
|
* @example 'hello-world'
|
|
5519
5531
|
* @example 'i-love-promptbook'
|
|
5520
5532
|
* @public exported from `@promptbook/utils`
|
|
@@ -5583,7 +5595,8 @@ function knowledgeSourceContentToName(knowledgeSourceContent) {
|
|
|
5583
5595
|
*/
|
|
5584
5596
|
|
|
5585
5597
|
/**
|
|
5586
|
-
*
|
|
5598
|
+
* Converts a name to a properly formatted subfolder path for cache storage.
|
|
5599
|
+
* Handles normalization and path formatting to create consistent cache directory structures.
|
|
5587
5600
|
*
|
|
5588
5601
|
* @private for `FileCacheStorage`
|
|
5589
5602
|
*/
|
|
@@ -5663,11 +5676,11 @@ function removeEmojis(text) {
|
|
|
5663
5676
|
}
|
|
5664
5677
|
|
|
5665
5678
|
/**
|
|
5666
|
-
*
|
|
5679
|
+
* Converts a title string into a normalized name.
|
|
5667
5680
|
*
|
|
5668
|
-
* @param value
|
|
5669
|
-
* @returns
|
|
5670
|
-
* @example
|
|
5681
|
+
* @param value The title string to be converted to a name.
|
|
5682
|
+
* @returns A normalized name derived from the input title.
|
|
5683
|
+
* @example 'Hello World!' -> 'hello-world'
|
|
5671
5684
|
* @public exported from `@promptbook/utils`
|
|
5672
5685
|
*/
|
|
5673
5686
|
function titleToName(value) {
|
|
@@ -5718,7 +5731,9 @@ const promptbookFetch = async (urlOrRequest, init) => {
|
|
|
5718
5731
|
*/
|
|
5719
5732
|
|
|
5720
5733
|
/**
|
|
5721
|
-
*
|
|
5734
|
+
* Factory function that creates a handler for processing knowledge sources.
|
|
5735
|
+
* Provides standardized processing of different types of knowledge sources
|
|
5736
|
+
* across various scraper implementations.
|
|
5722
5737
|
*
|
|
5723
5738
|
* @public exported from `@promptbook/core`
|
|
5724
5739
|
*/
|
|
@@ -5959,9 +5974,12 @@ TODO: [🧊] This is how it can look in future
|
|
|
5959
5974
|
*/
|
|
5960
5975
|
|
|
5961
5976
|
/**
|
|
5962
|
-
*
|
|
5977
|
+
* Prepares tasks by adding knowledge to the prompt and ensuring all necessary parameters are included.
|
|
5963
5978
|
*
|
|
5964
|
-
* @
|
|
5979
|
+
* @param tasks Sequence of tasks that are chained together to form a pipeline
|
|
5980
|
+
* @returns A promise that resolves to the prepared tasks.
|
|
5981
|
+
*
|
|
5982
|
+
* @private internal utility of `preparePipeline`
|
|
5965
5983
|
*/
|
|
5966
5984
|
async function prepareTasks(pipeline, tools, options) {
|
|
5967
5985
|
const { maxParallelCount = DEFAULT_MAX_PARALLEL_COUNT } = options;
|
|
@@ -6867,11 +6885,11 @@ const expectCommandParser = {
|
|
|
6867
6885
|
};
|
|
6868
6886
|
|
|
6869
6887
|
/**
|
|
6870
|
-
*
|
|
6888
|
+
* Normalizes a given text to camelCase format.
|
|
6871
6889
|
*
|
|
6872
|
-
* @param text
|
|
6873
|
-
* @param _isFirstLetterCapital
|
|
6874
|
-
* @returns
|
|
6890
|
+
* @param text The text to be normalized.
|
|
6891
|
+
* @param _isFirstLetterCapital Whether the first letter should be capitalized.
|
|
6892
|
+
* @returns The camelCase formatted string.
|
|
6875
6893
|
* @example 'helloWorld'
|
|
6876
6894
|
* @example 'iLovePromptbook'
|
|
6877
6895
|
* @public exported from `@promptbook/utils`
|
|
@@ -7359,7 +7377,7 @@ const GeneratorFormfactorDefinition = {
|
|
|
7359
7377
|
};
|
|
7360
7378
|
|
|
7361
7379
|
/**
|
|
7362
|
-
*
|
|
7380
|
+
* Pipeline interface which is equivalent to `any`
|
|
7363
7381
|
*
|
|
7364
7382
|
* @see https://github.com/webgptorg/promptbook/discussions/171
|
|
7365
7383
|
*
|
|
@@ -7440,14 +7458,15 @@ const MatcherFormfactorDefinition = {
|
|
|
7440
7458
|
};
|
|
7441
7459
|
|
|
7442
7460
|
/**
|
|
7443
|
-
* Sheets is form of app that
|
|
7461
|
+
* Sheets is form of app that processes tabular data in CSV format, allowing transformation
|
|
7462
|
+
* and analysis of structured data through AI-powered operations
|
|
7444
7463
|
*
|
|
7445
7464
|
* @public exported from `@promptbook/core`
|
|
7446
7465
|
*/
|
|
7447
7466
|
const SheetsFormfactorDefinition = {
|
|
7448
7467
|
name: 'SHEETS',
|
|
7449
7468
|
aliasNames: ['SHEETS', 'SHEET'],
|
|
7450
|
-
description:
|
|
7469
|
+
description: `A formfactor for processing spreadsheet-like data in CSV format, enabling AI transformations on tabular data`,
|
|
7451
7470
|
documentationUrl: `https://github.com/webgptorg/promptbook/discussions/176`,
|
|
7452
7471
|
pipelineInterface: {
|
|
7453
7472
|
inputParameters: [
|
|
@@ -7523,7 +7542,7 @@ const FORMFACTOR_DEFINITIONS = [
|
|
|
7523
7542
|
/**
|
|
7524
7543
|
* Parses the formfactor command
|
|
7525
7544
|
*
|
|
7526
|
-
* Note:
|
|
7545
|
+
* 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
|
|
7527
7546
|
*
|
|
7528
7547
|
* @see `documentationUrl` for more details
|
|
7529
7548
|
* @public exported from `@promptbook/editable`
|
|
@@ -7545,7 +7564,7 @@ const formfactorCommandParser = {
|
|
|
7545
7564
|
/**
|
|
7546
7565
|
* Description of the FORMFACTOR command
|
|
7547
7566
|
*/
|
|
7548
|
-
description:
|
|
7567
|
+
description: `Specifies the application type and interface requirements that this promptbook should conform to`,
|
|
7549
7568
|
/**
|
|
7550
7569
|
* Link to documentation
|
|
7551
7570
|
*/
|
|
@@ -7688,8 +7707,7 @@ const jokerCommandParser = {
|
|
|
7688
7707
|
};
|
|
7689
7708
|
|
|
7690
7709
|
/**
|
|
7691
|
-
*
|
|
7692
|
-
*
|
|
7710
|
+
* @see {@link ModelVariant}
|
|
7693
7711
|
* @public exported from `@promptbook/core`
|
|
7694
7712
|
*/
|
|
7695
7713
|
const MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
|
|
@@ -8662,7 +8680,7 @@ function parseCommandVariant(input) {
|
|
|
8662
8680
|
}
|
|
8663
8681
|
|
|
8664
8682
|
/**
|
|
8665
|
-
*
|
|
8683
|
+
* Extracts the interface (input and output parameters) from a pipeline.
|
|
8666
8684
|
*
|
|
8667
8685
|
* @deprecated https://github.com/webgptorg/promptbook/pull/186
|
|
8668
8686
|
* @see https://github.com/webgptorg/promptbook/discussions/171
|
|
@@ -8695,7 +8713,7 @@ function getPipelineInterface(pipeline) {
|
|
|
8695
8713
|
}
|
|
8696
8714
|
|
|
8697
8715
|
/**
|
|
8698
|
-
*
|
|
8716
|
+
* Checks if two pipeline interfaces are structurally identical.
|
|
8699
8717
|
*
|
|
8700
8718
|
* @deprecated https://github.com/webgptorg/promptbook/pull/186
|
|
8701
8719
|
* @see https://github.com/webgptorg/promptbook/discussions/171
|
|
@@ -8727,10 +8745,11 @@ function isPipelineInterfacesEqual(pipelineInterface1, pipelineInterface2) {
|
|
|
8727
8745
|
}
|
|
8728
8746
|
|
|
8729
8747
|
/**
|
|
8730
|
-
*
|
|
8748
|
+
* Checks if a given pipeline satisfies the requirements of a specified pipeline interface.
|
|
8731
8749
|
*
|
|
8732
8750
|
* @deprecated https://github.com/webgptorg/promptbook/pull/186
|
|
8733
8751
|
* @see https://github.com/webgptorg/promptbook/discussions/171
|
|
8752
|
+
* @returns `true` if the pipeline implements the interface, `false` otherwise.
|
|
8734
8753
|
*
|
|
8735
8754
|
* @public exported from `@promptbook/core`
|
|
8736
8755
|
*/
|
|
@@ -8916,7 +8935,8 @@ function removeMarkdownComments(content) {
|
|
|
8916
8935
|
}
|
|
8917
8936
|
|
|
8918
8937
|
/**
|
|
8919
|
-
*
|
|
8938
|
+
* Utility to determine if a pipeline string is in flat format.
|
|
8939
|
+
* A flat pipeline is a simple text without proper structure (headers, blocks, etc).
|
|
8920
8940
|
*
|
|
8921
8941
|
* @public exported from `@promptbook/editable`
|
|
8922
8942
|
*/
|
|
@@ -8937,7 +8957,10 @@ function isFlatPipeline(pipelineString) {
|
|
|
8937
8957
|
}
|
|
8938
8958
|
|
|
8939
8959
|
/**
|
|
8940
|
-
*
|
|
8960
|
+
* Converts a pipeline structure to its string representation.
|
|
8961
|
+
*
|
|
8962
|
+
* Transforms a flat, simple pipeline into a properly formatted pipeline string
|
|
8963
|
+
* with sections for title, prompt, and return statement.
|
|
8941
8964
|
*
|
|
8942
8965
|
* @public exported from `@promptbook/editable`
|
|
8943
8966
|
*/
|
|
@@ -8994,7 +9017,7 @@ function deflatePipeline(pipelineString) {
|
|
|
8994
9017
|
* Note: It can not work with html syntax and comments
|
|
8995
9018
|
*
|
|
8996
9019
|
* @param markdown any valid markdown
|
|
8997
|
-
* @returns
|
|
9020
|
+
* @returns An array of strings, each representing an individual list item found in the markdown
|
|
8998
9021
|
* @public exported from `@promptbook/markdown-utils`
|
|
8999
9022
|
*/
|
|
9000
9023
|
function extractAllListItemsFromMarkdown(markdown) {
|
|
@@ -9837,7 +9860,7 @@ class CallbackInterfaceTools {
|
|
|
9837
9860
|
}
|
|
9838
9861
|
|
|
9839
9862
|
/**
|
|
9840
|
-
* This error indicates
|
|
9863
|
+
* This error indicates @@
|
|
9841
9864
|
*
|
|
9842
9865
|
* @public exported from `@promptbook/core`
|
|
9843
9866
|
*/
|
|
@@ -9849,7 +9872,7 @@ class BoilerplateError extends Error {
|
|
|
9849
9872
|
}
|
|
9850
9873
|
}
|
|
9851
9874
|
/**
|
|
9852
|
-
* TODO:
|
|
9875
|
+
* TODO: @@ Do not forget to add the error into `0-index.ts` ERRORS
|
|
9853
9876
|
*/
|
|
9854
9877
|
|
|
9855
9878
|
/**
|
|
@@ -10208,22 +10231,23 @@ function usageToHuman(usage) {
|
|
|
10208
10231
|
*/
|
|
10209
10232
|
|
|
10210
10233
|
/**
|
|
10211
|
-
* Boilerplate is form of app that
|
|
10234
|
+
* Boilerplate is form of app that serves as a template structure for creating other formfactors
|
|
10235
|
+
* and should not be used directly in production.
|
|
10212
10236
|
*
|
|
10213
10237
|
* @public exported from `@promptbook/core`
|
|
10214
10238
|
*/
|
|
10215
10239
|
const BoilerplateFormfactorDefinition = {
|
|
10216
10240
|
name: 'BOILERPLATE',
|
|
10217
|
-
description:
|
|
10241
|
+
description: `A template structure for creating new formfactors, providing the base architecture and interfaces that should be implemented.`,
|
|
10218
10242
|
documentationUrl: `https://github.com/webgptorg/promptbook/discussions/@@`,
|
|
10219
10243
|
// <- TODO: https://github.com/webgptorg/promptbook/discussions/new?category=concepts
|
|
10220
10244
|
// "🔠 Boilerplate Formfactor"
|
|
10221
10245
|
pipelineInterface: {
|
|
10222
10246
|
inputParameters: [
|
|
10223
|
-
/*
|
|
10247
|
+
/* <- Example input parameters should be defined here */
|
|
10224
10248
|
],
|
|
10225
10249
|
outputParameters: [
|
|
10226
|
-
/*
|
|
10250
|
+
/* <- Example output parameters should be defined here */
|
|
10227
10251
|
],
|
|
10228
10252
|
},
|
|
10229
10253
|
};
|
|
@@ -10304,10 +10328,10 @@ function filterModels(llmTools, modelFilter) {
|
|
|
10304
10328
|
*/
|
|
10305
10329
|
|
|
10306
10330
|
/**
|
|
10307
|
-
*
|
|
10331
|
+
* Register for LLM tools metadata.
|
|
10308
10332
|
*
|
|
10309
10333
|
* Note: `$` is used to indicate that this interacts with the global scope
|
|
10310
|
-
* @singleton Only one instance of each register is created per build, but
|
|
10334
|
+
* @singleton Only one instance of each register is created per build, but there can be more instances across different builds or environments.
|
|
10311
10335
|
* @public exported from `@promptbook/core`
|
|
10312
10336
|
*/
|
|
10313
10337
|
const $llmToolsMetadataRegister = new $Register('llm_tools_metadata');
|
|
@@ -10316,10 +10340,10 @@ const $llmToolsMetadataRegister = new $Register('llm_tools_metadata');
|
|
|
10316
10340
|
*/
|
|
10317
10341
|
|
|
10318
10342
|
/**
|
|
10319
|
-
*
|
|
10343
|
+
* Register for LLM tools.
|
|
10320
10344
|
*
|
|
10321
10345
|
* Note: `$` is used to indicate that this interacts with the global scope
|
|
10322
|
-
* @singleton Only one instance of each register is created per build, but
|
|
10346
|
+
* @singleton Only one instance of each register is created per build, but there can be more instances across different builds or environments.
|
|
10323
10347
|
* @public exported from `@promptbook/core`
|
|
10324
10348
|
*/
|
|
10325
10349
|
const $llmToolsRegister = new $Register('llm_execution_tools_constructors');
|
|
@@ -10706,13 +10730,13 @@ function cacheLlmTools(llmTools, options = {}) {
|
|
|
10706
10730
|
/**
|
|
10707
10731
|
* TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
|
|
10708
10732
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
10709
|
-
* TODO: [👷♂️]
|
|
10710
|
-
*
|
|
10711
|
-
*
|
|
10733
|
+
* TODO: [👷♂️] Comprehensive manual about construction of llmTools
|
|
10734
|
+
* Detailed explanation about caching strategies and appropriate storage selection for different use cases
|
|
10735
|
+
* Examples of how to combine multiple interceptors for advanced caching, logging, and usage tracking
|
|
10712
10736
|
*/
|
|
10713
10737
|
|
|
10714
10738
|
/**
|
|
10715
|
-
*
|
|
10739
|
+
* Wraps LlmExecutionTools to limit the total usage based on provided limits.
|
|
10716
10740
|
*
|
|
10717
10741
|
* @public exported from `@promptbook/core`
|
|
10718
10742
|
*/
|
|
@@ -11210,8 +11234,8 @@ function prompt(strings, ...values) {
|
|
|
11210
11234
|
* 2) `promptTemplate` alias for `prompt`
|
|
11211
11235
|
* 3) `book` for notating and validating entire books exported from `@promptbook/utils`
|
|
11212
11236
|
*
|
|
11213
|
-
* @param strings
|
|
11214
|
-
* @param values
|
|
11237
|
+
* @param strings The static string parts of the template literal
|
|
11238
|
+
* @param values The dynamic values embedded within the template literal used as data
|
|
11215
11239
|
* @returns the pipeline string
|
|
11216
11240
|
* @public exported from `@promptbook/core`
|
|
11217
11241
|
*/
|
|
@@ -11278,14 +11302,14 @@ const boilerplateScraperMetadata = $deepFreeze({
|
|
|
11278
11302
|
packageName: '@promptbook/boilerplate',
|
|
11279
11303
|
className: 'BoilerplateScraper',
|
|
11280
11304
|
mimeTypes: [
|
|
11281
|
-
'
|
|
11282
|
-
// <- TODO:
|
|
11305
|
+
'@@/@@',
|
|
11306
|
+
// <- TODO: @@ Add compatible mime types with Boilerplate scraper
|
|
11283
11307
|
],
|
|
11284
|
-
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions
|
|
11308
|
+
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
11285
11309
|
isAvilableInBrowser: false,
|
|
11286
11310
|
// <- Note: [🌏] Only `MarkdownScraper` makes sense to be available in the browser, for scraping non-markdown sources in the browser use a remote server
|
|
11287
11311
|
requiredExecutables: [
|
|
11288
|
-
/*
|
|
11312
|
+
/* @@ 'Pandoc' */
|
|
11289
11313
|
],
|
|
11290
11314
|
}); /* <- Note: [🤛] */
|
|
11291
11315
|
/**
|
|
@@ -11557,5 +11581,5 @@ class PrefixStorage {
|
|
|
11557
11581
|
}
|
|
11558
11582
|
}
|
|
11559
11583
|
|
|
11560
|
-
export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, ADMIN_EMAIL, ADMIN_GITHUB_NAME, AbstractFormatError, AuthenticationError, BIG_DATASET_TRESHOLD, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateError, BoilerplateFormfactorDefinition, CLAIM, CLI_APP_ID, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CompletionFormfactorDefinition, CsvFormatError, CsvFormatParser, DEFAULT_BOOKS_DIRNAME, DEFAULT_BOOK_OUTPUT_PARAMETER_NAME, DEFAULT_BOOK_TITLE, DEFAULT_CSV_SETTINGS, DEFAULT_DOWNLOAD_CACHE_DIRNAME, DEFAULT_EXECUTION_CACHE_DIRNAME, DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_FILE_SIZE, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_PROMPT_TASK_TITLE, DEFAULT_REMOTE_SERVER_URL, DEFAULT_RPM, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TASK_TITLE, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FAILED_VALUE_PLACEHOLDER, FORMFACTOR_DEFINITIONS, GENERIC_PIPELINE_INTERFACE, GeneratorFormfactorDefinition, GenericFormfactorDefinition, ImageGeneratorFormfactorDefinition, KnowledgeScrapeError, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_ORDER, MODEL_TRUST_LEVEL, MODEL_VARIANTS, MatcherFormfactorDefinition, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NAME, NonTaskSectionTypes, NotFoundError, NotYetImplementedError, ORDER_OF_PIPELINE_JSON, PENDING_VALUE_PLACEHOLDER, PLAYGROUND_APP_ID, PROMPTBOOK_ENGINE_VERSION, PROMPTBOOK_ERRORS, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, PromptbookFetchError, REMOTE_SERVER_URLS, RESERVED_PARAMETER_NAMES, SET_IS_VERBOSE, SectionTypes, SheetsFormfactorDefinition, TaskTypes, TextFormatParser, TranslatorFormfactorDefinition, UNCERTAIN_USAGE, UNCERTAIN_ZERO_VALUE, UnexpectedError, WrappedError, ZERO_USAGE, ZERO_VALUE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _BoilerplateScraperMetadataRegistration, _DeepseekMetadataRegistration, _DocumentScraperMetadataRegistration, _GoogleMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _MarkitdownScraperMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, addUsage, book, cacheLlmTools, collectionToJson, compilePipeline, computeCosineSimilarity, countUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, extractParameterNamesFromTask, filterModels, getPipelineInterface, identificationToPromptbookToken, isPassingExpectations, isPipelineImplementingInterface, isPipelineInterfacesEqual, isPipelinePrepared, isValidPipelineString, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, migratePipeline, parsePipeline, pipelineJsonToString, prepareKnowledgePieces, preparePersona, preparePipeline,
|
|
11584
|
+
export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, ADMIN_EMAIL, ADMIN_GITHUB_NAME, AbstractFormatError, AuthenticationError, BIG_DATASET_TRESHOLD, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateError, BoilerplateFormfactorDefinition, CLAIM, CLI_APP_ID, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CompletionFormfactorDefinition, CsvFormatError, CsvFormatParser, DEFAULT_BOOKS_DIRNAME, DEFAULT_BOOK_OUTPUT_PARAMETER_NAME, DEFAULT_BOOK_TITLE, DEFAULT_CSV_SETTINGS, DEFAULT_DOWNLOAD_CACHE_DIRNAME, DEFAULT_EXECUTION_CACHE_DIRNAME, DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_FILE_SIZE, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_PROMPT_TASK_TITLE, DEFAULT_REMOTE_SERVER_URL, DEFAULT_RPM, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TASK_TITLE, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FAILED_VALUE_PLACEHOLDER, FORMFACTOR_DEFINITIONS, GENERIC_PIPELINE_INTERFACE, GeneratorFormfactorDefinition, GenericFormfactorDefinition, ImageGeneratorFormfactorDefinition, KnowledgeScrapeError, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_ORDER, MODEL_TRUST_LEVEL, MODEL_VARIANTS, MatcherFormfactorDefinition, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NAME, NonTaskSectionTypes, NotFoundError, NotYetImplementedError, ORDER_OF_PIPELINE_JSON, PENDING_VALUE_PLACEHOLDER, PLAYGROUND_APP_ID, PROMPTBOOK_ENGINE_VERSION, PROMPTBOOK_ERRORS, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, PromptbookFetchError, REMOTE_SERVER_URLS, RESERVED_PARAMETER_NAMES, SET_IS_VERBOSE, SectionTypes, SheetsFormfactorDefinition, TaskTypes, TextFormatParser, TranslatorFormfactorDefinition, UNCERTAIN_USAGE, UNCERTAIN_ZERO_VALUE, UnexpectedError, WrappedError, ZERO_USAGE, ZERO_VALUE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _BoilerplateScraperMetadataRegistration, _DeepseekMetadataRegistration, _DocumentScraperMetadataRegistration, _GoogleMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _MarkitdownScraperMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, addUsage, book, cacheLlmTools, collectionToJson, compilePipeline, computeCosineSimilarity, countUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, extractParameterNamesFromTask, filterModels, getPipelineInterface, identificationToPromptbookToken, isPassingExpectations, isPipelineImplementingInterface, isPipelineInterfacesEqual, isPipelinePrepared, isValidPipelineString, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, migratePipeline, parsePipeline, pipelineJsonToString, prepareKnowledgePieces, preparePersona, preparePipeline, prettifyPipelineString, promptbookFetch, promptbookTokenToIdentification, unpreparePipeline, usageToHuman, usageToWorktime, validatePipeline, validatePipelineString };
|
|
11561
11585
|
//# sourceMappingURL=index.es.js.map
|