@promptbook/core 0.80.0-0 → 0.80.0
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 +0 -4
- 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
package/README.md
CHANGED
|
@@ -23,10 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
<blockquote style="color: #ff8811">
|
|
27
|
-
<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>.
|
|
28
|
-
</blockquote>
|
|
29
|
-
|
|
30
26
|
## 📦 Package `@promptbook/core`
|
|
31
27
|
|
|
32
28
|
- Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
package/esm/index.es.js
CHANGED
|
@@ -23,7 +23,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
23
23
|
*
|
|
24
24
|
* @see https://github.com/webgptorg/promptbook
|
|
25
25
|
*/
|
|
26
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
26
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.80.0-1';
|
|
27
27
|
/**
|
|
28
28
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
29
29
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1514,6 +1514,7 @@ function extractParameterNames(template) {
|
|
|
1514
1514
|
/**
|
|
1515
1515
|
* Unprepare just strips the preparation data of the pipeline
|
|
1516
1516
|
*
|
|
1517
|
+
* @deprecated In future version this function will be removed or deprecated
|
|
1517
1518
|
* @public exported from `@promptbook/core`
|
|
1518
1519
|
*/
|
|
1519
1520
|
function unpreparePipeline(pipeline) {
|
|
@@ -7712,7 +7713,7 @@ var parameterCommandParser = {
|
|
|
7712
7713
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
7713
7714
|
*/
|
|
7714
7715
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
7715
|
-
// Note: [🍣] Do nothing, its application is implemented separately in `
|
|
7716
|
+
// Note: [🍣] Do nothing, its application is implemented separately in `precompilePipeline`
|
|
7716
7717
|
},
|
|
7717
7718
|
/**
|
|
7718
7719
|
* Apply the PARAMETER command to the `pipelineJson`
|
|
@@ -7720,7 +7721,7 @@ var parameterCommandParser = {
|
|
|
7720
7721
|
* Note: `$` is used to indicate that this function mutates given `taskJson`
|
|
7721
7722
|
*/
|
|
7722
7723
|
$applyToTaskJson: function (command, $taskJson, $pipelineJson) {
|
|
7723
|
-
// Note: [🍣] Do nothing, its application is implemented separately in `
|
|
7724
|
+
// Note: [🍣] Do nothing, its application is implemented separately in `precompilePipeline`
|
|
7724
7725
|
},
|
|
7725
7726
|
/**
|
|
7726
7727
|
* Converts the PARAMETER command back to string
|
|
@@ -8228,7 +8229,7 @@ var COMMANDS = [
|
|
|
8228
8229
|
* @returns the parser for the command
|
|
8229
8230
|
* @throws {UnexpectedError} if the parser is not found
|
|
8230
8231
|
*
|
|
8231
|
-
* @private within the
|
|
8232
|
+
* @private within the compilePipeline
|
|
8232
8233
|
*/
|
|
8233
8234
|
function getParserForCommand(command) {
|
|
8234
8235
|
var commandParser = COMMANDS.find(function (commandParser) { return commandParser.name === command.type; });
|
|
@@ -8264,7 +8265,7 @@ function removeMarkdownFormatting(str) {
|
|
|
8264
8265
|
* @returns parsed command object
|
|
8265
8266
|
* @throws {ParseError} if the command is invalid
|
|
8266
8267
|
*
|
|
8267
|
-
* @private within the
|
|
8268
|
+
* @private within the compilePipeline
|
|
8268
8269
|
*/
|
|
8269
8270
|
function parseCommand(raw, usagePlace) {
|
|
8270
8271
|
if (raw.includes('\n') || raw.includes('\r')) {
|
|
@@ -8679,7 +8680,7 @@ var QuickChatbotHla = {
|
|
|
8679
8680
|
/**
|
|
8680
8681
|
* All high-level abstractions
|
|
8681
8682
|
*
|
|
8682
|
-
* @private internal index of `
|
|
8683
|
+
* @private internal index of `precompilePipeline` (= used for sync) and `preparePipeline` (= used for async)
|
|
8683
8684
|
*/
|
|
8684
8685
|
var HIGH_LEVEL_ABSTRACTIONS = [
|
|
8685
8686
|
ImplicitFormfactorHla,
|
|
@@ -8953,8 +8954,8 @@ function titleToName(value) {
|
|
|
8953
8954
|
* Compile pipeline from string (markdown) format to JSON format synchronously
|
|
8954
8955
|
*
|
|
8955
8956
|
* Note: There are 3 similar functions:
|
|
8956
|
-
* - `
|
|
8957
|
-
* - `
|
|
8957
|
+
* - `compilePipeline` **(preferred)** - which propperly compiles the promptbook and use embedding for external knowledge
|
|
8958
|
+
* - `precompilePipeline` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
|
|
8958
8959
|
* - `preparePipeline` - just one step in the compilation process
|
|
8959
8960
|
*
|
|
8960
8961
|
* Note: This function does not validate logic of the pipeline only the parsing
|
|
@@ -8965,7 +8966,7 @@ function titleToName(value) {
|
|
|
8965
8966
|
* @throws {ParseError} if the promptbook string is not valid
|
|
8966
8967
|
* @public exported from `@promptbook/core`
|
|
8967
8968
|
*/
|
|
8968
|
-
function
|
|
8969
|
+
function precompilePipeline(pipelineString) {
|
|
8969
8970
|
var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
|
|
8970
8971
|
var $pipelineJson = {
|
|
8971
8972
|
title: DEFAULT_TITLE,
|
|
@@ -9385,7 +9386,7 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
9385
9386
|
// TODO: [🍙] Maybe do reorder of `$pipelineJson` here
|
|
9386
9387
|
return exportJson({
|
|
9387
9388
|
name: 'pipelineJson',
|
|
9388
|
-
message: "Result of `
|
|
9389
|
+
message: "Result of `precompilePipeline`",
|
|
9389
9390
|
order: ORDER_OF_PIPELINE_JSON,
|
|
9390
9391
|
value: __assign({ formfactorName: 'GENERIC' }, $pipelineJson),
|
|
9391
9392
|
});
|
|
@@ -9406,8 +9407,8 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
9406
9407
|
* Compile pipeline from string (markdown) format to JSON format
|
|
9407
9408
|
*
|
|
9408
9409
|
* Note: There are 3 similar functions:
|
|
9409
|
-
* - `
|
|
9410
|
-
* - `
|
|
9410
|
+
* - `compilePipeline` **(preferred)** - which propperly compiles the promptbook and use embedding for external knowledge
|
|
9411
|
+
* - `precompilePipeline` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
|
|
9411
9412
|
* - `preparePipeline` - just one step in the compilation process
|
|
9412
9413
|
*
|
|
9413
9414
|
* Note: This function does not validate logic of the pipeline only the parsing
|
|
@@ -9420,13 +9421,13 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
9420
9421
|
* @throws {ParseError} if the promptbook string is not valid
|
|
9421
9422
|
* @public exported from `@promptbook/core`
|
|
9422
9423
|
*/
|
|
9423
|
-
function
|
|
9424
|
+
function compilePipeline(pipelineString, tools, options) {
|
|
9424
9425
|
return __awaiter(this, void 0, void 0, function () {
|
|
9425
9426
|
var pipelineJson;
|
|
9426
9427
|
return __generator(this, function (_a) {
|
|
9427
9428
|
switch (_a.label) {
|
|
9428
9429
|
case 0:
|
|
9429
|
-
pipelineJson =
|
|
9430
|
+
pipelineJson = precompilePipeline(pipelineString);
|
|
9430
9431
|
if (!(tools !== undefined && tools.llm !== undefined)) return [3 /*break*/, 2];
|
|
9431
9432
|
return [4 /*yield*/, preparePipeline(pipelineJson, tools, options || {
|
|
9432
9433
|
rootDirname: null,
|
|
@@ -9435,7 +9436,7 @@ function pipelineStringToJson(pipelineString, tools, options) {
|
|
|
9435
9436
|
pipelineJson = _a.sent();
|
|
9436
9437
|
_a.label = 2;
|
|
9437
9438
|
case 2:
|
|
9438
|
-
// Note: No need to use `$exportJson` because `
|
|
9439
|
+
// Note: No need to use `$exportJson` because `precompilePipeline` and `preparePipeline` already do that
|
|
9439
9440
|
return [2 /*return*/, pipelineJson];
|
|
9440
9441
|
}
|
|
9441
9442
|
});
|
|
@@ -9552,7 +9553,7 @@ function prettifyPipelineString(pipelineString, options) {
|
|
|
9552
9553
|
case 0:
|
|
9553
9554
|
isGraphAdded = options.isGraphAdded, isPrettifyed = options.isPrettifyed;
|
|
9554
9555
|
if (!isGraphAdded) return [3 /*break*/, 2];
|
|
9555
|
-
return [4 /*yield*/,
|
|
9556
|
+
return [4 /*yield*/, compilePipeline(pipelineString)];
|
|
9556
9557
|
case 1:
|
|
9557
9558
|
pipelineJson = _a.sent();
|
|
9558
9559
|
promptbookMermaid_1 = renderPromptbookMermaid(pipelineJson, {
|
|
@@ -11129,5 +11130,5 @@ var PrefixStorage = /** @class */ (function () {
|
|
|
11129
11130
|
return PrefixStorage;
|
|
11130
11131
|
}());
|
|
11131
11132
|
|
|
11132
|
-
export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, ADMIN_EMAIL, ADMIN_GITHUB_NAME, AbstractFormatError, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateError, BoilerplateFormfactorDefinition, CLAIM, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CsvFormatDefinition, CsvFormatError, DEFAULT_BOOKS_DIRNAME, 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, DEFAULT_TITLE, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FORMFACTOR_DEFINITIONS, GENERIC_PIPELINE_INTERFACE, GeneratorFormfactorDefinition, GenericFormfactorDefinition, KnowledgeScrapeError, LOGO_DARK_SRC, LOGO_LIGHT_SRC, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_VARIANTS, MatcherFormfactorDefinition, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NAME, NonTaskSectionTypes, NotFoundError, NotYetImplementedError, ORDER_OF_PIPELINE_JSON, PROMPTBOOK_ENGINE_VERSION, PROMPTBOOK_ERRORS, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, RESERVED_PARAMETER_NAMES, SET_IS_VERBOSE, SectionTypes, SheetsFormfactorDefinition, TaskTypes, TextFormatDefinition, TranslatorFormfactorDefinition, UNCERTAIN_USAGE, UnexpectedError, ZERO_USAGE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _DocumentScraperMetadataRegistration, _GoogleMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, addUsage, assertsExecutionSuccessful, cacheLlmTools, collectionToJson, countTotalUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, extractParameterNamesFromTask, getPipelineInterface, isPassingExpectations, isPipelineImplementingInterface, isPipelineInterfacesEqual, isPipelinePrepared, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, pipelineJsonToString,
|
|
11133
|
+
export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, ADMIN_EMAIL, ADMIN_GITHUB_NAME, AbstractFormatError, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateError, BoilerplateFormfactorDefinition, CLAIM, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CsvFormatDefinition, CsvFormatError, DEFAULT_BOOKS_DIRNAME, 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, DEFAULT_TITLE, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FORMFACTOR_DEFINITIONS, GENERIC_PIPELINE_INTERFACE, GeneratorFormfactorDefinition, GenericFormfactorDefinition, KnowledgeScrapeError, LOGO_DARK_SRC, LOGO_LIGHT_SRC, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_VARIANTS, MatcherFormfactorDefinition, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NAME, NonTaskSectionTypes, NotFoundError, NotYetImplementedError, ORDER_OF_PIPELINE_JSON, PROMPTBOOK_ENGINE_VERSION, PROMPTBOOK_ERRORS, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, RESERVED_PARAMETER_NAMES, SET_IS_VERBOSE, SectionTypes, SheetsFormfactorDefinition, TaskTypes, TextFormatDefinition, TranslatorFormfactorDefinition, UNCERTAIN_USAGE, UnexpectedError, ZERO_USAGE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _DocumentScraperMetadataRegistration, _GoogleMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, addUsage, assertsExecutionSuccessful, cacheLlmTools, collectionToJson, compilePipeline, countTotalUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, extractParameterNamesFromTask, getPipelineInterface, isPassingExpectations, isPipelineImplementingInterface, isPipelineInterfacesEqual, isPipelinePrepared, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, pipelineJsonToString, precompilePipeline, prepareKnowledgePieces, preparePersona, preparePipeline, prepareTasks, prettifyPipelineString, removePipelineCommand, renamePipelineParameter, stringifyPipelineJson, unpreparePipeline, usageToHuman, usageToWorktime, validatePipeline };
|
|
11133
11134
|
//# sourceMappingURL=index.es.js.map
|