@promptbook/core 0.80.0-0 → 0.80.0-1
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/esm/index.es.js +18 -17
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +4 -4
- package/esm/typings/src/_packages/types.index.d.ts +0 -4
- package/esm/typings/src/commands/_common/getParserForCommand.d.ts +1 -1
- package/esm/typings/src/commands/_common/parseCommand.d.ts +1 -1
- package/esm/typings/src/commands/_common/stringifyCommand.d.ts +1 -1
- package/esm/typings/src/conversion/{pipelineStringToJson.d.ts → compilePipeline.d.ts} +3 -3
- package/esm/typings/src/conversion/{pipelineStringToJsonSync.d.ts → precompilePipeline.d.ts} +3 -3
- package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +1 -1
- package/esm/typings/src/high-level-abstractions/index.d.ts +1 -1
- package/esm/typings/src/prepare/unpreparePipeline.d.ts +1 -0
- package/package.json +1 -1
- package/umd/index.umd.js +19 -18
- package/umd/index.umd.js.map +1 -1
- /package/esm/typings/src/conversion/{pipelineStringToJson.test.d.ts → compilePipeline.test.d.ts} +0 -0
- /package/esm/typings/src/conversion/{pipelineStringToJsonSync.test.d.ts → precompilePipeline.test.d.ts} +0 -0
|
@@ -29,9 +29,9 @@ import { SET_IS_VERBOSE } from '../config';
|
|
|
29
29
|
import { DEFAULT_IS_AUTO_INSTALLED } from '../config';
|
|
30
30
|
import { ORDER_OF_PIPELINE_JSON } from '../constants';
|
|
31
31
|
import { RESERVED_PARAMETER_NAMES } from '../constants';
|
|
32
|
+
import { compilePipeline } from '../conversion/compilePipeline';
|
|
32
33
|
import { pipelineJsonToString } from '../conversion/pipelineJsonToString';
|
|
33
|
-
import {
|
|
34
|
-
import { pipelineStringToJsonSync } from '../conversion/pipelineStringToJsonSync';
|
|
34
|
+
import { precompilePipeline } from '../conversion/precompilePipeline';
|
|
35
35
|
import { prettifyPipelineString } from '../conversion/prettify/prettifyPipelineString';
|
|
36
36
|
import { extractParameterNamesFromTask } from '../conversion/utils/extractParameterNamesFromTask';
|
|
37
37
|
import { removePipelineCommand } from '../conversion/utils/removePipelineCommand';
|
|
@@ -150,9 +150,9 @@ export { SET_IS_VERBOSE };
|
|
|
150
150
|
export { DEFAULT_IS_AUTO_INSTALLED };
|
|
151
151
|
export { ORDER_OF_PIPELINE_JSON };
|
|
152
152
|
export { RESERVED_PARAMETER_NAMES };
|
|
153
|
+
export { compilePipeline };
|
|
153
154
|
export { pipelineJsonToString };
|
|
154
|
-
export {
|
|
155
|
-
export { pipelineStringToJsonSync };
|
|
155
|
+
export { precompilePipeline };
|
|
156
156
|
export { prettifyPipelineString };
|
|
157
157
|
export { extractParameterNamesFromTask };
|
|
158
158
|
export { removePipelineCommand };
|
|
@@ -46,8 +46,6 @@ import type { CsvSettings } from '../formats/csv/CsvSettings';
|
|
|
46
46
|
import type { AbstractFormfactorDefinition } from '../formfactors/_common/AbstractFormfactorDefinition';
|
|
47
47
|
import type { FormfactorDefinition } from '../formfactors/_common/FormfactorDefinition';
|
|
48
48
|
import type { string_formfactor_name } from '../formfactors/_common/string_formfactor_name';
|
|
49
|
-
import type { AsyncHighLevelAbstraction } from '../high-level-abstractions/_common/HighLevelAbstraction';
|
|
50
|
-
import type { CommonHighLevelAbstraction } from '../high-level-abstractions/_common/HighLevelAbstraction';
|
|
51
49
|
import type { LlmToolsConfiguration } from '../llm-providers/_common/register/LlmToolsConfiguration';
|
|
52
50
|
import type { LlmToolsMetadata } from '../llm-providers/_common/register/LlmToolsMetadata';
|
|
53
51
|
import type { LlmToolsOptions } from '../llm-providers/_common/register/LlmToolsOptions';
|
|
@@ -310,8 +308,6 @@ export type { CsvSettings };
|
|
|
310
308
|
export type { AbstractFormfactorDefinition };
|
|
311
309
|
export type { FormfactorDefinition };
|
|
312
310
|
export type { string_formfactor_name };
|
|
313
|
-
export type { AsyncHighLevelAbstraction };
|
|
314
|
-
export type { CommonHighLevelAbstraction };
|
|
315
311
|
export type { LlmToolsConfiguration };
|
|
316
312
|
export type { LlmToolsMetadata };
|
|
317
313
|
export type { LlmToolsOptions };
|
|
@@ -6,6 +6,6 @@ import type { CommandParser } from './types/CommandParser';
|
|
|
6
6
|
* @returns the parser for the command
|
|
7
7
|
* @throws {UnexpectedError} if the parser is not found
|
|
8
8
|
*
|
|
9
|
-
* @private within the
|
|
9
|
+
* @private within the compilePipeline
|
|
10
10
|
*/
|
|
11
11
|
export declare function getParserForCommand<TCommand extends Command>(command: TCommand): CommandParser<TCommand>;
|
|
@@ -7,6 +7,6 @@ import type { CommandUsagePlace } from './types/CommandUsagePlaces';
|
|
|
7
7
|
* @returns parsed command object
|
|
8
8
|
* @throws {ParseError} if the command is invalid
|
|
9
9
|
*
|
|
10
|
-
* @private within the
|
|
10
|
+
* @private within the compilePipeline
|
|
11
11
|
*/
|
|
12
12
|
export declare function parseCommand(raw: string_markdown_text, usagePlace: CommandUsagePlace): Command;
|
|
@@ -6,6 +6,6 @@ import type { Command } from './types/Command';
|
|
|
6
6
|
* @returns stringified command
|
|
7
7
|
* @throws {UnexpectedError} if the command is invalid
|
|
8
8
|
*
|
|
9
|
-
* @private within the
|
|
9
|
+
* @private within the compilePipeline
|
|
10
10
|
*/
|
|
11
11
|
export declare function stringifyCommand(command: Command): string_markdown_text;
|
|
@@ -6,8 +6,8 @@ import type { PrepareAndScrapeOptions } from '../prepare/PrepareAndScrapeOptions
|
|
|
6
6
|
* Compile pipeline from string (markdown) format to JSON format
|
|
7
7
|
*
|
|
8
8
|
* Note: There are 3 similar functions:
|
|
9
|
-
* - `
|
|
10
|
-
* - `
|
|
9
|
+
* - `compilePipeline` **(preferred)** - which propperly compiles the promptbook and use embedding for external knowledge
|
|
10
|
+
* - `precompilePipeline` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
|
|
11
11
|
* - `preparePipeline` - just one step in the compilation process
|
|
12
12
|
*
|
|
13
13
|
* Note: This function does not validate logic of the pipeline only the parsing
|
|
@@ -20,7 +20,7 @@ import type { PrepareAndScrapeOptions } from '../prepare/PrepareAndScrapeOptions
|
|
|
20
20
|
* @throws {ParseError} if the promptbook string is not valid
|
|
21
21
|
* @public exported from `@promptbook/core`
|
|
22
22
|
*/
|
|
23
|
-
export declare function
|
|
23
|
+
export declare function compilePipeline(pipelineString: PipelineString, tools?: Pick<ExecutionTools, 'llm' | 'fs' | 'scrapers'>, options?: PrepareAndScrapeOptions): Promise<PipelineJson>;
|
|
24
24
|
/**
|
|
25
25
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
26
26
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
package/esm/typings/src/conversion/{pipelineStringToJsonSync.d.ts → precompilePipeline.d.ts}
RENAMED
|
@@ -4,8 +4,8 @@ import type { PipelineString } from '../pipeline/PipelineString';
|
|
|
4
4
|
* Compile pipeline from string (markdown) format to JSON format synchronously
|
|
5
5
|
*
|
|
6
6
|
* Note: There are 3 similar functions:
|
|
7
|
-
* - `
|
|
8
|
-
* - `
|
|
7
|
+
* - `compilePipeline` **(preferred)** - which propperly compiles the promptbook and use embedding for external knowledge
|
|
8
|
+
* - `precompilePipeline` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
|
|
9
9
|
* - `preparePipeline` - just one step in the compilation process
|
|
10
10
|
*
|
|
11
11
|
* Note: This function does not validate logic of the pipeline only the parsing
|
|
@@ -16,7 +16,7 @@ import type { PipelineString } from '../pipeline/PipelineString';
|
|
|
16
16
|
* @throws {ParseError} if the promptbook string is not valid
|
|
17
17
|
* @public exported from `@promptbook/core`
|
|
18
18
|
*/
|
|
19
|
-
export declare function
|
|
19
|
+
export declare function precompilePipeline(pipelineString: PipelineString): PipelineJson;
|
|
20
20
|
/**
|
|
21
21
|
* TODO: [🧠] Maybe more things here can be refactored as high-level abstractions
|
|
22
22
|
* TODO: [main] !!!! Warn if used only sync version
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* All high-level abstractions
|
|
3
3
|
*
|
|
4
|
-
* @private internal index of `
|
|
4
|
+
* @private internal index of `precompilePipeline` (= used for sync) and `preparePipeline` (= used for async)
|
|
5
5
|
*/
|
|
6
6
|
export declare const HIGH_LEVEL_ABSTRACTIONS: readonly [{
|
|
7
7
|
type: "SYNC";
|
|
@@ -2,6 +2,7 @@ import type { PipelineJson } from '../pipeline/PipelineJson/PipelineJson';
|
|
|
2
2
|
/**
|
|
3
3
|
* Unprepare just strips the preparation data of the pipeline
|
|
4
4
|
*
|
|
5
|
+
* @deprecated In future version this function will be removed or deprecated
|
|
5
6
|
* @public exported from `@promptbook/core`
|
|
6
7
|
*/
|
|
7
8
|
export declare function unpreparePipeline(pipeline: PipelineJson): PipelineJson;
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
*
|
|
26
26
|
* @see https://github.com/webgptorg/promptbook
|
|
27
27
|
*/
|
|
28
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
28
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.80.0-0';
|
|
29
29
|
/**
|
|
30
30
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
31
31
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1516,6 +1516,7 @@
|
|
|
1516
1516
|
/**
|
|
1517
1517
|
* Unprepare just strips the preparation data of the pipeline
|
|
1518
1518
|
*
|
|
1519
|
+
* @deprecated In future version this function will be removed or deprecated
|
|
1519
1520
|
* @public exported from `@promptbook/core`
|
|
1520
1521
|
*/
|
|
1521
1522
|
function unpreparePipeline(pipeline) {
|
|
@@ -7714,7 +7715,7 @@
|
|
|
7714
7715
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7715
7716
|
*/
|
|
7716
7717
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
7717
|
-
// Note: [🍣] Do nothing, its application is implemented separately in `
|
|
7718
|
+
// Note: [🍣] Do nothing, its application is implemented separately in `precompilePipeline`
|
|
7718
7719
|
},
|
|
7719
7720
|
/**
|
|
7720
7721
|
* Apply the PARAMETER command to the `pipelineJson`
|
|
@@ -7722,7 +7723,7 @@
|
|
|
7722
7723
|
* Note: `$` is used to indicate that this function mutates given `taskJson`
|
|
7723
7724
|
*/
|
|
7724
7725
|
$applyToTaskJson: function (command, $taskJson, $pipelineJson) {
|
|
7725
|
-
// Note: [🍣] Do nothing, its application is implemented separately in `
|
|
7726
|
+
// Note: [🍣] Do nothing, its application is implemented separately in `precompilePipeline`
|
|
7726
7727
|
},
|
|
7727
7728
|
/**
|
|
7728
7729
|
* Converts the PARAMETER command back to string
|
|
@@ -8230,7 +8231,7 @@
|
|
|
8230
8231
|
* @returns the parser for the command
|
|
8231
8232
|
* @throws {UnexpectedError} if the parser is not found
|
|
8232
8233
|
*
|
|
8233
|
-
* @private within the
|
|
8234
|
+
* @private within the compilePipeline
|
|
8234
8235
|
*/
|
|
8235
8236
|
function getParserForCommand(command) {
|
|
8236
8237
|
var commandParser = COMMANDS.find(function (commandParser) { return commandParser.name === command.type; });
|
|
@@ -8266,7 +8267,7 @@
|
|
|
8266
8267
|
* @returns parsed command object
|
|
8267
8268
|
* @throws {ParseError} if the command is invalid
|
|
8268
8269
|
*
|
|
8269
|
-
* @private within the
|
|
8270
|
+
* @private within the compilePipeline
|
|
8270
8271
|
*/
|
|
8271
8272
|
function parseCommand(raw, usagePlace) {
|
|
8272
8273
|
if (raw.includes('\n') || raw.includes('\r')) {
|
|
@@ -8681,7 +8682,7 @@
|
|
|
8681
8682
|
/**
|
|
8682
8683
|
* All high-level abstractions
|
|
8683
8684
|
*
|
|
8684
|
-
* @private internal index of `
|
|
8685
|
+
* @private internal index of `precompilePipeline` (= used for sync) and `preparePipeline` (= used for async)
|
|
8685
8686
|
*/
|
|
8686
8687
|
var HIGH_LEVEL_ABSTRACTIONS = [
|
|
8687
8688
|
ImplicitFormfactorHla,
|
|
@@ -8955,8 +8956,8 @@
|
|
|
8955
8956
|
* Compile pipeline from string (markdown) format to JSON format synchronously
|
|
8956
8957
|
*
|
|
8957
8958
|
* Note: There are 3 similar functions:
|
|
8958
|
-
* - `
|
|
8959
|
-
* - `
|
|
8959
|
+
* - `compilePipeline` **(preferred)** - which propperly compiles the promptbook and use embedding for external knowledge
|
|
8960
|
+
* - `precompilePipeline` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
|
|
8960
8961
|
* - `preparePipeline` - just one step in the compilation process
|
|
8961
8962
|
*
|
|
8962
8963
|
* Note: This function does not validate logic of the pipeline only the parsing
|
|
@@ -8967,7 +8968,7 @@
|
|
|
8967
8968
|
* @throws {ParseError} if the promptbook string is not valid
|
|
8968
8969
|
* @public exported from `@promptbook/core`
|
|
8969
8970
|
*/
|
|
8970
|
-
function
|
|
8971
|
+
function precompilePipeline(pipelineString) {
|
|
8971
8972
|
var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
|
|
8972
8973
|
var $pipelineJson = {
|
|
8973
8974
|
title: DEFAULT_TITLE,
|
|
@@ -9387,7 +9388,7 @@
|
|
|
9387
9388
|
// TODO: [🍙] Maybe do reorder of `$pipelineJson` here
|
|
9388
9389
|
return exportJson({
|
|
9389
9390
|
name: 'pipelineJson',
|
|
9390
|
-
message: "Result of `
|
|
9391
|
+
message: "Result of `precompilePipeline`",
|
|
9391
9392
|
order: ORDER_OF_PIPELINE_JSON,
|
|
9392
9393
|
value: __assign({ formfactorName: 'GENERIC' }, $pipelineJson),
|
|
9393
9394
|
});
|
|
@@ -9408,8 +9409,8 @@
|
|
|
9408
9409
|
* Compile pipeline from string (markdown) format to JSON format
|
|
9409
9410
|
*
|
|
9410
9411
|
* Note: There are 3 similar functions:
|
|
9411
|
-
* - `
|
|
9412
|
-
* - `
|
|
9412
|
+
* - `compilePipeline` **(preferred)** - which propperly compiles the promptbook and use embedding for external knowledge
|
|
9413
|
+
* - `precompilePipeline` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
|
|
9413
9414
|
* - `preparePipeline` - just one step in the compilation process
|
|
9414
9415
|
*
|
|
9415
9416
|
* Note: This function does not validate logic of the pipeline only the parsing
|
|
@@ -9422,13 +9423,13 @@
|
|
|
9422
9423
|
* @throws {ParseError} if the promptbook string is not valid
|
|
9423
9424
|
* @public exported from `@promptbook/core`
|
|
9424
9425
|
*/
|
|
9425
|
-
function
|
|
9426
|
+
function compilePipeline(pipelineString, tools, options) {
|
|
9426
9427
|
return __awaiter(this, void 0, void 0, function () {
|
|
9427
9428
|
var pipelineJson;
|
|
9428
9429
|
return __generator(this, function (_a) {
|
|
9429
9430
|
switch (_a.label) {
|
|
9430
9431
|
case 0:
|
|
9431
|
-
pipelineJson =
|
|
9432
|
+
pipelineJson = precompilePipeline(pipelineString);
|
|
9432
9433
|
if (!(tools !== undefined && tools.llm !== undefined)) return [3 /*break*/, 2];
|
|
9433
9434
|
return [4 /*yield*/, preparePipeline(pipelineJson, tools, options || {
|
|
9434
9435
|
rootDirname: null,
|
|
@@ -9437,7 +9438,7 @@
|
|
|
9437
9438
|
pipelineJson = _a.sent();
|
|
9438
9439
|
_a.label = 2;
|
|
9439
9440
|
case 2:
|
|
9440
|
-
// Note: No need to use `$exportJson` because `
|
|
9441
|
+
// Note: No need to use `$exportJson` because `precompilePipeline` and `preparePipeline` already do that
|
|
9441
9442
|
return [2 /*return*/, pipelineJson];
|
|
9442
9443
|
}
|
|
9443
9444
|
});
|
|
@@ -9554,7 +9555,7 @@
|
|
|
9554
9555
|
case 0:
|
|
9555
9556
|
isGraphAdded = options.isGraphAdded, isPrettifyed = options.isPrettifyed;
|
|
9556
9557
|
if (!isGraphAdded) return [3 /*break*/, 2];
|
|
9557
|
-
return [4 /*yield*/,
|
|
9558
|
+
return [4 /*yield*/, compilePipeline(pipelineString)];
|
|
9558
9559
|
case 1:
|
|
9559
9560
|
pipelineJson = _a.sent();
|
|
9560
9561
|
promptbookMermaid_1 = renderPromptbookMermaid(pipelineJson, {
|
|
@@ -11217,6 +11218,7 @@
|
|
|
11217
11218
|
exports.assertsExecutionSuccessful = assertsExecutionSuccessful;
|
|
11218
11219
|
exports.cacheLlmTools = cacheLlmTools;
|
|
11219
11220
|
exports.collectionToJson = collectionToJson;
|
|
11221
|
+
exports.compilePipeline = compilePipeline;
|
|
11220
11222
|
exports.countTotalUsage = countTotalUsage;
|
|
11221
11223
|
exports.createCollectionFromJson = createCollectionFromJson;
|
|
11222
11224
|
exports.createCollectionFromPromise = createCollectionFromPromise;
|
|
@@ -11236,8 +11238,7 @@
|
|
|
11236
11238
|
exports.limitTotalUsage = limitTotalUsage;
|
|
11237
11239
|
exports.makeKnowledgeSourceHandler = makeKnowledgeSourceHandler;
|
|
11238
11240
|
exports.pipelineJsonToString = pipelineJsonToString;
|
|
11239
|
-
exports.
|
|
11240
|
-
exports.pipelineStringToJsonSync = pipelineStringToJsonSync;
|
|
11241
|
+
exports.precompilePipeline = precompilePipeline;
|
|
11241
11242
|
exports.prepareKnowledgePieces = prepareKnowledgePieces;
|
|
11242
11243
|
exports.preparePersona = preparePersona;
|
|
11243
11244
|
exports.preparePipeline = preparePipeline;
|