@promptbook/node 0.67.8 → 0.68.0-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/esm/index.es.js +166 -102
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/config.d.ts +6 -0
- package/package.json +4 -3
- package/umd/index.umd.js +169 -106
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -4,6 +4,7 @@ import { join as join$1, dirname } from 'path';
|
|
|
4
4
|
import spaceTrim$1, { spaceTrim } from 'spacetrim';
|
|
5
5
|
import { format } from 'prettier';
|
|
6
6
|
import parserHtml from 'prettier/parser-html';
|
|
7
|
+
import { forTime } from 'waitasecond';
|
|
7
8
|
import hexEncoder from 'crypto-js/enc-hex';
|
|
8
9
|
import sha256 from 'crypto-js/sha256';
|
|
9
10
|
import { join } from 'path/posix';
|
|
@@ -13,7 +14,7 @@ import * as dotenv from 'dotenv';
|
|
|
13
14
|
/**
|
|
14
15
|
* The version of the Promptbook library
|
|
15
16
|
*/
|
|
16
|
-
var PROMPTBOOK_VERSION = '0.67.
|
|
17
|
+
var PROMPTBOOK_VERSION = '0.67.9';
|
|
17
18
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
18
19
|
|
|
19
20
|
/*! *****************************************************************************
|
|
@@ -355,6 +356,12 @@ function $asDeeplyFrozenSerializableJson(name, objectValue) {
|
|
|
355
356
|
* @private within the repository - too low-level in comparison with other `MAX_...`
|
|
356
357
|
*/
|
|
357
358
|
var LOOP_LIMIT = 1000;
|
|
359
|
+
/**
|
|
360
|
+
* Short time interval to prevent race conditions in milliseconds
|
|
361
|
+
*
|
|
362
|
+
* @private within the repository - too low-level in comparison with other `MAX_...`
|
|
363
|
+
*/
|
|
364
|
+
var IMMEDIATE_TIME = 10;
|
|
358
365
|
/**
|
|
359
366
|
* The maximum number of (LLM) tasks running in parallel
|
|
360
367
|
*
|
|
@@ -867,7 +874,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
867
874
|
});
|
|
868
875
|
}
|
|
869
876
|
|
|
870
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.67.
|
|
877
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.67.9",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT"},content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",dependentParameterNames:["knowledgeContent"],resultingParameterName:"knowledgePieces"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.67.9",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT"},content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.67.9",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT"},content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.67.9",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",modelRequirements:{modelVariant:"CHAT"},content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Sample\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",expectFormat:"JSON",dependentParameterNames:["availableModelNames","personaDescription"],resultingParameterName:"modelRequirements"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
|
|
871
878
|
|
|
872
879
|
/**
|
|
873
880
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
@@ -3060,7 +3067,7 @@ function createPipelineExecutor(options) {
|
|
|
3060
3067
|
name = "pipeline-executor-frame-".concat(currentTemplate.name);
|
|
3061
3068
|
title = currentTemplate.title;
|
|
3062
3069
|
priority = preparedPipeline.promptTemplates.length - preparedPipeline.promptTemplates.indexOf(currentTemplate);
|
|
3063
|
-
if (!onProgress /* <- [3] */) return [3 /*break*/, 2]; /* <- [3] */
|
|
3070
|
+
if (!(onProgress !== undefined) /* <- [3] */) return [3 /*break*/, 2]; /* <- [3] */
|
|
3064
3071
|
progress_1 = {
|
|
3065
3072
|
name: name,
|
|
3066
3073
|
title: title,
|
|
@@ -3463,7 +3470,7 @@ function createPipelineExecutor(options) {
|
|
|
3463
3470
|
if (resultString === null) {
|
|
3464
3471
|
throw new UnexpectedError(spaceTrim(function (block) { return "\n Something went wrong and prompt result is null\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
3465
3472
|
}
|
|
3466
|
-
if (!onProgress /* <- [3] */) return [3 /*break*/, 9]; /* <- [3] */
|
|
3473
|
+
if (!(onProgress !== undefined) /* <- [3] */) return [3 /*break*/, 9]; /* <- [3] */
|
|
3467
3474
|
progress_2 = {
|
|
3468
3475
|
name: name,
|
|
3469
3476
|
title: title,
|
|
@@ -3521,7 +3528,7 @@ function createPipelineExecutor(options) {
|
|
|
3521
3528
|
}
|
|
3522
3529
|
return outputParameters;
|
|
3523
3530
|
}
|
|
3524
|
-
var errors, warnings, executionReport, isReturned, _a, _b, parameter, _loop_1, _c, _d, parameterName, state_1, parametersToPass, resovedParameterNames_1, unresovedTemplates_1, resolving_1, loopLimit, _loop_2, error_1, usage_1, outputParameters_1, usage, outputParameters;
|
|
3531
|
+
var errors, warnings, executionReport, isReturned, _a, _b, parameter, e_1_1, _loop_1, _c, _d, parameterName, state_1, e_2_1, parametersToPass, resovedParameterNames_1, unresovedTemplates_1, resolving_1, loopLimit, _loop_2, error_1, usage_1, outputParameters_1, usage, outputParameters;
|
|
3525
3532
|
var e_1, _e, e_2, _f;
|
|
3526
3533
|
return __generator(this, function (_g) {
|
|
3527
3534
|
switch (_g.label) {
|
|
@@ -3547,79 +3554,122 @@ function createPipelineExecutor(options) {
|
|
|
3547
3554
|
promptExecutions: [],
|
|
3548
3555
|
};
|
|
3549
3556
|
isReturned = false;
|
|
3557
|
+
_g.label = 3;
|
|
3558
|
+
case 3:
|
|
3559
|
+
_g.trys.push([3, 9, 10, 11]);
|
|
3560
|
+
_a = __values(preparedPipeline.parameters.filter(function (_a) {
|
|
3561
|
+
var isInput = _a.isInput;
|
|
3562
|
+
return isInput;
|
|
3563
|
+
})), _b = _a.next();
|
|
3564
|
+
_g.label = 4;
|
|
3565
|
+
case 4:
|
|
3566
|
+
if (!!_b.done) return [3 /*break*/, 8];
|
|
3567
|
+
parameter = _b.value;
|
|
3568
|
+
if (!(inputParameters[parameter.name] === undefined)) return [3 /*break*/, 7];
|
|
3569
|
+
isReturned = true;
|
|
3570
|
+
if (!(onProgress !== undefined)) return [3 /*break*/, 6];
|
|
3571
|
+
// Note: Wait a short time to prevent race conditions
|
|
3572
|
+
return [4 /*yield*/, forTime(IMMEDIATE_TIME)];
|
|
3573
|
+
case 5:
|
|
3574
|
+
// Note: Wait a short time to prevent race conditions
|
|
3575
|
+
_g.sent();
|
|
3576
|
+
_g.label = 6;
|
|
3577
|
+
case 6: return [2 /*return*/, $asDeeplyFrozenSerializableJson("Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"), {
|
|
3578
|
+
isSuccessful: false,
|
|
3579
|
+
errors: __spreadArray([
|
|
3580
|
+
new PipelineExecutionError("Parameter {".concat(parameter.name, "} is required as an input parameter"))
|
|
3581
|
+
], __read(errors), false).map(serializeError),
|
|
3582
|
+
warnings: [],
|
|
3583
|
+
executionReport: executionReport,
|
|
3584
|
+
outputParameters: {},
|
|
3585
|
+
usage: ZERO_USAGE,
|
|
3586
|
+
preparedPipeline: preparedPipeline,
|
|
3587
|
+
})];
|
|
3588
|
+
case 7:
|
|
3589
|
+
_b = _a.next();
|
|
3590
|
+
return [3 /*break*/, 4];
|
|
3591
|
+
case 8: return [3 /*break*/, 11];
|
|
3592
|
+
case 9:
|
|
3593
|
+
e_1_1 = _g.sent();
|
|
3594
|
+
e_1 = { error: e_1_1 };
|
|
3595
|
+
return [3 /*break*/, 11];
|
|
3596
|
+
case 10:
|
|
3550
3597
|
try {
|
|
3551
|
-
|
|
3552
|
-
for (_a = __values(preparedPipeline.parameters.filter(function (_a) {
|
|
3553
|
-
var isInput = _a.isInput;
|
|
3554
|
-
return isInput;
|
|
3555
|
-
})), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
3556
|
-
parameter = _b.value;
|
|
3557
|
-
if (inputParameters[parameter.name] === undefined) {
|
|
3558
|
-
isReturned = true;
|
|
3559
|
-
return [2 /*return*/, $asDeeplyFrozenSerializableJson("Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"), {
|
|
3560
|
-
isSuccessful: false,
|
|
3561
|
-
errors: __spreadArray([
|
|
3562
|
-
new PipelineExecutionError("Parameter {".concat(parameter.name, "} is required as an input parameter"))
|
|
3563
|
-
], __read(errors), false).map(serializeError),
|
|
3564
|
-
warnings: [],
|
|
3565
|
-
executionReport: executionReport,
|
|
3566
|
-
outputParameters: {},
|
|
3567
|
-
usage: ZERO_USAGE,
|
|
3568
|
-
preparedPipeline: preparedPipeline,
|
|
3569
|
-
})];
|
|
3570
|
-
}
|
|
3571
|
-
}
|
|
3572
|
-
}
|
|
3573
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3574
|
-
finally {
|
|
3575
|
-
try {
|
|
3576
|
-
if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
|
|
3577
|
-
}
|
|
3578
|
-
finally { if (e_1) throw e_1.error; }
|
|
3598
|
+
if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
|
|
3579
3599
|
}
|
|
3600
|
+
finally { if (e_1) throw e_1.error; }
|
|
3601
|
+
return [7 /*endfinally*/];
|
|
3602
|
+
case 11:
|
|
3580
3603
|
_loop_1 = function (parameterName) {
|
|
3581
|
-
var parameter
|
|
3582
|
-
|
|
3583
|
-
|
|
3604
|
+
var parameter;
|
|
3605
|
+
return __generator(this, function (_h) {
|
|
3606
|
+
switch (_h.label) {
|
|
3607
|
+
case 0:
|
|
3608
|
+
parameter = preparedPipeline.parameters.find(function (_a) {
|
|
3609
|
+
var name = _a.name;
|
|
3610
|
+
return name === parameterName;
|
|
3611
|
+
});
|
|
3612
|
+
if (!(parameter === undefined)) return [3 /*break*/, 1];
|
|
3613
|
+
warnings.push(new PipelineExecutionError(spaceTrim(function (block) { return "\n Extra parameter {".concat(parameterName, "} is being passed which is not part of the pipeline.\n\n ").concat(block(pipelineIdentification), "\n "); })));
|
|
3614
|
+
return [3 /*break*/, 4];
|
|
3615
|
+
case 1:
|
|
3616
|
+
if (!(parameter.isInput === false)) return [3 /*break*/, 4];
|
|
3617
|
+
isReturned = true;
|
|
3618
|
+
if (!(onProgress !== undefined)) return [3 /*break*/, 3];
|
|
3619
|
+
// Note: Wait a short time to prevent race conditions
|
|
3620
|
+
return [4 /*yield*/, forTime(IMMEDIATE_TIME)];
|
|
3621
|
+
case 2:
|
|
3622
|
+
// Note: Wait a short time to prevent race conditions
|
|
3623
|
+
_h.sent();
|
|
3624
|
+
_h.label = 3;
|
|
3625
|
+
case 3: return [2 /*return*/, { value: $asDeeplyFrozenSerializableJson(spaceTrim(function (block) { return "\n Unuccessful PipelineExecutorResult (with extra parameter {".concat(parameter.name, "}) PipelineExecutorResult\n\n ").concat(block(pipelineIdentification), "\n "); }), {
|
|
3626
|
+
isSuccessful: false,
|
|
3627
|
+
errors: __spreadArray([
|
|
3628
|
+
new PipelineExecutionError(spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
|
|
3629
|
+
], __read(errors), false).map(serializeError),
|
|
3630
|
+
warnings: warnings.map(serializeError),
|
|
3631
|
+
executionReport: executionReport,
|
|
3632
|
+
outputParameters: {},
|
|
3633
|
+
usage: ZERO_USAGE,
|
|
3634
|
+
preparedPipeline: preparedPipeline,
|
|
3635
|
+
}) }];
|
|
3636
|
+
case 4: return [2 /*return*/];
|
|
3637
|
+
}
|
|
3584
3638
|
});
|
|
3585
|
-
if (parameter === undefined) {
|
|
3586
|
-
warnings.push(new PipelineExecutionError(spaceTrim(function (block) { return "\n Extra parameter {".concat(parameterName, "} is being passed which is not part of the pipeline.\n\n ").concat(block(pipelineIdentification), "\n "); })));
|
|
3587
|
-
}
|
|
3588
|
-
else if (parameter.isInput === false) {
|
|
3589
|
-
isReturned = true;
|
|
3590
|
-
return { value: $asDeeplyFrozenSerializableJson(spaceTrim(function (block) { return "\n Unuccessful PipelineExecutorResult (with extra parameter {".concat(parameter.name, "}) PipelineExecutorResult\n\n ").concat(block(pipelineIdentification), "\n "); }), {
|
|
3591
|
-
isSuccessful: false,
|
|
3592
|
-
errors: __spreadArray([
|
|
3593
|
-
new PipelineExecutionError(spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
|
|
3594
|
-
], __read(errors), false).map(serializeError),
|
|
3595
|
-
warnings: warnings.map(serializeError),
|
|
3596
|
-
executionReport: executionReport,
|
|
3597
|
-
outputParameters: {},
|
|
3598
|
-
usage: ZERO_USAGE,
|
|
3599
|
-
preparedPipeline: preparedPipeline,
|
|
3600
|
-
}) };
|
|
3601
|
-
}
|
|
3602
3639
|
};
|
|
3640
|
+
_g.label = 12;
|
|
3641
|
+
case 12:
|
|
3642
|
+
_g.trys.push([12, 17, 18, 19]);
|
|
3643
|
+
_c = __values(Object.keys(inputParameters)), _d = _c.next();
|
|
3644
|
+
_g.label = 13;
|
|
3645
|
+
case 13:
|
|
3646
|
+
if (!!_d.done) return [3 /*break*/, 16];
|
|
3647
|
+
parameterName = _d.value;
|
|
3648
|
+
return [5 /*yield**/, _loop_1(parameterName)];
|
|
3649
|
+
case 14:
|
|
3650
|
+
state_1 = _g.sent();
|
|
3651
|
+
if (typeof state_1 === "object")
|
|
3652
|
+
return [2 /*return*/, state_1.value];
|
|
3653
|
+
_g.label = 15;
|
|
3654
|
+
case 15:
|
|
3655
|
+
_d = _c.next();
|
|
3656
|
+
return [3 /*break*/, 13];
|
|
3657
|
+
case 16: return [3 /*break*/, 19];
|
|
3658
|
+
case 17:
|
|
3659
|
+
e_2_1 = _g.sent();
|
|
3660
|
+
e_2 = { error: e_2_1 };
|
|
3661
|
+
return [3 /*break*/, 19];
|
|
3662
|
+
case 18:
|
|
3603
3663
|
try {
|
|
3604
|
-
|
|
3605
|
-
for (_c = __values(Object.keys(inputParameters)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
3606
|
-
parameterName = _d.value;
|
|
3607
|
-
state_1 = _loop_1(parameterName);
|
|
3608
|
-
if (typeof state_1 === "object")
|
|
3609
|
-
return [2 /*return*/, state_1.value];
|
|
3610
|
-
}
|
|
3611
|
-
}
|
|
3612
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
3613
|
-
finally {
|
|
3614
|
-
try {
|
|
3615
|
-
if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
|
|
3616
|
-
}
|
|
3617
|
-
finally { if (e_2) throw e_2.error; }
|
|
3664
|
+
if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
|
|
3618
3665
|
}
|
|
3666
|
+
finally { if (e_2) throw e_2.error; }
|
|
3667
|
+
return [7 /*endfinally*/];
|
|
3668
|
+
case 19:
|
|
3619
3669
|
parametersToPass = inputParameters;
|
|
3620
|
-
_g.label =
|
|
3621
|
-
case
|
|
3622
|
-
_g.trys.push([
|
|
3670
|
+
_g.label = 20;
|
|
3671
|
+
case 20:
|
|
3672
|
+
_g.trys.push([20, 25, , 28]);
|
|
3623
3673
|
resovedParameterNames_1 = preparedPipeline.parameters
|
|
3624
3674
|
.filter(function (_a) {
|
|
3625
3675
|
var isInput = _a.isInput;
|
|
@@ -3634,8 +3684,8 @@ function createPipelineExecutor(options) {
|
|
|
3634
3684
|
loopLimit = LOOP_LIMIT;
|
|
3635
3685
|
_loop_2 = function () {
|
|
3636
3686
|
var currentTemplate, work_1;
|
|
3637
|
-
return __generator(this, function (
|
|
3638
|
-
switch (
|
|
3687
|
+
return __generator(this, function (_j) {
|
|
3688
|
+
switch (_j.label) {
|
|
3639
3689
|
case 0:
|
|
3640
3690
|
if (loopLimit-- < 0) {
|
|
3641
3691
|
// Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
|
|
@@ -3661,7 +3711,7 @@ function createPipelineExecutor(options) {
|
|
|
3661
3711
|
if (!!currentTemplate) return [3 /*break*/, 3];
|
|
3662
3712
|
/* [5] */ return [4 /*yield*/, Promise.race(resolving_1)];
|
|
3663
3713
|
case 2:
|
|
3664
|
-
/* [5] */
|
|
3714
|
+
/* [5] */ _j.sent();
|
|
3665
3715
|
return [3 /*break*/, 4];
|
|
3666
3716
|
case 3:
|
|
3667
3717
|
unresovedTemplates_1 = unresovedTemplates_1.filter(function (template) { return template !== currentTemplate; });
|
|
@@ -3673,23 +3723,23 @@ function createPipelineExecutor(options) {
|
|
|
3673
3723
|
resolving_1 = resolving_1.filter(function (w) { return w !== work_1; });
|
|
3674
3724
|
});
|
|
3675
3725
|
resolving_1.push(work_1);
|
|
3676
|
-
|
|
3726
|
+
_j.label = 4;
|
|
3677
3727
|
case 4: return [2 /*return*/];
|
|
3678
3728
|
}
|
|
3679
3729
|
});
|
|
3680
3730
|
};
|
|
3681
|
-
_g.label =
|
|
3682
|
-
case
|
|
3683
|
-
if (!(unresovedTemplates_1.length > 0)) return [3 /*break*/,
|
|
3731
|
+
_g.label = 21;
|
|
3732
|
+
case 21:
|
|
3733
|
+
if (!(unresovedTemplates_1.length > 0)) return [3 /*break*/, 23];
|
|
3684
3734
|
return [5 /*yield**/, _loop_2()];
|
|
3685
|
-
case
|
|
3735
|
+
case 22:
|
|
3686
3736
|
_g.sent();
|
|
3687
|
-
return [3 /*break*/,
|
|
3688
|
-
case
|
|
3689
|
-
case
|
|
3737
|
+
return [3 /*break*/, 21];
|
|
3738
|
+
case 23: return [4 /*yield*/, Promise.all(resolving_1)];
|
|
3739
|
+
case 24:
|
|
3690
3740
|
_g.sent();
|
|
3691
|
-
return [3 /*break*/,
|
|
3692
|
-
case
|
|
3741
|
+
return [3 /*break*/, 28];
|
|
3742
|
+
case 25:
|
|
3693
3743
|
error_1 = _g.sent();
|
|
3694
3744
|
if (!(error_1 instanceof Error)) {
|
|
3695
3745
|
throw error_1;
|
|
@@ -3700,31 +3750,45 @@ function createPipelineExecutor(options) {
|
|
|
3700
3750
|
})), false));
|
|
3701
3751
|
outputParameters_1 = filterJustOutputParameters();
|
|
3702
3752
|
isReturned = true;
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3753
|
+
if (!(onProgress !== undefined)) return [3 /*break*/, 27];
|
|
3754
|
+
// Note: Wait a short time to prevent race conditions
|
|
3755
|
+
return [4 /*yield*/, forTime(IMMEDIATE_TIME)];
|
|
3756
|
+
case 26:
|
|
3757
|
+
// Note: Wait a short time to prevent race conditions
|
|
3758
|
+
_g.sent();
|
|
3759
|
+
_g.label = 27;
|
|
3760
|
+
case 27: return [2 /*return*/, $asDeeplyFrozenSerializableJson('Unuccessful PipelineExecutorResult (with misc errors) PipelineExecutorResult', {
|
|
3761
|
+
isSuccessful: false,
|
|
3762
|
+
errors: __spreadArray([error_1], __read(errors), false).map(serializeError),
|
|
3763
|
+
warnings: warnings.map(serializeError),
|
|
3764
|
+
usage: usage_1,
|
|
3765
|
+
executionReport: executionReport,
|
|
3766
|
+
outputParameters: outputParameters_1,
|
|
3767
|
+
preparedPipeline: preparedPipeline,
|
|
3768
|
+
})];
|
|
3769
|
+
case 28:
|
|
3713
3770
|
usage = addUsage.apply(void 0, __spreadArray([], __read(executionReport.promptExecutions.map(function (_a) {
|
|
3714
3771
|
var result = _a.result;
|
|
3715
3772
|
return (result === null || result === void 0 ? void 0 : result.usage) || ZERO_USAGE;
|
|
3716
3773
|
})), false));
|
|
3717
3774
|
outputParameters = filterJustOutputParameters();
|
|
3718
3775
|
isReturned = true;
|
|
3719
|
-
return [
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3776
|
+
if (!(onProgress !== undefined)) return [3 /*break*/, 30];
|
|
3777
|
+
// Note: Wait a short time to prevent race conditions
|
|
3778
|
+
return [4 /*yield*/, forTime(IMMEDIATE_TIME)];
|
|
3779
|
+
case 29:
|
|
3780
|
+
// Note: Wait a short time to prevent race conditions
|
|
3781
|
+
_g.sent();
|
|
3782
|
+
_g.label = 30;
|
|
3783
|
+
case 30: return [2 /*return*/, $asDeeplyFrozenSerializableJson('Successful PipelineExecutorResult', {
|
|
3784
|
+
isSuccessful: true,
|
|
3785
|
+
errors: errors.map(serializeError),
|
|
3786
|
+
warnings: warnings.map(serializeError),
|
|
3787
|
+
usage: usage,
|
|
3788
|
+
executionReport: executionReport,
|
|
3789
|
+
outputParameters: outputParameters,
|
|
3790
|
+
preparedPipeline: preparedPipeline,
|
|
3791
|
+
})];
|
|
3728
3792
|
}
|
|
3729
3793
|
});
|
|
3730
3794
|
}); };
|