@promptbook/cli 0.71.0-18 → 0.71.0-20
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 +0 -6
- package/esm/index.es.js +121 -122
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +22 -18
- package/esm/typings/src/_packages/types.index.d.ts +2 -2
- package/esm/typings/src/collection/PipelineCollection.d.ts +1 -1
- package/esm/typings/src/collection/SimplePipelineCollection.d.ts +2 -2
- package/esm/typings/src/collection/collectionToJson.d.ts +1 -1
- package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +1 -1
- package/esm/typings/src/collection/constructors/createCollectionFromPromise.d.ts +1 -1
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +5 -5
- package/esm/typings/src/config.d.ts +21 -14
- package/esm/typings/src/execution/EmbeddingVector.d.ts +1 -1
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/execution/PipelineExecutorResult.d.ts +2 -2
- package/esm/typings/src/execution/assertsExecutionSuccessful.d.ts +1 -0
- package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorOptions.d.ts +29 -6
- package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +2 -11
- package/esm/typings/src/execution/createPipelineExecutor/20-executeTemplate.d.ts +4 -13
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +9 -14
- package/esm/typings/src/execution/utils/addUsage.d.ts +1 -1
- package/esm/typings/src/execution/utils/forEachAsync.d.ts +1 -1
- package/esm/typings/src/formats/_common/FormatDefinition.d.ts +2 -2
- package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +2 -2
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForCli.d.ts +2 -2
- package/esm/typings/src/llm-providers/_common/register/LlmToolsConfiguration.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +4 -1
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +1 -1
- package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/multiple/joinLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_ListModels_Response.d.ts +1 -1
- package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +4 -4
- package/esm/typings/src/prepare/prepareTemplates.d.ts +1 -1
- package/esm/typings/src/scrapers/_common/Scraper.d.ts +1 -5
- package/esm/typings/src/scrapers/_common/prepareKnowledgePieces.d.ts +1 -1
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForBrowser.d.ts +1 -1
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForNode.d.ts +1 -1
- package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +2 -2
- package/esm/typings/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +2 -2
- package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +1 -1
- package/esm/typings/src/scrapers/document/DocumentScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/document/register-metadata.d.ts +1 -1
- package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +1 -1
- package/esm/typings/src/scrapers/markdown/MarkdownScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +1 -1
- package/esm/typings/src/scrapers/pdf/PdfScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +1 -1
- package/esm/typings/src/scrapers/website/WebsiteScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/website/register-metadata.d.ts +1 -1
- package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +1 -1
- package/esm/typings/src/storage/file-cache-storage/utils/nameToSubfolderPath.d.ts +1 -1
- package/esm/typings/src/types/Arrayable.d.ts +1 -1
- package/esm/typings/src/types/IntermediateFilesStrategy.d.ts +7 -0
- package/esm/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +4 -4
- package/esm/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/PersonaJson.d.ts +1 -1
- package/esm/typings/src/types/Prompt.d.ts +1 -1
- package/esm/typings/src/types/execution-report/ExecutionReportJson.d.ts +1 -1
- package/esm/typings/src/utils/$Register.d.ts +1 -1
- package/esm/typings/src/utils/FromtoItems.d.ts +1 -1
- package/esm/typings/src/utils/arrayableToArray.d.ts +1 -1
- package/esm/typings/src/utils/emojis.d.ts +1 -1
- package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +1 -1
- package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +1 -1
- package/esm/typings/src/utils/markdown/splitMarkdownIntoSections.d.ts +1 -1
- package/esm/typings/src/utils/organization/TODO_USE.d.ts +1 -1
- package/esm/typings/src/utils/organization/keepUnused.d.ts +1 -1
- package/esm/typings/src/utils/random/$randomSeed.d.ts +1 -1
- package/esm/typings/src/utils/sets/intersection.d.ts +1 -1
- package/esm/typings/src/utils/sets/union.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +121 -122
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorSettings.d.ts +0 -29
package/esm/index.es.js
CHANGED
|
@@ -26,7 +26,7 @@ import { Converter } from 'showdown';
|
|
|
26
26
|
/**
|
|
27
27
|
* The version of the Promptbook library
|
|
28
28
|
*/
|
|
29
|
-
var PROMPTBOOK_VERSION = '0.71.0-
|
|
29
|
+
var PROMPTBOOK_VERSION = '0.71.0-19';
|
|
30
30
|
// TODO: [main] !!!! List here all the versions and annotate + put into script
|
|
31
31
|
|
|
32
32
|
/*! *****************************************************************************
|
|
@@ -399,7 +399,8 @@ var GENERATOR_WARNING = "\u26A0\uFE0F WARNING: This code has been generated so t
|
|
|
399
399
|
*
|
|
400
400
|
* @public exported from `@promptbook/core`
|
|
401
401
|
*/
|
|
402
|
-
var CLAIM = "
|
|
402
|
+
var CLAIM = "Build responsible, controlled and transparent applications on top of LLM models!";
|
|
403
|
+
// <- TODO: [🐊] Pick the best claim
|
|
403
404
|
/**
|
|
404
405
|
* Warning message for the generated sections and files files
|
|
405
406
|
*
|
|
@@ -432,23 +433,30 @@ var CONNECTION_RETRIES_LIMIT = 5;
|
|
|
432
433
|
*/
|
|
433
434
|
var IMMEDIATE_TIME = 10;
|
|
434
435
|
/**
|
|
435
|
-
* The maximum
|
|
436
|
+
* The maximum length of the (generated) filename
|
|
436
437
|
*
|
|
437
438
|
* @public exported from `@promptbook/core`
|
|
438
439
|
*/
|
|
439
|
-
var
|
|
440
|
+
var MAX_FILENAME_LENGTH = 30;
|
|
440
441
|
/**
|
|
441
|
-
*
|
|
442
|
+
* Strategy for caching the intermediate results for knowledge sources
|
|
442
443
|
*
|
|
443
444
|
* @public exported from `@promptbook/core`
|
|
444
445
|
*/
|
|
445
|
-
var
|
|
446
|
+
var DEFAULT_INTERMEDIATE_FILES_STRATEGY = 'HIDE_AND_KEEP';
|
|
447
|
+
// <- TODO: [😡] Change to 'VISIBLE'
|
|
446
448
|
/**
|
|
447
|
-
* The maximum
|
|
449
|
+
* The maximum number of (LLM) tasks running in parallel
|
|
448
450
|
*
|
|
449
451
|
* @public exported from `@promptbook/core`
|
|
450
452
|
*/
|
|
451
|
-
var
|
|
453
|
+
var DEFAULT_MAX_PARALLEL_COUNT = 5; // <- TODO: [🤹♂️]
|
|
454
|
+
/**
|
|
455
|
+
* The maximum number of attempts to execute LLM task before giving up
|
|
456
|
+
*
|
|
457
|
+
* @public exported from `@promptbook/core`
|
|
458
|
+
*/
|
|
459
|
+
var DEFAULT_MAX_EXECUTION_ATTEMPTS = 3; // <- TODO: [🤹♂️]
|
|
452
460
|
/**
|
|
453
461
|
* Where to store the cache of executions for promptbook CLI
|
|
454
462
|
*
|
|
@@ -456,7 +464,7 @@ var MAX_FILENAME_LENGTH = 30;
|
|
|
456
464
|
*
|
|
457
465
|
* @public exported from `@promptbook/core`
|
|
458
466
|
*/
|
|
459
|
-
var
|
|
467
|
+
var DEFAULT_EXECUTIONS_CACHE_DIRNAME = '/.promptbook/executions-cache';
|
|
460
468
|
/**
|
|
461
469
|
* Where to store the scrape cache
|
|
462
470
|
*
|
|
@@ -464,13 +472,13 @@ var EXECUTIONS_CACHE_DIRNAME = '/.promptbook/executions-cache';
|
|
|
464
472
|
*
|
|
465
473
|
* @public exported from `@promptbook/core`
|
|
466
474
|
*/
|
|
467
|
-
var
|
|
475
|
+
var DEFAULT_SCRAPE_CACHE_DIRNAME = '/.promptbook/scrape-cache';
|
|
468
476
|
/**
|
|
469
477
|
* The name of the builded pipeline collection made by CLI `ptbk make` and for lookup in `createCollectionFromDirectory`
|
|
470
478
|
*
|
|
471
479
|
* @public exported from `@promptbook/core`
|
|
472
480
|
*/
|
|
473
|
-
var
|
|
481
|
+
var DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME = "index";
|
|
474
482
|
/**
|
|
475
483
|
* Nonce which is used for replacing things in strings
|
|
476
484
|
*
|
|
@@ -534,13 +542,13 @@ var DEFAULT_CSV_SETTINGS = Object.freeze({
|
|
|
534
542
|
*
|
|
535
543
|
* @public exported from `@promptbook/core`
|
|
536
544
|
*/
|
|
537
|
-
var
|
|
545
|
+
var DEFAULT_IS_VERBOSE = false;
|
|
538
546
|
/**
|
|
539
547
|
* @@@
|
|
540
548
|
*
|
|
541
549
|
* @public exported from `@promptbook/core`
|
|
542
550
|
*/
|
|
543
|
-
var
|
|
551
|
+
var DEFAULT_IS_AUTO_INSTALLED = false;
|
|
544
552
|
/**
|
|
545
553
|
* @@@
|
|
546
554
|
*
|
|
@@ -698,7 +706,6 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
698
706
|
pipelineString += '\n\n';
|
|
699
707
|
pipelineString += description;
|
|
700
708
|
}
|
|
701
|
-
// TODO:> const commands: Array<Command>
|
|
702
709
|
var commands = [];
|
|
703
710
|
if (pipelineUrl) {
|
|
704
711
|
commands.push("PIPELINE URL ".concat(pipelineUrl));
|
|
@@ -754,7 +761,6 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
754
761
|
pipelineString += '\n\n';
|
|
755
762
|
pipelineString += description_1;
|
|
756
763
|
}
|
|
757
|
-
// TODO:> const commands: Array<Command>
|
|
758
764
|
var commands_1 = [];
|
|
759
765
|
var contentLanguage = 'text';
|
|
760
766
|
if (templateType === 'PROMPT_TEMPLATE') {
|
|
@@ -2262,6 +2268,7 @@ function assertsExecutionSuccessful(executionResult) {
|
|
|
2262
2268
|
}
|
|
2263
2269
|
}
|
|
2264
2270
|
/**
|
|
2271
|
+
* TODO: [🐚] This function should be removed OR changed OR be completely rewritten
|
|
2265
2272
|
* TODO: [🧠] Can this return type be better typed than void
|
|
2266
2273
|
*/
|
|
2267
2274
|
|
|
@@ -3568,12 +3575,11 @@ function checkExpectations(expectations, value) {
|
|
|
3568
3575
|
*/
|
|
3569
3576
|
function executeAttempts(options) {
|
|
3570
3577
|
return __awaiter(this, void 0, void 0, function () {
|
|
3571
|
-
var jokerParameterNames, priority, maxAttempts, preparedContent, parameters, template, preparedPipeline, tools,
|
|
3578
|
+
var jokerParameterNames, priority, maxAttempts, preparedContent, parameters, template, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, $ongoingTemplateResult, _llms, llmTools, _loop_1, attempt, state_1;
|
|
3572
3579
|
return __generator(this, function (_a) {
|
|
3573
3580
|
switch (_a.label) {
|
|
3574
3581
|
case 0:
|
|
3575
|
-
jokerParameterNames = options.jokerParameterNames, priority = options.priority, maxAttempts = options.maxAttempts, preparedContent = options.preparedContent, parameters = options.parameters, template = options.template, preparedPipeline = options.preparedPipeline, tools = options.tools,
|
|
3576
|
-
maxExecutionAttempts = settings.maxExecutionAttempts;
|
|
3582
|
+
jokerParameterNames = options.jokerParameterNames, priority = options.priority, maxAttempts = options.maxAttempts, preparedContent = options.preparedContent, parameters = options.parameters, template = options.template, preparedPipeline = options.preparedPipeline, tools = options.tools, $executionReport = options.$executionReport, pipelineIdentification = options.pipelineIdentification, maxExecutionAttempts = options.maxExecutionAttempts;
|
|
3577
3583
|
$ongoingTemplateResult = {
|
|
3578
3584
|
$result: null,
|
|
3579
3585
|
$resultString: null,
|
|
@@ -3939,12 +3945,12 @@ function executeAttempts(options) {
|
|
|
3939
3945
|
*/
|
|
3940
3946
|
function executeFormatSubvalues(options) {
|
|
3941
3947
|
return __awaiter(this, void 0, void 0, function () {
|
|
3942
|
-
var template, jokerParameterNames, parameters, priority,
|
|
3948
|
+
var template, jokerParameterNames, parameters, priority, csvSettings, pipelineIdentification, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
|
|
3943
3949
|
var _this = this;
|
|
3944
3950
|
return __generator(this, function (_a) {
|
|
3945
3951
|
switch (_a.label) {
|
|
3946
3952
|
case 0:
|
|
3947
|
-
template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority,
|
|
3953
|
+
template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, csvSettings = options.csvSettings, pipelineIdentification = options.pipelineIdentification;
|
|
3948
3954
|
if (template.foreach === undefined) {
|
|
3949
3955
|
return [2 /*return*/, /* not await */ executeAttempts(options)];
|
|
3950
3956
|
}
|
|
@@ -3974,7 +3980,7 @@ function executeFormatSubvalues(options) {
|
|
|
3974
3980
|
.join('\n')), "\n\n [\u26F7] This should never happen because subformat name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
3975
3981
|
}
|
|
3976
3982
|
if (formatDefinition.formatName === 'CSV') {
|
|
3977
|
-
formatSettings =
|
|
3983
|
+
formatSettings = csvSettings;
|
|
3978
3984
|
// <- TODO: [🤹♂️] More universal, make simmilar pattern for other formats for example \n vs \r\n in text
|
|
3979
3985
|
}
|
|
3980
3986
|
return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, template.foreach.outputSubparameterName, formatSettings, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -4127,13 +4133,12 @@ function getReservedParametersForTemplate(options) {
|
|
|
4127
4133
|
*/
|
|
4128
4134
|
function executeTemplate(options) {
|
|
4129
4135
|
return __awaiter(this, void 0, void 0, function () {
|
|
4130
|
-
var currentTemplate, preparedPipeline, parametersToPass, tools, onProgress,
|
|
4131
|
-
var e_1,
|
|
4132
|
-
return __generator(this, function (
|
|
4133
|
-
switch (
|
|
4136
|
+
var currentTemplate, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, _a, maxExecutionAttempts, name, title, priority, usedParameterNames, dependentParameterNames, definedParameters, _b, _c, _d, definedParameterNames, parameters, _loop_1, _e, _f, parameterName, maxAttempts, jokerParameterNames, preparedContent, resultString;
|
|
4137
|
+
var e_1, _g, _h;
|
|
4138
|
+
return __generator(this, function (_j) {
|
|
4139
|
+
switch (_j.label) {
|
|
4134
4140
|
case 0:
|
|
4135
|
-
currentTemplate = options.currentTemplate, preparedPipeline = options.preparedPipeline, parametersToPass = options.parametersToPass, tools = options.tools, onProgress = options.onProgress,
|
|
4136
|
-
maxExecutionAttempts = settings.maxExecutionAttempts;
|
|
4141
|
+
currentTemplate = options.currentTemplate, preparedPipeline = options.preparedPipeline, parametersToPass = options.parametersToPass, tools = options.tools, onProgress = options.onProgress, $executionReport = options.$executionReport, pipelineIdentification = options.pipelineIdentification, _a = options.maxExecutionAttempts, maxExecutionAttempts = _a === void 0 ? DEFAULT_MAX_EXECUTION_ATTEMPTS : _a;
|
|
4137
4142
|
name = "pipeline-executor-frame-".concat(currentTemplate.name);
|
|
4138
4143
|
title = currentTemplate.title;
|
|
4139
4144
|
priority = preparedPipeline.templates.length - preparedPipeline.templates.indexOf(currentTemplate);
|
|
@@ -4148,7 +4153,7 @@ function executeTemplate(options) {
|
|
|
4148
4153
|
// <- [🍸]
|
|
4149
4154
|
})];
|
|
4150
4155
|
case 1:
|
|
4151
|
-
|
|
4156
|
+
_j.sent();
|
|
4152
4157
|
usedParameterNames = extractParameterNamesFromTemplate(currentTemplate);
|
|
4153
4158
|
dependentParameterNames = new Set(currentTemplate.dependentParameterNames);
|
|
4154
4159
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
@@ -4159,15 +4164,15 @@ function executeTemplate(options) {
|
|
|
4159
4164
|
.map(function (name) { return "{".concat(name, "}"); })
|
|
4160
4165
|
.join(', '), "\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
4161
4166
|
}
|
|
4162
|
-
|
|
4163
|
-
|
|
4167
|
+
_c = (_b = Object).freeze;
|
|
4168
|
+
_d = [{}];
|
|
4164
4169
|
return [4 /*yield*/, getReservedParametersForTemplate({
|
|
4165
4170
|
preparedPipeline: preparedPipeline,
|
|
4166
4171
|
template: currentTemplate,
|
|
4167
4172
|
pipelineIdentification: pipelineIdentification,
|
|
4168
4173
|
})];
|
|
4169
4174
|
case 2:
|
|
4170
|
-
definedParameters =
|
|
4175
|
+
definedParameters = _c.apply(_b, [__assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_j.sent())])), parametersToPass])]);
|
|
4171
4176
|
definedParameterNames = new Set(Object.keys(definedParameters));
|
|
4172
4177
|
parameters = {};
|
|
4173
4178
|
_loop_1 = function (parameterName) {
|
|
@@ -4187,15 +4192,15 @@ function executeTemplate(options) {
|
|
|
4187
4192
|
try {
|
|
4188
4193
|
// Note: [2] Check that all used parameters are defined and removing unused parameters for this template
|
|
4189
4194
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
4190
|
-
for (
|
|
4191
|
-
parameterName =
|
|
4195
|
+
for (_e = __values(Array.from(union(definedParameterNames, usedParameterNames, dependentParameterNames))), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
4196
|
+
parameterName = _f.value;
|
|
4192
4197
|
_loop_1(parameterName);
|
|
4193
4198
|
}
|
|
4194
4199
|
}
|
|
4195
4200
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
4196
4201
|
finally {
|
|
4197
4202
|
try {
|
|
4198
|
-
if (
|
|
4203
|
+
if (_f && !_f.done && (_g = _e.return)) _g.call(_e);
|
|
4199
4204
|
}
|
|
4200
4205
|
finally { if (e_1) throw e_1.error; }
|
|
4201
4206
|
}
|
|
@@ -4215,12 +4220,11 @@ function executeTemplate(options) {
|
|
|
4215
4220
|
template: currentTemplate,
|
|
4216
4221
|
preparedPipeline: preparedPipeline,
|
|
4217
4222
|
tools: tools,
|
|
4218
|
-
settings: settings,
|
|
4219
4223
|
$executionReport: $executionReport,
|
|
4220
4224
|
pipelineIdentification: pipelineIdentification,
|
|
4221
4225
|
})];
|
|
4222
4226
|
case 3:
|
|
4223
|
-
resultString =
|
|
4227
|
+
resultString = _j.sent();
|
|
4224
4228
|
return [4 /*yield*/, onProgress({
|
|
4225
4229
|
name: name,
|
|
4226
4230
|
title: title,
|
|
@@ -4232,12 +4236,12 @@ function executeTemplate(options) {
|
|
|
4232
4236
|
// <- [🍸]
|
|
4233
4237
|
})];
|
|
4234
4238
|
case 4:
|
|
4235
|
-
|
|
4236
|
-
return [2 /*return*/, Object.freeze((
|
|
4237
|
-
|
|
4239
|
+
_j.sent();
|
|
4240
|
+
return [2 /*return*/, Object.freeze((_h = {},
|
|
4241
|
+
_h[currentTemplate.resultingParameterName] =
|
|
4238
4242
|
// <- Note: [👩👩👧] No need to detect parameter collision here because pipeline checks logic consistency during construction
|
|
4239
4243
|
resultString,
|
|
4240
|
-
|
|
4244
|
+
_h))];
|
|
4241
4245
|
}
|
|
4242
4246
|
});
|
|
4243
4247
|
});
|
|
@@ -4296,13 +4300,12 @@ function filterJustOutputParameters(options) {
|
|
|
4296
4300
|
*/
|
|
4297
4301
|
function executePipeline(options) {
|
|
4298
4302
|
return __awaiter(this, void 0, void 0, function () {
|
|
4299
|
-
var inputParameters, tools, onProgress, pipeline, setPreparedPipeline, pipelineIdentification,
|
|
4303
|
+
var inputParameters, tools, onProgress, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, _a, isVerbose, preparedPipeline, errors, warnings, executionReport, isReturned, _b, _c, parameter, e_1_1, _loop_1, _d, _e, parameterName, state_1, e_2_1, parametersToPass, resovedParameterNames_1, unresovedTemplates_1, resolving_1, loopLimit, _loop_2, error_1, usage_1, outputParameters_1, usage, outputParameters;
|
|
4300
4304
|
var e_1, _f, e_2, _g;
|
|
4301
4305
|
return __generator(this, function (_h) {
|
|
4302
4306
|
switch (_h.label) {
|
|
4303
4307
|
case 0:
|
|
4304
|
-
inputParameters = options.inputParameters, tools = options.tools, onProgress = options.onProgress, pipeline = options.pipeline, setPreparedPipeline = options.setPreparedPipeline, pipelineIdentification = options.pipelineIdentification,
|
|
4305
|
-
maxParallelCount = settings.maxParallelCount, rootDirname = settings.rootDirname, _a = settings.isVerbose, isVerbose = _a === void 0 ? IS_VERBOSE : _a;
|
|
4308
|
+
inputParameters = options.inputParameters, tools = options.tools, onProgress = options.onProgress, pipeline = options.pipeline, setPreparedPipeline = options.setPreparedPipeline, pipelineIdentification = options.pipelineIdentification, maxParallelCount = options.maxParallelCount, rootDirname = options.rootDirname, _a = options.isVerbose, isVerbose = _a === void 0 ? DEFAULT_IS_VERBOSE : _a;
|
|
4306
4309
|
preparedPipeline = options.preparedPipeline;
|
|
4307
4310
|
if (!(preparedPipeline === undefined)) return [3 /*break*/, 2];
|
|
4308
4311
|
return [4 /*yield*/, preparePipeline(pipeline, tools, {
|
|
@@ -4487,12 +4490,7 @@ function executePipeline(options) {
|
|
|
4487
4490
|
return [3 /*break*/, 4];
|
|
4488
4491
|
case 3:
|
|
4489
4492
|
unresovedTemplates_1 = unresovedTemplates_1.filter(function (template) { return template !== currentTemplate; });
|
|
4490
|
-
work_1 = executeTemplate({
|
|
4491
|
-
currentTemplate: currentTemplate,
|
|
4492
|
-
preparedPipeline: preparedPipeline,
|
|
4493
|
-
parametersToPass: parametersToPass,
|
|
4494
|
-
tools: tools,
|
|
4495
|
-
onProgress: function (progress) {
|
|
4493
|
+
work_1 = executeTemplate(__assign(__assign({}, options), { currentTemplate: currentTemplate, preparedPipeline: preparedPipeline, parametersToPass: parametersToPass, tools: tools, onProgress: function (progress) {
|
|
4496
4494
|
if (isReturned) {
|
|
4497
4495
|
throw new UnexpectedError(spaceTrim(function (block) { return "\n Can not call `onProgress` after pipeline execution is finished\n\n ".concat(block(pipelineIdentification), "\n\n ").concat(block(JSON.stringify(progress, null, 4)
|
|
4498
4496
|
.split('\n')
|
|
@@ -4502,11 +4500,7 @@ function executePipeline(options) {
|
|
|
4502
4500
|
if (onProgress) {
|
|
4503
4501
|
onProgress(progress);
|
|
4504
4502
|
}
|
|
4505
|
-
},
|
|
4506
|
-
settings: settings,
|
|
4507
|
-
$executionReport: executionReport,
|
|
4508
|
-
pipelineIdentification: spaceTrim(function (block) { return "\n ".concat(block(pipelineIdentification), "\n Template name: ").concat(currentTemplate.name, "\n Template title: ").concat(currentTemplate.title, "\n "); }),
|
|
4509
|
-
})
|
|
4503
|
+
}, $executionReport: executionReport, pipelineIdentification: spaceTrim(function (block) { return "\n ".concat(block(pipelineIdentification), "\n Template name: ").concat(currentTemplate.name, "\n Template title: ").concat(currentTemplate.title, "\n "); }) }))
|
|
4510
4504
|
.then(function (newParametersToPass) {
|
|
4511
4505
|
parametersToPass = __assign(__assign({}, newParametersToPass), parametersToPass);
|
|
4512
4506
|
resovedParameterNames_1 = __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), [currentTemplate.resultingParameterName], false);
|
|
@@ -4610,8 +4604,7 @@ function executePipeline(options) {
|
|
|
4610
4604
|
*/
|
|
4611
4605
|
function createPipelineExecutor(options) {
|
|
4612
4606
|
var _this = this;
|
|
4613
|
-
var pipeline = options.pipeline, tools = options.tools, _a = options.
|
|
4614
|
-
var _b = settings.maxExecutionAttempts, maxExecutionAttempts = _b === void 0 ? MAX_EXECUTION_ATTEMPTS : _b, _c = settings.maxParallelCount, maxParallelCount = _c === void 0 ? MAX_PARALLEL_COUNT : _c, _d = settings.csvSettings, csvSettings = _d === void 0 ? DEFAULT_CSV_SETTINGS : _d, _e = settings.isVerbose, isVerbose = _e === void 0 ? IS_VERBOSE : _e, _f = settings.isNotPreparedWarningSupressed, isNotPreparedWarningSupressed = _f === void 0 ? false : _f, _g = settings.rootDirname, rootDirname = _g === void 0 ? null : _g;
|
|
4607
|
+
var pipeline = options.pipeline, tools = options.tools, _a = options.maxExecutionAttempts, maxExecutionAttempts = _a === void 0 ? DEFAULT_MAX_EXECUTION_ATTEMPTS : _a, _b = options.maxParallelCount, maxParallelCount = _b === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _b, _c = options.csvSettings, csvSettings = _c === void 0 ? DEFAULT_CSV_SETTINGS : _c, _d = options.isVerbose, isVerbose = _d === void 0 ? DEFAULT_IS_VERBOSE : _d, _e = options.isNotPreparedWarningSupressed, isNotPreparedWarningSupressed = _e === void 0 ? false : _e, _f = options.rootDirname, rootDirname = _f === void 0 ? null : _f;
|
|
4615
4608
|
validatePipeline(pipeline);
|
|
4616
4609
|
var pipelineIdentification = (function () {
|
|
4617
4610
|
// Note: This is a 😐 implementation of [🚞]
|
|
@@ -4645,14 +4638,12 @@ function createPipelineExecutor(options) {
|
|
|
4645
4638
|
tools: tools,
|
|
4646
4639
|
onProgress: onProgress,
|
|
4647
4640
|
pipelineIdentification: spaceTrim(function (block) { return "\n ".concat(block(pipelineIdentification), "\n ").concat(runCount === 1 ? '' : "Run #".concat(runCount), "\n "); }),
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
rootDirname: rootDirname,
|
|
4655
|
-
},
|
|
4641
|
+
maxExecutionAttempts: maxExecutionAttempts,
|
|
4642
|
+
maxParallelCount: maxParallelCount,
|
|
4643
|
+
csvSettings: csvSettings,
|
|
4644
|
+
isVerbose: isVerbose,
|
|
4645
|
+
isNotPreparedWarningSupressed: isNotPreparedWarningSupressed,
|
|
4646
|
+
rootDirname: rootDirname,
|
|
4656
4647
|
})];
|
|
4657
4648
|
});
|
|
4658
4649
|
}); };
|
|
@@ -4675,7 +4666,7 @@ function preparePersona(personaDescription, tools, options) {
|
|
|
4675
4666
|
return __generator(this, function (_d) {
|
|
4676
4667
|
switch (_d.label) {
|
|
4677
4668
|
case 0:
|
|
4678
|
-
_a = options.isVerbose, isVerbose = _a === void 0 ?
|
|
4669
|
+
_a = options.isVerbose, isVerbose = _a === void 0 ? DEFAULT_IS_VERBOSE : _a;
|
|
4679
4670
|
if (tools === undefined || tools.llm === undefined) {
|
|
4680
4671
|
throw new MissingToolsError('LLM tools are required for preparing persona');
|
|
4681
4672
|
}
|
|
@@ -4857,7 +4848,7 @@ var $Register = /** @class */ (function () {
|
|
|
4857
4848
|
this.storage = globalScope[storageName];
|
|
4858
4849
|
}
|
|
4859
4850
|
$Register.prototype.list = function () {
|
|
4860
|
-
// <- TODO: ReadonlyDeep<
|
|
4851
|
+
// <- TODO: ReadonlyDeep<ReadonlyArray<TRegistered>>
|
|
4861
4852
|
return this.storage;
|
|
4862
4853
|
};
|
|
4863
4854
|
$Register.prototype.register = function (registered) {
|
|
@@ -5175,7 +5166,7 @@ function isValidFilePath(filename) {
|
|
|
5175
5166
|
/**
|
|
5176
5167
|
* @@@
|
|
5177
5168
|
*
|
|
5178
|
-
* @
|
|
5169
|
+
* @public exported from `@promptbook/core`
|
|
5179
5170
|
*/
|
|
5180
5171
|
function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
5181
5172
|
var _a;
|
|
@@ -5188,7 +5179,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5188
5179
|
case 0:
|
|
5189
5180
|
sourceContent = knowledgeSource.sourceContent;
|
|
5190
5181
|
name = knowledgeSource.name;
|
|
5191
|
-
_b = options || {}, _c = _b.rootDirname, rootDirname = _c === void 0 ? null : _c, _d = _b.isVerbose, isVerbose = _d === void 0 ?
|
|
5182
|
+
_b = options || {}, _c = _b.rootDirname, rootDirname = _c === void 0 ? null : _c, _d = _b.isVerbose, isVerbose = _d === void 0 ? DEFAULT_IS_VERBOSE : _d;
|
|
5192
5183
|
TODO_USE(isVerbose);
|
|
5193
5184
|
if (!name) {
|
|
5194
5185
|
name = sourceContentToName(sourceContent);
|
|
@@ -5341,7 +5332,7 @@ function prepareKnowledgePieces(knowledgeSources, tools, options) {
|
|
|
5341
5332
|
return __generator(this, function (_c) {
|
|
5342
5333
|
switch (_c.label) {
|
|
5343
5334
|
case 0:
|
|
5344
|
-
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ?
|
|
5335
|
+
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a, rootDirname = options.rootDirname, _b = options.isVerbose, isVerbose = _b === void 0 ? DEFAULT_IS_VERBOSE : _b;
|
|
5345
5336
|
knowledgePreparedUnflatten = new Array(knowledgeSources.length);
|
|
5346
5337
|
return [4 /*yield*/, forEachAsync(knowledgeSources, { maxParallelCount: maxParallelCount }, function (knowledgeSource, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
5347
5338
|
var partialPieces, sourceHandler, _a, _b, scraper, partialPiecesUnchecked, e_1_1, pieces;
|
|
@@ -5370,7 +5361,8 @@ function prepareKnowledgePieces(knowledgeSources, tools, options) {
|
|
|
5370
5361
|
case 4:
|
|
5371
5362
|
partialPiecesUnchecked = _d.sent();
|
|
5372
5363
|
if (partialPiecesUnchecked !== null) {
|
|
5373
|
-
partialPieces = partialPiecesUnchecked;
|
|
5364
|
+
partialPieces = __spreadArray([], __read(partialPiecesUnchecked), false);
|
|
5365
|
+
// <- TODO: [🪓] Here should be no need for spreading new array, just `partialPieces = partialPiecesUnchecked`
|
|
5374
5366
|
return [3 /*break*/, 6];
|
|
5375
5367
|
}
|
|
5376
5368
|
_d.label = 5;
|
|
@@ -5418,7 +5410,7 @@ TODO: [🧊] This is how it can look in future
|
|
|
5418
5410
|
> /**
|
|
5419
5411
|
> * Unprepared knowledge
|
|
5420
5412
|
> * /
|
|
5421
|
-
> readonly knowledgeSources:
|
|
5413
|
+
> readonly knowledgeSources: ReadonlyArray<KnowledgeSourceJson>;
|
|
5422
5414
|
> };
|
|
5423
5415
|
>
|
|
5424
5416
|
> export async function prepareKnowledgePieces(
|
|
@@ -5476,7 +5468,7 @@ function prepareTemplates(pipeline, tools, options) {
|
|
|
5476
5468
|
return __generator(this, function (_b) {
|
|
5477
5469
|
switch (_b.label) {
|
|
5478
5470
|
case 0:
|
|
5479
|
-
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ?
|
|
5471
|
+
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a;
|
|
5480
5472
|
templates = pipeline.templates, parameters = pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
|
|
5481
5473
|
// TODO: [main] !!!!! Apply samples to each template (if missing and is for the template defined)
|
|
5482
5474
|
TODO_USE(parameters);
|
|
@@ -5538,7 +5530,7 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
5538
5530
|
if (isPipelinePrepared(pipeline)) {
|
|
5539
5531
|
return [2 /*return*/, pipeline];
|
|
5540
5532
|
}
|
|
5541
|
-
rootDirname = options.rootDirname, _a = options.maxParallelCount, maxParallelCount = _a === void 0 ?
|
|
5533
|
+
rootDirname = options.rootDirname, _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a, _b = options.isVerbose, isVerbose = _b === void 0 ? DEFAULT_IS_VERBOSE : _b;
|
|
5542
5534
|
parameters = pipeline.parameters, templates = pipeline.templates, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
|
|
5543
5535
|
if (tools === undefined || tools.llm === undefined) {
|
|
5544
5536
|
throw new MissingToolsError('LLM tools are required for preparing the pipeline');
|
|
@@ -5596,7 +5588,9 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
5596
5588
|
// ----- /Templates preparation -----
|
|
5597
5589
|
// Note: Count total usage
|
|
5598
5590
|
currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
|
|
5599
|
-
return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { templates:
|
|
5591
|
+
return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { templates: __spreadArray([], __read(templatesPrepared), false),
|
|
5592
|
+
// <- TODO: [🪓] Here should be no need for spreading new array, just ` templates: templatesPrepared`
|
|
5593
|
+
knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: __spreadArray([], __read(preparations), false) }))];
|
|
5600
5594
|
}
|
|
5601
5595
|
});
|
|
5602
5596
|
});
|
|
@@ -8520,7 +8514,7 @@ function $registeredLlmToolsMessage() {
|
|
|
8520
8514
|
*/
|
|
8521
8515
|
function createLlmToolsFromConfiguration(configuration, options) {
|
|
8522
8516
|
if (options === void 0) { options = {}; }
|
|
8523
|
-
var _a = options.isVerbose, isVerbose = _a === void 0 ?
|
|
8517
|
+
var _a = options.isVerbose, isVerbose = _a === void 0 ? DEFAULT_IS_VERBOSE : _a;
|
|
8524
8518
|
var llmTools = configuration.map(function (llmConfiguration) {
|
|
8525
8519
|
var registeredItem = $llmToolsRegister
|
|
8526
8520
|
.list()
|
|
@@ -8593,7 +8587,7 @@ function $provideExecutablesForNode(options) {
|
|
|
8593
8587
|
if (!$isRunningInNode()) {
|
|
8594
8588
|
throw new EnvironmentMismatchError('Function `$getScrapersForNode` works only in Node.js environment');
|
|
8595
8589
|
}
|
|
8596
|
-
_a = options || {}, _b = _a.isAutoInstalled, isAutoInstalled = _b === void 0 ?
|
|
8590
|
+
_a = options || {}, _b = _a.isAutoInstalled, isAutoInstalled = _b === void 0 ? DEFAULT_IS_AUTO_INSTALLED : _b, _c = _a.isVerbose, isVerbose = _c === void 0 ? DEFAULT_IS_VERBOSE : _c;
|
|
8597
8591
|
TODO_USE(isAutoInstalled);
|
|
8598
8592
|
TODO_USE(isVerbose);
|
|
8599
8593
|
return [2 /*return*/, {
|
|
@@ -8618,7 +8612,7 @@ function $provideFilesystemForNode(options) {
|
|
|
8618
8612
|
if (!$isRunningInNode()) {
|
|
8619
8613
|
throw new EnvironmentMismatchError('Function `$provideFilesystemForNode` works only in Node.js environment');
|
|
8620
8614
|
}
|
|
8621
|
-
var _a = (options || {}).isVerbose, isVerbose = _a === void 0 ?
|
|
8615
|
+
var _a = (options || {}).isVerbose, isVerbose = _a === void 0 ? DEFAULT_IS_VERBOSE : _a;
|
|
8622
8616
|
TODO_USE(isVerbose);
|
|
8623
8617
|
return {
|
|
8624
8618
|
stat: stat,
|
|
@@ -8650,7 +8644,7 @@ function $provideScrapersForNode(tools, options) {
|
|
|
8650
8644
|
if (!$isRunningInNode()) {
|
|
8651
8645
|
throw new EnvironmentMismatchError('Function `$getScrapersForNode` works only in Node.js environment');
|
|
8652
8646
|
}
|
|
8653
|
-
_a = options || {}, _b = _a.isAutoInstalled, isAutoInstalled = _b === void 0 ?
|
|
8647
|
+
_a = options || {}, _b = _a.isAutoInstalled, isAutoInstalled = _b === void 0 ? DEFAULT_IS_AUTO_INSTALLED : _b, _c = _a.isVerbose, isVerbose = _c === void 0 ? DEFAULT_IS_VERBOSE : _c;
|
|
8654
8648
|
TODO_USE(isAutoInstalled);
|
|
8655
8649
|
TODO_USE(isVerbose);
|
|
8656
8650
|
scrapers = [];
|
|
@@ -9401,7 +9395,9 @@ function createCollectionFromDirectory(path, tools, options) {
|
|
|
9401
9395
|
throw new EnvironmentMismatchError('Can not create collection without filesystem tools');
|
|
9402
9396
|
// <- TODO: [🧠] What is the best error type here`
|
|
9403
9397
|
}
|
|
9404
|
-
makedLibraryFilePath = join(path, "".concat(
|
|
9398
|
+
makedLibraryFilePath = join(path, "".concat(DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME
|
|
9399
|
+
// <- TODO: [🦒] Allow to override (pass different value into the function)
|
|
9400
|
+
, ".json"));
|
|
9405
9401
|
return [4 /*yield*/, isFileExisting(makedLibraryFilePath, tools.fs)];
|
|
9406
9402
|
case 3:
|
|
9407
9403
|
if (!(_f.sent())) {
|
|
@@ -9412,7 +9408,7 @@ function createCollectionFromDirectory(path, tools, options) {
|
|
|
9412
9408
|
// TODO: !! Implement;
|
|
9413
9409
|
// TODO: [🌗]
|
|
9414
9410
|
}
|
|
9415
|
-
_a = options || {}, _b = _a.isRecursive, isRecursive = _b === void 0 ? true : _b, _c = _a.isVerbose, isVerbose = _c === void 0 ?
|
|
9411
|
+
_a = options || {}, _b = _a.isRecursive, isRecursive = _b === void 0 ? true : _b, _c = _a.isVerbose, isVerbose = _c === void 0 ? DEFAULT_IS_VERBOSE : _c, _d = _a.isLazyLoaded, isLazyLoaded = _d === void 0 ? false : _d, _e = _a.isCrashedOnError, isCrashedOnError = _e === void 0 ? true : _e;
|
|
9416
9412
|
collection = createCollectionFromPromise(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
9417
9413
|
var fileNames, collection, _loop_1, fileNames_1, fileNames_1_1, fileName, e_1_1;
|
|
9418
9414
|
var e_1, _a;
|
|
@@ -9884,7 +9880,7 @@ function $currentDate() {
|
|
|
9884
9880
|
function cacheLlmTools(llmTools, options) {
|
|
9885
9881
|
var _this = this;
|
|
9886
9882
|
if (options === void 0) { options = {}; }
|
|
9887
|
-
var _a = options.storage, storage = _a === void 0 ? new MemoryStorage() : _a, _b = options.
|
|
9883
|
+
var _a = options.storage, storage = _a === void 0 ? new MemoryStorage() : _a, _b = options.isCacheReloaded, isCacheReloaded = _b === void 0 ? false : _b;
|
|
9888
9884
|
var proxyTools = __assign(__assign({}, llmTools), {
|
|
9889
9885
|
// <- Note: [🥫]
|
|
9890
9886
|
get title() {
|
|
@@ -9906,7 +9902,7 @@ function cacheLlmTools(llmTools, options) {
|
|
|
9906
9902
|
key = titleToName(prompt.title.substring(0, MAX_FILENAME_LENGTH - 10) +
|
|
9907
9903
|
'-' +
|
|
9908
9904
|
sha256(hexEncoder.parse(JSON.stringify(prompt.parameters))).toString( /* hex */));
|
|
9909
|
-
if (!!
|
|
9905
|
+
if (!!isCacheReloaded) return [3 /*break*/, 2];
|
|
9910
9906
|
return [4 /*yield*/, storage.getItem(key)];
|
|
9911
9907
|
case 1:
|
|
9912
9908
|
_a = _c.sent();
|
|
@@ -9992,12 +9988,14 @@ function $provideLlmToolsForCli(options) {
|
|
|
9992
9988
|
if (!$isRunningInNode()) {
|
|
9993
9989
|
throw new EnvironmentMismatchError('Function `$provideLlmToolsForTestingAndScriptsAndPlayground` works only in Node.js environment');
|
|
9994
9990
|
}
|
|
9995
|
-
var
|
|
9991
|
+
var isCacheReloaded = (options !== null && options !== void 0 ? options : {}).isCacheReloaded;
|
|
9996
9992
|
return cacheLlmTools(countTotalUsage(
|
|
9997
9993
|
// <- Note: for example here we don`t want the [🌯]
|
|
9998
9994
|
$provideLlmToolsFromEnv()), {
|
|
9999
|
-
storage: new FileCacheStorage({ fs: $provideFilesystemForNode() }, {
|
|
10000
|
-
|
|
9995
|
+
storage: new FileCacheStorage({ fs: $provideFilesystemForNode() }, {
|
|
9996
|
+
rootFolderPath: join(process.cwd(), DEFAULT_EXECUTIONS_CACHE_DIRNAME),
|
|
9997
|
+
}),
|
|
9998
|
+
isCacheReloaded: isCacheReloaded,
|
|
10001
9999
|
});
|
|
10002
10000
|
}
|
|
10003
10001
|
/**
|
|
@@ -10024,11 +10022,11 @@ function initializeMakeCommand(program) {
|
|
|
10024
10022
|
makeCommand.option('-f, --format <format>', spaceTrim$1("\n Output format of builded collection \"javascript\", \"typescript\" or \"json\"\n\n Note: You can use multiple formats separated by comma\n "), 'javascript' /* <- Note: [🏳🌈] */);
|
|
10025
10023
|
makeCommand.option('--no-validation', "Do not validate logic of pipelines in collection", true);
|
|
10026
10024
|
makeCommand.option('--validation', "Types of validations separated by comma (options \"logic\",\"imports\")", 'logic,imports');
|
|
10027
|
-
makeCommand.option('--reload
|
|
10025
|
+
makeCommand.option('--reload', "Call LLM models even if same prompt with result is in the cache", false);
|
|
10028
10026
|
makeCommand.option('--verbose', "Is output verbose", false);
|
|
10029
|
-
makeCommand.option('-o, --out-file <path>', spaceTrim$1("\n Where to save the builded collection\n\n Note: If you keep it \"".concat(
|
|
10027
|
+
makeCommand.option('-o, --out-file <path>', spaceTrim$1("\n Where to save the builded collection\n\n Note: If you keep it \"".concat(DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, "\" it will be saved in the root of the promptbook directory\n If you set it to a path, it will be saved in that path\n BUT you can use only one format and set correct extension\n ")), DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME);
|
|
10030
10028
|
makeCommand.action(function (path, _a) {
|
|
10031
|
-
var projectName = _a.projectName, format = _a.format, validation = _a.validation,
|
|
10029
|
+
var projectName = _a.projectName, format = _a.format, validation = _a.validation, isCacheReloaded = _a.reloadCache, isVerbose = _a.verbose, outFile = _a.outFile;
|
|
10032
10030
|
return __awaiter(_this, void 0, void 0, function () {
|
|
10033
10031
|
var formats, validations, options, fs, llm, executables, tools, collection, validations_1, validations_1_1, validation_1, _b, _c, pipelineUrl, pipeline, e_1_1, e_2_1, collectionJson, collectionJsonString, collectionJsonItems, saveFile;
|
|
10034
10032
|
var _d, e_2, _e, e_1, _f;
|
|
@@ -10044,13 +10042,13 @@ function initializeMakeCommand(program) {
|
|
|
10044
10042
|
.split(',')
|
|
10045
10043
|
.map(function (_) { return _.trim(); })
|
|
10046
10044
|
.filter(function (_) { return _ !== ''; });
|
|
10047
|
-
if (outFile !==
|
|
10045
|
+
if (outFile !== DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME && formats.length !== 1) {
|
|
10048
10046
|
console.error(colors.red("You can only use one format if you specify --out-file"));
|
|
10049
10047
|
process.exit(1);
|
|
10050
10048
|
}
|
|
10051
10049
|
options = {
|
|
10052
10050
|
isVerbose: isVerbose,
|
|
10053
|
-
|
|
10051
|
+
isCacheReloaded: isCacheReloaded,
|
|
10054
10052
|
};
|
|
10055
10053
|
fs = $provideFilesystemForNode(options);
|
|
10056
10054
|
llm = $provideLlmToolsForCli(options);
|
|
@@ -10071,7 +10069,7 @@ function initializeMakeCommand(program) {
|
|
|
10071
10069
|
return [4 /*yield*/, createCollectionFromDirectory(path, tools, {
|
|
10072
10070
|
isVerbose: isVerbose,
|
|
10073
10071
|
isRecursive: true,
|
|
10074
|
-
// <- TODO: [🍖]
|
|
10072
|
+
// <- TODO: [🍖] Add `intermediateFilesStrategy`
|
|
10075
10073
|
})];
|
|
10076
10074
|
case 3:
|
|
10077
10075
|
collection = _g.sent();
|
|
@@ -10152,9 +10150,9 @@ function initializeMakeCommand(program) {
|
|
|
10152
10150
|
return __generator(this, function (_a) {
|
|
10153
10151
|
switch (_a.label) {
|
|
10154
10152
|
case 0:
|
|
10155
|
-
filename = outFile !==
|
|
10153
|
+
filename = outFile !== DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME
|
|
10156
10154
|
? outFile
|
|
10157
|
-
: join(path, "".concat(
|
|
10155
|
+
: join(path, "".concat(DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, ".").concat(extension));
|
|
10158
10156
|
if (!outFile.endsWith(".".concat(extension))) {
|
|
10159
10157
|
console.warn(colors.yellow("Warning: Extension of output file should be \"".concat(extension, "\"")));
|
|
10160
10158
|
}
|
|
@@ -10452,10 +10450,10 @@ function initializeTestCommand(program) {
|
|
|
10452
10450
|
// <- TODO: [🧟♂️] Unite path to promptbook collection argument
|
|
10453
10451
|
'Pipelines to test as glob pattern');
|
|
10454
10452
|
testCommand.option('-i, --ignore <glob>', "Ignore as glob pattern");
|
|
10455
|
-
testCommand.option('--reload
|
|
10453
|
+
testCommand.option('--reload', "Call LLM models even if same prompt with result is in the cache ", false);
|
|
10456
10454
|
testCommand.option('-v, --verbose', "Is output verbose", false);
|
|
10457
10455
|
testCommand.action(function (filesGlob, _a) {
|
|
10458
|
-
var ignore = _a.ignore,
|
|
10456
|
+
var ignore = _a.ignore, isCacheReloaded = _a.reloadCache, isVerbose = _a.verbose;
|
|
10459
10457
|
return __awaiter(_this, void 0, void 0, function () {
|
|
10460
10458
|
var options, fs, llm, executables, tools, filenames, filenames_1, filenames_1_1, filename, pipeline, pipelineMarkdown, _b, _c, error_1, e_1_1;
|
|
10461
10459
|
var _d, e_1, _e;
|
|
@@ -10464,7 +10462,7 @@ function initializeTestCommand(program) {
|
|
|
10464
10462
|
case 0:
|
|
10465
10463
|
options = {
|
|
10466
10464
|
isVerbose: isVerbose,
|
|
10467
|
-
|
|
10465
|
+
isCacheReloaded: isCacheReloaded,
|
|
10468
10466
|
};
|
|
10469
10467
|
fs = $provideFilesystemForNode(options);
|
|
10470
10468
|
llm = $provideLlmToolsForCli(options);
|
|
@@ -12755,12 +12753,12 @@ function $execCommand(options) {
|
|
|
12755
12753
|
*/
|
|
12756
12754
|
function getScraperIntermediateSource(source, options) {
|
|
12757
12755
|
return __awaiter(this, void 0, void 0, function () {
|
|
12758
|
-
var sourceFilename, url, rootDirname, cacheDirname,
|
|
12756
|
+
var sourceFilename, url, rootDirname, cacheDirname, intermediateFilesStrategy, extension, isVerbose, hash, semanticName, pieces, name, cacheFilename, isDestroyed, fileHandler;
|
|
12759
12757
|
return __generator(this, function (_a) {
|
|
12760
12758
|
switch (_a.label) {
|
|
12761
12759
|
case 0:
|
|
12762
12760
|
sourceFilename = source.filename, url = source.url;
|
|
12763
|
-
rootDirname = options.rootDirname, cacheDirname = options.cacheDirname,
|
|
12761
|
+
rootDirname = options.rootDirname, cacheDirname = options.cacheDirname, intermediateFilesStrategy = options.intermediateFilesStrategy, extension = options.extension, isVerbose = options.isVerbose;
|
|
12764
12762
|
hash = SHA256(
|
|
12765
12763
|
// <- TODO: [🥬] Encapsulate sha256 to some private utility function
|
|
12766
12764
|
hexEncoder.parse(sourceFilename || url || 'untitled'))
|
|
@@ -12770,7 +12768,7 @@ function getScraperIntermediateSource(source, options) {
|
|
|
12770
12768
|
pieces = ['intermediate', semanticName, hash].filter(function (piece) { return piece !== ''; });
|
|
12771
12769
|
name = pieces.join('-').split('--').join('-');
|
|
12772
12770
|
// <- TODO: Use MAX_FILENAME_LENGTH
|
|
12773
|
-
TODO_USE(rootDirname); // <- TODO:
|
|
12771
|
+
TODO_USE(rootDirname); // <- TODO: [😡]
|
|
12774
12772
|
cacheFilename = join.apply(void 0, __spreadArray(__spreadArray([process.cwd(),
|
|
12775
12773
|
cacheDirname], __read(nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */)), false), [name], false)).split('\\')
|
|
12776
12774
|
.join('/') +
|
|
@@ -12790,7 +12788,7 @@ function getScraperIntermediateSource(source, options) {
|
|
|
12790
12788
|
return __generator(this, function (_a) {
|
|
12791
12789
|
switch (_a.label) {
|
|
12792
12790
|
case 0:
|
|
12793
|
-
if (!
|
|
12791
|
+
if (!(intermediateFilesStrategy === 'HIDE_AND_CLEAN')) return [3 /*break*/, 2];
|
|
12794
12792
|
if (isVerbose) {
|
|
12795
12793
|
console.info('legacyDocumentScraper: Clening cache');
|
|
12796
12794
|
}
|
|
@@ -12814,7 +12812,7 @@ function getScraperIntermediateSource(source, options) {
|
|
|
12814
12812
|
/**
|
|
12815
12813
|
* Note: Not using `FileCacheStorage` for two reasons:
|
|
12816
12814
|
* 1) Need to store more than serialized JSONs
|
|
12817
|
-
* 2) Need to switch between a `rootDirname` and `cacheDirname` <- TODO:
|
|
12815
|
+
* 2) Need to switch between a `rootDirname` and `cacheDirname` <- TODO: [😡]
|
|
12818
12816
|
* TODO: [🐱🐉][🧠] Make some smart crop
|
|
12819
12817
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
12820
12818
|
*/
|
|
@@ -12831,7 +12829,7 @@ var markdownScraperMetadata = $deepFreeze({
|
|
|
12831
12829
|
mimeTypes: ['text/markdown', 'text/plain'],
|
|
12832
12830
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
12833
12831
|
isAvilableInBrowser: true,
|
|
12834
|
-
requiredExecutables: [
|
|
12832
|
+
requiredExecutables: [],
|
|
12835
12833
|
}); /* <- TODO: [🤛] */
|
|
12836
12834
|
/**
|
|
12837
12835
|
* Registration of known scraper metadata
|
|
@@ -12875,7 +12873,7 @@ var MarkdownScraper = /** @class */ (function () {
|
|
|
12875
12873
|
return __generator(this, function (_k) {
|
|
12876
12874
|
switch (_k.label) {
|
|
12877
12875
|
case 0:
|
|
12878
|
-
_a = this.options, _b = _a.maxParallelCount, maxParallelCount = _b === void 0 ?
|
|
12876
|
+
_a = this.options, _b = _a.maxParallelCount, maxParallelCount = _b === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _b, _c = _a.isVerbose, isVerbose = _c === void 0 ? DEFAULT_IS_VERBOSE : _c;
|
|
12879
12877
|
llm = this.tools.llm;
|
|
12880
12878
|
if (llm === undefined) {
|
|
12881
12879
|
throw new MissingToolsError('LLM tools are required for scraping external files');
|
|
@@ -12974,7 +12972,8 @@ var MarkdownScraper = /** @class */ (function () {
|
|
|
12974
12972
|
embeddingResult = _c.sent();
|
|
12975
12973
|
index.push({
|
|
12976
12974
|
modelName: embeddingResult.modelName,
|
|
12977
|
-
position: embeddingResult.content,
|
|
12975
|
+
position: __spreadArray([], __read(embeddingResult.content), false),
|
|
12976
|
+
// <- TODO: [🪓] Here should be no need for spreading new array, just `position: embeddingResult.content`
|
|
12978
12977
|
});
|
|
12979
12978
|
_c.label = 6;
|
|
12980
12979
|
case 6: return [3 /*break*/, 8];
|
|
@@ -13025,7 +13024,7 @@ var documentScraperMetadata = $deepFreeze({
|
|
|
13025
13024
|
mimeTypes: ['application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
|
|
13026
13025
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
13027
13026
|
isAvilableInBrowser: false,
|
|
13028
|
-
requiredExecutables: ['
|
|
13027
|
+
requiredExecutables: ['Pandoc'],
|
|
13029
13028
|
}); /* <- TODO: [🤛] */
|
|
13030
13029
|
/**
|
|
13031
13030
|
* Registration of known scraper metadata
|
|
@@ -13067,11 +13066,11 @@ var DocumentScraper = /** @class */ (function () {
|
|
|
13067
13066
|
DocumentScraper.prototype.$convert = function (source) {
|
|
13068
13067
|
var _a;
|
|
13069
13068
|
return __awaiter(this, void 0, void 0, function () {
|
|
13070
|
-
var _b, _c, rootDirname, _d, cacheDirname, _e,
|
|
13069
|
+
var _b, _c, rootDirname, _d, cacheDirname, _e, intermediateFilesStrategy, _f, isVerbose, extension, cacheFilehandler, command_1;
|
|
13071
13070
|
return __generator(this, function (_g) {
|
|
13072
13071
|
switch (_g.label) {
|
|
13073
13072
|
case 0:
|
|
13074
|
-
_b = this.options, _c = _b.rootDirname, rootDirname = _c === void 0 ? process.cwd() : _c, _d = _b.cacheDirname, cacheDirname = _d === void 0 ?
|
|
13073
|
+
_b = this.options, _c = _b.rootDirname, rootDirname = _c === void 0 ? process.cwd() : _c, _d = _b.cacheDirname, cacheDirname = _d === void 0 ? DEFAULT_SCRAPE_CACHE_DIRNAME : _d, _e = _b.intermediateFilesStrategy, intermediateFilesStrategy = _e === void 0 ? DEFAULT_INTERMEDIATE_FILES_STRATEGY : _e, _f = _b.isVerbose, isVerbose = _f === void 0 ? DEFAULT_IS_VERBOSE : _f;
|
|
13075
13074
|
if (!$isRunningInNode()) {
|
|
13076
13075
|
throw new KnowledgeScrapeError('Scraping .docx files is only supported in Node environment');
|
|
13077
13076
|
}
|
|
@@ -13090,7 +13089,7 @@ var DocumentScraper = /** @class */ (function () {
|
|
|
13090
13089
|
return [4 /*yield*/, getScraperIntermediateSource(source, {
|
|
13091
13090
|
rootDirname: rootDirname,
|
|
13092
13091
|
cacheDirname: cacheDirname,
|
|
13093
|
-
|
|
13092
|
+
intermediateFilesStrategy: intermediateFilesStrategy,
|
|
13094
13093
|
extension: 'md',
|
|
13095
13094
|
isVerbose: isVerbose,
|
|
13096
13095
|
})];
|
|
@@ -13100,10 +13099,8 @@ var DocumentScraper = /** @class */ (function () {
|
|
|
13100
13099
|
case 2:
|
|
13101
13100
|
if (!!(_g.sent())) return [3 /*break*/, 5];
|
|
13102
13101
|
command_1 = "\"".concat(this.tools.executables.pandocPath, "\" -f ").concat(extension, " -t markdown \"").concat(source.filename, "\" -o \"").concat(cacheFilehandler.filename, "\"");
|
|
13103
|
-
// TODO: !!!!!! [🕊] Make execCommand standard (?node-)util of the promptbook
|
|
13104
13102
|
return [4 /*yield*/, $execCommand(command_1)];
|
|
13105
13103
|
case 3:
|
|
13106
|
-
// TODO: !!!!!! [🕊] Make execCommand standard (?node-)util of the promptbook
|
|
13107
13104
|
_g.sent();
|
|
13108
13105
|
return [4 /*yield*/, isFileExisting(cacheFilehandler.filename, this.tools.fs)];
|
|
13109
13106
|
case 4:
|
|
@@ -13182,7 +13179,11 @@ var legacyDocumentScraperMetadata = $deepFreeze({
|
|
|
13182
13179
|
mimeTypes: ['application/msword', 'text/rtf'],
|
|
13183
13180
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
13184
13181
|
isAvilableInBrowser: false,
|
|
13185
|
-
requiredExecutables: [
|
|
13182
|
+
requiredExecutables: [
|
|
13183
|
+
'Pandoc',
|
|
13184
|
+
'LibreOffice',
|
|
13185
|
+
// <- TODO: [🧠] Should be 'LibreOffice' here, its dependency of dependency
|
|
13186
|
+
],
|
|
13186
13187
|
}); /* <- TODO: [🤛] */
|
|
13187
13188
|
/**
|
|
13188
13189
|
* Registration of known scraper metadata
|
|
@@ -13224,11 +13225,11 @@ var LegacyDocumentScraper = /** @class */ (function () {
|
|
|
13224
13225
|
LegacyDocumentScraper.prototype.$convert = function (source) {
|
|
13225
13226
|
var _a;
|
|
13226
13227
|
return __awaiter(this, void 0, void 0, function () {
|
|
13227
|
-
var _b, _c, rootDirname, _d, cacheDirname, _e,
|
|
13228
|
+
var _b, _c, rootDirname, _d, cacheDirname, _e, intermediateFilesStrategy, _f, isVerbose, extension, cacheFilehandler, documentSourceOutdirPathForLibreOffice_1, command_1, files_1, file;
|
|
13228
13229
|
return __generator(this, function (_g) {
|
|
13229
13230
|
switch (_g.label) {
|
|
13230
13231
|
case 0:
|
|
13231
|
-
_b = this.options, _c = _b.rootDirname, rootDirname = _c === void 0 ? process.cwd() : _c, _d = _b.cacheDirname, cacheDirname = _d === void 0 ?
|
|
13232
|
+
_b = this.options, _c = _b.rootDirname, rootDirname = _c === void 0 ? process.cwd() : _c, _d = _b.cacheDirname, cacheDirname = _d === void 0 ? DEFAULT_SCRAPE_CACHE_DIRNAME : _d, _e = _b.intermediateFilesStrategy, intermediateFilesStrategy = _e === void 0 ? DEFAULT_INTERMEDIATE_FILES_STRATEGY : _e, _f = _b.isVerbose, isVerbose = _f === void 0 ? DEFAULT_IS_VERBOSE : _f;
|
|
13232
13233
|
if (!$isRunningInNode()) {
|
|
13233
13234
|
throw new KnowledgeScrapeError('Scraping .doc files is only supported in Node environment');
|
|
13234
13235
|
}
|
|
@@ -13247,7 +13248,7 @@ var LegacyDocumentScraper = /** @class */ (function () {
|
|
|
13247
13248
|
return [4 /*yield*/, getScraperIntermediateSource(source, {
|
|
13248
13249
|
rootDirname: rootDirname,
|
|
13249
13250
|
cacheDirname: cacheDirname,
|
|
13250
|
-
|
|
13251
|
+
intermediateFilesStrategy: intermediateFilesStrategy,
|
|
13251
13252
|
extension: 'docx',
|
|
13252
13253
|
isVerbose: isVerbose,
|
|
13253
13254
|
})];
|
|
@@ -13263,10 +13264,8 @@ var LegacyDocumentScraper = /** @class */ (function () {
|
|
|
13263
13264
|
.split('\\')
|
|
13264
13265
|
.join('/');
|
|
13265
13266
|
command_1 = "\"".concat(this.tools.executables.libreOfficePath, "\" --headless --convert-to docx \"").concat(source.filename, "\" --outdir \"").concat(documentSourceOutdirPathForLibreOffice_1, "\"");
|
|
13266
|
-
// TODO: !!!!!! [🕊] Make execCommand standard (?node-)util of the promptbook - this should trigger build polution error
|
|
13267
13267
|
return [4 /*yield*/, $execCommand(command_1)];
|
|
13268
13268
|
case 3:
|
|
13269
|
-
// TODO: !!!!!! [🕊] Make execCommand standard (?node-)util of the promptbook - this should trigger build polution error
|
|
13270
13269
|
_g.sent();
|
|
13271
13270
|
return [4 /*yield*/, readdir(documentSourceOutdirPathForLibreOffice_1)];
|
|
13272
13271
|
case 4:
|
|
@@ -13423,7 +13422,7 @@ var pdfScraperMetadata = $deepFreeze({
|
|
|
13423
13422
|
mimeTypes: ['application/pdf'],
|
|
13424
13423
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
13425
13424
|
isAvilableInBrowser: true,
|
|
13426
|
-
requiredExecutables: [
|
|
13425
|
+
requiredExecutables: [],
|
|
13427
13426
|
}); /* <- TODO: [🤛] */
|
|
13428
13427
|
/**
|
|
13429
13428
|
* Registration of known scraper metadata
|
|
@@ -13480,7 +13479,7 @@ var PdfScraper = /** @class */ (function () {
|
|
|
13480
13479
|
/*
|
|
13481
13480
|
const {
|
|
13482
13481
|
cacheDirname = SCRAPE_CACHE_DIRNAME,
|
|
13483
|
-
|
|
13482
|
+
intermediateFilesStrategy = DEFAULT_INTERMEDIATE_FILES_STRATEGY,
|
|
13484
13483
|
isVerbose = IS_VERBOSE,
|
|
13485
13484
|
} = options;
|
|
13486
13485
|
*/
|
|
@@ -13533,7 +13532,7 @@ var websiteScraperMetadata = $deepFreeze({
|
|
|
13533
13532
|
mimeTypes: ['text/html'],
|
|
13534
13533
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
13535
13534
|
isAvilableInBrowser: false,
|
|
13536
|
-
requiredExecutables: [
|
|
13535
|
+
requiredExecutables: [],
|
|
13537
13536
|
}); /* <- TODO: [🤛] */
|
|
13538
13537
|
/**
|
|
13539
13538
|
* Registration of known scraper metadata
|
|
@@ -13599,11 +13598,11 @@ var WebsiteScraper = /** @class */ (function () {
|
|
|
13599
13598
|
return __awaiter(this, void 0, void 0, function () {
|
|
13600
13599
|
var _a, _b,
|
|
13601
13600
|
// TODO: [🧠] Maybe in node use headless browser not just JSDOM
|
|
13602
|
-
rootDirname, _c, cacheDirname, _d,
|
|
13601
|
+
rootDirname, _c, cacheDirname, _d, intermediateFilesStrategy, _e, isVerbose, jsdom, _f, reader, article, html, i, cacheFilehandler, markdown;
|
|
13603
13602
|
return __generator(this, function (_g) {
|
|
13604
13603
|
switch (_g.label) {
|
|
13605
13604
|
case 0:
|
|
13606
|
-
_a = this.options, _b = _a.rootDirname, rootDirname = _b === void 0 ? process.cwd() : _b, _c = _a.cacheDirname, cacheDirname = _c === void 0 ?
|
|
13605
|
+
_a = this.options, _b = _a.rootDirname, rootDirname = _b === void 0 ? process.cwd() : _b, _c = _a.cacheDirname, cacheDirname = _c === void 0 ? DEFAULT_SCRAPE_CACHE_DIRNAME : _c, _d = _a.intermediateFilesStrategy, intermediateFilesStrategy = _d === void 0 ? DEFAULT_INTERMEDIATE_FILES_STRATEGY : _d, _e = _a.isVerbose, isVerbose = _e === void 0 ? DEFAULT_IS_VERBOSE : _e;
|
|
13607
13606
|
// TODO: !!!!!! Does this work in browser? Make it work.
|
|
13608
13607
|
if (source.url === null) {
|
|
13609
13608
|
throw new KnowledgeScrapeError('Website scraper requires URL');
|
|
@@ -13627,7 +13626,7 @@ var WebsiteScraper = /** @class */ (function () {
|
|
|
13627
13626
|
return [4 /*yield*/, getScraperIntermediateSource(source, {
|
|
13628
13627
|
rootDirname: rootDirname,
|
|
13629
13628
|
cacheDirname: cacheDirname,
|
|
13630
|
-
|
|
13629
|
+
intermediateFilesStrategy: intermediateFilesStrategy,
|
|
13631
13630
|
extension: 'html',
|
|
13632
13631
|
isVerbose: isVerbose,
|
|
13633
13632
|
})];
|