@promptbook/node 0.86.0-8 โ 0.86.6
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 +54 -59
- package/esm/index.es.js +14 -12
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/cli/test/ptbk2.d.ts +5 -0
- package/esm/typings/src/conversion/compilePipeline.d.ts +1 -1
- package/esm/typings/src/conversion/compilePipelineOnRemoteServer.d.ts +1 -1
- package/esm/typings/src/conversion/parsePipeline.d.ts +1 -1
- package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
- package/esm/typings/src/conversion/validation/_importPipeline.d.ts +6 -6
- package/esm/typings/src/pipeline/PipelineJson/PreparationJson.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +14 -12
- package/umd/index.umd.js.map +1 -1
|
@@ -13,7 +13,7 @@ import type { PrepareAndScrapeOptions } from '../prepare/PrepareAndScrapeOptions
|
|
|
13
13
|
* @param pipelineString {Promptbook} in string markdown format (.book.md)
|
|
14
14
|
* @param tools - Tools for the preparation and scraping - if not provided together with `llm`, the preparation will be skipped
|
|
15
15
|
* @param options - Options and tools for the compilation
|
|
16
|
-
* @returns {Promptbook} compiled in JSON format (.
|
|
16
|
+
* @returns {Promptbook} compiled in JSON format (.bookc)
|
|
17
17
|
* @throws {ParseError} if the promptbook string is not valid
|
|
18
18
|
* @public exported from `@promptbook/core`
|
|
19
19
|
*/
|
|
@@ -11,7 +11,7 @@ import type { RemoteClientOptions } from '../remote-server/types/RemoteClientOpt
|
|
|
11
11
|
*
|
|
12
12
|
* @param pipelineString {Promptbook} in string markdown format (.book.md)
|
|
13
13
|
* @param options - Configuration of the remote server
|
|
14
|
-
* @returns {Promptbook} compiled in JSON format (.
|
|
14
|
+
* @returns {Promptbook} compiled in JSON format (.bookc)
|
|
15
15
|
* @throws {ParseError} if the promptbook string is not valid
|
|
16
16
|
* @public exported from `@promptbook/remote-client`
|
|
17
17
|
*/
|
|
@@ -12,7 +12,7 @@ import type { PipelineString } from '../pipeline/PipelineString';
|
|
|
12
12
|
* Note: This function acts as compilation process
|
|
13
13
|
*
|
|
14
14
|
* @param pipelineString {Promptbook} in string markdown format (.book.md)
|
|
15
|
-
* @returns {Promptbook} compiled in JSON format (.
|
|
15
|
+
* @returns {Promptbook} compiled in JSON format (.bookc)
|
|
16
16
|
* @throws {ParseError} if the promptbook string is not valid
|
|
17
17
|
* @public exported from `@promptbook/core`
|
|
18
18
|
*/
|
|
@@ -4,7 +4,7 @@ import type { PipelineString } from '../pipeline/PipelineString';
|
|
|
4
4
|
* Converts promptbook in JSON format to string format
|
|
5
5
|
*
|
|
6
6
|
* @deprecated TODO: [๐ฅ][๐ง ] Backup original files in `PipelineJson` same as in Promptbook.studio
|
|
7
|
-
* @param pipelineJson Promptbook in JSON format (.
|
|
7
|
+
* @param pipelineJson Promptbook in JSON format (.bookc)
|
|
8
8
|
* @returns Promptbook in string format (.book.md)
|
|
9
9
|
* @public exported from `@promptbook/core`
|
|
10
10
|
*/
|
|
@@ -2,7 +2,7 @@ import type { PipelineJson } from '../../pipeline/PipelineJson/PipelineJson';
|
|
|
2
2
|
import type { PipelineString } from '../../pipeline/PipelineString';
|
|
3
3
|
import type { string_json } from '../../types/typeAliases';
|
|
4
4
|
/**
|
|
5
|
-
* Import the pipeline.book or pipeline.
|
|
5
|
+
* Import the pipeline.book or pipeline.bookc file
|
|
6
6
|
*
|
|
7
7
|
* Note: Using here custom import to work in jest tests
|
|
8
8
|
* Note: Using sync version is ๐ฉ in the production code, but it's ok here in tests
|
|
@@ -11,19 +11,19 @@ import type { string_json } from '../../types/typeAliases';
|
|
|
11
11
|
* @private internal function of tests
|
|
12
12
|
*/
|
|
13
13
|
export declare function importPipelineWithoutPreparation(path: `${string}.book`): PipelineString;
|
|
14
|
-
export declare function importPipelineWithoutPreparation(path: `${string}.
|
|
14
|
+
export declare function importPipelineWithoutPreparation(path: `${string}.bookc`): PipelineJson;
|
|
15
15
|
/**
|
|
16
|
-
* Import the pipeline.
|
|
16
|
+
* Import the pipeline.bookc file as parsed JSON
|
|
17
17
|
*
|
|
18
18
|
* @private internal function of tests
|
|
19
19
|
*/
|
|
20
|
-
export declare function importPipelineJson(path: `${string}.
|
|
20
|
+
export declare function importPipelineJson(path: `${string}.bookc`): PipelineJson;
|
|
21
21
|
/**
|
|
22
|
-
* Import the pipeline.
|
|
22
|
+
* Import the pipeline.bookc file as string
|
|
23
23
|
*
|
|
24
24
|
* @private internal function of tests
|
|
25
25
|
*/
|
|
26
|
-
export declare function importPipelineJsonAsString(path: `${string}.
|
|
26
|
+
export declare function importPipelineJsonAsString(path: `${string}.bookc`): string_json<PipelineJson>;
|
|
27
27
|
/**
|
|
28
28
|
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
29
29
|
* Note: [โซ] Code in this file should never be published in any package
|
|
@@ -18,5 +18,5 @@ export type PreparationJson = {
|
|
|
18
18
|
/**
|
|
19
19
|
* TODO: [๐] Make some standard order of json properties
|
|
20
20
|
* TODO: Maybe put here used `modelName`
|
|
21
|
-
* TODO: [๐ฅ] When using `date` it changes all examples .
|
|
21
|
+
* TODO: [๐ฅ] When using `date` it changes all examples .bookc files each time so until some more elegant solution omit the time from prepared pipeline
|
|
22
22
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/node",
|
|
3
|
-
"version": "0.86.
|
|
3
|
+
"version": "0.86.6",
|
|
4
4
|
"description": "It's time for a paradigm shift. The future of software in plain English, French or Latin",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"module": "./esm/index.es.js",
|
|
48
48
|
"typings": "./esm/typings/src/_packages/node.index.d.ts",
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@promptbook/core": "0.86.
|
|
50
|
+
"@promptbook/core": "0.86.6"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"colors": "1.4.0",
|
package/umd/index.umd.js
CHANGED
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
* @generated
|
|
46
46
|
* @see https://github.com/webgptorg/promptbook
|
|
47
47
|
*/
|
|
48
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.86.
|
|
48
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.86.6';
|
|
49
49
|
/**
|
|
50
50
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
51
51
|
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
@@ -564,7 +564,7 @@
|
|
|
564
564
|
* Converts promptbook in JSON format to string format
|
|
565
565
|
*
|
|
566
566
|
* @deprecated TODO: [๐ฅ][๐ง ] Backup original files in `PipelineJson` same as in Promptbook.studio
|
|
567
|
-
* @param pipelineJson Promptbook in JSON format (.
|
|
567
|
+
* @param pipelineJson Promptbook in JSON format (.bookc)
|
|
568
568
|
* @returns Promptbook in string format (.book.md)
|
|
569
569
|
* @public exported from `@promptbook/core`
|
|
570
570
|
*/
|
|
@@ -5924,7 +5924,9 @@
|
|
|
5924
5924
|
return __generator(this, function (_a) {
|
|
5925
5925
|
dependentParameterNames = task.dependentParameterNames;
|
|
5926
5926
|
preparedContent = undefined;
|
|
5927
|
-
if (
|
|
5927
|
+
if (task.taskType === 'PROMPT_TASK' &&
|
|
5928
|
+
knowledgePiecesCount > 0 &&
|
|
5929
|
+
!dependentParameterNames.includes('knowledge')) {
|
|
5928
5930
|
preparedContent = spaceTrim.spaceTrim("\n {content}\n\n ## Knowledge\n\n {knowledge}\n ");
|
|
5929
5931
|
// <- TODO: [๐ง ][๐งป] Cutomize shape/language/formatting of the addition to the prompt
|
|
5930
5932
|
dependentParameterNames = __spreadArray(__spreadArray([], __read(dependentParameterNames), false), [
|
|
@@ -9086,7 +9088,7 @@
|
|
|
9086
9088
|
* Note: This function acts as compilation process
|
|
9087
9089
|
*
|
|
9088
9090
|
* @param pipelineString {Promptbook} in string markdown format (.book.md)
|
|
9089
|
-
* @returns {Promptbook} compiled in JSON format (.
|
|
9091
|
+
* @returns {Promptbook} compiled in JSON format (.bookc)
|
|
9090
9092
|
* @throws {ParseError} if the promptbook string is not valid
|
|
9091
9093
|
* @public exported from `@promptbook/core`
|
|
9092
9094
|
*/
|
|
@@ -9554,7 +9556,7 @@
|
|
|
9554
9556
|
* @param pipelineString {Promptbook} in string markdown format (.book.md)
|
|
9555
9557
|
* @param tools - Tools for the preparation and scraping - if not provided together with `llm`, the preparation will be skipped
|
|
9556
9558
|
* @param options - Options and tools for the compilation
|
|
9557
|
-
* @returns {Promptbook} compiled in JSON format (.
|
|
9559
|
+
* @returns {Promptbook} compiled in JSON format (.bookc)
|
|
9558
9560
|
* @throws {ParseError} if the promptbook string is not valid
|
|
9559
9561
|
* @public exported from `@promptbook/core`
|
|
9560
9562
|
*/
|
|
@@ -11282,7 +11284,7 @@
|
|
|
11282
11284
|
}
|
|
11283
11285
|
madeLibraryFilePath = path.join(rootPath, "".concat(DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME
|
|
11284
11286
|
// <- TODO: [๐ฆ] Allow to override (pass different value into the function)
|
|
11285
|
-
, ".
|
|
11287
|
+
, ".bookc"));
|
|
11286
11288
|
return [4 /*yield*/, isFileExisting(madeLibraryFilePath, tools.fs)];
|
|
11287
11289
|
case 3:
|
|
11288
11290
|
if (!(_f.sent())) ;
|
|
@@ -11304,13 +11306,13 @@
|
|
|
11304
11306
|
return [4 /*yield*/, listAllFiles(rootPath, isRecursive, tools.fs)];
|
|
11305
11307
|
case 1:
|
|
11306
11308
|
fileNames = _b.sent();
|
|
11307
|
-
// Note: First load
|
|
11308
|
-
// `.
|
|
11309
|
+
// Note: First load compiled `.bookc` files and then source `.book` files
|
|
11310
|
+
// `.bookc` are already compiled and can be used faster
|
|
11309
11311
|
fileNames.sort(function (a, b) {
|
|
11310
|
-
if (a.endsWith('.json') && (b.endsWith('.book') || b.endsWith('.book'))) {
|
|
11312
|
+
if ((a.endsWith('.bookc') || a.endsWith('.book.json')) && (b.endsWith('.book') || b.endsWith('.book.md'))) {
|
|
11311
11313
|
return -1;
|
|
11312
11314
|
}
|
|
11313
|
-
if ((a.endsWith('.book') || a.endsWith('.book')) && b.endsWith('.json')) {
|
|
11315
|
+
if ((a.endsWith('.book') || a.endsWith('.book.md')) && (b.endsWith('.bookc') || b.endsWith('.book.json'))) {
|
|
11314
11316
|
return 1;
|
|
11315
11317
|
}
|
|
11316
11318
|
return 0;
|
|
@@ -11327,7 +11329,7 @@
|
|
|
11327
11329
|
case 1:
|
|
11328
11330
|
_f.trys.push([1, 8, , 9]);
|
|
11329
11331
|
pipeline = null;
|
|
11330
|
-
if (!(fileName.endsWith('.book') || fileName.endsWith('.book'))) return [3 /*break*/, 4];
|
|
11332
|
+
if (!(fileName.endsWith('.book') || fileName.endsWith('.book.md'))) return [3 /*break*/, 4];
|
|
11331
11333
|
_c = validatePipelineString;
|
|
11332
11334
|
return [4 /*yield*/, promises.readFile(fileName, 'utf-8')];
|
|
11333
11335
|
case 2:
|
|
@@ -11340,7 +11342,7 @@
|
|
|
11340
11342
|
pipeline = __assign(__assign({}, pipeline), { sourceFile: sourceFile });
|
|
11341
11343
|
return [3 /*break*/, 7];
|
|
11342
11344
|
case 4:
|
|
11343
|
-
if (!fileName.endsWith('.book.json')) return [3 /*break*/, 6];
|
|
11345
|
+
if (!(fileName.endsWith('.bookc') || fileName.endsWith('.book.json'))) return [3 /*break*/, 6];
|
|
11344
11346
|
_e = (_d = JSON).parse;
|
|
11345
11347
|
return [4 /*yield*/, promises.readFile(fileName, 'utf-8')];
|
|
11346
11348
|
case 5:
|