@promptbook/pdf 0.88.0 → 0.89.0-11
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 +7 -1
- package/esm/index.es.js +160 -88
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +18 -6
- package/esm/typings/src/_packages/remote-client.index.d.ts +6 -8
- package/esm/typings/src/_packages/remote-server.index.d.ts +6 -6
- package/esm/typings/src/_packages/types.index.d.ts +18 -10
- package/esm/typings/src/cli/cli-commands/login.d.ts +15 -0
- package/esm/typings/src/cli/common/$addGlobalOptionsToCommand.d.ts +7 -0
- package/esm/typings/src/cli/common/$provideLlmToolsForCli.d.ts +15 -0
- package/esm/typings/src/config.d.ts +15 -8
- package/esm/typings/src/errors/0-index.d.ts +6 -0
- package/esm/typings/src/errors/AuthenticationError.d.ts +9 -0
- package/esm/typings/src/errors/PromptbookFetchError.d.ts +9 -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/register/$provideEnvFilename.d.ts +12 -0
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +2 -8
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +2 -0
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizzardOrCli.d.ts +36 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -0
- 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/AnthropicClaudeExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/computeAnthropicClaudeUsage.d.ts +2 -2
- package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +1 -1
- 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/playground.d.ts +5 -0
- package/esm/typings/src/remote-server/RemoteServer.d.ts +23 -0
- package/esm/typings/src/remote-server/socket-types/_subtypes/{PromptbookServer_Identification.d.ts → Identification.d.ts} +5 -4
- package/esm/typings/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Request.d.ts +2 -2
- package/esm/typings/src/remote-server/socket-types/prepare/PromptbookServer_PreparePipeline_Request.d.ts +2 -2
- package/esm/typings/src/remote-server/socket-types/prompt/PromptbookServer_Prompt_Request.d.ts +2 -2
- package/esm/typings/src/remote-server/startRemoteServer.d.ts +2 -2
- package/esm/typings/src/remote-server/types/RemoteClientOptions.d.ts +4 -12
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +88 -6
- package/esm/typings/src/scrapers/_common/utils/{scraperFetch.d.ts → promptbookFetch.d.ts} +2 -2
- package/esm/typings/src/storage/env-storage/$EnvStorage.d.ts +37 -0
- package/esm/typings/src/types/typeAliases.d.ts +8 -2
- package/esm/typings/src/utils/organization/TODO_narrow.d.ts +6 -0
- package/package.json +2 -2
- package/umd/index.umd.js +161 -89
- package/umd/index.umd.js.map +1 -1
package/umd/index.umd.js
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* @generated
|
|
26
26
|
* @see https://github.com/webgptorg/promptbook
|
|
27
27
|
*/
|
|
28
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.
|
|
28
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-11';
|
|
29
29
|
/**
|
|
30
30
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
31
31
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -159,6 +159,7 @@
|
|
|
159
159
|
*/
|
|
160
160
|
const DEFAULT_MAX_EXECUTION_ATTEMPTS = 10; // <- TODO: [🤹♂️]
|
|
161
161
|
// <- TODO: [🕝] Make also `BOOKS_DIRNAME_ALTERNATIVES`
|
|
162
|
+
// TODO: !!!!!! Just .promptbook dir, hardocode others
|
|
162
163
|
/**
|
|
163
164
|
* Where to store the temporary downloads
|
|
164
165
|
*
|
|
@@ -210,7 +211,7 @@
|
|
|
210
211
|
true);
|
|
211
212
|
/**
|
|
212
213
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
213
|
-
* TODO: [🧠][🧜♂️] Maybe join
|
|
214
|
+
* TODO: [🧠][🧜♂️] Maybe join remoteServerUrl and path into single value
|
|
214
215
|
*/
|
|
215
216
|
|
|
216
217
|
/**
|
|
@@ -2146,6 +2147,19 @@
|
|
|
2146
2147
|
}
|
|
2147
2148
|
}
|
|
2148
2149
|
|
|
2150
|
+
/**
|
|
2151
|
+
* AuthenticationError is thrown from login function which is dependency of remote server
|
|
2152
|
+
*
|
|
2153
|
+
* @public exported from `@promptbook/core`
|
|
2154
|
+
*/
|
|
2155
|
+
class AuthenticationError extends Error {
|
|
2156
|
+
constructor(message) {
|
|
2157
|
+
super(message);
|
|
2158
|
+
this.name = 'AuthenticationError';
|
|
2159
|
+
Object.setPrototypeOf(this, AuthenticationError.prototype);
|
|
2160
|
+
}
|
|
2161
|
+
}
|
|
2162
|
+
|
|
2149
2163
|
/**
|
|
2150
2164
|
* This error indicates that the pipeline collection cannot be propperly loaded
|
|
2151
2165
|
*
|
|
@@ -2211,6 +2225,19 @@
|
|
|
2211
2225
|
}
|
|
2212
2226
|
}
|
|
2213
2227
|
|
|
2228
|
+
/**
|
|
2229
|
+
* Error thrown when a fetch request fails
|
|
2230
|
+
*
|
|
2231
|
+
* @public exported from `@promptbook/core`
|
|
2232
|
+
*/
|
|
2233
|
+
class PromptbookFetchError extends Error {
|
|
2234
|
+
constructor(message) {
|
|
2235
|
+
super(message);
|
|
2236
|
+
this.name = 'PromptbookFetchError';
|
|
2237
|
+
Object.setPrototypeOf(this, PromptbookFetchError.prototype);
|
|
2238
|
+
}
|
|
2239
|
+
}
|
|
2240
|
+
|
|
2214
2241
|
/**
|
|
2215
2242
|
* Index of all custom errors
|
|
2216
2243
|
*
|
|
@@ -2248,6 +2275,8 @@
|
|
|
2248
2275
|
TypeError,
|
|
2249
2276
|
URIError,
|
|
2250
2277
|
AggregateError,
|
|
2278
|
+
AuthenticationError,
|
|
2279
|
+
PromptbookFetchError,
|
|
2251
2280
|
/*
|
|
2252
2281
|
Note: Not widely supported
|
|
2253
2282
|
> InternalError,
|
|
@@ -2309,6 +2338,7 @@
|
|
|
2309
2338
|
const { isSuccessful, errors, warnings } = executionResult;
|
|
2310
2339
|
for (const warning of warnings) {
|
|
2311
2340
|
console.warn(warning.message);
|
|
2341
|
+
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
2312
2342
|
}
|
|
2313
2343
|
if (isSuccessful === true) {
|
|
2314
2344
|
return;
|
|
@@ -2446,6 +2476,10 @@
|
|
|
2446
2476
|
|
|
2447
2477
|
Cannot serialize error with name "${name}"
|
|
2448
2478
|
|
|
2479
|
+
Authors of Promptbook probably forgot to add this error into the list of errors:
|
|
2480
|
+
https://github.com/webgptorg/promptbook/blob/main/src/errors/0-index.ts
|
|
2481
|
+
|
|
2482
|
+
|
|
2449
2483
|
${block(stack || message)}
|
|
2450
2484
|
|
|
2451
2485
|
`));
|
|
@@ -2487,30 +2521,42 @@
|
|
|
2487
2521
|
await Promise.all(tasks);
|
|
2488
2522
|
}
|
|
2489
2523
|
|
|
2524
|
+
/**
|
|
2525
|
+
* Represents the uncertain value
|
|
2526
|
+
*
|
|
2527
|
+
* @public exported from `@promptbook/core`
|
|
2528
|
+
*/
|
|
2529
|
+
const ZERO_VALUE = $deepFreeze({ value: 0 });
|
|
2530
|
+
/**
|
|
2531
|
+
* Represents the uncertain value
|
|
2532
|
+
*
|
|
2533
|
+
* @public exported from `@promptbook/core`
|
|
2534
|
+
*/
|
|
2535
|
+
const UNCERTAIN_ZERO_VALUE = $deepFreeze({ value: 0, isUncertain: true });
|
|
2490
2536
|
/**
|
|
2491
2537
|
* Represents the usage with no resources consumed
|
|
2492
2538
|
*
|
|
2493
2539
|
* @public exported from `@promptbook/core`
|
|
2494
2540
|
*/
|
|
2495
2541
|
const ZERO_USAGE = $deepFreeze({
|
|
2496
|
-
price:
|
|
2542
|
+
price: ZERO_VALUE,
|
|
2497
2543
|
input: {
|
|
2498
|
-
tokensCount:
|
|
2499
|
-
charactersCount:
|
|
2500
|
-
wordsCount:
|
|
2501
|
-
sentencesCount:
|
|
2502
|
-
linesCount:
|
|
2503
|
-
paragraphsCount:
|
|
2504
|
-
pagesCount:
|
|
2544
|
+
tokensCount: ZERO_VALUE,
|
|
2545
|
+
charactersCount: ZERO_VALUE,
|
|
2546
|
+
wordsCount: ZERO_VALUE,
|
|
2547
|
+
sentencesCount: ZERO_VALUE,
|
|
2548
|
+
linesCount: ZERO_VALUE,
|
|
2549
|
+
paragraphsCount: ZERO_VALUE,
|
|
2550
|
+
pagesCount: ZERO_VALUE,
|
|
2505
2551
|
},
|
|
2506
2552
|
output: {
|
|
2507
|
-
tokensCount:
|
|
2508
|
-
charactersCount:
|
|
2509
|
-
wordsCount:
|
|
2510
|
-
sentencesCount:
|
|
2511
|
-
linesCount:
|
|
2512
|
-
paragraphsCount:
|
|
2513
|
-
pagesCount:
|
|
2553
|
+
tokensCount: ZERO_VALUE,
|
|
2554
|
+
charactersCount: ZERO_VALUE,
|
|
2555
|
+
wordsCount: ZERO_VALUE,
|
|
2556
|
+
sentencesCount: ZERO_VALUE,
|
|
2557
|
+
linesCount: ZERO_VALUE,
|
|
2558
|
+
paragraphsCount: ZERO_VALUE,
|
|
2559
|
+
pagesCount: ZERO_VALUE,
|
|
2514
2560
|
},
|
|
2515
2561
|
});
|
|
2516
2562
|
/**
|
|
@@ -2519,24 +2565,24 @@
|
|
|
2519
2565
|
* @public exported from `@promptbook/core`
|
|
2520
2566
|
*/
|
|
2521
2567
|
$deepFreeze({
|
|
2522
|
-
price:
|
|
2568
|
+
price: UNCERTAIN_ZERO_VALUE,
|
|
2523
2569
|
input: {
|
|
2524
|
-
tokensCount:
|
|
2525
|
-
charactersCount:
|
|
2526
|
-
wordsCount:
|
|
2527
|
-
sentencesCount:
|
|
2528
|
-
linesCount:
|
|
2529
|
-
paragraphsCount:
|
|
2530
|
-
pagesCount:
|
|
2570
|
+
tokensCount: UNCERTAIN_ZERO_VALUE,
|
|
2571
|
+
charactersCount: UNCERTAIN_ZERO_VALUE,
|
|
2572
|
+
wordsCount: UNCERTAIN_ZERO_VALUE,
|
|
2573
|
+
sentencesCount: UNCERTAIN_ZERO_VALUE,
|
|
2574
|
+
linesCount: UNCERTAIN_ZERO_VALUE,
|
|
2575
|
+
paragraphsCount: UNCERTAIN_ZERO_VALUE,
|
|
2576
|
+
pagesCount: UNCERTAIN_ZERO_VALUE,
|
|
2531
2577
|
},
|
|
2532
2578
|
output: {
|
|
2533
|
-
tokensCount:
|
|
2534
|
-
charactersCount:
|
|
2535
|
-
wordsCount:
|
|
2536
|
-
sentencesCount:
|
|
2537
|
-
linesCount:
|
|
2538
|
-
paragraphsCount:
|
|
2539
|
-
pagesCount:
|
|
2579
|
+
tokensCount: UNCERTAIN_ZERO_VALUE,
|
|
2580
|
+
charactersCount: UNCERTAIN_ZERO_VALUE,
|
|
2581
|
+
wordsCount: UNCERTAIN_ZERO_VALUE,
|
|
2582
|
+
sentencesCount: UNCERTAIN_ZERO_VALUE,
|
|
2583
|
+
linesCount: UNCERTAIN_ZERO_VALUE,
|
|
2584
|
+
paragraphsCount: UNCERTAIN_ZERO_VALUE,
|
|
2585
|
+
pagesCount: UNCERTAIN_ZERO_VALUE,
|
|
2540
2586
|
},
|
|
2541
2587
|
});
|
|
2542
2588
|
/**
|
|
@@ -2597,8 +2643,9 @@
|
|
|
2597
2643
|
* @returns LLM tools with same functionality with added total cost counting
|
|
2598
2644
|
* @public exported from `@promptbook/core`
|
|
2599
2645
|
*/
|
|
2600
|
-
function
|
|
2646
|
+
function countUsage(llmTools) {
|
|
2601
2647
|
let totalUsage = ZERO_USAGE;
|
|
2648
|
+
const spending = new rxjs.Subject();
|
|
2602
2649
|
const proxyTools = {
|
|
2603
2650
|
get title() {
|
|
2604
2651
|
// TODO: [🧠] Maybe put here some suffix
|
|
@@ -2608,12 +2655,15 @@
|
|
|
2608
2655
|
// TODO: [🧠] Maybe put here some suffix
|
|
2609
2656
|
return llmTools.description;
|
|
2610
2657
|
},
|
|
2611
|
-
|
|
2658
|
+
checkConfiguration() {
|
|
2612
2659
|
return /* not await */ llmTools.checkConfiguration();
|
|
2613
2660
|
},
|
|
2614
2661
|
listModels() {
|
|
2615
2662
|
return /* not await */ llmTools.listModels();
|
|
2616
2663
|
},
|
|
2664
|
+
spending() {
|
|
2665
|
+
return spending.asObservable();
|
|
2666
|
+
},
|
|
2617
2667
|
getTotalUsage() {
|
|
2618
2668
|
// <- Note: [🥫] Not using getter `get totalUsage` but `getTotalUsage` to allow this object to be proxied
|
|
2619
2669
|
return totalUsage;
|
|
@@ -2624,6 +2674,7 @@
|
|
|
2624
2674
|
// console.info('[🚕] callChatModel through countTotalUsage');
|
|
2625
2675
|
const promptResult = await llmTools.callChatModel(prompt);
|
|
2626
2676
|
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
2677
|
+
spending.next(promptResult.usage);
|
|
2627
2678
|
return promptResult;
|
|
2628
2679
|
};
|
|
2629
2680
|
}
|
|
@@ -2632,6 +2683,7 @@
|
|
|
2632
2683
|
// console.info('[🚕] callCompletionModel through countTotalUsage');
|
|
2633
2684
|
const promptResult = await llmTools.callCompletionModel(prompt);
|
|
2634
2685
|
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
2686
|
+
spending.next(promptResult.usage);
|
|
2635
2687
|
return promptResult;
|
|
2636
2688
|
};
|
|
2637
2689
|
}
|
|
@@ -2640,6 +2692,7 @@
|
|
|
2640
2692
|
// console.info('[🚕] callEmbeddingModel through countTotalUsage');
|
|
2641
2693
|
const promptResult = await llmTools.callEmbeddingModel(prompt);
|
|
2642
2694
|
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
2695
|
+
spending.next(promptResult.usage);
|
|
2643
2696
|
return promptResult;
|
|
2644
2697
|
};
|
|
2645
2698
|
}
|
|
@@ -2817,6 +2870,7 @@
|
|
|
2817
2870
|
`);
|
|
2818
2871
|
// TODO: [🟥] Detect browser / node and make it colorfull
|
|
2819
2872
|
console.warn(warningMessage);
|
|
2873
|
+
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
2820
2874
|
/*
|
|
2821
2875
|
return {
|
|
2822
2876
|
async listModels() {
|
|
@@ -3202,17 +3256,24 @@
|
|
|
3202
3256
|
/**
|
|
3203
3257
|
* The built-in `fetch' function with a lightweight error handling wrapper as default fetch function used in Promptbook scrapers
|
|
3204
3258
|
*
|
|
3205
|
-
* @
|
|
3259
|
+
* @public exported from `@promptbook/core`
|
|
3206
3260
|
*/
|
|
3207
|
-
const
|
|
3261
|
+
const promptbookFetch = async (urlOrRequest, init) => {
|
|
3208
3262
|
try {
|
|
3209
|
-
return await fetch(
|
|
3263
|
+
return await fetch(urlOrRequest, init);
|
|
3210
3264
|
}
|
|
3211
3265
|
catch (error) {
|
|
3212
3266
|
if (!(error instanceof Error)) {
|
|
3213
3267
|
throw error;
|
|
3214
3268
|
}
|
|
3215
|
-
|
|
3269
|
+
let url;
|
|
3270
|
+
if (typeof urlOrRequest === 'string') {
|
|
3271
|
+
url = urlOrRequest;
|
|
3272
|
+
}
|
|
3273
|
+
else if (urlOrRequest instanceof Request) {
|
|
3274
|
+
url = urlOrRequest.url;
|
|
3275
|
+
}
|
|
3276
|
+
throw new PromptbookFetchError(spaceTrim__default["default"]((block) => `
|
|
3216
3277
|
Can not fetch "${url}"
|
|
3217
3278
|
|
|
3218
3279
|
Fetch error:
|
|
@@ -3233,7 +3294,7 @@
|
|
|
3233
3294
|
async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
3234
3295
|
// console.log('!! makeKnowledgeSourceHandler', knowledgeSource);
|
|
3235
3296
|
var _a;
|
|
3236
|
-
const { fetch =
|
|
3297
|
+
const { fetch = promptbookFetch } = tools;
|
|
3237
3298
|
const { knowledgeSourceContent } = knowledgeSource;
|
|
3238
3299
|
let { name } = knowledgeSource;
|
|
3239
3300
|
const { rootDirname = null,
|
|
@@ -3374,63 +3435,73 @@
|
|
|
3374
3435
|
const { maxParallelCount = DEFAULT_MAX_PARALLEL_COUNT, rootDirname, isVerbose = DEFAULT_IS_VERBOSE } = options;
|
|
3375
3436
|
const knowledgePreparedUnflatten = new Array(knowledgeSources.length);
|
|
3376
3437
|
await forEachAsync(knowledgeSources, { maxParallelCount }, async (knowledgeSource, index) => {
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3438
|
+
try {
|
|
3439
|
+
let partialPieces = null;
|
|
3440
|
+
const sourceHandler = await makeKnowledgeSourceHandler(knowledgeSource, tools, { rootDirname, isVerbose });
|
|
3441
|
+
const scrapers = arrayableToArray(tools.scrapers);
|
|
3442
|
+
for (const scraper of scrapers) {
|
|
3443
|
+
if (!scraper.metadata.mimeTypes.includes(sourceHandler.mimeType)
|
|
3444
|
+
// <- TODO: [🦔] Implement mime-type wildcards
|
|
3445
|
+
) {
|
|
3446
|
+
continue;
|
|
3447
|
+
}
|
|
3448
|
+
const partialPiecesUnchecked = await scraper.scrape(sourceHandler);
|
|
3449
|
+
if (partialPiecesUnchecked !== null) {
|
|
3450
|
+
partialPieces = [...partialPiecesUnchecked];
|
|
3451
|
+
// <- TODO: [🪓] Here should be no need for spreading new array, just `partialPieces = partialPiecesUnchecked`
|
|
3452
|
+
break;
|
|
3453
|
+
}
|
|
3454
|
+
console.warn(spaceTrim__default["default"]((block) => `
|
|
3455
|
+
Cannot scrape knowledge from source despite the scraper \`${scraper.metadata.className}\` supports the mime type "${sourceHandler.mimeType}".
|
|
3394
3456
|
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3457
|
+
The source:
|
|
3458
|
+
${block(knowledgeSource.knowledgeSourceContent
|
|
3459
|
+
.split('\n')
|
|
3460
|
+
.map((line) => `> ${line}`)
|
|
3461
|
+
.join('\n'))}
|
|
3400
3462
|
|
|
3401
|
-
|
|
3463
|
+
${block($registeredScrapersMessage(scrapers))}
|
|
3402
3464
|
|
|
3403
3465
|
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
The source:
|
|
3411
|
-
> ${block(knowledgeSource.knowledgeSourceContent
|
|
3412
|
-
.split('\n')
|
|
3413
|
-
.map((line) => `> ${line}`)
|
|
3414
|
-
.join('\n'))}
|
|
3466
|
+
`));
|
|
3467
|
+
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
3468
|
+
}
|
|
3469
|
+
if (partialPieces === null) {
|
|
3470
|
+
throw new KnowledgeScrapeError(spaceTrim__default["default"]((block) => `
|
|
3471
|
+
Cannot scrape knowledge
|
|
3415
3472
|
|
|
3416
|
-
|
|
3473
|
+
The source:
|
|
3474
|
+
> ${block(knowledgeSource.knowledgeSourceContent
|
|
3475
|
+
.split('\n')
|
|
3476
|
+
.map((line) => `> ${line}`)
|
|
3477
|
+
.join('\n'))}
|
|
3417
3478
|
|
|
3418
|
-
|
|
3479
|
+
No scraper found for the mime type "${sourceHandler.mimeType}"
|
|
3419
3480
|
|
|
3481
|
+
${block($registeredScrapersMessage(scrapers))}
|
|
3420
3482
|
|
|
3421
|
-
|
|
3483
|
+
|
|
3484
|
+
`));
|
|
3485
|
+
}
|
|
3486
|
+
const pieces = partialPieces.map((partialPiece) => ({
|
|
3487
|
+
...partialPiece,
|
|
3488
|
+
sources: [
|
|
3489
|
+
{
|
|
3490
|
+
name: knowledgeSource.name,
|
|
3491
|
+
// line, column <- TODO: [☀]
|
|
3492
|
+
// <- TODO: [❎]
|
|
3493
|
+
},
|
|
3494
|
+
],
|
|
3495
|
+
}));
|
|
3496
|
+
knowledgePreparedUnflatten[index] = pieces;
|
|
3497
|
+
}
|
|
3498
|
+
catch (error) {
|
|
3499
|
+
if (!(error instanceof Error)) {
|
|
3500
|
+
throw error;
|
|
3501
|
+
}
|
|
3502
|
+
console.warn(error);
|
|
3503
|
+
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
3422
3504
|
}
|
|
3423
|
-
const pieces = partialPieces.map((partialPiece) => ({
|
|
3424
|
-
...partialPiece,
|
|
3425
|
-
sources: [
|
|
3426
|
-
{
|
|
3427
|
-
name: knowledgeSource.name,
|
|
3428
|
-
// line, column <- TODO: [☀]
|
|
3429
|
-
// <- TODO: [❎]
|
|
3430
|
-
},
|
|
3431
|
-
],
|
|
3432
|
-
}));
|
|
3433
|
-
knowledgePreparedUnflatten[index] = pieces;
|
|
3434
3505
|
});
|
|
3435
3506
|
const knowledgePrepared = knowledgePreparedUnflatten.flat();
|
|
3436
3507
|
return knowledgePrepared;
|
|
@@ -3536,7 +3607,7 @@
|
|
|
3536
3607
|
// TODO: [🚐] Make arrayable LLMs -> single LLM DRY
|
|
3537
3608
|
const _llms = arrayableToArray(tools.llm);
|
|
3538
3609
|
const llmTools = _llms.length === 1 ? _llms[0] : joinLlmExecutionTools(..._llms);
|
|
3539
|
-
const llmToolsWithUsage =
|
|
3610
|
+
const llmToolsWithUsage = countUsage(llmTools);
|
|
3540
3611
|
// <- TODO: [🌯]
|
|
3541
3612
|
/*
|
|
3542
3613
|
TODO: [🧠][🪑][🔃] Should this be done or not
|
|
@@ -3848,7 +3919,7 @@
|
|
|
3848
3919
|
if (parameterNames.has(subparameterName)) {
|
|
3849
3920
|
parameterNames.delete(subparameterName);
|
|
3850
3921
|
parameterNames.add(foreach.parameterName);
|
|
3851
|
-
// <- TODO: [
|
|
3922
|
+
// <- TODO: [🏮] Warn/logic error when `subparameterName` not used
|
|
3852
3923
|
}
|
|
3853
3924
|
}
|
|
3854
3925
|
}
|
|
@@ -5444,6 +5515,7 @@
|
|
|
5444
5515
|
|
|
5445
5516
|
@see more at https://ptbk.io/prepare-pipeline
|
|
5446
5517
|
`));
|
|
5518
|
+
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
5447
5519
|
}
|
|
5448
5520
|
let runCount = 0;
|
|
5449
5521
|
const pipelineExecutorWithCallback = async (inputParameters, onProgress) => {
|