@promptbook/node 0.71.0-17 → 0.71.0-19
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 +2 -4
- package/esm/index.es.js +106 -87
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +24 -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/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 +4 -4
- package/esm/typings/src/llm-providers/remote/interfaces/PromptbookServer_Prompt_Response.d.ts +3 -3
- 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 +2 -2
- 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/_common/utils/makeKnowledgeSourceHandler.d.ts +1 -1
- 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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
#  Promptbook
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Build responsible, controlled and transparent applications on top of LLM models!
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -21,11 +21,9 @@ Supercharge your use of large language models
|
|
|
21
21
|
- ✨ **Support of [OpenAI o1 model](https://openai.com/o1/)**
|
|
22
22
|
|
|
23
23
|
<blockquote style="color: #ff8811">
|
|
24
|
-
<b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
|
|
24
|
+
<b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
|
|
25
25
|
</blockquote>
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
27
|
## 📦 Package `@promptbook/node`
|
|
30
28
|
|
|
31
29
|
- Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
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.71.0-
|
|
20
|
+
var PROMPTBOOK_VERSION = '0.71.0-18';
|
|
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') {
|
|
@@ -1028,8 +1027,7 @@ var PipelineExecutionError = /** @class */ (function (_super) {
|
|
|
1028
1027
|
* Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
|
|
1029
1028
|
*
|
|
1030
1029
|
* Note: Internal utility of `joinLlmExecutionTools` but exposed type
|
|
1031
|
-
* @public exported from `@promptbook/
|
|
1032
|
-
* TODO: !!!!!! Export as runtime class not just type
|
|
1030
|
+
* @public exported from `@promptbook/core`
|
|
1033
1031
|
*/
|
|
1034
1032
|
var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
1035
1033
|
/**
|
|
@@ -2099,6 +2097,7 @@ function assertsExecutionSuccessful(executionResult) {
|
|
|
2099
2097
|
}
|
|
2100
2098
|
}
|
|
2101
2099
|
/**
|
|
2100
|
+
* TODO: [🐚] This function should be removed OR changed OR be completely rewritten
|
|
2102
2101
|
* TODO: [🧠] Can this return type be better typed than void
|
|
2103
2102
|
*/
|
|
2104
2103
|
|
|
@@ -3405,12 +3404,11 @@ function checkExpectations(expectations, value) {
|
|
|
3405
3404
|
*/
|
|
3406
3405
|
function executeAttempts(options) {
|
|
3407
3406
|
return __awaiter(this, void 0, void 0, function () {
|
|
3408
|
-
var jokerParameterNames, priority, maxAttempts, preparedContent, parameters, template, preparedPipeline, tools,
|
|
3407
|
+
var jokerParameterNames, priority, maxAttempts, preparedContent, parameters, template, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, $ongoingTemplateResult, _llms, llmTools, _loop_1, attempt, state_1;
|
|
3409
3408
|
return __generator(this, function (_a) {
|
|
3410
3409
|
switch (_a.label) {
|
|
3411
3410
|
case 0:
|
|
3412
|
-
jokerParameterNames = options.jokerParameterNames, priority = options.priority, maxAttempts = options.maxAttempts, preparedContent = options.preparedContent, parameters = options.parameters, template = options.template, preparedPipeline = options.preparedPipeline, tools = options.tools,
|
|
3413
|
-
maxExecutionAttempts = settings.maxExecutionAttempts;
|
|
3411
|
+
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;
|
|
3414
3412
|
$ongoingTemplateResult = {
|
|
3415
3413
|
$result: null,
|
|
3416
3414
|
$resultString: null,
|
|
@@ -3776,12 +3774,12 @@ function executeAttempts(options) {
|
|
|
3776
3774
|
*/
|
|
3777
3775
|
function executeFormatSubvalues(options) {
|
|
3778
3776
|
return __awaiter(this, void 0, void 0, function () {
|
|
3779
|
-
var template, jokerParameterNames, parameters, priority,
|
|
3777
|
+
var template, jokerParameterNames, parameters, priority, csvSettings, pipelineIdentification, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
|
|
3780
3778
|
var _this = this;
|
|
3781
3779
|
return __generator(this, function (_a) {
|
|
3782
3780
|
switch (_a.label) {
|
|
3783
3781
|
case 0:
|
|
3784
|
-
template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority,
|
|
3782
|
+
template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, csvSettings = options.csvSettings, pipelineIdentification = options.pipelineIdentification;
|
|
3785
3783
|
if (template.foreach === undefined) {
|
|
3786
3784
|
return [2 /*return*/, /* not await */ executeAttempts(options)];
|
|
3787
3785
|
}
|
|
@@ -3811,7 +3809,7 @@ function executeFormatSubvalues(options) {
|
|
|
3811
3809
|
.join('\n')), "\n\n [\u26F7] This should never happen because subformat name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
3812
3810
|
}
|
|
3813
3811
|
if (formatDefinition.formatName === 'CSV') {
|
|
3814
|
-
formatSettings =
|
|
3812
|
+
formatSettings = csvSettings;
|
|
3815
3813
|
// <- TODO: [🤹♂️] More universal, make simmilar pattern for other formats for example \n vs \r\n in text
|
|
3816
3814
|
}
|
|
3817
3815
|
return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, template.foreach.outputSubparameterName, formatSettings, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -3964,13 +3962,12 @@ function getReservedParametersForTemplate(options) {
|
|
|
3964
3962
|
*/
|
|
3965
3963
|
function executeTemplate(options) {
|
|
3966
3964
|
return __awaiter(this, void 0, void 0, function () {
|
|
3967
|
-
var currentTemplate, preparedPipeline, parametersToPass, tools, onProgress,
|
|
3968
|
-
var e_1,
|
|
3969
|
-
return __generator(this, function (
|
|
3970
|
-
switch (
|
|
3965
|
+
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;
|
|
3966
|
+
var e_1, _g, _h;
|
|
3967
|
+
return __generator(this, function (_j) {
|
|
3968
|
+
switch (_j.label) {
|
|
3971
3969
|
case 0:
|
|
3972
|
-
currentTemplate = options.currentTemplate, preparedPipeline = options.preparedPipeline, parametersToPass = options.parametersToPass, tools = options.tools, onProgress = options.onProgress,
|
|
3973
|
-
maxExecutionAttempts = settings.maxExecutionAttempts;
|
|
3970
|
+
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;
|
|
3974
3971
|
name = "pipeline-executor-frame-".concat(currentTemplate.name);
|
|
3975
3972
|
title = currentTemplate.title;
|
|
3976
3973
|
priority = preparedPipeline.templates.length - preparedPipeline.templates.indexOf(currentTemplate);
|
|
@@ -3985,7 +3982,7 @@ function executeTemplate(options) {
|
|
|
3985
3982
|
// <- [🍸]
|
|
3986
3983
|
})];
|
|
3987
3984
|
case 1:
|
|
3988
|
-
|
|
3985
|
+
_j.sent();
|
|
3989
3986
|
usedParameterNames = extractParameterNamesFromTemplate(currentTemplate);
|
|
3990
3987
|
dependentParameterNames = new Set(currentTemplate.dependentParameterNames);
|
|
3991
3988
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
@@ -3996,15 +3993,15 @@ function executeTemplate(options) {
|
|
|
3996
3993
|
.map(function (name) { return "{".concat(name, "}"); })
|
|
3997
3994
|
.join(', '), "\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
3998
3995
|
}
|
|
3999
|
-
|
|
4000
|
-
|
|
3996
|
+
_c = (_b = Object).freeze;
|
|
3997
|
+
_d = [{}];
|
|
4001
3998
|
return [4 /*yield*/, getReservedParametersForTemplate({
|
|
4002
3999
|
preparedPipeline: preparedPipeline,
|
|
4003
4000
|
template: currentTemplate,
|
|
4004
4001
|
pipelineIdentification: pipelineIdentification,
|
|
4005
4002
|
})];
|
|
4006
4003
|
case 2:
|
|
4007
|
-
definedParameters =
|
|
4004
|
+
definedParameters = _c.apply(_b, [__assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_j.sent())])), parametersToPass])]);
|
|
4008
4005
|
definedParameterNames = new Set(Object.keys(definedParameters));
|
|
4009
4006
|
parameters = {};
|
|
4010
4007
|
_loop_1 = function (parameterName) {
|
|
@@ -4024,15 +4021,15 @@ function executeTemplate(options) {
|
|
|
4024
4021
|
try {
|
|
4025
4022
|
// Note: [2] Check that all used parameters are defined and removing unused parameters for this template
|
|
4026
4023
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
4027
|
-
for (
|
|
4028
|
-
parameterName =
|
|
4024
|
+
for (_e = __values(Array.from(union(definedParameterNames, usedParameterNames, dependentParameterNames))), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
4025
|
+
parameterName = _f.value;
|
|
4029
4026
|
_loop_1(parameterName);
|
|
4030
4027
|
}
|
|
4031
4028
|
}
|
|
4032
4029
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
4033
4030
|
finally {
|
|
4034
4031
|
try {
|
|
4035
|
-
if (
|
|
4032
|
+
if (_f && !_f.done && (_g = _e.return)) _g.call(_e);
|
|
4036
4033
|
}
|
|
4037
4034
|
finally { if (e_1) throw e_1.error; }
|
|
4038
4035
|
}
|
|
@@ -4052,12 +4049,11 @@ function executeTemplate(options) {
|
|
|
4052
4049
|
template: currentTemplate,
|
|
4053
4050
|
preparedPipeline: preparedPipeline,
|
|
4054
4051
|
tools: tools,
|
|
4055
|
-
settings: settings,
|
|
4056
4052
|
$executionReport: $executionReport,
|
|
4057
4053
|
pipelineIdentification: pipelineIdentification,
|
|
4058
4054
|
})];
|
|
4059
4055
|
case 3:
|
|
4060
|
-
resultString =
|
|
4056
|
+
resultString = _j.sent();
|
|
4061
4057
|
return [4 /*yield*/, onProgress({
|
|
4062
4058
|
name: name,
|
|
4063
4059
|
title: title,
|
|
@@ -4069,12 +4065,12 @@ function executeTemplate(options) {
|
|
|
4069
4065
|
// <- [🍸]
|
|
4070
4066
|
})];
|
|
4071
4067
|
case 4:
|
|
4072
|
-
|
|
4073
|
-
return [2 /*return*/, Object.freeze((
|
|
4074
|
-
|
|
4068
|
+
_j.sent();
|
|
4069
|
+
return [2 /*return*/, Object.freeze((_h = {},
|
|
4070
|
+
_h[currentTemplate.resultingParameterName] =
|
|
4075
4071
|
// <- Note: [👩👩👧] No need to detect parameter collision here because pipeline checks logic consistency during construction
|
|
4076
4072
|
resultString,
|
|
4077
|
-
|
|
4073
|
+
_h))];
|
|
4078
4074
|
}
|
|
4079
4075
|
});
|
|
4080
4076
|
});
|
|
@@ -4133,13 +4129,12 @@ function filterJustOutputParameters(options) {
|
|
|
4133
4129
|
*/
|
|
4134
4130
|
function executePipeline(options) {
|
|
4135
4131
|
return __awaiter(this, void 0, void 0, function () {
|
|
4136
|
-
var inputParameters, tools, onProgress, pipeline, setPreparedPipeline, pipelineIdentification,
|
|
4132
|
+
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;
|
|
4137
4133
|
var e_1, _f, e_2, _g;
|
|
4138
4134
|
return __generator(this, function (_h) {
|
|
4139
4135
|
switch (_h.label) {
|
|
4140
4136
|
case 0:
|
|
4141
|
-
inputParameters = options.inputParameters, tools = options.tools, onProgress = options.onProgress, pipeline = options.pipeline, setPreparedPipeline = options.setPreparedPipeline, pipelineIdentification = options.pipelineIdentification,
|
|
4142
|
-
maxParallelCount = settings.maxParallelCount, rootDirname = settings.rootDirname, _a = settings.isVerbose, isVerbose = _a === void 0 ? IS_VERBOSE : _a;
|
|
4137
|
+
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;
|
|
4143
4138
|
preparedPipeline = options.preparedPipeline;
|
|
4144
4139
|
if (!(preparedPipeline === undefined)) return [3 /*break*/, 2];
|
|
4145
4140
|
return [4 /*yield*/, preparePipeline(pipeline, tools, {
|
|
@@ -4324,12 +4319,7 @@ function executePipeline(options) {
|
|
|
4324
4319
|
return [3 /*break*/, 4];
|
|
4325
4320
|
case 3:
|
|
4326
4321
|
unresovedTemplates_1 = unresovedTemplates_1.filter(function (template) { return template !== currentTemplate; });
|
|
4327
|
-
work_1 = executeTemplate({
|
|
4328
|
-
currentTemplate: currentTemplate,
|
|
4329
|
-
preparedPipeline: preparedPipeline,
|
|
4330
|
-
parametersToPass: parametersToPass,
|
|
4331
|
-
tools: tools,
|
|
4332
|
-
onProgress: function (progress) {
|
|
4322
|
+
work_1 = executeTemplate(__assign(__assign({}, options), { currentTemplate: currentTemplate, preparedPipeline: preparedPipeline, parametersToPass: parametersToPass, tools: tools, onProgress: function (progress) {
|
|
4333
4323
|
if (isReturned) {
|
|
4334
4324
|
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)
|
|
4335
4325
|
.split('\n')
|
|
@@ -4339,11 +4329,7 @@ function executePipeline(options) {
|
|
|
4339
4329
|
if (onProgress) {
|
|
4340
4330
|
onProgress(progress);
|
|
4341
4331
|
}
|
|
4342
|
-
},
|
|
4343
|
-
settings: settings,
|
|
4344
|
-
$executionReport: executionReport,
|
|
4345
|
-
pipelineIdentification: spaceTrim(function (block) { return "\n ".concat(block(pipelineIdentification), "\n Template name: ").concat(currentTemplate.name, "\n Template title: ").concat(currentTemplate.title, "\n "); }),
|
|
4346
|
-
})
|
|
4332
|
+
}, $executionReport: executionReport, pipelineIdentification: spaceTrim(function (block) { return "\n ".concat(block(pipelineIdentification), "\n Template name: ").concat(currentTemplate.name, "\n Template title: ").concat(currentTemplate.title, "\n "); }) }))
|
|
4347
4333
|
.then(function (newParametersToPass) {
|
|
4348
4334
|
parametersToPass = __assign(__assign({}, newParametersToPass), parametersToPass);
|
|
4349
4335
|
resovedParameterNames_1 = __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), [currentTemplate.resultingParameterName], false);
|
|
@@ -4447,8 +4433,7 @@ function executePipeline(options) {
|
|
|
4447
4433
|
*/
|
|
4448
4434
|
function createPipelineExecutor(options) {
|
|
4449
4435
|
var _this = this;
|
|
4450
|
-
var pipeline = options.pipeline, tools = options.tools, _a = options.
|
|
4451
|
-
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;
|
|
4436
|
+
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;
|
|
4452
4437
|
validatePipeline(pipeline);
|
|
4453
4438
|
var pipelineIdentification = (function () {
|
|
4454
4439
|
// Note: This is a 😐 implementation of [🚞]
|
|
@@ -4482,14 +4467,12 @@ function createPipelineExecutor(options) {
|
|
|
4482
4467
|
tools: tools,
|
|
4483
4468
|
onProgress: onProgress,
|
|
4484
4469
|
pipelineIdentification: spaceTrim(function (block) { return "\n ".concat(block(pipelineIdentification), "\n ").concat(runCount === 1 ? '' : "Run #".concat(runCount), "\n "); }),
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
rootDirname: rootDirname,
|
|
4492
|
-
},
|
|
4470
|
+
maxExecutionAttempts: maxExecutionAttempts,
|
|
4471
|
+
maxParallelCount: maxParallelCount,
|
|
4472
|
+
csvSettings: csvSettings,
|
|
4473
|
+
isVerbose: isVerbose,
|
|
4474
|
+
isNotPreparedWarningSupressed: isNotPreparedWarningSupressed,
|
|
4475
|
+
rootDirname: rootDirname,
|
|
4493
4476
|
})];
|
|
4494
4477
|
});
|
|
4495
4478
|
}); };
|
|
@@ -4512,7 +4495,7 @@ function preparePersona(personaDescription, tools, options) {
|
|
|
4512
4495
|
return __generator(this, function (_d) {
|
|
4513
4496
|
switch (_d.label) {
|
|
4514
4497
|
case 0:
|
|
4515
|
-
_a = options.isVerbose, isVerbose = _a === void 0 ?
|
|
4498
|
+
_a = options.isVerbose, isVerbose = _a === void 0 ? DEFAULT_IS_VERBOSE : _a;
|
|
4516
4499
|
if (tools === undefined || tools.llm === undefined) {
|
|
4517
4500
|
throw new MissingToolsError('LLM tools are required for preparing persona');
|
|
4518
4501
|
}
|
|
@@ -4694,7 +4677,7 @@ var $Register = /** @class */ (function () {
|
|
|
4694
4677
|
this.storage = globalScope[storageName];
|
|
4695
4678
|
}
|
|
4696
4679
|
$Register.prototype.list = function () {
|
|
4697
|
-
// <- TODO: ReadonlyDeep<
|
|
4680
|
+
// <- TODO: ReadonlyDeep<ReadonlyArray<TRegistered>>
|
|
4698
4681
|
return this.storage;
|
|
4699
4682
|
};
|
|
4700
4683
|
$Register.prototype.register = function (registered) {
|
|
@@ -4746,7 +4729,7 @@ var $scrapersRegister = new $Register('scraper_constructors');
|
|
|
4746
4729
|
* TODO: [®] DRY Register logic
|
|
4747
4730
|
*/
|
|
4748
4731
|
|
|
4749
|
-
// TODO: !!!!!! Maybe delete this function
|
|
4732
|
+
// TODO: !!!!!!last - Maybe delete this function
|
|
4750
4733
|
/**
|
|
4751
4734
|
* Creates a message with all registered scrapers
|
|
4752
4735
|
*
|
|
@@ -4913,7 +4896,6 @@ function normalizeToKebabCase(text) {
|
|
|
4913
4896
|
* @private within the repository
|
|
4914
4897
|
*/
|
|
4915
4898
|
function sourceContentToName(sourceContent) {
|
|
4916
|
-
// TODO: !!!!!! Better name for source than gibberish hash
|
|
4917
4899
|
var hash = SHA256(hexEncoder.parse(JSON.stringify(sourceContent)))
|
|
4918
4900
|
// <- TODO: [🥬] Encapsulate sha256 to some private utility function
|
|
4919
4901
|
.toString( /* hex */)
|
|
@@ -5013,7 +4995,7 @@ function isValidFilePath(filename) {
|
|
|
5013
4995
|
/**
|
|
5014
4996
|
* @@@
|
|
5015
4997
|
*
|
|
5016
|
-
* @
|
|
4998
|
+
* @public exported from `@promptbook/core`
|
|
5017
4999
|
*/
|
|
5018
5000
|
function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
5019
5001
|
var _a;
|
|
@@ -5026,7 +5008,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5026
5008
|
case 0:
|
|
5027
5009
|
sourceContent = knowledgeSource.sourceContent;
|
|
5028
5010
|
name = knowledgeSource.name;
|
|
5029
|
-
_b = options || {}, _c = _b.rootDirname, rootDirname = _c === void 0 ? null : _c, _d = _b.isVerbose, isVerbose = _d === void 0 ?
|
|
5011
|
+
_b = options || {}, _c = _b.rootDirname, rootDirname = _c === void 0 ? null : _c, _d = _b.isVerbose, isVerbose = _d === void 0 ? DEFAULT_IS_VERBOSE : _d;
|
|
5030
5012
|
TODO_USE(isVerbose);
|
|
5031
5013
|
if (!name) {
|
|
5032
5014
|
name = sourceContentToName(sourceContent);
|
|
@@ -5116,7 +5098,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5116
5098
|
content = _a.sent();
|
|
5117
5099
|
return [2 /*return*/, new Blob([
|
|
5118
5100
|
content,
|
|
5119
|
-
// <- TODO: !!!!!!
|
|
5101
|
+
// <- TODO: !!!!!! Test that this is working
|
|
5120
5102
|
], { type: mimeType_1 })];
|
|
5121
5103
|
}
|
|
5122
5104
|
});
|
|
@@ -5179,7 +5161,7 @@ function prepareKnowledgePieces(knowledgeSources, tools, options) {
|
|
|
5179
5161
|
return __generator(this, function (_c) {
|
|
5180
5162
|
switch (_c.label) {
|
|
5181
5163
|
case 0:
|
|
5182
|
-
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ?
|
|
5164
|
+
_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;
|
|
5183
5165
|
knowledgePreparedUnflatten = new Array(knowledgeSources.length);
|
|
5184
5166
|
return [4 /*yield*/, forEachAsync(knowledgeSources, { maxParallelCount: maxParallelCount }, function (knowledgeSource, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
5185
5167
|
var partialPieces, sourceHandler, _a, _b, scraper, partialPiecesUnchecked, e_1_1, pieces;
|
|
@@ -5208,7 +5190,8 @@ function prepareKnowledgePieces(knowledgeSources, tools, options) {
|
|
|
5208
5190
|
case 4:
|
|
5209
5191
|
partialPiecesUnchecked = _d.sent();
|
|
5210
5192
|
if (partialPiecesUnchecked !== null) {
|
|
5211
|
-
partialPieces = partialPiecesUnchecked;
|
|
5193
|
+
partialPieces = __spreadArray([], __read(partialPiecesUnchecked), false);
|
|
5194
|
+
// <- TODO: [🪓] Here should be no need for spreading new array, just `partialPieces = partialPiecesUnchecked`
|
|
5212
5195
|
return [3 /*break*/, 6];
|
|
5213
5196
|
}
|
|
5214
5197
|
_d.label = 5;
|
|
@@ -5256,7 +5239,7 @@ TODO: [🧊] This is how it can look in future
|
|
|
5256
5239
|
> /**
|
|
5257
5240
|
> * Unprepared knowledge
|
|
5258
5241
|
> * /
|
|
5259
|
-
> readonly knowledgeSources:
|
|
5242
|
+
> readonly knowledgeSources: ReadonlyArray<KnowledgeSourceJson>;
|
|
5260
5243
|
> };
|
|
5261
5244
|
>
|
|
5262
5245
|
> export async function prepareKnowledgePieces(
|
|
@@ -5314,7 +5297,7 @@ function prepareTemplates(pipeline, tools, options) {
|
|
|
5314
5297
|
return __generator(this, function (_b) {
|
|
5315
5298
|
switch (_b.label) {
|
|
5316
5299
|
case 0:
|
|
5317
|
-
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ?
|
|
5300
|
+
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a;
|
|
5318
5301
|
templates = pipeline.templates, parameters = pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
|
|
5319
5302
|
// TODO: [main] !!!!! Apply samples to each template (if missing and is for the template defined)
|
|
5320
5303
|
TODO_USE(parameters);
|
|
@@ -5376,7 +5359,7 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
5376
5359
|
if (isPipelinePrepared(pipeline)) {
|
|
5377
5360
|
return [2 /*return*/, pipeline];
|
|
5378
5361
|
}
|
|
5379
|
-
rootDirname = options.rootDirname, _a = options.maxParallelCount, maxParallelCount = _a === void 0 ?
|
|
5362
|
+
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;
|
|
5380
5363
|
parameters = pipeline.parameters, templates = pipeline.templates, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
|
|
5381
5364
|
if (tools === undefined || tools.llm === undefined) {
|
|
5382
5365
|
throw new MissingToolsError('LLM tools are required for preparing the pipeline');
|
|
@@ -5434,7 +5417,9 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
5434
5417
|
// ----- /Templates preparation -----
|
|
5435
5418
|
// Note: Count total usage
|
|
5436
5419
|
currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
|
|
5437
|
-
return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { templates:
|
|
5420
|
+
return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { templates: __spreadArray([], __read(templatesPrepared), false),
|
|
5421
|
+
// <- TODO: [🪓] Here should be no need for spreading new array, just ` templates: templatesPrepared`
|
|
5422
|
+
knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: __spreadArray([], __read(preparations), false) }))];
|
|
5438
5423
|
}
|
|
5439
5424
|
});
|
|
5440
5425
|
});
|
|
@@ -8367,7 +8352,7 @@ function $registeredLlmToolsMessage() {
|
|
|
8367
8352
|
*/
|
|
8368
8353
|
function createLlmToolsFromConfiguration(configuration, options) {
|
|
8369
8354
|
if (options === void 0) { options = {}; }
|
|
8370
|
-
var _a = options.isVerbose, isVerbose = _a === void 0 ?
|
|
8355
|
+
var _a = options.isVerbose, isVerbose = _a === void 0 ? DEFAULT_IS_VERBOSE : _a;
|
|
8371
8356
|
var llmTools = configuration.map(function (llmConfiguration) {
|
|
8372
8357
|
var registeredItem = $llmToolsRegister
|
|
8373
8358
|
.list()
|
|
@@ -8428,6 +8413,34 @@ function $provideLlmToolsFromEnv(options) {
|
|
|
8428
8413
|
* TODO: [®] DRY Register logic
|
|
8429
8414
|
*/
|
|
8430
8415
|
|
|
8416
|
+
/**
|
|
8417
|
+
* @@@
|
|
8418
|
+
*
|
|
8419
|
+
* @public exported from `@promptbook/node`
|
|
8420
|
+
*/
|
|
8421
|
+
function $provideExecutablesForNode(options) {
|
|
8422
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
8423
|
+
var _a, _b, isAutoInstalled, _c, isVerbose;
|
|
8424
|
+
return __generator(this, function (_d) {
|
|
8425
|
+
if (!$isRunningInNode()) {
|
|
8426
|
+
throw new EnvironmentMismatchError('Function `$getScrapersForNode` works only in Node.js environment');
|
|
8427
|
+
}
|
|
8428
|
+
_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;
|
|
8429
|
+
TODO_USE(isAutoInstalled);
|
|
8430
|
+
TODO_USE(isVerbose);
|
|
8431
|
+
return [2 /*return*/, {
|
|
8432
|
+
// TODO: !!!!!! use `locate-app` library here
|
|
8433
|
+
pandocPath: 'C:/Users/me/AppData/Local/Pandoc/pandoc.exe',
|
|
8434
|
+
libreOfficePath: 'C:/Program Files/LibreOffice/program/swriter.exe',
|
|
8435
|
+
}];
|
|
8436
|
+
});
|
|
8437
|
+
});
|
|
8438
|
+
}
|
|
8439
|
+
/**
|
|
8440
|
+
* TODO: [🧠] THis should be maybe in different folder
|
|
8441
|
+
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
8442
|
+
*/
|
|
8443
|
+
|
|
8431
8444
|
/**
|
|
8432
8445
|
* @@@
|
|
8433
8446
|
*
|
|
@@ -8437,7 +8450,7 @@ function $provideFilesystemForNode(options) {
|
|
|
8437
8450
|
if (!$isRunningInNode()) {
|
|
8438
8451
|
throw new EnvironmentMismatchError('Function `$provideFilesystemForNode` works only in Node.js environment');
|
|
8439
8452
|
}
|
|
8440
|
-
var _a = (options || {}).isVerbose, isVerbose = _a === void 0 ?
|
|
8453
|
+
var _a = (options || {}).isVerbose, isVerbose = _a === void 0 ? DEFAULT_IS_VERBOSE : _a;
|
|
8441
8454
|
TODO_USE(isVerbose);
|
|
8442
8455
|
return {
|
|
8443
8456
|
stat: stat,
|
|
@@ -8452,7 +8465,7 @@ function $provideFilesystemForNode(options) {
|
|
|
8452
8465
|
*/
|
|
8453
8466
|
|
|
8454
8467
|
/**
|
|
8455
|
-
*
|
|
8468
|
+
* @@@
|
|
8456
8469
|
*
|
|
8457
8470
|
* 1) @@@
|
|
8458
8471
|
* 2) @@@
|
|
@@ -8469,7 +8482,7 @@ function $provideScrapersForNode(tools, options) {
|
|
|
8469
8482
|
if (!$isRunningInNode()) {
|
|
8470
8483
|
throw new EnvironmentMismatchError('Function `$getScrapersForNode` works only in Node.js environment');
|
|
8471
8484
|
}
|
|
8472
|
-
_a = options || {}, _b = _a.isAutoInstalled, isAutoInstalled = _b === void 0 ?
|
|
8485
|
+
_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;
|
|
8473
8486
|
TODO_USE(isAutoInstalled);
|
|
8474
8487
|
TODO_USE(isVerbose);
|
|
8475
8488
|
scrapers = [];
|
|
@@ -8963,7 +8976,7 @@ var JavascriptExecutionTools = JavascriptEvalExecutionTools;
|
|
|
8963
8976
|
*/
|
|
8964
8977
|
function $provideExecutionToolsForNode(options) {
|
|
8965
8978
|
return __awaiter(this, void 0, void 0, function () {
|
|
8966
|
-
var fs, llm, tools;
|
|
8979
|
+
var fs, llm, executables, tools;
|
|
8967
8980
|
var _a;
|
|
8968
8981
|
return __generator(this, function (_b) {
|
|
8969
8982
|
switch (_b.label) {
|
|
@@ -8973,12 +8986,16 @@ function $provideExecutionToolsForNode(options) {
|
|
|
8973
8986
|
}
|
|
8974
8987
|
fs = $provideFilesystemForNode();
|
|
8975
8988
|
llm = $provideLlmToolsFromEnv(options);
|
|
8989
|
+
return [4 /*yield*/, $provideExecutablesForNode(options)];
|
|
8990
|
+
case 1:
|
|
8991
|
+
executables = _b.sent();
|
|
8976
8992
|
_a = {
|
|
8977
8993
|
llm: llm,
|
|
8978
|
-
fs: fs
|
|
8994
|
+
fs: fs,
|
|
8995
|
+
executables: executables
|
|
8979
8996
|
};
|
|
8980
|
-
return [4 /*yield*/, $provideScrapersForNode({ fs: fs, llm: llm }, options)];
|
|
8981
|
-
case
|
|
8997
|
+
return [4 /*yield*/, $provideScrapersForNode({ fs: fs, llm: llm, executables: executables }, options)];
|
|
8998
|
+
case 2:
|
|
8982
8999
|
tools = (_a.scrapers = _b.sent(),
|
|
8983
9000
|
_a.script = [new JavascriptExecutionTools(options)],
|
|
8984
9001
|
_a);
|
|
@@ -9216,7 +9233,9 @@ function createCollectionFromDirectory(path, tools, options) {
|
|
|
9216
9233
|
throw new EnvironmentMismatchError('Can not create collection without filesystem tools');
|
|
9217
9234
|
// <- TODO: [🧠] What is the best error type here`
|
|
9218
9235
|
}
|
|
9219
|
-
makedLibraryFilePath = join(path, "".concat(
|
|
9236
|
+
makedLibraryFilePath = join(path, "".concat(DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME
|
|
9237
|
+
// <- TODO: [🦒] Allow to override (pass different value into the function)
|
|
9238
|
+
, ".json"));
|
|
9220
9239
|
return [4 /*yield*/, isFileExisting(makedLibraryFilePath, tools.fs)];
|
|
9221
9240
|
case 3:
|
|
9222
9241
|
if (!(_f.sent())) {
|
|
@@ -9227,7 +9246,7 @@ function createCollectionFromDirectory(path, tools, options) {
|
|
|
9227
9246
|
// TODO: !! Implement;
|
|
9228
9247
|
// TODO: [🌗]
|
|
9229
9248
|
}
|
|
9230
|
-
_a = options || {}, _b = _a.isRecursive, isRecursive = _b === void 0 ? true : _b, _c = _a.isVerbose, isVerbose = _c === void 0 ?
|
|
9249
|
+
_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;
|
|
9231
9250
|
collection = createCollectionFromPromise(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
9232
9251
|
var fileNames, collection, _loop_1, fileNames_1, fileNames_1_1, fileName, e_1_1;
|
|
9233
9252
|
var e_1, _a;
|
|
@@ -9757,5 +9776,5 @@ function $execCommands(_a) {
|
|
|
9757
9776
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
9758
9777
|
*/
|
|
9759
9778
|
|
|
9760
|
-
export { $execCommand, $execCommands, $provideExecutionToolsForNode, $provideFilesystemForNode, $provideLlmToolsConfigurationFromEnv, $provideLlmToolsFromEnv, $provideScrapersForNode, FileCacheStorage, PROMPTBOOK_VERSION, createCollectionFromDirectory };
|
|
9779
|
+
export { $execCommand, $execCommands, $provideExecutablesForNode, $provideExecutionToolsForNode, $provideFilesystemForNode, $provideLlmToolsConfigurationFromEnv, $provideLlmToolsFromEnv, $provideScrapersForNode, FileCacheStorage, PROMPTBOOK_VERSION, createCollectionFromDirectory };
|
|
9761
9780
|
//# sourceMappingURL=index.es.js.map
|