@promptbook/core 0.88.0 → 0.89.0-2
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/README.md +4 -0
- package/esm/index.es.js +128 -93
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +6 -2
- package/esm/typings/src/_packages/types.index.d.ts +16 -4
- package/esm/typings/src/cli/cli-commands/login.d.ts +15 -0
- package/esm/typings/src/execution/PipelineExecutorResult.d.ts +2 -2
- package/esm/typings/src/execution/PromptResult.d.ts +2 -2
- package/esm/typings/src/execution/{PromptResultUsage.d.ts → Usage.d.ts} +5 -5
- package/esm/typings/src/execution/utils/addUsage.d.ts +2 -2
- package/esm/typings/src/execution/utils/computeUsageCounts.d.ts +3 -3
- package/esm/typings/src/execution/utils/usage-constants.d.ts +77 -60
- package/esm/typings/src/execution/utils/usageToHuman.d.ts +5 -5
- package/esm/typings/src/execution/utils/usageToWorktime.d.ts +5 -5
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +9 -2
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/{countTotalUsage.d.ts → countUsage.d.ts} +1 -1
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +2 -2
- package/esm/typings/src/llm-providers/anthropic-claude/computeAnthropicClaudeUsage.d.ts +2 -2
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +0 -9
- package/esm/typings/src/llm-providers/openai/computeOpenAiUsage.d.ts +2 -2
- package/esm/typings/src/pipeline/PipelineJson/PreparationJson.d.ts +2 -2
- package/esm/typings/src/playground/BrjappConnector.d.ts +67 -0
- package/esm/typings/src/playground/brjapp-api-schema.d.ts +12879 -0
- package/esm/typings/src/playground/playground.d.ts +5 -0
- package/esm/typings/src/remote-server/socket-types/_subtypes/PromptbookServer_Identification.d.ts +2 -1
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +15 -3
- package/esm/typings/src/types/typeAliases.d.ts +8 -2
- package/package.json +1 -1
- package/umd/index.umd.js +130 -93
- package/umd/index.umd.js.map +1 -1
package/README.md
CHANGED
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
+
<blockquote style="color: #ff8811">
|
|
27
|
+
<b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
|
|
28
|
+
</blockquote>
|
|
29
|
+
|
|
26
30
|
## 📦 Package `@promptbook/core`
|
|
27
31
|
|
|
28
32
|
- Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
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.
|
|
30
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-2';
|
|
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
|
|
@@ -2082,6 +2082,7 @@ function assertsTaskSuccessful(executionResult) {
|
|
|
2082
2082
|
const { isSuccessful, errors, warnings } = executionResult;
|
|
2083
2083
|
for (const warning of warnings) {
|
|
2084
2084
|
console.warn(warning.message);
|
|
2085
|
+
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
2085
2086
|
}
|
|
2086
2087
|
if (isSuccessful === true) {
|
|
2087
2088
|
return;
|
|
@@ -2306,30 +2307,42 @@ function valueToString(value) {
|
|
|
2306
2307
|
}
|
|
2307
2308
|
}
|
|
2308
2309
|
|
|
2310
|
+
/**
|
|
2311
|
+
* Represents the uncertain value
|
|
2312
|
+
*
|
|
2313
|
+
* @public exported from `@promptbook/core`
|
|
2314
|
+
*/
|
|
2315
|
+
const ZERO_VALUE = $deepFreeze({ value: 0 });
|
|
2316
|
+
/**
|
|
2317
|
+
* Represents the uncertain value
|
|
2318
|
+
*
|
|
2319
|
+
* @public exported from `@promptbook/core`
|
|
2320
|
+
*/
|
|
2321
|
+
const UNCERTAIN_ZERO_VALUE = $deepFreeze({ value: 0, isUncertain: true });
|
|
2309
2322
|
/**
|
|
2310
2323
|
* Represents the usage with no resources consumed
|
|
2311
2324
|
*
|
|
2312
2325
|
* @public exported from `@promptbook/core`
|
|
2313
2326
|
*/
|
|
2314
2327
|
const ZERO_USAGE = $deepFreeze({
|
|
2315
|
-
price:
|
|
2328
|
+
price: ZERO_VALUE,
|
|
2316
2329
|
input: {
|
|
2317
|
-
tokensCount:
|
|
2318
|
-
charactersCount:
|
|
2319
|
-
wordsCount:
|
|
2320
|
-
sentencesCount:
|
|
2321
|
-
linesCount:
|
|
2322
|
-
paragraphsCount:
|
|
2323
|
-
pagesCount:
|
|
2330
|
+
tokensCount: ZERO_VALUE,
|
|
2331
|
+
charactersCount: ZERO_VALUE,
|
|
2332
|
+
wordsCount: ZERO_VALUE,
|
|
2333
|
+
sentencesCount: ZERO_VALUE,
|
|
2334
|
+
linesCount: ZERO_VALUE,
|
|
2335
|
+
paragraphsCount: ZERO_VALUE,
|
|
2336
|
+
pagesCount: ZERO_VALUE,
|
|
2324
2337
|
},
|
|
2325
2338
|
output: {
|
|
2326
|
-
tokensCount:
|
|
2327
|
-
charactersCount:
|
|
2328
|
-
wordsCount:
|
|
2329
|
-
sentencesCount:
|
|
2330
|
-
linesCount:
|
|
2331
|
-
paragraphsCount:
|
|
2332
|
-
pagesCount:
|
|
2339
|
+
tokensCount: ZERO_VALUE,
|
|
2340
|
+
charactersCount: ZERO_VALUE,
|
|
2341
|
+
wordsCount: ZERO_VALUE,
|
|
2342
|
+
sentencesCount: ZERO_VALUE,
|
|
2343
|
+
linesCount: ZERO_VALUE,
|
|
2344
|
+
paragraphsCount: ZERO_VALUE,
|
|
2345
|
+
pagesCount: ZERO_VALUE,
|
|
2333
2346
|
},
|
|
2334
2347
|
});
|
|
2335
2348
|
/**
|
|
@@ -2338,24 +2351,24 @@ const ZERO_USAGE = $deepFreeze({
|
|
|
2338
2351
|
* @public exported from `@promptbook/core`
|
|
2339
2352
|
*/
|
|
2340
2353
|
const UNCERTAIN_USAGE = $deepFreeze({
|
|
2341
|
-
price:
|
|
2354
|
+
price: UNCERTAIN_ZERO_VALUE,
|
|
2342
2355
|
input: {
|
|
2343
|
-
tokensCount:
|
|
2344
|
-
charactersCount:
|
|
2345
|
-
wordsCount:
|
|
2346
|
-
sentencesCount:
|
|
2347
|
-
linesCount:
|
|
2348
|
-
paragraphsCount:
|
|
2349
|
-
pagesCount:
|
|
2356
|
+
tokensCount: UNCERTAIN_ZERO_VALUE,
|
|
2357
|
+
charactersCount: UNCERTAIN_ZERO_VALUE,
|
|
2358
|
+
wordsCount: UNCERTAIN_ZERO_VALUE,
|
|
2359
|
+
sentencesCount: UNCERTAIN_ZERO_VALUE,
|
|
2360
|
+
linesCount: UNCERTAIN_ZERO_VALUE,
|
|
2361
|
+
paragraphsCount: UNCERTAIN_ZERO_VALUE,
|
|
2362
|
+
pagesCount: UNCERTAIN_ZERO_VALUE,
|
|
2350
2363
|
},
|
|
2351
2364
|
output: {
|
|
2352
|
-
tokensCount:
|
|
2353
|
-
charactersCount:
|
|
2354
|
-
wordsCount:
|
|
2355
|
-
sentencesCount:
|
|
2356
|
-
linesCount:
|
|
2357
|
-
paragraphsCount:
|
|
2358
|
-
pagesCount:
|
|
2365
|
+
tokensCount: UNCERTAIN_ZERO_VALUE,
|
|
2366
|
+
charactersCount: UNCERTAIN_ZERO_VALUE,
|
|
2367
|
+
wordsCount: UNCERTAIN_ZERO_VALUE,
|
|
2368
|
+
sentencesCount: UNCERTAIN_ZERO_VALUE,
|
|
2369
|
+
linesCount: UNCERTAIN_ZERO_VALUE,
|
|
2370
|
+
paragraphsCount: UNCERTAIN_ZERO_VALUE,
|
|
2371
|
+
pagesCount: UNCERTAIN_ZERO_VALUE,
|
|
2359
2372
|
},
|
|
2360
2373
|
});
|
|
2361
2374
|
/**
|
|
@@ -2526,7 +2539,7 @@ function extractParameterNamesFromTask(task) {
|
|
|
2526
2539
|
if (parameterNames.has(subparameterName)) {
|
|
2527
2540
|
parameterNames.delete(subparameterName);
|
|
2528
2541
|
parameterNames.add(foreach.parameterName);
|
|
2529
|
-
// <- TODO: [
|
|
2542
|
+
// <- TODO: [🏮] Warn/logic error when `subparameterName` not used
|
|
2530
2543
|
}
|
|
2531
2544
|
}
|
|
2532
2545
|
}
|
|
@@ -3020,6 +3033,7 @@ function joinLlmExecutionTools(...llmExecutionTools) {
|
|
|
3020
3033
|
`);
|
|
3021
3034
|
// TODO: [🟥] Detect browser / node and make it colorfull
|
|
3022
3035
|
console.warn(warningMessage);
|
|
3036
|
+
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
3023
3037
|
/*
|
|
3024
3038
|
return {
|
|
3025
3039
|
async listModels() {
|
|
@@ -4631,6 +4645,7 @@ function createPipelineExecutor(options) {
|
|
|
4631
4645
|
|
|
4632
4646
|
@see more at https://ptbk.io/prepare-pipeline
|
|
4633
4647
|
`));
|
|
4648
|
+
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
4634
4649
|
}
|
|
4635
4650
|
let runCount = 0;
|
|
4636
4651
|
const pipelineExecutorWithCallback = async (inputParameters, onProgress) => {
|
|
@@ -4707,8 +4722,9 @@ async function forEachAsync(array, options, callbackfunction) {
|
|
|
4707
4722
|
* @returns LLM tools with same functionality with added total cost counting
|
|
4708
4723
|
* @public exported from `@promptbook/core`
|
|
4709
4724
|
*/
|
|
4710
|
-
function
|
|
4725
|
+
function countUsage(llmTools) {
|
|
4711
4726
|
let totalUsage = ZERO_USAGE;
|
|
4727
|
+
const spending = new Subject();
|
|
4712
4728
|
const proxyTools = {
|
|
4713
4729
|
get title() {
|
|
4714
4730
|
// TODO: [🧠] Maybe put here some suffix
|
|
@@ -4718,12 +4734,15 @@ function countTotalUsage(llmTools) {
|
|
|
4718
4734
|
// TODO: [🧠] Maybe put here some suffix
|
|
4719
4735
|
return llmTools.description;
|
|
4720
4736
|
},
|
|
4721
|
-
|
|
4737
|
+
checkConfiguration() {
|
|
4722
4738
|
return /* not await */ llmTools.checkConfiguration();
|
|
4723
4739
|
},
|
|
4724
4740
|
listModels() {
|
|
4725
4741
|
return /* not await */ llmTools.listModels();
|
|
4726
4742
|
},
|
|
4743
|
+
spending() {
|
|
4744
|
+
return spending.asObservable();
|
|
4745
|
+
},
|
|
4727
4746
|
getTotalUsage() {
|
|
4728
4747
|
// <- Note: [🥫] Not using getter `get totalUsage` but `getTotalUsage` to allow this object to be proxied
|
|
4729
4748
|
return totalUsage;
|
|
@@ -4734,6 +4753,7 @@ function countTotalUsage(llmTools) {
|
|
|
4734
4753
|
// console.info('[🚕] callChatModel through countTotalUsage');
|
|
4735
4754
|
const promptResult = await llmTools.callChatModel(prompt);
|
|
4736
4755
|
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
4756
|
+
spending.next(promptResult.usage);
|
|
4737
4757
|
return promptResult;
|
|
4738
4758
|
};
|
|
4739
4759
|
}
|
|
@@ -4742,6 +4762,7 @@ function countTotalUsage(llmTools) {
|
|
|
4742
4762
|
// console.info('[🚕] callCompletionModel through countTotalUsage');
|
|
4743
4763
|
const promptResult = await llmTools.callCompletionModel(prompt);
|
|
4744
4764
|
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
4765
|
+
spending.next(promptResult.usage);
|
|
4745
4766
|
return promptResult;
|
|
4746
4767
|
};
|
|
4747
4768
|
}
|
|
@@ -4750,6 +4771,7 @@ function countTotalUsage(llmTools) {
|
|
|
4750
4771
|
// console.info('[🚕] callEmbeddingModel through countTotalUsage');
|
|
4751
4772
|
const promptResult = await llmTools.callEmbeddingModel(prompt);
|
|
4752
4773
|
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
4774
|
+
spending.next(promptResult.usage);
|
|
4753
4775
|
return promptResult;
|
|
4754
4776
|
};
|
|
4755
4777
|
}
|
|
@@ -4920,7 +4942,7 @@ class $Register {
|
|
|
4920
4942
|
const existingRegistration = this.storage[existingRegistrationIndex];
|
|
4921
4943
|
if (!existingRegistration) {
|
|
4922
4944
|
if (DEFAULT_IS_VERBOSE) {
|
|
4923
|
-
console.
|
|
4945
|
+
console.info(`[📦] Registering \`${packageName}.${className}\` to \`${this.registerName}\``);
|
|
4924
4946
|
}
|
|
4925
4947
|
this.storage.push(registered);
|
|
4926
4948
|
}
|
|
@@ -5406,63 +5428,73 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
|
|
|
5406
5428
|
const { maxParallelCount = DEFAULT_MAX_PARALLEL_COUNT, rootDirname, isVerbose = DEFAULT_IS_VERBOSE } = options;
|
|
5407
5429
|
const knowledgePreparedUnflatten = new Array(knowledgeSources.length);
|
|
5408
5430
|
await forEachAsync(knowledgeSources, { maxParallelCount }, async (knowledgeSource, index) => {
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5431
|
+
try {
|
|
5432
|
+
let partialPieces = null;
|
|
5433
|
+
const sourceHandler = await makeKnowledgeSourceHandler(knowledgeSource, tools, { rootDirname, isVerbose });
|
|
5434
|
+
const scrapers = arrayableToArray(tools.scrapers);
|
|
5435
|
+
for (const scraper of scrapers) {
|
|
5436
|
+
if (!scraper.metadata.mimeTypes.includes(sourceHandler.mimeType)
|
|
5437
|
+
// <- TODO: [🦔] Implement mime-type wildcards
|
|
5438
|
+
) {
|
|
5439
|
+
continue;
|
|
5440
|
+
}
|
|
5441
|
+
const partialPiecesUnchecked = await scraper.scrape(sourceHandler);
|
|
5442
|
+
if (partialPiecesUnchecked !== null) {
|
|
5443
|
+
partialPieces = [...partialPiecesUnchecked];
|
|
5444
|
+
// <- TODO: [🪓] Here should be no need for spreading new array, just `partialPieces = partialPiecesUnchecked`
|
|
5445
|
+
break;
|
|
5446
|
+
}
|
|
5447
|
+
console.warn(spaceTrim((block) => `
|
|
5448
|
+
Cannot scrape knowledge from source despite the scraper \`${scraper.metadata.className}\` supports the mime type "${sourceHandler.mimeType}".
|
|
5426
5449
|
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5450
|
+
The source:
|
|
5451
|
+
${block(knowledgeSource.knowledgeSourceContent
|
|
5452
|
+
.split('\n')
|
|
5453
|
+
.map((line) => `> ${line}`)
|
|
5454
|
+
.join('\n'))}
|
|
5432
5455
|
|
|
5433
|
-
|
|
5456
|
+
${block($registeredScrapersMessage(scrapers))}
|
|
5434
5457
|
|
|
5435
5458
|
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5459
|
+
`));
|
|
5460
|
+
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
5461
|
+
}
|
|
5462
|
+
if (partialPieces === null) {
|
|
5463
|
+
throw new KnowledgeScrapeError(spaceTrim((block) => `
|
|
5464
|
+
Cannot scrape knowledge
|
|
5441
5465
|
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5466
|
+
The source:
|
|
5467
|
+
> ${block(knowledgeSource.knowledgeSourceContent
|
|
5468
|
+
.split('\n')
|
|
5469
|
+
.map((line) => `> ${line}`)
|
|
5470
|
+
.join('\n'))}
|
|
5447
5471
|
|
|
5448
|
-
|
|
5472
|
+
No scraper found for the mime type "${sourceHandler.mimeType}"
|
|
5449
5473
|
|
|
5450
|
-
|
|
5474
|
+
${block($registeredScrapersMessage(scrapers))}
|
|
5451
5475
|
|
|
5452
5476
|
|
|
5453
|
-
|
|
5477
|
+
`));
|
|
5478
|
+
}
|
|
5479
|
+
const pieces = partialPieces.map((partialPiece) => ({
|
|
5480
|
+
...partialPiece,
|
|
5481
|
+
sources: [
|
|
5482
|
+
{
|
|
5483
|
+
name: knowledgeSource.name,
|
|
5484
|
+
// line, column <- TODO: [☀]
|
|
5485
|
+
// <- TODO: [❎]
|
|
5486
|
+
},
|
|
5487
|
+
],
|
|
5488
|
+
}));
|
|
5489
|
+
knowledgePreparedUnflatten[index] = pieces;
|
|
5490
|
+
}
|
|
5491
|
+
catch (error) {
|
|
5492
|
+
if (!(error instanceof Error)) {
|
|
5493
|
+
throw error;
|
|
5494
|
+
}
|
|
5495
|
+
console.warn(error);
|
|
5496
|
+
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
5454
5497
|
}
|
|
5455
|
-
const pieces = partialPieces.map((partialPiece) => ({
|
|
5456
|
-
...partialPiece,
|
|
5457
|
-
sources: [
|
|
5458
|
-
{
|
|
5459
|
-
name: knowledgeSource.name,
|
|
5460
|
-
// line, column <- TODO: [☀]
|
|
5461
|
-
// <- TODO: [❎]
|
|
5462
|
-
},
|
|
5463
|
-
],
|
|
5464
|
-
}));
|
|
5465
|
-
knowledgePreparedUnflatten[index] = pieces;
|
|
5466
5498
|
});
|
|
5467
5499
|
const knowledgePrepared = knowledgePreparedUnflatten.flat();
|
|
5468
5500
|
return knowledgePrepared;
|
|
@@ -5568,7 +5600,7 @@ async function preparePipeline(pipeline, tools, options) {
|
|
|
5568
5600
|
// TODO: [🚐] Make arrayable LLMs -> single LLM DRY
|
|
5569
5601
|
const _llms = arrayableToArray(tools.llm);
|
|
5570
5602
|
const llmTools = _llms.length === 1 ? _llms[0] : joinLlmExecutionTools(..._llms);
|
|
5571
|
-
const llmToolsWithUsage =
|
|
5603
|
+
const llmToolsWithUsage = countUsage(llmTools);
|
|
5572
5604
|
// <- TODO: [🌯]
|
|
5573
5605
|
/*
|
|
5574
5606
|
TODO: [🧠][🪑][🔃] Should this be done or not
|
|
@@ -7287,7 +7319,8 @@ const modelCommandParser = {
|
|
|
7287
7319
|
if ($pipelineJson.defaultModelRequirements[command.key] !== undefined) {
|
|
7288
7320
|
if ($pipelineJson.defaultModelRequirements[command.key] === command.value) {
|
|
7289
7321
|
console.warn(`Multiple commands \`MODEL ${command.key} ${command.value}\` in the pipeline head`);
|
|
7290
|
-
// <- TODO: [
|
|
7322
|
+
// <- TODO: [🏮] Some better way how to get warnings from pipeline parsing / logic
|
|
7323
|
+
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
7291
7324
|
}
|
|
7292
7325
|
else {
|
|
7293
7326
|
throw new ParseError(spaceTrim(`
|
|
@@ -7319,6 +7352,7 @@ const modelCommandParser = {
|
|
|
7319
7352
|
modelVariant: 'VARIANT',
|
|
7320
7353
|
maxTokens: '???',
|
|
7321
7354
|
}[command.key]} ${command.value}\` in the task "${$taskJson.title || $taskJson.name}"`);
|
|
7355
|
+
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
7322
7356
|
}
|
|
7323
7357
|
else {
|
|
7324
7358
|
throw new ParseError(spaceTrim(`
|
|
@@ -7598,15 +7632,15 @@ function $applyToTaskJson(command, $taskJson, $pipelineJson) {
|
|
|
7598
7632
|
}
|
|
7599
7633
|
console.warn(spaceTrim(`
|
|
7600
7634
|
|
|
7601
|
-
|
|
7635
|
+
Persona "${personaName}" is defined multiple times with different description:
|
|
7602
7636
|
|
|
7603
|
-
|
|
7604
|
-
|
|
7637
|
+
First definition:
|
|
7638
|
+
${persona.description}
|
|
7605
7639
|
|
|
7606
|
-
|
|
7607
|
-
|
|
7640
|
+
Second definition:
|
|
7641
|
+
${personaDescription}
|
|
7608
7642
|
|
|
7609
|
-
|
|
7643
|
+
`));
|
|
7610
7644
|
persona.description += spaceTrim('\n\n' + personaDescription);
|
|
7611
7645
|
}
|
|
7612
7646
|
|
|
@@ -9168,7 +9202,8 @@ function addAutoGeneratedSection(content, options) {
|
|
|
9168
9202
|
`));
|
|
9169
9203
|
}
|
|
9170
9204
|
console.warn(`No place where to put the section <!--${sectionName}-->, using the end of the file`);
|
|
9171
|
-
// <- TODO: [
|
|
9205
|
+
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
9206
|
+
// <- TODO: [🏮] Some better way how to get warnings from pipeline parsing / logic
|
|
9172
9207
|
return spaceTrim$1((block) => `
|
|
9173
9208
|
${block(content)}
|
|
9174
9209
|
|
|
@@ -10079,7 +10114,7 @@ function cacheLlmTools(llmTools, options = {}) {
|
|
|
10079
10114
|
*/
|
|
10080
10115
|
function limitTotalUsage(llmTools, options = {}) {
|
|
10081
10116
|
const { maxTotalUsage = ZERO_USAGE, storage = new MemoryStorage() } = options;
|
|
10082
|
-
const proxyTools =
|
|
10117
|
+
const proxyTools = countUsage(llmTools);
|
|
10083
10118
|
if (maxTotalUsage.price.value !== 0) {
|
|
10084
10119
|
throw new NotYetImplementedError('`limitTotalUsage` is not yet implemented for non-zero price');
|
|
10085
10120
|
// TODO: "Cannot call `callChatModel` because the total cost limit is reached"
|
|
@@ -10828,5 +10863,5 @@ class PrefixStorage {
|
|
|
10828
10863
|
}
|
|
10829
10864
|
}
|
|
10830
10865
|
|
|
10831
|
-
export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, ADMIN_EMAIL, ADMIN_GITHUB_NAME, AbstractFormatError, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateError, BoilerplateFormfactorDefinition, CLAIM, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CsvFormatDefinition, CsvFormatError, 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_URL, DEFAULT_REMOTE_URL_PATH, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TASK_TITLE, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FORMFACTOR_DEFINITIONS, GENERIC_PIPELINE_INTERFACE, GeneratorFormfactorDefinition, GenericFormfactorDefinition, ImageGeneratorFormfactorDefinition, KnowledgeScrapeError, LOGO_DARK_SRC, LOGO_LIGHT_SRC, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_VARIANTS, MatcherFormfactorDefinition, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NAME, NonTaskSectionTypes, NotFoundError, NotYetImplementedError, ORDER_OF_PIPELINE_JSON, PROMPTBOOK_ENGINE_VERSION, PROMPTBOOK_ERRORS, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, RESERVED_PARAMETER_NAMES, SET_IS_VERBOSE, SectionTypes, SheetsFormfactorDefinition, TaskTypes, TextFormatDefinition, TranslatorFormfactorDefinition, UNCERTAIN_USAGE, UnexpectedError, ZERO_USAGE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _BoilerplateScraperMetadataRegistration, _DeepseekMetadataRegistration, _DocumentScraperMetadataRegistration, _GoogleMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _MarkitdownScraperMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, addUsage, book, cacheLlmTools, collectionToJson, compilePipeline,
|
|
10866
|
+
export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, ADMIN_EMAIL, ADMIN_GITHUB_NAME, AbstractFormatError, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateError, BoilerplateFormfactorDefinition, CLAIM, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CsvFormatDefinition, CsvFormatError, 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_URL, DEFAULT_REMOTE_URL_PATH, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TASK_TITLE, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FORMFACTOR_DEFINITIONS, GENERIC_PIPELINE_INTERFACE, GeneratorFormfactorDefinition, GenericFormfactorDefinition, ImageGeneratorFormfactorDefinition, KnowledgeScrapeError, LOGO_DARK_SRC, LOGO_LIGHT_SRC, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_VARIANTS, MatcherFormfactorDefinition, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NAME, NonTaskSectionTypes, NotFoundError, NotYetImplementedError, ORDER_OF_PIPELINE_JSON, PROMPTBOOK_ENGINE_VERSION, PROMPTBOOK_ERRORS, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, RESERVED_PARAMETER_NAMES, SET_IS_VERBOSE, SectionTypes, SheetsFormfactorDefinition, TaskTypes, TextFormatDefinition, TranslatorFormfactorDefinition, UNCERTAIN_USAGE, UNCERTAIN_ZERO_VALUE, UnexpectedError, ZERO_USAGE, ZERO_VALUE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _BoilerplateScraperMetadataRegistration, _DeepseekMetadataRegistration, _DocumentScraperMetadataRegistration, _GoogleMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _MarkitdownScraperMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, addUsage, book, cacheLlmTools, collectionToJson, compilePipeline, countUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, extractParameterNamesFromTask, getPipelineInterface, isPassingExpectations, isPipelineImplementingInterface, isPipelineInterfacesEqual, isPipelinePrepared, isValidPipelineString, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, parsePipeline, pipelineJsonToString, prepareKnowledgePieces, preparePersona, preparePipeline, prepareTasks, prettifyPipelineString, unpreparePipeline, usageToHuman, usageToWorktime, validatePipeline, validatePipelineString };
|
|
10832
10867
|
//# sourceMappingURL=index.es.js.map
|