@promptbook/node 0.72.0-13 → 0.72.0-15
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 +1 -1
- package/esm/index.es.js +106 -87
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +22 -18
- package/esm/typings/src/_packages/node.index.d.ts +2 -0
- package/esm/typings/src/_packages/types.index.d.ts +10 -10
- package/esm/typings/src/_packages/utils.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/Executables.d.ts +18 -0
- package/esm/typings/src/execution/ExecutionTools.d.ts +9 -3
- 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/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +11 -3
- 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/register/createLlmToolsFromConfiguration.d.ts +7 -0
- 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 +4 -5
- 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 +3 -3
- package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_Prompt_Response.d.ts +2 -2
- package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +4 -23
- 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/$provideExecutablesForNode.d.ts +12 -0
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForBrowser.d.ts +2 -2
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForNode.d.ts +2 -2
- 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/document/DocumentScraper.d.ts +2 -2
- 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 +3 -3
- 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 +2 -2
- 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 +6 -3
- 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/scrapers/website/utils/createShowdownConverter.d.ts +7 -0
- 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/PipelineJson/TemplateJsonCommon.d.ts +2 -2
- 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/execCommand/$execCommand.d.ts +2 -2
- package/esm/typings/src/utils/execCommand/{IExecCommandOptions.d.ts → ExecCommandOptions.d.ts} +2 -6
- package/esm/typings/src/utils/execCommand/execCommandNormalizeOptions.d.ts +3 -3
- 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/normalization/IKeywords.d.ts +2 -2
- package/esm/typings/src/utils/normalization/parseKeywords.d.ts +2 -2
- package/esm/typings/src/utils/normalization/parseKeywordsFromString.d.ts +2 -2
- package/esm/typings/src/utils/normalization/searchKeywords.d.ts +2 -2
- 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/esm/typings/src/utils/unwrapResult.d.ts +4 -4
- package/package.json +4 -3
- package/umd/index.umd.js +106 -86
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorSettings.d.ts +0 -29
- package/esm/typings/src/scrapers/website/utils/markdownConverter.d.ts +0 -12
- /package/esm/typings/src/scrapers/website/utils/{markdownConverter.test.d.ts → createShowdownConverter.test.d.ts} +0 -0
package/README.md
CHANGED
package/esm/index.es.js
CHANGED
|
@@ -17,7 +17,7 @@ import { spawn } from 'child_process';
|
|
|
17
17
|
/**
|
|
18
18
|
* The version of the Promptbook library
|
|
19
19
|
*/
|
|
20
|
-
var PROMPTBOOK_VERSION = '0.72.0-
|
|
20
|
+
var PROMPTBOOK_VERSION = '0.72.0-14';
|
|
21
21
|
// TODO: [main] !!!! List here all the versions and annotate + put into script
|
|
22
22
|
|
|
23
23
|
/*! *****************************************************************************
|
|
@@ -366,29 +366,30 @@ var LOOP_LIMIT = 1000;
|
|
|
366
366
|
*/
|
|
367
367
|
var IMMEDIATE_TIME = 10;
|
|
368
368
|
/**
|
|
369
|
-
* The maximum
|
|
369
|
+
* The maximum length of the (generated) filename
|
|
370
370
|
*
|
|
371
371
|
* @public exported from `@promptbook/core`
|
|
372
372
|
*/
|
|
373
|
-
var
|
|
373
|
+
var MAX_FILENAME_LENGTH = 30;
|
|
374
|
+
// <- TODO: [😡] Change to 'VISIBLE'
|
|
374
375
|
/**
|
|
375
|
-
* The maximum number of
|
|
376
|
+
* The maximum number of (LLM) tasks running in parallel
|
|
376
377
|
*
|
|
377
378
|
* @public exported from `@promptbook/core`
|
|
378
379
|
*/
|
|
379
|
-
var
|
|
380
|
+
var DEFAULT_MAX_PARALLEL_COUNT = 5; // <- TODO: [🤹♂️]
|
|
380
381
|
/**
|
|
381
|
-
* The maximum
|
|
382
|
+
* The maximum number of attempts to execute LLM task before giving up
|
|
382
383
|
*
|
|
383
384
|
* @public exported from `@promptbook/core`
|
|
384
385
|
*/
|
|
385
|
-
var
|
|
386
|
+
var DEFAULT_MAX_EXECUTION_ATTEMPTS = 3; // <- TODO: [🤹♂️]
|
|
386
387
|
/**
|
|
387
388
|
* The name of the builded pipeline collection made by CLI `ptbk make` and for lookup in `createCollectionFromDirectory`
|
|
388
389
|
*
|
|
389
390
|
* @public exported from `@promptbook/core`
|
|
390
391
|
*/
|
|
391
|
-
var
|
|
392
|
+
var DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME = "index";
|
|
392
393
|
/**
|
|
393
394
|
* Nonce which is used for replacing things in strings
|
|
394
395
|
*
|
|
@@ -440,13 +441,13 @@ var DEFAULT_CSV_SETTINGS = Object.freeze({
|
|
|
440
441
|
*
|
|
441
442
|
* @public exported from `@promptbook/core`
|
|
442
443
|
*/
|
|
443
|
-
var
|
|
444
|
+
var DEFAULT_IS_VERBOSE = false;
|
|
444
445
|
/**
|
|
445
446
|
* @@@
|
|
446
447
|
*
|
|
447
448
|
* @public exported from `@promptbook/core`
|
|
448
449
|
*/
|
|
449
|
-
var
|
|
450
|
+
var DEFAULT_IS_AUTO_INSTALLED = false;
|
|
450
451
|
/**
|
|
451
452
|
* @@@
|
|
452
453
|
*
|
|
@@ -518,7 +519,6 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
518
519
|
pipelineString += '\n\n';
|
|
519
520
|
pipelineString += description;
|
|
520
521
|
}
|
|
521
|
-
// TODO:> const commands: Array<Command>
|
|
522
522
|
var commands = [];
|
|
523
523
|
if (pipelineUrl) {
|
|
524
524
|
commands.push("PIPELINE URL ".concat(pipelineUrl));
|
|
@@ -574,7 +574,6 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
574
574
|
pipelineString += '\n\n';
|
|
575
575
|
pipelineString += description_1;
|
|
576
576
|
}
|
|
577
|
-
// TODO:> const commands: Array<Command>
|
|
578
577
|
var commands_1 = [];
|
|
579
578
|
var contentLanguage = 'text';
|
|
580
579
|
if (templateType === 'PROMPT_TEMPLATE') {
|
|
@@ -873,8 +872,7 @@ var PipelineExecutionError = /** @class */ (function (_super) {
|
|
|
873
872
|
* Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
|
|
874
873
|
*
|
|
875
874
|
* Note: Internal utility of `joinLlmExecutionTools` but exposed type
|
|
876
|
-
* @public exported from `@promptbook/
|
|
877
|
-
* TODO: !!!!!! Export as runtime class not just type
|
|
875
|
+
* @public exported from `@promptbook/core`
|
|
878
876
|
*/
|
|
879
877
|
var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
880
878
|
/**
|
|
@@ -2126,6 +2124,7 @@ function assertsExecutionSuccessful(executionResult) {
|
|
|
2126
2124
|
}
|
|
2127
2125
|
}
|
|
2128
2126
|
/**
|
|
2127
|
+
* TODO: [🐚] This function should be removed OR changed OR be completely rewritten
|
|
2129
2128
|
* TODO: [🧠] Can this return type be better typed than void
|
|
2130
2129
|
*/
|
|
2131
2130
|
|
|
@@ -3432,12 +3431,11 @@ function checkExpectations(expectations, value) {
|
|
|
3432
3431
|
*/
|
|
3433
3432
|
function executeAttempts(options) {
|
|
3434
3433
|
return __awaiter(this, void 0, void 0, function () {
|
|
3435
|
-
var jokerParameterNames, priority, maxAttempts, preparedContent, parameters, template, preparedPipeline, tools,
|
|
3434
|
+
var jokerParameterNames, priority, maxAttempts, preparedContent, parameters, template, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, $ongoingTemplateResult, _llms, llmTools, _loop_1, attempt, state_1;
|
|
3436
3435
|
return __generator(this, function (_a) {
|
|
3437
3436
|
switch (_a.label) {
|
|
3438
3437
|
case 0:
|
|
3439
|
-
jokerParameterNames = options.jokerParameterNames, priority = options.priority, maxAttempts = options.maxAttempts, preparedContent = options.preparedContent, parameters = options.parameters, template = options.template, preparedPipeline = options.preparedPipeline, tools = options.tools,
|
|
3440
|
-
maxExecutionAttempts = settings.maxExecutionAttempts;
|
|
3438
|
+
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;
|
|
3441
3439
|
$ongoingTemplateResult = {
|
|
3442
3440
|
$result: null,
|
|
3443
3441
|
$resultString: null,
|
|
@@ -3803,12 +3801,12 @@ function executeAttempts(options) {
|
|
|
3803
3801
|
*/
|
|
3804
3802
|
function executeFormatSubvalues(options) {
|
|
3805
3803
|
return __awaiter(this, void 0, void 0, function () {
|
|
3806
|
-
var template, jokerParameterNames, parameters, priority,
|
|
3804
|
+
var template, jokerParameterNames, parameters, priority, csvSettings, pipelineIdentification, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
|
|
3807
3805
|
var _this = this;
|
|
3808
3806
|
return __generator(this, function (_a) {
|
|
3809
3807
|
switch (_a.label) {
|
|
3810
3808
|
case 0:
|
|
3811
|
-
template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority,
|
|
3809
|
+
template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, csvSettings = options.csvSettings, pipelineIdentification = options.pipelineIdentification;
|
|
3812
3810
|
if (template.foreach === undefined) {
|
|
3813
3811
|
return [2 /*return*/, /* not await */ executeAttempts(options)];
|
|
3814
3812
|
}
|
|
@@ -3838,7 +3836,7 @@ function executeFormatSubvalues(options) {
|
|
|
3838
3836
|
.join('\n')), "\n\n [\u26F7] This should never happen because subformat name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
3839
3837
|
}
|
|
3840
3838
|
if (formatDefinition.formatName === 'CSV') {
|
|
3841
|
-
formatSettings =
|
|
3839
|
+
formatSettings = csvSettings;
|
|
3842
3840
|
// <- TODO: [🤹♂️] More universal, make simmilar pattern for other formats for example \n vs \r\n in text
|
|
3843
3841
|
}
|
|
3844
3842
|
return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, template.foreach.outputSubparameterName, formatSettings, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -3991,13 +3989,12 @@ function getReservedParametersForTemplate(options) {
|
|
|
3991
3989
|
*/
|
|
3992
3990
|
function executeTemplate(options) {
|
|
3993
3991
|
return __awaiter(this, void 0, void 0, function () {
|
|
3994
|
-
var currentTemplate, preparedPipeline, parametersToPass, tools, onProgress,
|
|
3995
|
-
var e_1,
|
|
3996
|
-
return __generator(this, function (
|
|
3997
|
-
switch (
|
|
3992
|
+
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;
|
|
3993
|
+
var e_1, _g, _h;
|
|
3994
|
+
return __generator(this, function (_j) {
|
|
3995
|
+
switch (_j.label) {
|
|
3998
3996
|
case 0:
|
|
3999
|
-
currentTemplate = options.currentTemplate, preparedPipeline = options.preparedPipeline, parametersToPass = options.parametersToPass, tools = options.tools, onProgress = options.onProgress,
|
|
4000
|
-
maxExecutionAttempts = settings.maxExecutionAttempts;
|
|
3997
|
+
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;
|
|
4001
3998
|
name = "pipeline-executor-frame-".concat(currentTemplate.name);
|
|
4002
3999
|
title = currentTemplate.title;
|
|
4003
4000
|
priority = preparedPipeline.templates.length - preparedPipeline.templates.indexOf(currentTemplate);
|
|
@@ -4012,7 +4009,7 @@ function executeTemplate(options) {
|
|
|
4012
4009
|
// <- [🍸]
|
|
4013
4010
|
})];
|
|
4014
4011
|
case 1:
|
|
4015
|
-
|
|
4012
|
+
_j.sent();
|
|
4016
4013
|
usedParameterNames = extractParameterNamesFromTemplate(currentTemplate);
|
|
4017
4014
|
dependentParameterNames = new Set(currentTemplate.dependentParameterNames);
|
|
4018
4015
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
@@ -4023,15 +4020,15 @@ function executeTemplate(options) {
|
|
|
4023
4020
|
.map(function (name) { return "{".concat(name, "}"); })
|
|
4024
4021
|
.join(', '), "\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
4025
4022
|
}
|
|
4026
|
-
|
|
4027
|
-
|
|
4023
|
+
_c = (_b = Object).freeze;
|
|
4024
|
+
_d = [{}];
|
|
4028
4025
|
return [4 /*yield*/, getReservedParametersForTemplate({
|
|
4029
4026
|
preparedPipeline: preparedPipeline,
|
|
4030
4027
|
template: currentTemplate,
|
|
4031
4028
|
pipelineIdentification: pipelineIdentification,
|
|
4032
4029
|
})];
|
|
4033
4030
|
case 2:
|
|
4034
|
-
definedParameters =
|
|
4031
|
+
definedParameters = _c.apply(_b, [__assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_j.sent())])), parametersToPass])]);
|
|
4035
4032
|
definedParameterNames = new Set(Object.keys(definedParameters));
|
|
4036
4033
|
parameters = {};
|
|
4037
4034
|
_loop_1 = function (parameterName) {
|
|
@@ -4051,15 +4048,15 @@ function executeTemplate(options) {
|
|
|
4051
4048
|
try {
|
|
4052
4049
|
// Note: [2] Check that all used parameters are defined and removing unused parameters for this template
|
|
4053
4050
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
4054
|
-
for (
|
|
4055
|
-
parameterName =
|
|
4051
|
+
for (_e = __values(Array.from(union(definedParameterNames, usedParameterNames, dependentParameterNames))), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
4052
|
+
parameterName = _f.value;
|
|
4056
4053
|
_loop_1(parameterName);
|
|
4057
4054
|
}
|
|
4058
4055
|
}
|
|
4059
4056
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
4060
4057
|
finally {
|
|
4061
4058
|
try {
|
|
4062
|
-
if (
|
|
4059
|
+
if (_f && !_f.done && (_g = _e.return)) _g.call(_e);
|
|
4063
4060
|
}
|
|
4064
4061
|
finally { if (e_1) throw e_1.error; }
|
|
4065
4062
|
}
|
|
@@ -4079,12 +4076,11 @@ function executeTemplate(options) {
|
|
|
4079
4076
|
template: currentTemplate,
|
|
4080
4077
|
preparedPipeline: preparedPipeline,
|
|
4081
4078
|
tools: tools,
|
|
4082
|
-
settings: settings,
|
|
4083
4079
|
$executionReport: $executionReport,
|
|
4084
4080
|
pipelineIdentification: pipelineIdentification,
|
|
4085
4081
|
})];
|
|
4086
4082
|
case 3:
|
|
4087
|
-
resultString =
|
|
4083
|
+
resultString = _j.sent();
|
|
4088
4084
|
return [4 /*yield*/, onProgress({
|
|
4089
4085
|
name: name,
|
|
4090
4086
|
title: title,
|
|
@@ -4096,12 +4092,12 @@ function executeTemplate(options) {
|
|
|
4096
4092
|
// <- [🍸]
|
|
4097
4093
|
})];
|
|
4098
4094
|
case 4:
|
|
4099
|
-
|
|
4100
|
-
return [2 /*return*/, Object.freeze((
|
|
4101
|
-
|
|
4095
|
+
_j.sent();
|
|
4096
|
+
return [2 /*return*/, Object.freeze((_h = {},
|
|
4097
|
+
_h[currentTemplate.resultingParameterName] =
|
|
4102
4098
|
// <- Note: [👩👩👧] No need to detect parameter collision here because pipeline checks logic consistency during construction
|
|
4103
4099
|
resultString,
|
|
4104
|
-
|
|
4100
|
+
_h))];
|
|
4105
4101
|
}
|
|
4106
4102
|
});
|
|
4107
4103
|
});
|
|
@@ -4160,13 +4156,12 @@ function filterJustOutputParameters(options) {
|
|
|
4160
4156
|
*/
|
|
4161
4157
|
function executePipeline(options) {
|
|
4162
4158
|
return __awaiter(this, void 0, void 0, function () {
|
|
4163
|
-
var inputParameters, tools, onProgress, pipeline, setPreparedPipeline, pipelineIdentification,
|
|
4159
|
+
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;
|
|
4164
4160
|
var e_1, _f, e_2, _g;
|
|
4165
4161
|
return __generator(this, function (_h) {
|
|
4166
4162
|
switch (_h.label) {
|
|
4167
4163
|
case 0:
|
|
4168
|
-
inputParameters = options.inputParameters, tools = options.tools, onProgress = options.onProgress, pipeline = options.pipeline, setPreparedPipeline = options.setPreparedPipeline, pipelineIdentification = options.pipelineIdentification,
|
|
4169
|
-
maxParallelCount = settings.maxParallelCount, rootDirname = settings.rootDirname, _a = settings.isVerbose, isVerbose = _a === void 0 ? IS_VERBOSE : _a;
|
|
4164
|
+
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;
|
|
4170
4165
|
preparedPipeline = options.preparedPipeline;
|
|
4171
4166
|
if (!(preparedPipeline === undefined)) return [3 /*break*/, 2];
|
|
4172
4167
|
return [4 /*yield*/, preparePipeline(pipeline, tools, {
|
|
@@ -4351,12 +4346,7 @@ function executePipeline(options) {
|
|
|
4351
4346
|
return [3 /*break*/, 4];
|
|
4352
4347
|
case 3:
|
|
4353
4348
|
unresovedTemplates_1 = unresovedTemplates_1.filter(function (template) { return template !== currentTemplate; });
|
|
4354
|
-
work_1 = executeTemplate({
|
|
4355
|
-
currentTemplate: currentTemplate,
|
|
4356
|
-
preparedPipeline: preparedPipeline,
|
|
4357
|
-
parametersToPass: parametersToPass,
|
|
4358
|
-
tools: tools,
|
|
4359
|
-
onProgress: function (progress) {
|
|
4349
|
+
work_1 = executeTemplate(__assign(__assign({}, options), { currentTemplate: currentTemplate, preparedPipeline: preparedPipeline, parametersToPass: parametersToPass, tools: tools, onProgress: function (progress) {
|
|
4360
4350
|
if (isReturned) {
|
|
4361
4351
|
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)
|
|
4362
4352
|
.split('\n')
|
|
@@ -4366,11 +4356,7 @@ function executePipeline(options) {
|
|
|
4366
4356
|
if (onProgress) {
|
|
4367
4357
|
onProgress(progress);
|
|
4368
4358
|
}
|
|
4369
|
-
},
|
|
4370
|
-
settings: settings,
|
|
4371
|
-
$executionReport: executionReport,
|
|
4372
|
-
pipelineIdentification: spaceTrim(function (block) { return "\n ".concat(block(pipelineIdentification), "\n Template name: ").concat(currentTemplate.name, "\n Template title: ").concat(currentTemplate.title, "\n "); }),
|
|
4373
|
-
})
|
|
4359
|
+
}, $executionReport: executionReport, pipelineIdentification: spaceTrim(function (block) { return "\n ".concat(block(pipelineIdentification), "\n Template name: ").concat(currentTemplate.name, "\n Template title: ").concat(currentTemplate.title, "\n "); }) }))
|
|
4374
4360
|
.then(function (newParametersToPass) {
|
|
4375
4361
|
parametersToPass = __assign(__assign({}, newParametersToPass), parametersToPass);
|
|
4376
4362
|
resovedParameterNames_1 = __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), [currentTemplate.resultingParameterName], false);
|
|
@@ -4474,8 +4460,7 @@ function executePipeline(options) {
|
|
|
4474
4460
|
*/
|
|
4475
4461
|
function createPipelineExecutor(options) {
|
|
4476
4462
|
var _this = this;
|
|
4477
|
-
var pipeline = options.pipeline, tools = options.tools, _a = options.
|
|
4478
|
-
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;
|
|
4463
|
+
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;
|
|
4479
4464
|
validatePipeline(pipeline);
|
|
4480
4465
|
var pipelineIdentification = (function () {
|
|
4481
4466
|
// Note: This is a 😐 implementation of [🚞]
|
|
@@ -4509,14 +4494,12 @@ function createPipelineExecutor(options) {
|
|
|
4509
4494
|
tools: tools,
|
|
4510
4495
|
onProgress: onProgress,
|
|
4511
4496
|
pipelineIdentification: spaceTrim(function (block) { return "\n ".concat(block(pipelineIdentification), "\n ").concat(runCount === 1 ? '' : "Run #".concat(runCount), "\n "); }),
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
rootDirname: rootDirname,
|
|
4519
|
-
},
|
|
4497
|
+
maxExecutionAttempts: maxExecutionAttempts,
|
|
4498
|
+
maxParallelCount: maxParallelCount,
|
|
4499
|
+
csvSettings: csvSettings,
|
|
4500
|
+
isVerbose: isVerbose,
|
|
4501
|
+
isNotPreparedWarningSupressed: isNotPreparedWarningSupressed,
|
|
4502
|
+
rootDirname: rootDirname,
|
|
4520
4503
|
})];
|
|
4521
4504
|
});
|
|
4522
4505
|
}); };
|
|
@@ -4539,7 +4522,7 @@ function preparePersona(personaDescription, tools, options) {
|
|
|
4539
4522
|
return __generator(this, function (_d) {
|
|
4540
4523
|
switch (_d.label) {
|
|
4541
4524
|
case 0:
|
|
4542
|
-
_a = options.isVerbose, isVerbose = _a === void 0 ?
|
|
4525
|
+
_a = options.isVerbose, isVerbose = _a === void 0 ? DEFAULT_IS_VERBOSE : _a;
|
|
4543
4526
|
if (tools === undefined || tools.llm === undefined) {
|
|
4544
4527
|
throw new MissingToolsError('LLM tools are required for preparing persona');
|
|
4545
4528
|
}
|
|
@@ -4721,7 +4704,7 @@ var $Register = /** @class */ (function () {
|
|
|
4721
4704
|
this.storage = globalScope[storageName];
|
|
4722
4705
|
}
|
|
4723
4706
|
$Register.prototype.list = function () {
|
|
4724
|
-
// <- TODO: ReadonlyDeep<
|
|
4707
|
+
// <- TODO: ReadonlyDeep<ReadonlyArray<TRegistered>>
|
|
4725
4708
|
return this.storage;
|
|
4726
4709
|
};
|
|
4727
4710
|
$Register.prototype.register = function (registered) {
|
|
@@ -4773,7 +4756,7 @@ var $scrapersRegister = new $Register('scraper_constructors');
|
|
|
4773
4756
|
* TODO: [®] DRY Register logic
|
|
4774
4757
|
*/
|
|
4775
4758
|
|
|
4776
|
-
// TODO: !!!!!! Maybe delete this function
|
|
4759
|
+
// TODO: !!!!!!last - Maybe delete this function
|
|
4777
4760
|
/**
|
|
4778
4761
|
* Creates a message with all registered scrapers
|
|
4779
4762
|
*
|
|
@@ -4940,7 +4923,6 @@ function normalizeToKebabCase(text) {
|
|
|
4940
4923
|
* @private within the repository
|
|
4941
4924
|
*/
|
|
4942
4925
|
function sourceContentToName(sourceContent) {
|
|
4943
|
-
// TODO: !!!!!! Better name for source than gibberish hash
|
|
4944
4926
|
var hash = SHA256(hexEncoder.parse(JSON.stringify(sourceContent)))
|
|
4945
4927
|
// <- TODO: [🥬] Encapsulate sha256 to some private utility function
|
|
4946
4928
|
.toString( /* hex */)
|
|
@@ -5053,7 +5035,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5053
5035
|
case 0:
|
|
5054
5036
|
sourceContent = knowledgeSource.sourceContent;
|
|
5055
5037
|
name = knowledgeSource.name;
|
|
5056
|
-
_b = options || {}, _c = _b.rootDirname, rootDirname = _c === void 0 ? null : _c, _d = _b.isVerbose, isVerbose = _d === void 0 ?
|
|
5038
|
+
_b = options || {}, _c = _b.rootDirname, rootDirname = _c === void 0 ? null : _c, _d = _b.isVerbose, isVerbose = _d === void 0 ? DEFAULT_IS_VERBOSE : _d;
|
|
5057
5039
|
TODO_USE(isVerbose);
|
|
5058
5040
|
if (!name) {
|
|
5059
5041
|
name = sourceContentToName(sourceContent);
|
|
@@ -5143,7 +5125,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5143
5125
|
content = _a.sent();
|
|
5144
5126
|
return [2 /*return*/, new Blob([
|
|
5145
5127
|
content,
|
|
5146
|
-
// <- TODO: !!!!!!
|
|
5128
|
+
// <- TODO: !!!!!! Test that this is working
|
|
5147
5129
|
], { type: mimeType_1 })];
|
|
5148
5130
|
}
|
|
5149
5131
|
});
|
|
@@ -5206,7 +5188,7 @@ function prepareKnowledgePieces(knowledgeSources, tools, options) {
|
|
|
5206
5188
|
return __generator(this, function (_c) {
|
|
5207
5189
|
switch (_c.label) {
|
|
5208
5190
|
case 0:
|
|
5209
|
-
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ?
|
|
5191
|
+
_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;
|
|
5210
5192
|
knowledgePreparedUnflatten = new Array(knowledgeSources.length);
|
|
5211
5193
|
return [4 /*yield*/, forEachAsync(knowledgeSources, { maxParallelCount: maxParallelCount }, function (knowledgeSource, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
5212
5194
|
var partialPieces, sourceHandler, _a, _b, scraper, partialPiecesUnchecked, e_1_1, pieces;
|
|
@@ -5235,7 +5217,8 @@ function prepareKnowledgePieces(knowledgeSources, tools, options) {
|
|
|
5235
5217
|
case 4:
|
|
5236
5218
|
partialPiecesUnchecked = _d.sent();
|
|
5237
5219
|
if (partialPiecesUnchecked !== null) {
|
|
5238
|
-
partialPieces = partialPiecesUnchecked;
|
|
5220
|
+
partialPieces = __spreadArray([], __read(partialPiecesUnchecked), false);
|
|
5221
|
+
// <- TODO: [🪓] Here should be no need for spreading new array, just `partialPieces = partialPiecesUnchecked`
|
|
5239
5222
|
return [3 /*break*/, 6];
|
|
5240
5223
|
}
|
|
5241
5224
|
_d.label = 5;
|
|
@@ -5283,7 +5266,7 @@ TODO: [🧊] This is how it can look in future
|
|
|
5283
5266
|
> /**
|
|
5284
5267
|
> * Unprepared knowledge
|
|
5285
5268
|
> * /
|
|
5286
|
-
> readonly knowledgeSources:
|
|
5269
|
+
> readonly knowledgeSources: ReadonlyArray<KnowledgeSourceJson>;
|
|
5287
5270
|
> };
|
|
5288
5271
|
>
|
|
5289
5272
|
> export async function prepareKnowledgePieces(
|
|
@@ -5341,7 +5324,7 @@ function prepareTemplates(pipeline, tools, options) {
|
|
|
5341
5324
|
return __generator(this, function (_b) {
|
|
5342
5325
|
switch (_b.label) {
|
|
5343
5326
|
case 0:
|
|
5344
|
-
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ?
|
|
5327
|
+
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a;
|
|
5345
5328
|
templates = pipeline.templates, parameters = pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
|
|
5346
5329
|
// TODO: [main] !!!!! Apply samples to each template (if missing and is for the template defined)
|
|
5347
5330
|
TODO_USE(parameters);
|
|
@@ -5403,7 +5386,7 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
5403
5386
|
if (isPipelinePrepared(pipeline)) {
|
|
5404
5387
|
return [2 /*return*/, pipeline];
|
|
5405
5388
|
}
|
|
5406
|
-
rootDirname = options.rootDirname, _a = options.maxParallelCount, maxParallelCount = _a === void 0 ?
|
|
5389
|
+
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;
|
|
5407
5390
|
parameters = pipeline.parameters, templates = pipeline.templates, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
|
|
5408
5391
|
if (tools === undefined || tools.llm === undefined) {
|
|
5409
5392
|
throw new MissingToolsError('LLM tools are required for preparing the pipeline');
|
|
@@ -5461,7 +5444,9 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
5461
5444
|
// ----- /Templates preparation -----
|
|
5462
5445
|
// Note: Count total usage
|
|
5463
5446
|
currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
|
|
5464
|
-
return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { templates:
|
|
5447
|
+
return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { templates: __spreadArray([], __read(templatesPrepared), false),
|
|
5448
|
+
// <- TODO: [🪓] Here should be no need for spreading new array, just ` templates: templatesPrepared`
|
|
5449
|
+
knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: __spreadArray([], __read(preparations), false) }))];
|
|
5465
5450
|
}
|
|
5466
5451
|
});
|
|
5467
5452
|
});
|
|
@@ -8394,7 +8379,7 @@ function $registeredLlmToolsMessage() {
|
|
|
8394
8379
|
*/
|
|
8395
8380
|
function createLlmToolsFromConfiguration(configuration, options) {
|
|
8396
8381
|
if (options === void 0) { options = {}; }
|
|
8397
|
-
var _a = options.isVerbose, isVerbose = _a === void 0 ?
|
|
8382
|
+
var _a = options.isVerbose, isVerbose = _a === void 0 ? DEFAULT_IS_VERBOSE : _a, userId = options.userId;
|
|
8398
8383
|
var llmTools = configuration.map(function (llmConfiguration) {
|
|
8399
8384
|
var registeredItem = $llmToolsRegister
|
|
8400
8385
|
.list()
|
|
@@ -8405,7 +8390,7 @@ function createLlmToolsFromConfiguration(configuration, options) {
|
|
|
8405
8390
|
if (registeredItem === undefined) {
|
|
8406
8391
|
throw new Error(spaceTrim$1(function (block) { return "\n There is no constructor for LLM provider `".concat(llmConfiguration.className, "` from `").concat(llmConfiguration.packageName, "`\n\n You have probably forgotten install and import the provider package.\n To fix this issue, you can:\n\n Install:\n\n > npm install ").concat(llmConfiguration.packageName, "\n\n And import:\n\n > import '").concat(llmConfiguration.packageName, "';\n\n\n ").concat(block($registeredLlmToolsMessage()), "\n "); }));
|
|
8407
8392
|
}
|
|
8408
|
-
return registeredItem(__assign({ isVerbose: isVerbose }, llmConfiguration.options));
|
|
8393
|
+
return registeredItem(__assign({ isVerbose: isVerbose, userId: userId }, llmConfiguration.options));
|
|
8409
8394
|
});
|
|
8410
8395
|
return joinLlmExecutionTools.apply(void 0, __spreadArray([], __read(llmTools), false));
|
|
8411
8396
|
}
|
|
@@ -8455,6 +8440,34 @@ function $provideLlmToolsFromEnv(options) {
|
|
|
8455
8440
|
* TODO: [®] DRY Register logic
|
|
8456
8441
|
*/
|
|
8457
8442
|
|
|
8443
|
+
/**
|
|
8444
|
+
* @@@
|
|
8445
|
+
*
|
|
8446
|
+
* @public exported from `@promptbook/node`
|
|
8447
|
+
*/
|
|
8448
|
+
function $provideExecutablesForNode(options) {
|
|
8449
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
8450
|
+
var _a, _b, isAutoInstalled, _c, isVerbose;
|
|
8451
|
+
return __generator(this, function (_d) {
|
|
8452
|
+
if (!$isRunningInNode()) {
|
|
8453
|
+
throw new EnvironmentMismatchError('Function `$getScrapersForNode` works only in Node.js environment');
|
|
8454
|
+
}
|
|
8455
|
+
_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;
|
|
8456
|
+
TODO_USE(isAutoInstalled);
|
|
8457
|
+
TODO_USE(isVerbose);
|
|
8458
|
+
return [2 /*return*/, {
|
|
8459
|
+
// TODO: !!!!!! use `locate-app` library here
|
|
8460
|
+
pandocPath: 'C:/Users/me/AppData/Local/Pandoc/pandoc.exe',
|
|
8461
|
+
libreOfficePath: 'C:/Program Files/LibreOffice/program/swriter.exe',
|
|
8462
|
+
}];
|
|
8463
|
+
});
|
|
8464
|
+
});
|
|
8465
|
+
}
|
|
8466
|
+
/**
|
|
8467
|
+
* TODO: [🧠] THis should be maybe in different folder
|
|
8468
|
+
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
8469
|
+
*/
|
|
8470
|
+
|
|
8458
8471
|
/**
|
|
8459
8472
|
* @@@
|
|
8460
8473
|
*
|
|
@@ -8464,7 +8477,7 @@ function $provideFilesystemForNode(options) {
|
|
|
8464
8477
|
if (!$isRunningInNode()) {
|
|
8465
8478
|
throw new EnvironmentMismatchError('Function `$provideFilesystemForNode` works only in Node.js environment');
|
|
8466
8479
|
}
|
|
8467
|
-
var _a = (options || {}).isVerbose, isVerbose = _a === void 0 ?
|
|
8480
|
+
var _a = (options || {}).isVerbose, isVerbose = _a === void 0 ? DEFAULT_IS_VERBOSE : _a;
|
|
8468
8481
|
TODO_USE(isVerbose);
|
|
8469
8482
|
return {
|
|
8470
8483
|
stat: stat,
|
|
@@ -8479,7 +8492,7 @@ function $provideFilesystemForNode(options) {
|
|
|
8479
8492
|
*/
|
|
8480
8493
|
|
|
8481
8494
|
/**
|
|
8482
|
-
*
|
|
8495
|
+
* @@@
|
|
8483
8496
|
*
|
|
8484
8497
|
* 1) @@@
|
|
8485
8498
|
* 2) @@@
|
|
@@ -8496,7 +8509,7 @@ function $provideScrapersForNode(tools, options) {
|
|
|
8496
8509
|
if (!$isRunningInNode()) {
|
|
8497
8510
|
throw new EnvironmentMismatchError('Function `$getScrapersForNode` works only in Node.js environment');
|
|
8498
8511
|
}
|
|
8499
|
-
_a = options || {}, _b = _a.isAutoInstalled, isAutoInstalled = _b === void 0 ?
|
|
8512
|
+
_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;
|
|
8500
8513
|
TODO_USE(isAutoInstalled);
|
|
8501
8514
|
TODO_USE(isVerbose);
|
|
8502
8515
|
scrapers = [];
|
|
@@ -8990,7 +9003,7 @@ var JavascriptExecutionTools = JavascriptEvalExecutionTools;
|
|
|
8990
9003
|
*/
|
|
8991
9004
|
function $provideExecutionToolsForNode(options) {
|
|
8992
9005
|
return __awaiter(this, void 0, void 0, function () {
|
|
8993
|
-
var fs, llm, tools;
|
|
9006
|
+
var fs, llm, executables, tools;
|
|
8994
9007
|
var _a;
|
|
8995
9008
|
return __generator(this, function (_b) {
|
|
8996
9009
|
switch (_b.label) {
|
|
@@ -9000,12 +9013,16 @@ function $provideExecutionToolsForNode(options) {
|
|
|
9000
9013
|
}
|
|
9001
9014
|
fs = $provideFilesystemForNode();
|
|
9002
9015
|
llm = $provideLlmToolsFromEnv(options);
|
|
9016
|
+
return [4 /*yield*/, $provideExecutablesForNode(options)];
|
|
9017
|
+
case 1:
|
|
9018
|
+
executables = _b.sent();
|
|
9003
9019
|
_a = {
|
|
9004
9020
|
llm: llm,
|
|
9005
|
-
fs: fs
|
|
9021
|
+
fs: fs,
|
|
9022
|
+
executables: executables
|
|
9006
9023
|
};
|
|
9007
|
-
return [4 /*yield*/, $provideScrapersForNode({ fs: fs, llm: llm }, options)];
|
|
9008
|
-
case
|
|
9024
|
+
return [4 /*yield*/, $provideScrapersForNode({ fs: fs, llm: llm, executables: executables }, options)];
|
|
9025
|
+
case 2:
|
|
9009
9026
|
tools = (_a.scrapers = _b.sent(),
|
|
9010
9027
|
_a.script = [new JavascriptExecutionTools(options)],
|
|
9011
9028
|
_a);
|
|
@@ -9243,7 +9260,9 @@ function createCollectionFromDirectory(path, tools, options) {
|
|
|
9243
9260
|
throw new EnvironmentMismatchError('Can not create collection without filesystem tools');
|
|
9244
9261
|
// <- TODO: [🧠] What is the best error type here`
|
|
9245
9262
|
}
|
|
9246
|
-
makedLibraryFilePath = join(path, "".concat(
|
|
9263
|
+
makedLibraryFilePath = join(path, "".concat(DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME
|
|
9264
|
+
// <- TODO: [🦒] Allow to override (pass different value into the function)
|
|
9265
|
+
, ".json"));
|
|
9247
9266
|
return [4 /*yield*/, isFileExisting(makedLibraryFilePath, tools.fs)];
|
|
9248
9267
|
case 3:
|
|
9249
9268
|
if (!(_f.sent())) {
|
|
@@ -9254,7 +9273,7 @@ function createCollectionFromDirectory(path, tools, options) {
|
|
|
9254
9273
|
// TODO: !! Implement;
|
|
9255
9274
|
// TODO: [🌗]
|
|
9256
9275
|
}
|
|
9257
|
-
_a = options || {}, _b = _a.isRecursive, isRecursive = _b === void 0 ? true : _b, _c = _a.isVerbose, isVerbose = _c === void 0 ?
|
|
9276
|
+
_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;
|
|
9258
9277
|
collection = createCollectionFromPromise(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
9259
9278
|
var fileNames, collection, _loop_1, fileNames_1, fileNames_1_1, fileName, e_1_1;
|
|
9260
9279
|
var e_1, _a;
|
|
@@ -9784,5 +9803,5 @@ function $execCommands(_a) {
|
|
|
9784
9803
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
9785
9804
|
*/
|
|
9786
9805
|
|
|
9787
|
-
export { $execCommand, $execCommands, $provideExecutionToolsForNode, $provideFilesystemForNode, $provideLlmToolsConfigurationFromEnv, $provideLlmToolsFromEnv, $provideScrapersForNode, FileCacheStorage, PROMPTBOOK_VERSION, createCollectionFromDirectory };
|
|
9806
|
+
export { $execCommand, $execCommands, $provideExecutablesForNode, $provideExecutionToolsForNode, $provideFilesystemForNode, $provideLlmToolsConfigurationFromEnv, $provideLlmToolsFromEnv, $provideScrapersForNode, FileCacheStorage, PROMPTBOOK_VERSION, createCollectionFromDirectory };
|
|
9788
9807
|
//# sourceMappingURL=index.es.js.map
|