@promptbook/core 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 +86 -91
- 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 +3 -2
- package/umd/index.umd.js +97 -99
- 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/core`
|
|
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
|
@@ -14,7 +14,7 @@ import moment from 'moment';
|
|
|
14
14
|
/**
|
|
15
15
|
* The version of the Promptbook library
|
|
16
16
|
*/
|
|
17
|
-
var PROMPTBOOK_VERSION = '0.71.0-
|
|
17
|
+
var PROMPTBOOK_VERSION = '0.71.0-18';
|
|
18
18
|
// TODO: [main] !!!! List here all the versions and annotate + put into script
|
|
19
19
|
|
|
20
20
|
/*! *****************************************************************************
|
|
@@ -221,7 +221,6 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
221
221
|
pipelineString += '\n\n';
|
|
222
222
|
pipelineString += description;
|
|
223
223
|
}
|
|
224
|
-
// TODO:> const commands: Array<Command>
|
|
225
224
|
var commands = [];
|
|
226
225
|
if (pipelineUrl) {
|
|
227
226
|
commands.push("PIPELINE URL ".concat(pipelineUrl));
|
|
@@ -277,7 +276,6 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
277
276
|
pipelineString += '\n\n';
|
|
278
277
|
pipelineString += description_1;
|
|
279
278
|
}
|
|
280
|
-
// TODO:> const commands: Array<Command>
|
|
281
279
|
var commands_1 = [];
|
|
282
280
|
var contentLanguage = 'text';
|
|
283
281
|
if (templateType === 'PROMPT_TEMPLATE') {
|
|
@@ -637,7 +635,7 @@ var GENERATOR_WARNING = "\u26A0\uFE0F WARNING: This code has been generated so t
|
|
|
637
635
|
*
|
|
638
636
|
* @public exported from `@promptbook/core`
|
|
639
637
|
*/
|
|
640
|
-
var CLAIM = "
|
|
638
|
+
var CLAIM = "Build responsible, controlled and transparent applications on top of LLM models!";
|
|
641
639
|
// <- TODO: [🧠] Better system for generator warnings - not always "code" and "by `@promptbook/cli`"
|
|
642
640
|
/**
|
|
643
641
|
* The maximum number of iterations for a loops
|
|
@@ -652,37 +650,44 @@ var LOOP_LIMIT = 1000;
|
|
|
652
650
|
*/
|
|
653
651
|
var IMMEDIATE_TIME = 10;
|
|
654
652
|
/**
|
|
655
|
-
* The maximum
|
|
653
|
+
* The maximum length of the (generated) filename
|
|
656
654
|
*
|
|
657
655
|
* @public exported from `@promptbook/core`
|
|
658
656
|
*/
|
|
659
|
-
var
|
|
657
|
+
var MAX_FILENAME_LENGTH = 30;
|
|
660
658
|
/**
|
|
661
|
-
*
|
|
659
|
+
* Strategy for caching the intermediate results for knowledge sources
|
|
662
660
|
*
|
|
663
661
|
* @public exported from `@promptbook/core`
|
|
664
662
|
*/
|
|
665
|
-
var
|
|
663
|
+
var DEFAULT_INTERMEDIATE_FILES_STRATEGY = 'HIDE_AND_KEEP';
|
|
664
|
+
// <- TODO: [😡] Change to 'VISIBLE'
|
|
666
665
|
/**
|
|
667
|
-
* The maximum
|
|
666
|
+
* The maximum number of (LLM) tasks running in parallel
|
|
668
667
|
*
|
|
669
668
|
* @public exported from `@promptbook/core`
|
|
670
669
|
*/
|
|
671
|
-
var
|
|
670
|
+
var DEFAULT_MAX_PARALLEL_COUNT = 5; // <- TODO: [🤹♂️]
|
|
671
|
+
/**
|
|
672
|
+
* The maximum number of attempts to execute LLM task before giving up
|
|
673
|
+
*
|
|
674
|
+
* @public exported from `@promptbook/core`
|
|
675
|
+
*/
|
|
676
|
+
var DEFAULT_MAX_EXECUTION_ATTEMPTS = 3; // <- TODO: [🤹♂️]
|
|
672
677
|
/**
|
|
673
678
|
* @@@
|
|
674
679
|
* TODO: [🐝][main] !!! Use
|
|
675
680
|
*
|
|
676
681
|
* @public exported from `@promptbook/core`
|
|
677
682
|
*/
|
|
678
|
-
var
|
|
683
|
+
var DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH = 3;
|
|
679
684
|
/**
|
|
680
685
|
* @@@
|
|
681
686
|
* TODO: [🐝][main] !!! Use
|
|
682
687
|
*
|
|
683
688
|
* @public exported from `@promptbook/core`
|
|
684
689
|
*/
|
|
685
|
-
var
|
|
690
|
+
var DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL = 200;
|
|
686
691
|
/**
|
|
687
692
|
* Where to store the cache of executions for promptbook CLI
|
|
688
693
|
*
|
|
@@ -690,7 +695,7 @@ var MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL = 200;
|
|
|
690
695
|
*
|
|
691
696
|
* @public exported from `@promptbook/core`
|
|
692
697
|
*/
|
|
693
|
-
var
|
|
698
|
+
var DEFAULT_EXECUTIONS_CACHE_DIRNAME = '/.promptbook/executions-cache';
|
|
694
699
|
/**
|
|
695
700
|
* Where to store the scrape cache
|
|
696
701
|
*
|
|
@@ -698,13 +703,13 @@ var EXECUTIONS_CACHE_DIRNAME = '/.promptbook/executions-cache';
|
|
|
698
703
|
*
|
|
699
704
|
* @public exported from `@promptbook/core`
|
|
700
705
|
*/
|
|
701
|
-
var
|
|
706
|
+
var DEFAULT_SCRAPE_CACHE_DIRNAME = '/.promptbook/scrape-cache';
|
|
702
707
|
/**
|
|
703
708
|
* The name of the builded pipeline collection made by CLI `ptbk make` and for lookup in `createCollectionFromDirectory`
|
|
704
709
|
*
|
|
705
710
|
* @public exported from `@promptbook/core`
|
|
706
711
|
*/
|
|
707
|
-
var
|
|
712
|
+
var DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME = "index";
|
|
708
713
|
/**
|
|
709
714
|
* Nonce which is used for replacing things in strings
|
|
710
715
|
*
|
|
@@ -777,13 +782,13 @@ var DEFAULT_CSV_SETTINGS = Object.freeze({
|
|
|
777
782
|
*
|
|
778
783
|
* @public exported from `@promptbook/core`
|
|
779
784
|
*/
|
|
780
|
-
var
|
|
785
|
+
var DEFAULT_IS_VERBOSE = false;
|
|
781
786
|
/**
|
|
782
787
|
* @@@
|
|
783
788
|
*
|
|
784
789
|
* @public exported from `@promptbook/core`
|
|
785
790
|
*/
|
|
786
|
-
var
|
|
791
|
+
var DEFAULT_IS_AUTO_INSTALLED = false;
|
|
787
792
|
/**
|
|
788
793
|
* @@@
|
|
789
794
|
*
|
|
@@ -1532,7 +1537,7 @@ function createCollectionFromUrl(url, options) {
|
|
|
1532
1537
|
return __generator(this, function (_d) {
|
|
1533
1538
|
switch (_d.label) {
|
|
1534
1539
|
case 0:
|
|
1535
|
-
_a = options || {}, _b = _a.isVerbose, isVerbose = _b === void 0 ?
|
|
1540
|
+
_a = options || {}, _b = _a.isVerbose, isVerbose = _b === void 0 ? DEFAULT_IS_VERBOSE : _b, _c = _a.isLazyLoaded, isLazyLoaded = _c === void 0 ? false : _c;
|
|
1536
1541
|
collection = createCollectionFromPromise(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1537
1542
|
return __generator(this, function (_a) {
|
|
1538
1543
|
if (isVerbose) {
|
|
@@ -1973,8 +1978,7 @@ var PipelineExecutionError = /** @class */ (function (_super) {
|
|
|
1973
1978
|
* Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
|
|
1974
1979
|
*
|
|
1975
1980
|
* Note: Internal utility of `joinLlmExecutionTools` but exposed type
|
|
1976
|
-
* @public exported from `@promptbook/
|
|
1977
|
-
* TODO: !!!!!! Export as runtime class not just type
|
|
1981
|
+
* @public exported from `@promptbook/core`
|
|
1978
1982
|
*/
|
|
1979
1983
|
var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
1980
1984
|
/**
|
|
@@ -2408,6 +2412,7 @@ function assertsExecutionSuccessful(executionResult) {
|
|
|
2408
2412
|
}
|
|
2409
2413
|
}
|
|
2410
2414
|
/**
|
|
2415
|
+
* TODO: [🐚] This function should be removed OR changed OR be completely rewritten
|
|
2411
2416
|
* TODO: [🧠] Can this return type be better typed than void
|
|
2412
2417
|
*/
|
|
2413
2418
|
|
|
@@ -3736,12 +3741,11 @@ function isPassingExpectations(expectations, value) {
|
|
|
3736
3741
|
*/
|
|
3737
3742
|
function executeAttempts(options) {
|
|
3738
3743
|
return __awaiter(this, void 0, void 0, function () {
|
|
3739
|
-
var jokerParameterNames, priority, maxAttempts, preparedContent, parameters, template, preparedPipeline, tools,
|
|
3744
|
+
var jokerParameterNames, priority, maxAttempts, preparedContent, parameters, template, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, $ongoingTemplateResult, _llms, llmTools, _loop_1, attempt, state_1;
|
|
3740
3745
|
return __generator(this, function (_a) {
|
|
3741
3746
|
switch (_a.label) {
|
|
3742
3747
|
case 0:
|
|
3743
|
-
jokerParameterNames = options.jokerParameterNames, priority = options.priority, maxAttempts = options.maxAttempts, preparedContent = options.preparedContent, parameters = options.parameters, template = options.template, preparedPipeline = options.preparedPipeline, tools = options.tools,
|
|
3744
|
-
maxExecutionAttempts = settings.maxExecutionAttempts;
|
|
3748
|
+
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;
|
|
3745
3749
|
$ongoingTemplateResult = {
|
|
3746
3750
|
$result: null,
|
|
3747
3751
|
$resultString: null,
|
|
@@ -4107,12 +4111,12 @@ function executeAttempts(options) {
|
|
|
4107
4111
|
*/
|
|
4108
4112
|
function executeFormatSubvalues(options) {
|
|
4109
4113
|
return __awaiter(this, void 0, void 0, function () {
|
|
4110
|
-
var template, jokerParameterNames, parameters, priority,
|
|
4114
|
+
var template, jokerParameterNames, parameters, priority, csvSettings, pipelineIdentification, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
|
|
4111
4115
|
var _this = this;
|
|
4112
4116
|
return __generator(this, function (_a) {
|
|
4113
4117
|
switch (_a.label) {
|
|
4114
4118
|
case 0:
|
|
4115
|
-
template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority,
|
|
4119
|
+
template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, csvSettings = options.csvSettings, pipelineIdentification = options.pipelineIdentification;
|
|
4116
4120
|
if (template.foreach === undefined) {
|
|
4117
4121
|
return [2 /*return*/, /* not await */ executeAttempts(options)];
|
|
4118
4122
|
}
|
|
@@ -4142,7 +4146,7 @@ function executeFormatSubvalues(options) {
|
|
|
4142
4146
|
.join('\n')), "\n\n [\u26F7] This should never happen because subformat name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
4143
4147
|
}
|
|
4144
4148
|
if (formatDefinition.formatName === 'CSV') {
|
|
4145
|
-
formatSettings =
|
|
4149
|
+
formatSettings = csvSettings;
|
|
4146
4150
|
// <- TODO: [🤹♂️] More universal, make simmilar pattern for other formats for example \n vs \r\n in text
|
|
4147
4151
|
}
|
|
4148
4152
|
return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, template.foreach.outputSubparameterName, formatSettings, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -4295,13 +4299,12 @@ function getReservedParametersForTemplate(options) {
|
|
|
4295
4299
|
*/
|
|
4296
4300
|
function executeTemplate(options) {
|
|
4297
4301
|
return __awaiter(this, void 0, void 0, function () {
|
|
4298
|
-
var currentTemplate, preparedPipeline, parametersToPass, tools, onProgress,
|
|
4299
|
-
var e_1,
|
|
4300
|
-
return __generator(this, function (
|
|
4301
|
-
switch (
|
|
4302
|
+
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;
|
|
4303
|
+
var e_1, _g, _h;
|
|
4304
|
+
return __generator(this, function (_j) {
|
|
4305
|
+
switch (_j.label) {
|
|
4302
4306
|
case 0:
|
|
4303
|
-
currentTemplate = options.currentTemplate, preparedPipeline = options.preparedPipeline, parametersToPass = options.parametersToPass, tools = options.tools, onProgress = options.onProgress,
|
|
4304
|
-
maxExecutionAttempts = settings.maxExecutionAttempts;
|
|
4307
|
+
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;
|
|
4305
4308
|
name = "pipeline-executor-frame-".concat(currentTemplate.name);
|
|
4306
4309
|
title = currentTemplate.title;
|
|
4307
4310
|
priority = preparedPipeline.templates.length - preparedPipeline.templates.indexOf(currentTemplate);
|
|
@@ -4316,7 +4319,7 @@ function executeTemplate(options) {
|
|
|
4316
4319
|
// <- [🍸]
|
|
4317
4320
|
})];
|
|
4318
4321
|
case 1:
|
|
4319
|
-
|
|
4322
|
+
_j.sent();
|
|
4320
4323
|
usedParameterNames = extractParameterNamesFromTemplate(currentTemplate);
|
|
4321
4324
|
dependentParameterNames = new Set(currentTemplate.dependentParameterNames);
|
|
4322
4325
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
@@ -4327,15 +4330,15 @@ function executeTemplate(options) {
|
|
|
4327
4330
|
.map(function (name) { return "{".concat(name, "}"); })
|
|
4328
4331
|
.join(', '), "\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
4329
4332
|
}
|
|
4330
|
-
|
|
4331
|
-
|
|
4333
|
+
_c = (_b = Object).freeze;
|
|
4334
|
+
_d = [{}];
|
|
4332
4335
|
return [4 /*yield*/, getReservedParametersForTemplate({
|
|
4333
4336
|
preparedPipeline: preparedPipeline,
|
|
4334
4337
|
template: currentTemplate,
|
|
4335
4338
|
pipelineIdentification: pipelineIdentification,
|
|
4336
4339
|
})];
|
|
4337
4340
|
case 2:
|
|
4338
|
-
definedParameters =
|
|
4341
|
+
definedParameters = _c.apply(_b, [__assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_j.sent())])), parametersToPass])]);
|
|
4339
4342
|
definedParameterNames = new Set(Object.keys(definedParameters));
|
|
4340
4343
|
parameters = {};
|
|
4341
4344
|
_loop_1 = function (parameterName) {
|
|
@@ -4355,15 +4358,15 @@ function executeTemplate(options) {
|
|
|
4355
4358
|
try {
|
|
4356
4359
|
// Note: [2] Check that all used parameters are defined and removing unused parameters for this template
|
|
4357
4360
|
// TODO: [👩🏾🤝👩🏻] Use here `mapAvailableToExpectedParameters`
|
|
4358
|
-
for (
|
|
4359
|
-
parameterName =
|
|
4361
|
+
for (_e = __values(Array.from(union(definedParameterNames, usedParameterNames, dependentParameterNames))), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
4362
|
+
parameterName = _f.value;
|
|
4360
4363
|
_loop_1(parameterName);
|
|
4361
4364
|
}
|
|
4362
4365
|
}
|
|
4363
4366
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
4364
4367
|
finally {
|
|
4365
4368
|
try {
|
|
4366
|
-
if (
|
|
4369
|
+
if (_f && !_f.done && (_g = _e.return)) _g.call(_e);
|
|
4367
4370
|
}
|
|
4368
4371
|
finally { if (e_1) throw e_1.error; }
|
|
4369
4372
|
}
|
|
@@ -4383,12 +4386,11 @@ function executeTemplate(options) {
|
|
|
4383
4386
|
template: currentTemplate,
|
|
4384
4387
|
preparedPipeline: preparedPipeline,
|
|
4385
4388
|
tools: tools,
|
|
4386
|
-
settings: settings,
|
|
4387
4389
|
$executionReport: $executionReport,
|
|
4388
4390
|
pipelineIdentification: pipelineIdentification,
|
|
4389
4391
|
})];
|
|
4390
4392
|
case 3:
|
|
4391
|
-
resultString =
|
|
4393
|
+
resultString = _j.sent();
|
|
4392
4394
|
return [4 /*yield*/, onProgress({
|
|
4393
4395
|
name: name,
|
|
4394
4396
|
title: title,
|
|
@@ -4400,12 +4402,12 @@ function executeTemplate(options) {
|
|
|
4400
4402
|
// <- [🍸]
|
|
4401
4403
|
})];
|
|
4402
4404
|
case 4:
|
|
4403
|
-
|
|
4404
|
-
return [2 /*return*/, Object.freeze((
|
|
4405
|
-
|
|
4405
|
+
_j.sent();
|
|
4406
|
+
return [2 /*return*/, Object.freeze((_h = {},
|
|
4407
|
+
_h[currentTemplate.resultingParameterName] =
|
|
4406
4408
|
// <- Note: [👩👩👧] No need to detect parameter collision here because pipeline checks logic consistency during construction
|
|
4407
4409
|
resultString,
|
|
4408
|
-
|
|
4410
|
+
_h))];
|
|
4409
4411
|
}
|
|
4410
4412
|
});
|
|
4411
4413
|
});
|
|
@@ -4464,13 +4466,12 @@ function filterJustOutputParameters(options) {
|
|
|
4464
4466
|
*/
|
|
4465
4467
|
function executePipeline(options) {
|
|
4466
4468
|
return __awaiter(this, void 0, void 0, function () {
|
|
4467
|
-
var inputParameters, tools, onProgress, pipeline, setPreparedPipeline, pipelineIdentification,
|
|
4469
|
+
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;
|
|
4468
4470
|
var e_1, _f, e_2, _g;
|
|
4469
4471
|
return __generator(this, function (_h) {
|
|
4470
4472
|
switch (_h.label) {
|
|
4471
4473
|
case 0:
|
|
4472
|
-
inputParameters = options.inputParameters, tools = options.tools, onProgress = options.onProgress, pipeline = options.pipeline, setPreparedPipeline = options.setPreparedPipeline, pipelineIdentification = options.pipelineIdentification,
|
|
4473
|
-
maxParallelCount = settings.maxParallelCount, rootDirname = settings.rootDirname, _a = settings.isVerbose, isVerbose = _a === void 0 ? IS_VERBOSE : _a;
|
|
4474
|
+
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;
|
|
4474
4475
|
preparedPipeline = options.preparedPipeline;
|
|
4475
4476
|
if (!(preparedPipeline === undefined)) return [3 /*break*/, 2];
|
|
4476
4477
|
return [4 /*yield*/, preparePipeline(pipeline, tools, {
|
|
@@ -4655,12 +4656,7 @@ function executePipeline(options) {
|
|
|
4655
4656
|
return [3 /*break*/, 4];
|
|
4656
4657
|
case 3:
|
|
4657
4658
|
unresovedTemplates_1 = unresovedTemplates_1.filter(function (template) { return template !== currentTemplate; });
|
|
4658
|
-
work_1 = executeTemplate({
|
|
4659
|
-
currentTemplate: currentTemplate,
|
|
4660
|
-
preparedPipeline: preparedPipeline,
|
|
4661
|
-
parametersToPass: parametersToPass,
|
|
4662
|
-
tools: tools,
|
|
4663
|
-
onProgress: function (progress) {
|
|
4659
|
+
work_1 = executeTemplate(__assign(__assign({}, options), { currentTemplate: currentTemplate, preparedPipeline: preparedPipeline, parametersToPass: parametersToPass, tools: tools, onProgress: function (progress) {
|
|
4664
4660
|
if (isReturned) {
|
|
4665
4661
|
throw new UnexpectedError(spaceTrim$1(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)
|
|
4666
4662
|
.split('\n')
|
|
@@ -4670,11 +4666,7 @@ function executePipeline(options) {
|
|
|
4670
4666
|
if (onProgress) {
|
|
4671
4667
|
onProgress(progress);
|
|
4672
4668
|
}
|
|
4673
|
-
},
|
|
4674
|
-
settings: settings,
|
|
4675
|
-
$executionReport: executionReport,
|
|
4676
|
-
pipelineIdentification: spaceTrim$1(function (block) { return "\n ".concat(block(pipelineIdentification), "\n Template name: ").concat(currentTemplate.name, "\n Template title: ").concat(currentTemplate.title, "\n "); }),
|
|
4677
|
-
})
|
|
4669
|
+
}, $executionReport: executionReport, pipelineIdentification: spaceTrim$1(function (block) { return "\n ".concat(block(pipelineIdentification), "\n Template name: ").concat(currentTemplate.name, "\n Template title: ").concat(currentTemplate.title, "\n "); }) }))
|
|
4678
4670
|
.then(function (newParametersToPass) {
|
|
4679
4671
|
parametersToPass = __assign(__assign({}, newParametersToPass), parametersToPass);
|
|
4680
4672
|
resovedParameterNames_1 = __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), [currentTemplate.resultingParameterName], false);
|
|
@@ -4778,8 +4770,7 @@ function executePipeline(options) {
|
|
|
4778
4770
|
*/
|
|
4779
4771
|
function createPipelineExecutor(options) {
|
|
4780
4772
|
var _this = this;
|
|
4781
|
-
var pipeline = options.pipeline, tools = options.tools, _a = options.
|
|
4782
|
-
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;
|
|
4773
|
+
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;
|
|
4783
4774
|
validatePipeline(pipeline);
|
|
4784
4775
|
var pipelineIdentification = (function () {
|
|
4785
4776
|
// Note: This is a 😐 implementation of [🚞]
|
|
@@ -4813,14 +4804,12 @@ function createPipelineExecutor(options) {
|
|
|
4813
4804
|
tools: tools,
|
|
4814
4805
|
onProgress: onProgress,
|
|
4815
4806
|
pipelineIdentification: spaceTrim$1(function (block) { return "\n ".concat(block(pipelineIdentification), "\n ").concat(runCount === 1 ? '' : "Run #".concat(runCount), "\n "); }),
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
rootDirname: rootDirname,
|
|
4823
|
-
},
|
|
4807
|
+
maxExecutionAttempts: maxExecutionAttempts,
|
|
4808
|
+
maxParallelCount: maxParallelCount,
|
|
4809
|
+
csvSettings: csvSettings,
|
|
4810
|
+
isVerbose: isVerbose,
|
|
4811
|
+
isNotPreparedWarningSupressed: isNotPreparedWarningSupressed,
|
|
4812
|
+
rootDirname: rootDirname,
|
|
4824
4813
|
})];
|
|
4825
4814
|
});
|
|
4826
4815
|
}); };
|
|
@@ -4843,7 +4832,7 @@ function preparePersona(personaDescription, tools, options) {
|
|
|
4843
4832
|
return __generator(this, function (_d) {
|
|
4844
4833
|
switch (_d.label) {
|
|
4845
4834
|
case 0:
|
|
4846
|
-
_a = options.isVerbose, isVerbose = _a === void 0 ?
|
|
4835
|
+
_a = options.isVerbose, isVerbose = _a === void 0 ? DEFAULT_IS_VERBOSE : _a;
|
|
4847
4836
|
if (tools === undefined || tools.llm === undefined) {
|
|
4848
4837
|
throw new MissingToolsError('LLM tools are required for preparing persona');
|
|
4849
4838
|
}
|
|
@@ -5025,7 +5014,7 @@ var $Register = /** @class */ (function () {
|
|
|
5025
5014
|
this.storage = globalScope[storageName];
|
|
5026
5015
|
}
|
|
5027
5016
|
$Register.prototype.list = function () {
|
|
5028
|
-
// <- TODO: ReadonlyDeep<
|
|
5017
|
+
// <- TODO: ReadonlyDeep<ReadonlyArray<TRegistered>>
|
|
5029
5018
|
return this.storage;
|
|
5030
5019
|
};
|
|
5031
5020
|
$Register.prototype.register = function (registered) {
|
|
@@ -5077,7 +5066,7 @@ var $scrapersRegister = new $Register('scraper_constructors');
|
|
|
5077
5066
|
* TODO: [®] DRY Register logic
|
|
5078
5067
|
*/
|
|
5079
5068
|
|
|
5080
|
-
// TODO: !!!!!! Maybe delete this function
|
|
5069
|
+
// TODO: !!!!!!last - Maybe delete this function
|
|
5081
5070
|
/**
|
|
5082
5071
|
* Creates a message with all registered scrapers
|
|
5083
5072
|
*
|
|
@@ -5244,7 +5233,6 @@ function normalizeToKebabCase(text) {
|
|
|
5244
5233
|
* @private within the repository
|
|
5245
5234
|
*/
|
|
5246
5235
|
function sourceContentToName(sourceContent) {
|
|
5247
|
-
// TODO: !!!!!! Better name for source than gibberish hash
|
|
5248
5236
|
var hash = SHA256(hexEncoder.parse(JSON.stringify(sourceContent)))
|
|
5249
5237
|
// <- TODO: [🥬] Encapsulate sha256 to some private utility function
|
|
5250
5238
|
.toString( /* hex */)
|
|
@@ -5344,7 +5332,7 @@ function isValidFilePath(filename) {
|
|
|
5344
5332
|
/**
|
|
5345
5333
|
* @@@
|
|
5346
5334
|
*
|
|
5347
|
-
* @
|
|
5335
|
+
* @public exported from `@promptbook/core`
|
|
5348
5336
|
*/
|
|
5349
5337
|
function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
5350
5338
|
var _a;
|
|
@@ -5357,7 +5345,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5357
5345
|
case 0:
|
|
5358
5346
|
sourceContent = knowledgeSource.sourceContent;
|
|
5359
5347
|
name = knowledgeSource.name;
|
|
5360
|
-
_b = options || {}, _c = _b.rootDirname, rootDirname = _c === void 0 ? null : _c, _d = _b.isVerbose, isVerbose = _d === void 0 ?
|
|
5348
|
+
_b = options || {}, _c = _b.rootDirname, rootDirname = _c === void 0 ? null : _c, _d = _b.isVerbose, isVerbose = _d === void 0 ? DEFAULT_IS_VERBOSE : _d;
|
|
5361
5349
|
TODO_USE(isVerbose);
|
|
5362
5350
|
if (!name) {
|
|
5363
5351
|
name = sourceContentToName(sourceContent);
|
|
@@ -5447,7 +5435,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5447
5435
|
content = _a.sent();
|
|
5448
5436
|
return [2 /*return*/, new Blob([
|
|
5449
5437
|
content,
|
|
5450
|
-
// <- TODO: !!!!!!
|
|
5438
|
+
// <- TODO: !!!!!! Test that this is working
|
|
5451
5439
|
], { type: mimeType_1 })];
|
|
5452
5440
|
}
|
|
5453
5441
|
});
|
|
@@ -5510,7 +5498,7 @@ function prepareKnowledgePieces(knowledgeSources, tools, options) {
|
|
|
5510
5498
|
return __generator(this, function (_c) {
|
|
5511
5499
|
switch (_c.label) {
|
|
5512
5500
|
case 0:
|
|
5513
|
-
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ?
|
|
5501
|
+
_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;
|
|
5514
5502
|
knowledgePreparedUnflatten = new Array(knowledgeSources.length);
|
|
5515
5503
|
return [4 /*yield*/, forEachAsync(knowledgeSources, { maxParallelCount: maxParallelCount }, function (knowledgeSource, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
5516
5504
|
var partialPieces, sourceHandler, _a, _b, scraper, partialPiecesUnchecked, e_1_1, pieces;
|
|
@@ -5539,7 +5527,8 @@ function prepareKnowledgePieces(knowledgeSources, tools, options) {
|
|
|
5539
5527
|
case 4:
|
|
5540
5528
|
partialPiecesUnchecked = _d.sent();
|
|
5541
5529
|
if (partialPiecesUnchecked !== null) {
|
|
5542
|
-
partialPieces = partialPiecesUnchecked;
|
|
5530
|
+
partialPieces = __spreadArray([], __read(partialPiecesUnchecked), false);
|
|
5531
|
+
// <- TODO: [🪓] Here should be no need for spreading new array, just `partialPieces = partialPiecesUnchecked`
|
|
5543
5532
|
return [3 /*break*/, 6];
|
|
5544
5533
|
}
|
|
5545
5534
|
_d.label = 5;
|
|
@@ -5587,7 +5576,7 @@ TODO: [🧊] This is how it can look in future
|
|
|
5587
5576
|
> /**
|
|
5588
5577
|
> * Unprepared knowledge
|
|
5589
5578
|
> * /
|
|
5590
|
-
> readonly knowledgeSources:
|
|
5579
|
+
> readonly knowledgeSources: ReadonlyArray<KnowledgeSourceJson>;
|
|
5591
5580
|
> };
|
|
5592
5581
|
>
|
|
5593
5582
|
> export async function prepareKnowledgePieces(
|
|
@@ -5645,7 +5634,7 @@ function prepareTemplates(pipeline, tools, options) {
|
|
|
5645
5634
|
return __generator(this, function (_b) {
|
|
5646
5635
|
switch (_b.label) {
|
|
5647
5636
|
case 0:
|
|
5648
|
-
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ?
|
|
5637
|
+
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a;
|
|
5649
5638
|
templates = pipeline.templates, parameters = pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
|
|
5650
5639
|
// TODO: [main] !!!!! Apply samples to each template (if missing and is for the template defined)
|
|
5651
5640
|
TODO_USE(parameters);
|
|
@@ -5707,7 +5696,7 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
5707
5696
|
if (isPipelinePrepared(pipeline)) {
|
|
5708
5697
|
return [2 /*return*/, pipeline];
|
|
5709
5698
|
}
|
|
5710
|
-
rootDirname = options.rootDirname, _a = options.maxParallelCount, maxParallelCount = _a === void 0 ?
|
|
5699
|
+
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;
|
|
5711
5700
|
parameters = pipeline.parameters, templates = pipeline.templates, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
|
|
5712
5701
|
if (tools === undefined || tools.llm === undefined) {
|
|
5713
5702
|
throw new MissingToolsError('LLM tools are required for preparing the pipeline');
|
|
@@ -5765,7 +5754,9 @@ function preparePipeline(pipeline, tools, options) {
|
|
|
5765
5754
|
// ----- /Templates preparation -----
|
|
5766
5755
|
// Note: Count total usage
|
|
5767
5756
|
currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
|
|
5768
|
-
return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { templates:
|
|
5757
|
+
return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { templates: __spreadArray([], __read(templatesPrepared), false),
|
|
5758
|
+
// <- TODO: [🪓] Here should be no need for spreading new array, just ` templates: templatesPrepared`
|
|
5759
|
+
knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: __spreadArray([], __read(preparations), false) }))];
|
|
5769
5760
|
}
|
|
5770
5761
|
});
|
|
5771
5762
|
});
|
|
@@ -8935,7 +8926,7 @@ function $registeredLlmToolsMessage() {
|
|
|
8935
8926
|
*/
|
|
8936
8927
|
function createLlmToolsFromConfiguration(configuration, options) {
|
|
8937
8928
|
if (options === void 0) { options = {}; }
|
|
8938
|
-
var _a = options.isVerbose, isVerbose = _a === void 0 ?
|
|
8929
|
+
var _a = options.isVerbose, isVerbose = _a === void 0 ? DEFAULT_IS_VERBOSE : _a;
|
|
8939
8930
|
var llmTools = configuration.map(function (llmConfiguration) {
|
|
8940
8931
|
var registeredItem = $llmToolsRegister
|
|
8941
8932
|
.list()
|
|
@@ -9036,7 +9027,7 @@ function $currentDate() {
|
|
|
9036
9027
|
function cacheLlmTools(llmTools, options) {
|
|
9037
9028
|
var _this = this;
|
|
9038
9029
|
if (options === void 0) { options = {}; }
|
|
9039
|
-
var _a = options.storage, storage = _a === void 0 ? new MemoryStorage() : _a, _b = options.
|
|
9030
|
+
var _a = options.storage, storage = _a === void 0 ? new MemoryStorage() : _a, _b = options.isCacheReloaded, isCacheReloaded = _b === void 0 ? false : _b;
|
|
9040
9031
|
var proxyTools = __assign(__assign({}, llmTools), {
|
|
9041
9032
|
// <- Note: [🥫]
|
|
9042
9033
|
get title() {
|
|
@@ -9058,7 +9049,7 @@ function cacheLlmTools(llmTools, options) {
|
|
|
9058
9049
|
key = titleToName(prompt.title.substring(0, MAX_FILENAME_LENGTH - 10) +
|
|
9059
9050
|
'-' +
|
|
9060
9051
|
sha256(hexEncoder.parse(JSON.stringify(prompt.parameters))).toString( /* hex */));
|
|
9061
|
-
if (!!
|
|
9052
|
+
if (!!isCacheReloaded) return [3 /*break*/, 2];
|
|
9062
9053
|
return [4 /*yield*/, storage.getItem(key)];
|
|
9063
9054
|
case 1:
|
|
9064
9055
|
_a = _c.sent();
|
|
@@ -9320,7 +9311,11 @@ var legacyDocumentScraperMetadata = $deepFreeze({
|
|
|
9320
9311
|
mimeTypes: ['application/msword', 'text/rtf'],
|
|
9321
9312
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
9322
9313
|
isAvilableInBrowser: false,
|
|
9323
|
-
requiredExecutables: [
|
|
9314
|
+
requiredExecutables: [
|
|
9315
|
+
'Pandoc',
|
|
9316
|
+
'LibreOffice',
|
|
9317
|
+
// <- TODO: [🧠] Should be 'LibreOffice' here, its dependency of dependency
|
|
9318
|
+
],
|
|
9324
9319
|
}); /* <- TODO: [🤛] */
|
|
9325
9320
|
/**
|
|
9326
9321
|
* Registration of known scraper metadata
|
|
@@ -9344,7 +9339,7 @@ var documentScraperMetadata = $deepFreeze({
|
|
|
9344
9339
|
mimeTypes: ['application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
|
|
9345
9340
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
9346
9341
|
isAvilableInBrowser: false,
|
|
9347
|
-
requiredExecutables: ['
|
|
9342
|
+
requiredExecutables: ['Pandoc'],
|
|
9348
9343
|
}); /* <- TODO: [🤛] */
|
|
9349
9344
|
/**
|
|
9350
9345
|
* Registration of known scraper metadata
|
|
@@ -9368,7 +9363,7 @@ var markdownScraperMetadata = $deepFreeze({
|
|
|
9368
9363
|
mimeTypes: ['text/markdown', 'text/plain'],
|
|
9369
9364
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
9370
9365
|
isAvilableInBrowser: true,
|
|
9371
|
-
requiredExecutables: [
|
|
9366
|
+
requiredExecutables: [],
|
|
9372
9367
|
}); /* <- TODO: [🤛] */
|
|
9373
9368
|
/**
|
|
9374
9369
|
* Registration of known scraper metadata
|
|
@@ -9392,7 +9387,7 @@ var pdfScraperMetadata = $deepFreeze({
|
|
|
9392
9387
|
mimeTypes: ['application/pdf'],
|
|
9393
9388
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
9394
9389
|
isAvilableInBrowser: true,
|
|
9395
|
-
requiredExecutables: [
|
|
9390
|
+
requiredExecutables: [],
|
|
9396
9391
|
}); /* <- TODO: [🤛] */
|
|
9397
9392
|
/**
|
|
9398
9393
|
* Registration of known scraper metadata
|
|
@@ -9416,7 +9411,7 @@ var websiteScraperMetadata = $deepFreeze({
|
|
|
9416
9411
|
mimeTypes: ['text/html'],
|
|
9417
9412
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
|
|
9418
9413
|
isAvilableInBrowser: false,
|
|
9419
|
-
requiredExecutables: [
|
|
9414
|
+
requiredExecutables: [],
|
|
9420
9415
|
}); /* <- TODO: [🤛] */
|
|
9421
9416
|
/**
|
|
9422
9417
|
* Registration of known scraper metadata
|
|
@@ -9778,5 +9773,5 @@ function executionReportJsonToString(executionReportJson, options) {
|
|
|
9778
9773
|
* TODO: [🧠] Should be in generated file GENERATOR_WARNING
|
|
9779
9774
|
*/
|
|
9780
9775
|
|
|
9781
|
-
export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, AbstractFormatError, CLAIM, CallbackInterfaceTools, CollectionError, CsvFormatDefinition, CsvFormatError, DEFAULT_CSV_SETTINGS,
|
|
9776
|
+
export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, AbstractFormatError, CLAIM, CallbackInterfaceTools, CollectionError, CsvFormatDefinition, CsvFormatError, DEFAULT_CSV_SETTINGS, DEFAULT_EXECUTIONS_CACHE_DIRNAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_REMOTE_URL, DEFAULT_REMOTE_URL_PATH, DEFAULT_SCRAPE_CACHE_DIRNAME, ERRORS, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, KnowledgeScrapeError, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_VARIANTS, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NotFoundError, NotYetImplementedError, PROMPTBOOK_VERSION, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, RESERVED_PARAMETER_NAMES, TemplateTypes, TextFormatDefinition, UnexpectedError, ZERO_USAGE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _DocumentScraperMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, addUsage, assertsExecutionSuccessful, cacheLlmTools, collectionToJson, countTotalUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, isPassingExpectations, isPipelinePrepared, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, pipelineJsonToString, pipelineStringToJson, pipelineStringToJsonSync, prepareKnowledgePieces, preparePersona, preparePipeline, prepareTemplates, prettifyPipelineString, stringifyPipelineJson, unpreparePipeline, usageToHuman, usageToWorktime, validatePipeline };
|
|
9782
9777
|
//# sourceMappingURL=index.es.js.map
|