@promptbook/node 0.71.0-16 → 0.71.0-18
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 +5 -1
- package/esm/index.es.js +45 -15
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +2 -0
- package/esm/typings/src/_packages/node.index.d.ts +2 -0
- package/esm/typings/src/_packages/types.index.d.ts +8 -8
- package/esm/typings/src/_packages/utils.index.d.ts +2 -2
- 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/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +11 -3
- package/esm/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +1 -2
- 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 +0 -19
- package/esm/typings/src/scrapers/_common/Scraper.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 +1 -1
- package/esm/typings/src/scrapers/_common/register/$provideScrapersForNode.d.ts +2 -2
- package/esm/typings/src/scrapers/document/DocumentScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +2 -2
- package/esm/typings/src/scrapers/pdf/PdfScraper.d.ts +1 -1
- package/esm/typings/src/scrapers/website/WebsiteScraper.d.ts +5 -2
- package/esm/typings/src/scrapers/website/utils/createShowdownConverter.d.ts +7 -0
- package/esm/typings/src/types/PipelineJson/TemplateJsonCommon.d.ts +2 -2
- 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/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/unwrapResult.d.ts +4 -4
- package/package.json +4 -3
- package/umd/index.umd.js +44 -13
- package/umd/index.umd.js.map +1 -1
- 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
|
|
|
@@ -26,6 +26,10 @@ Supercharge your use of large language models
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
|
+
<blockquote style="color: #ff8811">
|
|
30
|
+
<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>.
|
|
31
|
+
</blockquote>
|
|
32
|
+
|
|
29
33
|
## 📦 Package `@promptbook/node`
|
|
30
34
|
|
|
31
35
|
- Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
package/esm/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import colors from 'colors';
|
|
2
|
-
import {
|
|
2
|
+
import { stat, access, constants, readFile, readdir, writeFile, mkdir, unlink } from 'fs/promises';
|
|
3
3
|
import { join, basename, dirname } from 'path';
|
|
4
4
|
import spaceTrim$1, { spaceTrim } from 'spacetrim';
|
|
5
5
|
import { format } from 'prettier';
|
|
@@ -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-17';
|
|
21
21
|
// TODO: [main] !!!! List here all the versions and annotate + put into script
|
|
22
22
|
|
|
23
23
|
/*! *****************************************************************************
|
|
@@ -1028,8 +1028,7 @@ var PipelineExecutionError = /** @class */ (function (_super) {
|
|
|
1028
1028
|
* Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
|
|
1029
1029
|
*
|
|
1030
1030
|
* Note: Internal utility of `joinLlmExecutionTools` but exposed type
|
|
1031
|
-
* @public exported from `@promptbook/
|
|
1032
|
-
* TODO: !!!!!! Export as runtime class not just type
|
|
1031
|
+
* @public exported from `@promptbook/core`
|
|
1033
1032
|
*/
|
|
1034
1033
|
var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
1035
1034
|
/**
|
|
@@ -4746,7 +4745,7 @@ var $scrapersRegister = new $Register('scraper_constructors');
|
|
|
4746
4745
|
* TODO: [®] DRY Register logic
|
|
4747
4746
|
*/
|
|
4748
4747
|
|
|
4749
|
-
// TODO: !!!!!! Maybe delete this function
|
|
4748
|
+
// TODO: !!!!!!last - Maybe delete this function
|
|
4750
4749
|
/**
|
|
4751
4750
|
* Creates a message with all registered scrapers
|
|
4752
4751
|
*
|
|
@@ -4913,7 +4912,6 @@ function normalizeToKebabCase(text) {
|
|
|
4913
4912
|
* @private within the repository
|
|
4914
4913
|
*/
|
|
4915
4914
|
function sourceContentToName(sourceContent) {
|
|
4916
|
-
// TODO: !!!!!! Better name for source than gibberish hash
|
|
4917
4915
|
var hash = SHA256(hexEncoder.parse(JSON.stringify(sourceContent)))
|
|
4918
4916
|
// <- TODO: [🥬] Encapsulate sha256 to some private utility function
|
|
4919
4917
|
.toString( /* hex */)
|
|
@@ -5116,7 +5114,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5116
5114
|
content = _a.sent();
|
|
5117
5115
|
return [2 /*return*/, new Blob([
|
|
5118
5116
|
content,
|
|
5119
|
-
// <- TODO: !!!!!!
|
|
5117
|
+
// <- TODO: !!!!!! Test that this is working
|
|
5120
5118
|
], { type: mimeType_1 })];
|
|
5121
5119
|
}
|
|
5122
5120
|
});
|
|
@@ -5129,7 +5127,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5129
5127
|
switch (_c.label) {
|
|
5130
5128
|
case 0:
|
|
5131
5129
|
_b = (_a = JSON).parse;
|
|
5132
|
-
return [4 /*yield*/, readFile(filename_1, 'utf-8')];
|
|
5130
|
+
return [4 /*yield*/, tools.fs.readFile(filename_1, 'utf-8')];
|
|
5133
5131
|
case 1: return [2 /*return*/, _b.apply(_a, [_c.sent()])];
|
|
5134
5132
|
}
|
|
5135
5133
|
});
|
|
@@ -5139,7 +5137,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
5139
5137
|
return __awaiter(this, void 0, void 0, function () {
|
|
5140
5138
|
return __generator(this, function (_a) {
|
|
5141
5139
|
switch (_a.label) {
|
|
5142
|
-
case 0: return [4 /*yield*/, readFile(filename_1, 'utf-8')];
|
|
5140
|
+
case 0: return [4 /*yield*/, tools.fs.readFile(filename_1, 'utf-8')];
|
|
5143
5141
|
case 1: return [2 /*return*/, _a.sent()];
|
|
5144
5142
|
}
|
|
5145
5143
|
});
|
|
@@ -8428,6 +8426,34 @@ function $provideLlmToolsFromEnv(options) {
|
|
|
8428
8426
|
* TODO: [®] DRY Register logic
|
|
8429
8427
|
*/
|
|
8430
8428
|
|
|
8429
|
+
/**
|
|
8430
|
+
* @@@
|
|
8431
|
+
*
|
|
8432
|
+
* @public exported from `@promptbook/node`
|
|
8433
|
+
*/
|
|
8434
|
+
function $provideExecutablesForNode(options) {
|
|
8435
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
8436
|
+
var _a, _b, isAutoInstalled, _c, isVerbose;
|
|
8437
|
+
return __generator(this, function (_d) {
|
|
8438
|
+
if (!$isRunningInNode()) {
|
|
8439
|
+
throw new EnvironmentMismatchError('Function `$getScrapersForNode` works only in Node.js environment');
|
|
8440
|
+
}
|
|
8441
|
+
_a = options || {}, _b = _a.isAutoInstalled, isAutoInstalled = _b === void 0 ? IS_AUTO_INSTALLED : _b, _c = _a.isVerbose, isVerbose = _c === void 0 ? IS_VERBOSE : _c;
|
|
8442
|
+
TODO_USE(isAutoInstalled);
|
|
8443
|
+
TODO_USE(isVerbose);
|
|
8444
|
+
return [2 /*return*/, {
|
|
8445
|
+
// TODO: !!!!!! use `locate-app` library here
|
|
8446
|
+
pandocPath: 'C:/Users/me/AppData/Local/Pandoc/pandoc.exe',
|
|
8447
|
+
libreOfficePath: 'C:/Program Files/LibreOffice/program/swriter.exe',
|
|
8448
|
+
}];
|
|
8449
|
+
});
|
|
8450
|
+
});
|
|
8451
|
+
}
|
|
8452
|
+
/**
|
|
8453
|
+
* TODO: [🧠] THis should be maybe in different folder
|
|
8454
|
+
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
8455
|
+
*/
|
|
8456
|
+
|
|
8431
8457
|
/**
|
|
8432
8458
|
* @@@
|
|
8433
8459
|
*
|
|
@@ -8452,7 +8478,7 @@ function $provideFilesystemForNode(options) {
|
|
|
8452
8478
|
*/
|
|
8453
8479
|
|
|
8454
8480
|
/**
|
|
8455
|
-
*
|
|
8481
|
+
* @@@
|
|
8456
8482
|
*
|
|
8457
8483
|
* 1) @@@
|
|
8458
8484
|
* 2) @@@
|
|
@@ -8963,7 +8989,7 @@ var JavascriptExecutionTools = JavascriptEvalExecutionTools;
|
|
|
8963
8989
|
*/
|
|
8964
8990
|
function $provideExecutionToolsForNode(options) {
|
|
8965
8991
|
return __awaiter(this, void 0, void 0, function () {
|
|
8966
|
-
var fs, llm, tools;
|
|
8992
|
+
var fs, llm, executables, tools;
|
|
8967
8993
|
var _a;
|
|
8968
8994
|
return __generator(this, function (_b) {
|
|
8969
8995
|
switch (_b.label) {
|
|
@@ -8973,12 +8999,16 @@ function $provideExecutionToolsForNode(options) {
|
|
|
8973
8999
|
}
|
|
8974
9000
|
fs = $provideFilesystemForNode();
|
|
8975
9001
|
llm = $provideLlmToolsFromEnv(options);
|
|
9002
|
+
return [4 /*yield*/, $provideExecutablesForNode(options)];
|
|
9003
|
+
case 1:
|
|
9004
|
+
executables = _b.sent();
|
|
8976
9005
|
_a = {
|
|
8977
9006
|
llm: llm,
|
|
8978
|
-
fs: fs
|
|
9007
|
+
fs: fs,
|
|
9008
|
+
executables: executables
|
|
8979
9009
|
};
|
|
8980
|
-
return [4 /*yield*/, $provideScrapersForNode({ fs: fs, llm: llm }, options)];
|
|
8981
|
-
case
|
|
9010
|
+
return [4 /*yield*/, $provideScrapersForNode({ fs: fs, llm: llm, executables: executables }, options)];
|
|
9011
|
+
case 2:
|
|
8982
9012
|
tools = (_a.scrapers = _b.sent(),
|
|
8983
9013
|
_a.script = [new JavascriptExecutionTools(options)],
|
|
8984
9014
|
_a);
|
|
@@ -9757,5 +9787,5 @@ function $execCommands(_a) {
|
|
|
9757
9787
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
9758
9788
|
*/
|
|
9759
9789
|
|
|
9760
|
-
export { $execCommand, $execCommands, $provideExecutionToolsForNode, $provideFilesystemForNode, $provideLlmToolsConfigurationFromEnv, $provideLlmToolsFromEnv, $provideScrapersForNode, FileCacheStorage, PROMPTBOOK_VERSION, createCollectionFromDirectory };
|
|
9790
|
+
export { $execCommand, $execCommands, $provideExecutablesForNode, $provideExecutionToolsForNode, $provideFilesystemForNode, $provideLlmToolsConfigurationFromEnv, $provideLlmToolsFromEnv, $provideScrapersForNode, FileCacheStorage, PROMPTBOOK_VERSION, createCollectionFromDirectory };
|
|
9761
9791
|
//# sourceMappingURL=index.es.js.map
|