@promptbook/cli 0.67.8 → 0.67.9
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 +165 -102
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/config.d.ts +6 -0
- package/package.json +1 -1
- package/umd/index.umd.js +165 -102
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -20,7 +20,7 @@ import OpenAI from 'openai';
|
|
|
20
20
|
/**
|
|
21
21
|
* The version of the Promptbook library
|
|
22
22
|
*/
|
|
23
|
-
var PROMPTBOOK_VERSION = '0.67.
|
|
23
|
+
var PROMPTBOOK_VERSION = '0.67.8';
|
|
24
24
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
25
25
|
|
|
26
26
|
/*! *****************************************************************************
|
|
@@ -419,6 +419,12 @@ var CONNECTION_TIMEOUT_MS = 7 * 1000;
|
|
|
419
419
|
* @private within the repository - too low-level in comparison with other `MAX_...`
|
|
420
420
|
*/
|
|
421
421
|
var CONNECTION_RETRIES_LIMIT = 5;
|
|
422
|
+
/**
|
|
423
|
+
* Short time interval to prevent race conditions in milliseconds
|
|
424
|
+
*
|
|
425
|
+
* @private within the repository - too low-level in comparison with other `MAX_...`
|
|
426
|
+
*/
|
|
427
|
+
var IMMEDIATE_TIME = 10;
|
|
422
428
|
/**
|
|
423
429
|
* The maximum number of (LLM) tasks running in parallel
|
|
424
430
|
*
|
|
@@ -1034,7 +1040,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
1034
1040
|
});
|
|
1035
1041
|
}
|
|
1036
1042
|
|
|
1037
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.67.
|
|
1043
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.67.8",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.8",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.8",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.8",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"}];
|
|
1038
1044
|
|
|
1039
1045
|
/**
|
|
1040
1046
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
@@ -3211,7 +3217,7 @@ function createPipelineExecutor(options) {
|
|
|
3211
3217
|
name = "pipeline-executor-frame-".concat(currentTemplate.name);
|
|
3212
3218
|
title = currentTemplate.title;
|
|
3213
3219
|
priority = preparedPipeline.promptTemplates.length - preparedPipeline.promptTemplates.indexOf(currentTemplate);
|
|
3214
|
-
if (!onProgress /* <- [3] */) return [3 /*break*/, 2]; /* <- [3] */
|
|
3220
|
+
if (!(onProgress !== undefined) /* <- [3] */) return [3 /*break*/, 2]; /* <- [3] */
|
|
3215
3221
|
progress_1 = {
|
|
3216
3222
|
name: name,
|
|
3217
3223
|
title: title,
|
|
@@ -3614,7 +3620,7 @@ function createPipelineExecutor(options) {
|
|
|
3614
3620
|
if (resultString === null) {
|
|
3615
3621
|
throw new UnexpectedError(spaceTrim(function (block) { return "\n Something went wrong and prompt result is null\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
3616
3622
|
}
|
|
3617
|
-
if (!onProgress /* <- [3] */) return [3 /*break*/, 9]; /* <- [3] */
|
|
3623
|
+
if (!(onProgress !== undefined) /* <- [3] */) return [3 /*break*/, 9]; /* <- [3] */
|
|
3618
3624
|
progress_2 = {
|
|
3619
3625
|
name: name,
|
|
3620
3626
|
title: title,
|
|
@@ -3672,7 +3678,7 @@ function createPipelineExecutor(options) {
|
|
|
3672
3678
|
}
|
|
3673
3679
|
return outputParameters;
|
|
3674
3680
|
}
|
|
3675
|
-
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;
|
|
3681
|
+
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;
|
|
3676
3682
|
var e_1, _e, e_2, _f;
|
|
3677
3683
|
return __generator(this, function (_g) {
|
|
3678
3684
|
switch (_g.label) {
|
|
@@ -3698,79 +3704,122 @@ function createPipelineExecutor(options) {
|
|
|
3698
3704
|
promptExecutions: [],
|
|
3699
3705
|
};
|
|
3700
3706
|
isReturned = false;
|
|
3707
|
+
_g.label = 3;
|
|
3708
|
+
case 3:
|
|
3709
|
+
_g.trys.push([3, 9, 10, 11]);
|
|
3710
|
+
_a = __values(preparedPipeline.parameters.filter(function (_a) {
|
|
3711
|
+
var isInput = _a.isInput;
|
|
3712
|
+
return isInput;
|
|
3713
|
+
})), _b = _a.next();
|
|
3714
|
+
_g.label = 4;
|
|
3715
|
+
case 4:
|
|
3716
|
+
if (!!_b.done) return [3 /*break*/, 8];
|
|
3717
|
+
parameter = _b.value;
|
|
3718
|
+
if (!(inputParameters[parameter.name] === undefined)) return [3 /*break*/, 7];
|
|
3719
|
+
isReturned = true;
|
|
3720
|
+
if (!(onProgress !== undefined)) return [3 /*break*/, 6];
|
|
3721
|
+
// Note: Wait a short time to prevent race conditions
|
|
3722
|
+
return [4 /*yield*/, forTime(IMMEDIATE_TIME)];
|
|
3723
|
+
case 5:
|
|
3724
|
+
// Note: Wait a short time to prevent race conditions
|
|
3725
|
+
_g.sent();
|
|
3726
|
+
_g.label = 6;
|
|
3727
|
+
case 6: return [2 /*return*/, $asDeeplyFrozenSerializableJson("Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"), {
|
|
3728
|
+
isSuccessful: false,
|
|
3729
|
+
errors: __spreadArray([
|
|
3730
|
+
new PipelineExecutionError("Parameter {".concat(parameter.name, "} is required as an input parameter"))
|
|
3731
|
+
], __read(errors), false).map(serializeError),
|
|
3732
|
+
warnings: [],
|
|
3733
|
+
executionReport: executionReport,
|
|
3734
|
+
outputParameters: {},
|
|
3735
|
+
usage: ZERO_USAGE,
|
|
3736
|
+
preparedPipeline: preparedPipeline,
|
|
3737
|
+
})];
|
|
3738
|
+
case 7:
|
|
3739
|
+
_b = _a.next();
|
|
3740
|
+
return [3 /*break*/, 4];
|
|
3741
|
+
case 8: return [3 /*break*/, 11];
|
|
3742
|
+
case 9:
|
|
3743
|
+
e_1_1 = _g.sent();
|
|
3744
|
+
e_1 = { error: e_1_1 };
|
|
3745
|
+
return [3 /*break*/, 11];
|
|
3746
|
+
case 10:
|
|
3701
3747
|
try {
|
|
3702
|
-
|
|
3703
|
-
for (_a = __values(preparedPipeline.parameters.filter(function (_a) {
|
|
3704
|
-
var isInput = _a.isInput;
|
|
3705
|
-
return isInput;
|
|
3706
|
-
})), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
3707
|
-
parameter = _b.value;
|
|
3708
|
-
if (inputParameters[parameter.name] === undefined) {
|
|
3709
|
-
isReturned = true;
|
|
3710
|
-
return [2 /*return*/, $asDeeplyFrozenSerializableJson("Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"), {
|
|
3711
|
-
isSuccessful: false,
|
|
3712
|
-
errors: __spreadArray([
|
|
3713
|
-
new PipelineExecutionError("Parameter {".concat(parameter.name, "} is required as an input parameter"))
|
|
3714
|
-
], __read(errors), false).map(serializeError),
|
|
3715
|
-
warnings: [],
|
|
3716
|
-
executionReport: executionReport,
|
|
3717
|
-
outputParameters: {},
|
|
3718
|
-
usage: ZERO_USAGE,
|
|
3719
|
-
preparedPipeline: preparedPipeline,
|
|
3720
|
-
})];
|
|
3721
|
-
}
|
|
3722
|
-
}
|
|
3723
|
-
}
|
|
3724
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3725
|
-
finally {
|
|
3726
|
-
try {
|
|
3727
|
-
if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
|
|
3728
|
-
}
|
|
3729
|
-
finally { if (e_1) throw e_1.error; }
|
|
3748
|
+
if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
|
|
3730
3749
|
}
|
|
3750
|
+
finally { if (e_1) throw e_1.error; }
|
|
3751
|
+
return [7 /*endfinally*/];
|
|
3752
|
+
case 11:
|
|
3731
3753
|
_loop_1 = function (parameterName) {
|
|
3732
|
-
var parameter
|
|
3733
|
-
|
|
3734
|
-
|
|
3754
|
+
var parameter;
|
|
3755
|
+
return __generator(this, function (_h) {
|
|
3756
|
+
switch (_h.label) {
|
|
3757
|
+
case 0:
|
|
3758
|
+
parameter = preparedPipeline.parameters.find(function (_a) {
|
|
3759
|
+
var name = _a.name;
|
|
3760
|
+
return name === parameterName;
|
|
3761
|
+
});
|
|
3762
|
+
if (!(parameter === undefined)) return [3 /*break*/, 1];
|
|
3763
|
+
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 "); })));
|
|
3764
|
+
return [3 /*break*/, 4];
|
|
3765
|
+
case 1:
|
|
3766
|
+
if (!(parameter.isInput === false)) return [3 /*break*/, 4];
|
|
3767
|
+
isReturned = true;
|
|
3768
|
+
if (!(onProgress !== undefined)) return [3 /*break*/, 3];
|
|
3769
|
+
// Note: Wait a short time to prevent race conditions
|
|
3770
|
+
return [4 /*yield*/, forTime(IMMEDIATE_TIME)];
|
|
3771
|
+
case 2:
|
|
3772
|
+
// Note: Wait a short time to prevent race conditions
|
|
3773
|
+
_h.sent();
|
|
3774
|
+
_h.label = 3;
|
|
3775
|
+
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 "); }), {
|
|
3776
|
+
isSuccessful: false,
|
|
3777
|
+
errors: __spreadArray([
|
|
3778
|
+
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 "); }))
|
|
3779
|
+
], __read(errors), false).map(serializeError),
|
|
3780
|
+
warnings: warnings.map(serializeError),
|
|
3781
|
+
executionReport: executionReport,
|
|
3782
|
+
outputParameters: {},
|
|
3783
|
+
usage: ZERO_USAGE,
|
|
3784
|
+
preparedPipeline: preparedPipeline,
|
|
3785
|
+
}) }];
|
|
3786
|
+
case 4: return [2 /*return*/];
|
|
3787
|
+
}
|
|
3735
3788
|
});
|
|
3736
|
-
if (parameter === undefined) {
|
|
3737
|
-
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 "); })));
|
|
3738
|
-
}
|
|
3739
|
-
else if (parameter.isInput === false) {
|
|
3740
|
-
isReturned = true;
|
|
3741
|
-
return { value: $asDeeplyFrozenSerializableJson(spaceTrim(function (block) { return "\n Unuccessful PipelineExecutorResult (with extra parameter {".concat(parameter.name, "}) PipelineExecutorResult\n\n ").concat(block(pipelineIdentification), "\n "); }), {
|
|
3742
|
-
isSuccessful: false,
|
|
3743
|
-
errors: __spreadArray([
|
|
3744
|
-
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 "); }))
|
|
3745
|
-
], __read(errors), false).map(serializeError),
|
|
3746
|
-
warnings: warnings.map(serializeError),
|
|
3747
|
-
executionReport: executionReport,
|
|
3748
|
-
outputParameters: {},
|
|
3749
|
-
usage: ZERO_USAGE,
|
|
3750
|
-
preparedPipeline: preparedPipeline,
|
|
3751
|
-
}) };
|
|
3752
|
-
}
|
|
3753
3789
|
};
|
|
3790
|
+
_g.label = 12;
|
|
3791
|
+
case 12:
|
|
3792
|
+
_g.trys.push([12, 17, 18, 19]);
|
|
3793
|
+
_c = __values(Object.keys(inputParameters)), _d = _c.next();
|
|
3794
|
+
_g.label = 13;
|
|
3795
|
+
case 13:
|
|
3796
|
+
if (!!_d.done) return [3 /*break*/, 16];
|
|
3797
|
+
parameterName = _d.value;
|
|
3798
|
+
return [5 /*yield**/, _loop_1(parameterName)];
|
|
3799
|
+
case 14:
|
|
3800
|
+
state_1 = _g.sent();
|
|
3801
|
+
if (typeof state_1 === "object")
|
|
3802
|
+
return [2 /*return*/, state_1.value];
|
|
3803
|
+
_g.label = 15;
|
|
3804
|
+
case 15:
|
|
3805
|
+
_d = _c.next();
|
|
3806
|
+
return [3 /*break*/, 13];
|
|
3807
|
+
case 16: return [3 /*break*/, 19];
|
|
3808
|
+
case 17:
|
|
3809
|
+
e_2_1 = _g.sent();
|
|
3810
|
+
e_2 = { error: e_2_1 };
|
|
3811
|
+
return [3 /*break*/, 19];
|
|
3812
|
+
case 18:
|
|
3754
3813
|
try {
|
|
3755
|
-
|
|
3756
|
-
for (_c = __values(Object.keys(inputParameters)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
3757
|
-
parameterName = _d.value;
|
|
3758
|
-
state_1 = _loop_1(parameterName);
|
|
3759
|
-
if (typeof state_1 === "object")
|
|
3760
|
-
return [2 /*return*/, state_1.value];
|
|
3761
|
-
}
|
|
3762
|
-
}
|
|
3763
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
3764
|
-
finally {
|
|
3765
|
-
try {
|
|
3766
|
-
if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
|
|
3767
|
-
}
|
|
3768
|
-
finally { if (e_2) throw e_2.error; }
|
|
3814
|
+
if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
|
|
3769
3815
|
}
|
|
3816
|
+
finally { if (e_2) throw e_2.error; }
|
|
3817
|
+
return [7 /*endfinally*/];
|
|
3818
|
+
case 19:
|
|
3770
3819
|
parametersToPass = inputParameters;
|
|
3771
|
-
_g.label =
|
|
3772
|
-
case
|
|
3773
|
-
_g.trys.push([
|
|
3820
|
+
_g.label = 20;
|
|
3821
|
+
case 20:
|
|
3822
|
+
_g.trys.push([20, 25, , 28]);
|
|
3774
3823
|
resovedParameterNames_1 = preparedPipeline.parameters
|
|
3775
3824
|
.filter(function (_a) {
|
|
3776
3825
|
var isInput = _a.isInput;
|
|
@@ -3785,8 +3834,8 @@ function createPipelineExecutor(options) {
|
|
|
3785
3834
|
loopLimit = LOOP_LIMIT;
|
|
3786
3835
|
_loop_2 = function () {
|
|
3787
3836
|
var currentTemplate, work_1;
|
|
3788
|
-
return __generator(this, function (
|
|
3789
|
-
switch (
|
|
3837
|
+
return __generator(this, function (_j) {
|
|
3838
|
+
switch (_j.label) {
|
|
3790
3839
|
case 0:
|
|
3791
3840
|
if (loopLimit-- < 0) {
|
|
3792
3841
|
// Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
|
|
@@ -3812,7 +3861,7 @@ function createPipelineExecutor(options) {
|
|
|
3812
3861
|
if (!!currentTemplate) return [3 /*break*/, 3];
|
|
3813
3862
|
/* [5] */ return [4 /*yield*/, Promise.race(resolving_1)];
|
|
3814
3863
|
case 2:
|
|
3815
|
-
/* [5] */
|
|
3864
|
+
/* [5] */ _j.sent();
|
|
3816
3865
|
return [3 /*break*/, 4];
|
|
3817
3866
|
case 3:
|
|
3818
3867
|
unresovedTemplates_1 = unresovedTemplates_1.filter(function (template) { return template !== currentTemplate; });
|
|
@@ -3824,23 +3873,23 @@ function createPipelineExecutor(options) {
|
|
|
3824
3873
|
resolving_1 = resolving_1.filter(function (w) { return w !== work_1; });
|
|
3825
3874
|
});
|
|
3826
3875
|
resolving_1.push(work_1);
|
|
3827
|
-
|
|
3876
|
+
_j.label = 4;
|
|
3828
3877
|
case 4: return [2 /*return*/];
|
|
3829
3878
|
}
|
|
3830
3879
|
});
|
|
3831
3880
|
};
|
|
3832
|
-
_g.label =
|
|
3833
|
-
case
|
|
3834
|
-
if (!(unresovedTemplates_1.length > 0)) return [3 /*break*/,
|
|
3881
|
+
_g.label = 21;
|
|
3882
|
+
case 21:
|
|
3883
|
+
if (!(unresovedTemplates_1.length > 0)) return [3 /*break*/, 23];
|
|
3835
3884
|
return [5 /*yield**/, _loop_2()];
|
|
3836
|
-
case
|
|
3885
|
+
case 22:
|
|
3837
3886
|
_g.sent();
|
|
3838
|
-
return [3 /*break*/,
|
|
3839
|
-
case
|
|
3840
|
-
case
|
|
3887
|
+
return [3 /*break*/, 21];
|
|
3888
|
+
case 23: return [4 /*yield*/, Promise.all(resolving_1)];
|
|
3889
|
+
case 24:
|
|
3841
3890
|
_g.sent();
|
|
3842
|
-
return [3 /*break*/,
|
|
3843
|
-
case
|
|
3891
|
+
return [3 /*break*/, 28];
|
|
3892
|
+
case 25:
|
|
3844
3893
|
error_1 = _g.sent();
|
|
3845
3894
|
if (!(error_1 instanceof Error)) {
|
|
3846
3895
|
throw error_1;
|
|
@@ -3851,31 +3900,45 @@ function createPipelineExecutor(options) {
|
|
|
3851
3900
|
})), false));
|
|
3852
3901
|
outputParameters_1 = filterJustOutputParameters();
|
|
3853
3902
|
isReturned = true;
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3903
|
+
if (!(onProgress !== undefined)) return [3 /*break*/, 27];
|
|
3904
|
+
// Note: Wait a short time to prevent race conditions
|
|
3905
|
+
return [4 /*yield*/, forTime(IMMEDIATE_TIME)];
|
|
3906
|
+
case 26:
|
|
3907
|
+
// Note: Wait a short time to prevent race conditions
|
|
3908
|
+
_g.sent();
|
|
3909
|
+
_g.label = 27;
|
|
3910
|
+
case 27: return [2 /*return*/, $asDeeplyFrozenSerializableJson('Unuccessful PipelineExecutorResult (with misc errors) PipelineExecutorResult', {
|
|
3911
|
+
isSuccessful: false,
|
|
3912
|
+
errors: __spreadArray([error_1], __read(errors), false).map(serializeError),
|
|
3913
|
+
warnings: warnings.map(serializeError),
|
|
3914
|
+
usage: usage_1,
|
|
3915
|
+
executionReport: executionReport,
|
|
3916
|
+
outputParameters: outputParameters_1,
|
|
3917
|
+
preparedPipeline: preparedPipeline,
|
|
3918
|
+
})];
|
|
3919
|
+
case 28:
|
|
3864
3920
|
usage = addUsage.apply(void 0, __spreadArray([], __read(executionReport.promptExecutions.map(function (_a) {
|
|
3865
3921
|
var result = _a.result;
|
|
3866
3922
|
return (result === null || result === void 0 ? void 0 : result.usage) || ZERO_USAGE;
|
|
3867
3923
|
})), false));
|
|
3868
3924
|
outputParameters = filterJustOutputParameters();
|
|
3869
3925
|
isReturned = true;
|
|
3870
|
-
return [
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3926
|
+
if (!(onProgress !== undefined)) return [3 /*break*/, 30];
|
|
3927
|
+
// Note: Wait a short time to prevent race conditions
|
|
3928
|
+
return [4 /*yield*/, forTime(IMMEDIATE_TIME)];
|
|
3929
|
+
case 29:
|
|
3930
|
+
// Note: Wait a short time to prevent race conditions
|
|
3931
|
+
_g.sent();
|
|
3932
|
+
_g.label = 30;
|
|
3933
|
+
case 30: return [2 /*return*/, $asDeeplyFrozenSerializableJson('Successful PipelineExecutorResult', {
|
|
3934
|
+
isSuccessful: true,
|
|
3935
|
+
errors: errors.map(serializeError),
|
|
3936
|
+
warnings: warnings.map(serializeError),
|
|
3937
|
+
usage: usage,
|
|
3938
|
+
executionReport: executionReport,
|
|
3939
|
+
outputParameters: outputParameters,
|
|
3940
|
+
preparedPipeline: preparedPipeline,
|
|
3941
|
+
})];
|
|
3879
3942
|
}
|
|
3880
3943
|
});
|
|
3881
3944
|
}); };
|