@promptbook/core 0.67.1 β 0.67.3
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 +382 -346
- package/esm/index.es.js.map +1 -1
- package/esm/typings/promptbook-collection/index.d.ts +0 -2
- package/esm/typings/src/_packages/core.index.d.ts +2 -0
- package/esm/typings/src/errors/{_ExpectError.d.ts β ExpectError.d.ts} +2 -1
- package/esm/typings/src/errors/index.d.ts +2 -0
- package/esm/typings/src/execution/createPipelineExecutor.d.ts +1 -0
- package/esm/typings/src/prepare/preparePipeline.d.ts +2 -0
- package/package.json +1 -1
- package/umd/index.umd.js +382 -345
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -9,7 +9,7 @@ import moment from 'moment';
|
|
|
9
9
|
/**
|
|
10
10
|
* The version of the Promptbook library
|
|
11
11
|
*/
|
|
12
|
-
var PROMPTBOOK_VERSION = '0.67.
|
|
12
|
+
var PROMPTBOOK_VERSION = '0.67.2';
|
|
13
13
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
14
14
|
|
|
15
15
|
/*! *****************************************************************************
|
|
@@ -1779,7 +1779,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
1779
1779
|
});
|
|
1780
1780
|
}
|
|
1781
1781
|
|
|
1782
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.67.
|
|
1782
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.67.2",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.2",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.2",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.2",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"}];
|
|
1783
1783
|
|
|
1784
1784
|
var defaultDiacriticsRemovalMap = [
|
|
1785
1785
|
{
|
|
@@ -2192,6 +2192,25 @@ var EnvironmentMismatchError = /** @class */ (function (_super) {
|
|
|
2192
2192
|
return EnvironmentMismatchError;
|
|
2193
2193
|
}(Error));
|
|
2194
2194
|
|
|
2195
|
+
/**
|
|
2196
|
+
* This error occurs when some expectation is not met in the execution of the pipeline
|
|
2197
|
+
*
|
|
2198
|
+
* @public exported from `@promptbook/core`
|
|
2199
|
+
* Note: Do not throw this error, its reserved for `checkExpectations` and `createPipelineExecutor` and public ONLY to be serializable through remote server
|
|
2200
|
+
* Note: Always thrown in `checkExpectations` and catched in `createPipelineExecutor` and rethrown as `PipelineExecutionError`
|
|
2201
|
+
* Note: This is a kindof subtype of PipelineExecutionError
|
|
2202
|
+
*/
|
|
2203
|
+
var ExpectError = /** @class */ (function (_super) {
|
|
2204
|
+
__extends(ExpectError, _super);
|
|
2205
|
+
function ExpectError(message) {
|
|
2206
|
+
var _this = _super.call(this, message) || this;
|
|
2207
|
+
_this.name = 'ExpectError';
|
|
2208
|
+
Object.setPrototypeOf(_this, ExpectError.prototype);
|
|
2209
|
+
return _this;
|
|
2210
|
+
}
|
|
2211
|
+
return ExpectError;
|
|
2212
|
+
}(Error));
|
|
2213
|
+
|
|
2195
2214
|
/**
|
|
2196
2215
|
* This error type indicates that some limit was reached
|
|
2197
2216
|
*
|
|
@@ -2230,6 +2249,7 @@ var NotYetImplementedError = /** @class */ (function (_super) {
|
|
|
2230
2249
|
* @public exported from `@promptbook/core`
|
|
2231
2250
|
*/
|
|
2232
2251
|
var ERRORS = {
|
|
2252
|
+
ExpectError: ExpectError,
|
|
2233
2253
|
CollectionError: CollectionError,
|
|
2234
2254
|
EnvironmentMismatchError: EnvironmentMismatchError,
|
|
2235
2255
|
LimitReachedError: LimitReachedError,
|
|
@@ -2397,24 +2417,6 @@ function extractParameterNamesFromPromptTemplate(promptTemplate) {
|
|
|
2397
2417
|
* TODO: [π£] If script require contentLanguage
|
|
2398
2418
|
*/
|
|
2399
2419
|
|
|
2400
|
-
/**
|
|
2401
|
-
* This error occurs when some expectation is not met in the execution of the pipeline
|
|
2402
|
-
*
|
|
2403
|
-
* @private error of `checkExpectations` and `createPipelineExecutor`
|
|
2404
|
-
* Note: Always thrown in `checkExpectations` and catched in `createPipelineExecutor` and rethrown as `PipelineExecutionError`
|
|
2405
|
-
* Note: This is a kindof subtype of PipelineExecutionError
|
|
2406
|
-
*/
|
|
2407
|
-
var ExpectError = /** @class */ (function (_super) {
|
|
2408
|
-
__extends(ExpectError, _super);
|
|
2409
|
-
function ExpectError(message) {
|
|
2410
|
-
var _this = _super.call(this, message) || this;
|
|
2411
|
-
_this.name = 'ExpectError';
|
|
2412
|
-
Object.setPrototypeOf(_this, ExpectError.prototype);
|
|
2413
|
-
return _this;
|
|
2414
|
-
}
|
|
2415
|
-
return ExpectError;
|
|
2416
|
-
}(Error));
|
|
2417
|
-
|
|
2418
2420
|
/**
|
|
2419
2421
|
* Serializes an error into a [π] JSON-serializable object
|
|
2420
2422
|
*
|
|
@@ -3129,13 +3131,24 @@ function createPipelineExecutor(options) {
|
|
|
3129
3131
|
var pipeline = options.pipeline, tools = options.tools, _a = options.settings, settings = _a === void 0 ? {} : _a;
|
|
3130
3132
|
var _b = settings.maxExecutionAttempts, maxExecutionAttempts = _b === void 0 ? MAX_EXECUTION_ATTEMPTS : _b, _c = settings.maxParallelCount, maxParallelCount = _c === void 0 ? MAX_PARALLEL_COUNT : _c, _d = settings.isVerbose, isVerbose = _d === void 0 ? IS_VERBOSE : _d, _e = settings.isNotPreparedWarningSupressed, isNotPreparedWarningSupressed = _e === void 0 ? false : _e;
|
|
3131
3133
|
validatePipeline(pipeline);
|
|
3134
|
+
var pipelineIdentification = (function () {
|
|
3135
|
+
// Note: This is a π implementation of [π]
|
|
3136
|
+
var _ = [];
|
|
3137
|
+
if (pipeline.sourceFile !== undefined) {
|
|
3138
|
+
_.push("File: ".concat(pipeline.sourceFile));
|
|
3139
|
+
}
|
|
3140
|
+
if (pipeline.pipelineUrl !== undefined) {
|
|
3141
|
+
_.push("Url: ".concat(pipeline.pipelineUrl));
|
|
3142
|
+
}
|
|
3143
|
+
return _.join('\n');
|
|
3144
|
+
})();
|
|
3132
3145
|
var llmTools = joinLlmExecutionTools.apply(void 0, __spreadArray([], __read(arrayableToArray(tools.llm)), false));
|
|
3133
3146
|
var preparedPipeline;
|
|
3134
3147
|
if (isPipelinePrepared(pipeline)) {
|
|
3135
3148
|
preparedPipeline = pipeline;
|
|
3136
3149
|
}
|
|
3137
3150
|
else if (isNotPreparedWarningSupressed !== true) {
|
|
3138
|
-
console.warn(spaceTrim$1(
|
|
3151
|
+
console.warn(spaceTrim$1(function (block) { return "\n Pipeline is not prepared\n\n ".concat(block(pipelineIdentification), "\n\n It will be prepared ad-hoc before the first execution and **returned as `preparedPipeline` in `PipelineExecutorResult`**\n But it is recommended to prepare the pipeline during collection preparation\n\n @see more at https://ptbk.io/prepare-pipeline\n "); }));
|
|
3139
3152
|
}
|
|
3140
3153
|
var pipelineExecutor = function (inputParameters, onProgress) { return __awaiter(_this, void 0, void 0, function () {
|
|
3141
3154
|
// TODO: !!! Extract to separate functions and files - ALL FUNCTIONS BELOW
|
|
@@ -3173,7 +3186,7 @@ function createPipelineExecutor(options) {
|
|
|
3173
3186
|
}
|
|
3174
3187
|
function getReservedParametersForTemplate(template) {
|
|
3175
3188
|
return __awaiter(this, void 0, void 0, function () {
|
|
3176
|
-
var context, knowledge, samples, currentDate, modelName, reservedParameters, RESERVED_PARAMETER_NAMES_1, RESERVED_PARAMETER_NAMES_1_1, parameterName;
|
|
3189
|
+
var context, knowledge, samples, currentDate, modelName, reservedParameters, _loop_3, RESERVED_PARAMETER_NAMES_1, RESERVED_PARAMETER_NAMES_1_1, parameterName;
|
|
3177
3190
|
var e_3, _a;
|
|
3178
3191
|
return __generator(this, function (_b) {
|
|
3179
3192
|
switch (_b.label) {
|
|
@@ -3196,13 +3209,16 @@ function createPipelineExecutor(options) {
|
|
|
3196
3209
|
currentDate: currentDate,
|
|
3197
3210
|
modelName: modelName,
|
|
3198
3211
|
};
|
|
3212
|
+
_loop_3 = function (parameterName) {
|
|
3213
|
+
if (reservedParameters[parameterName] === undefined) {
|
|
3214
|
+
throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Reserved parameter {".concat(parameterName, "} is not defined\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
3215
|
+
}
|
|
3216
|
+
};
|
|
3199
3217
|
try {
|
|
3200
3218
|
// Note: Doublecheck that ALL reserved parameters are defined:
|
|
3201
3219
|
for (RESERVED_PARAMETER_NAMES_1 = __values(RESERVED_PARAMETER_NAMES), RESERVED_PARAMETER_NAMES_1_1 = RESERVED_PARAMETER_NAMES_1.next(); !RESERVED_PARAMETER_NAMES_1_1.done; RESERVED_PARAMETER_NAMES_1_1 = RESERVED_PARAMETER_NAMES_1.next()) {
|
|
3202
3220
|
parameterName = RESERVED_PARAMETER_NAMES_1_1.value;
|
|
3203
|
-
|
|
3204
|
-
throw new UnexpectedError("Reserved parameter {".concat(parameterName, "} is not defined"));
|
|
3205
|
-
}
|
|
3221
|
+
_loop_3(parameterName);
|
|
3206
3222
|
}
|
|
3207
3223
|
}
|
|
3208
3224
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
@@ -3219,10 +3235,10 @@ function createPipelineExecutor(options) {
|
|
|
3219
3235
|
}
|
|
3220
3236
|
function executeSingleTemplate(currentTemplate) {
|
|
3221
3237
|
return __awaiter(this, void 0, void 0, function () {
|
|
3222
|
-
var name, title, priority, usedParameterNames, dependentParameterNames, definedParameters, _a, _b, _c, definedParameterNames, parameters, _d, _e, parameterName, prompt, chatResult, completionResult, embeddingResult, result, resultString, expectError, scriptPipelineExecutionErrors, maxAttempts, jokerParameterNames, preparedContent,
|
|
3223
|
-
var
|
|
3224
|
-
return __generator(this, function (
|
|
3225
|
-
switch (
|
|
3238
|
+
var name, title, priority, usedParameterNames, dependentParameterNames, definedParameters, _a, _b, _c, definedParameterNames, parameters, _loop_4, _d, _e, parameterName, prompt, chatResult, completionResult, embeddingResult, result, resultString, expectError, scriptPipelineExecutionErrors, maxAttempts, jokerParameterNames, preparedContent, _loop_5, attempt, state_2;
|
|
3239
|
+
var e_4, _f, _g;
|
|
3240
|
+
return __generator(this, function (_h) {
|
|
3241
|
+
switch (_h.label) {
|
|
3226
3242
|
case 0:
|
|
3227
3243
|
name = "pipeline-executor-frame-".concat(currentTemplate.name);
|
|
3228
3244
|
title = currentTemplate.title;
|
|
@@ -3239,47 +3255,48 @@ function createPipelineExecutor(options) {
|
|
|
3239
3255
|
// <- [3]
|
|
3240
3256
|
})];
|
|
3241
3257
|
case 1:
|
|
3242
|
-
|
|
3243
|
-
|
|
3258
|
+
_h.sent();
|
|
3259
|
+
_h.label = 2;
|
|
3244
3260
|
case 2:
|
|
3245
3261
|
usedParameterNames = extractParameterNamesFromPromptTemplate(currentTemplate);
|
|
3246
3262
|
dependentParameterNames = new Set(currentTemplate.dependentParameterNames);
|
|
3247
3263
|
if (union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)).size !== 0) {
|
|
3248
|
-
throw new UnexpectedError(spaceTrim$1("\n
|
|
3264
|
+
throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Dependent parameters are not consistent used parameters:\n\n ".concat(block(pipelineIdentification), "\n\n Dependent parameters:\n ").concat(Array.from(dependentParameterNames).join(', '), "\n\n Used parameters:\n ").concat(Array.from(usedParameterNames).join(', '), "\n\n "); }));
|
|
3249
3265
|
}
|
|
3250
3266
|
_b = (_a = Object).freeze;
|
|
3251
3267
|
_c = [{}];
|
|
3252
3268
|
return [4 /*yield*/, getReservedParametersForTemplate(currentTemplate)];
|
|
3253
3269
|
case 3:
|
|
3254
|
-
definedParameters = _b.apply(_a, [__assign.apply(void 0, [__assign.apply(void 0, _c.concat([(
|
|
3270
|
+
definedParameters = _b.apply(_a, [__assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_h.sent())])), parametersToPass])]);
|
|
3255
3271
|
definedParameterNames = new Set(Object.keys(definedParameters));
|
|
3256
3272
|
parameters = {};
|
|
3273
|
+
_loop_4 = function (parameterName) {
|
|
3274
|
+
// Situation: Parameter is defined and used
|
|
3275
|
+
if (definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
|
|
3276
|
+
parameters[parameterName] = definedParameters[parameterName];
|
|
3277
|
+
}
|
|
3278
|
+
// Situation: Parameter is defined but NOT used
|
|
3279
|
+
else if (definedParameterNames.has(parameterName) && !usedParameterNames.has(parameterName)) ;
|
|
3280
|
+
// Situation: Parameter is NOT defined BUT used
|
|
3281
|
+
else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
|
|
3282
|
+
// Houston, we have a problem
|
|
3283
|
+
// Note: Checking part is also done in `validatePipeline`, but itβs good to doublecheck
|
|
3284
|
+
throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Parameter {".concat(parameterName, "} is NOT defined\n BUT used in template \"").concat(currentTemplate.title || currentTemplate.name, "\"\n\n This should be catched in `validatePipeline`\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
3285
|
+
}
|
|
3286
|
+
};
|
|
3257
3287
|
try {
|
|
3258
3288
|
// Note: [2] Check that all used parameters are defined and removing unused parameters for this template
|
|
3259
3289
|
for (_d = __values(Array.from(union(definedParameterNames, usedParameterNames, dependentParameterNames))), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
3260
3290
|
parameterName = _e.value;
|
|
3261
|
-
|
|
3262
|
-
if (definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
|
|
3263
|
-
parameters[parameterName] = definedParameters[parameterName];
|
|
3264
|
-
}
|
|
3265
|
-
// Situation: Parameter is defined but NOT used
|
|
3266
|
-
else if (definedParameterNames.has(parameterName) && !usedParameterNames.has(parameterName)) {
|
|
3267
|
-
// Do not pass this parameter to prompt
|
|
3268
|
-
}
|
|
3269
|
-
// Situation: Parameter is NOT defined BUT used
|
|
3270
|
-
else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
|
|
3271
|
-
// Houston, we have a problem
|
|
3272
|
-
// Note: Checking part is also done in `validatePipeline`, but itβs good to doublecheck
|
|
3273
|
-
throw new UnexpectedError(spaceTrim$1("\n Parameter {".concat(parameterName, "} is NOT defined\n BUT used in template \"").concat(currentTemplate.title || currentTemplate.name, "\"\n\n This should be catched in `validatePipeline`\n\n ")));
|
|
3274
|
-
}
|
|
3291
|
+
_loop_4(parameterName);
|
|
3275
3292
|
}
|
|
3276
3293
|
}
|
|
3277
|
-
catch (
|
|
3294
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
3278
3295
|
finally {
|
|
3279
3296
|
try {
|
|
3280
|
-
if (_e && !_e.done && (
|
|
3297
|
+
if (_e && !_e.done && (_f = _d.return)) _f.call(_d);
|
|
3281
3298
|
}
|
|
3282
|
-
finally { if (
|
|
3299
|
+
finally { if (e_4) throw e_4.error; }
|
|
3283
3300
|
}
|
|
3284
3301
|
// Note: Now we can freeze `parameters` because we are sure that all and only used parameters are defined
|
|
3285
3302
|
Object.freeze(parameters);
|
|
@@ -3291,297 +3308,310 @@ function createPipelineExecutor(options) {
|
|
|
3291
3308
|
preparedContent = (currentTemplate.preparedContent || '{content}')
|
|
3292
3309
|
.split('{content}')
|
|
3293
3310
|
.join(currentTemplate.content);
|
|
3311
|
+
_loop_5 = function (attempt) {
|
|
3312
|
+
var isJokerAttempt, jokerParameterName, _j, _k, _l, _m, scriptTools, error_2, e_5_1, _o, _p, functionName, postprocessingError, _q, _r, scriptTools, error_3, e_6_1, e_7_1, error_4;
|
|
3313
|
+
var e_5, _s, e_7, _t, e_6, _u;
|
|
3314
|
+
return __generator(this, function (_v) {
|
|
3315
|
+
switch (_v.label) {
|
|
3316
|
+
case 0:
|
|
3317
|
+
isJokerAttempt = attempt < 0;
|
|
3318
|
+
jokerParameterName = jokerParameterNames[jokerParameterNames.length + attempt];
|
|
3319
|
+
if (isJokerAttempt && !jokerParameterName) {
|
|
3320
|
+
throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Joker not found in attempt ".concat(attempt, "\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
3321
|
+
}
|
|
3322
|
+
result = null;
|
|
3323
|
+
resultString = null;
|
|
3324
|
+
expectError = null;
|
|
3325
|
+
if (isJokerAttempt) {
|
|
3326
|
+
if (parameters[jokerParameterName] === undefined) {
|
|
3327
|
+
throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Joker parameter {".concat(jokerParameterName, "} not defined\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
3328
|
+
// <- TODO: This is maybe `PipelineLogicError` which should be detected in `validatePipeline` and here just thrown as `UnexpectedError`
|
|
3329
|
+
}
|
|
3330
|
+
else {
|
|
3331
|
+
resultString = parameters[jokerParameterName];
|
|
3332
|
+
}
|
|
3333
|
+
}
|
|
3334
|
+
_v.label = 1;
|
|
3335
|
+
case 1:
|
|
3336
|
+
_v.trys.push([1, 44, 45, 46]);
|
|
3337
|
+
if (!!isJokerAttempt) return [3 /*break*/, 26];
|
|
3338
|
+
_j = currentTemplate.blockType;
|
|
3339
|
+
switch (_j) {
|
|
3340
|
+
case 'SIMPLE_TEMPLATE': return [3 /*break*/, 2];
|
|
3341
|
+
case 'PROMPT_TEMPLATE': return [3 /*break*/, 3];
|
|
3342
|
+
case 'SCRIPT': return [3 /*break*/, 12];
|
|
3343
|
+
case 'PROMPT_DIALOG': return [3 /*break*/, 23];
|
|
3344
|
+
}
|
|
3345
|
+
return [3 /*break*/, 25];
|
|
3346
|
+
case 2:
|
|
3347
|
+
resultString = replaceParameters(preparedContent, parameters);
|
|
3348
|
+
return [3 /*break*/, 26];
|
|
3349
|
+
case 3:
|
|
3350
|
+
prompt = {
|
|
3351
|
+
title: currentTemplate.title,
|
|
3352
|
+
pipelineUrl: "".concat(preparedPipeline.pipelineUrl
|
|
3353
|
+
? preparedPipeline.pipelineUrl
|
|
3354
|
+
: 'anonymous' /* <- TODO: [π§ ] How to deal with anonymous pipelines, do here some auto-url like SHA-256 based ad-hoc identifier? */, "#").concat(currentTemplate.name),
|
|
3355
|
+
parameters: parameters,
|
|
3356
|
+
content: preparedContent,
|
|
3357
|
+
modelRequirements: currentTemplate.modelRequirements,
|
|
3358
|
+
expectations: __assign(__assign({}, (preparedPipeline.personas.find(function (_a) {
|
|
3359
|
+
var name = _a.name;
|
|
3360
|
+
return name === currentTemplate.personaName;
|
|
3361
|
+
}) || {})), currentTemplate.expectations),
|
|
3362
|
+
expectFormat: currentTemplate.expectFormat,
|
|
3363
|
+
postprocessingFunctionNames: currentTemplate.postprocessingFunctionNames,
|
|
3364
|
+
}; // <- TODO: Not very good type guard
|
|
3365
|
+
_k = currentTemplate.modelRequirements.modelVariant;
|
|
3366
|
+
switch (_k) {
|
|
3367
|
+
case 'CHAT': return [3 /*break*/, 4];
|
|
3368
|
+
case 'COMPLETION': return [3 /*break*/, 6];
|
|
3369
|
+
case 'EMBEDDING': return [3 /*break*/, 8];
|
|
3370
|
+
}
|
|
3371
|
+
return [3 /*break*/, 10];
|
|
3372
|
+
case 4: return [4 /*yield*/, llmTools.callChatModel($deepFreeze(prompt))];
|
|
3373
|
+
case 5:
|
|
3374
|
+
chatResult = _v.sent();
|
|
3375
|
+
// TODO: [π¬] Destroy chatThread
|
|
3376
|
+
result = chatResult;
|
|
3377
|
+
resultString = chatResult.content;
|
|
3378
|
+
return [3 /*break*/, 11];
|
|
3379
|
+
case 6: return [4 /*yield*/, llmTools.callCompletionModel($deepFreeze(prompt))];
|
|
3380
|
+
case 7:
|
|
3381
|
+
completionResult = _v.sent();
|
|
3382
|
+
result = completionResult;
|
|
3383
|
+
resultString = completionResult.content;
|
|
3384
|
+
return [3 /*break*/, 11];
|
|
3385
|
+
case 8: return [4 /*yield*/, llmTools.callEmbeddingModel($deepFreeze(prompt))];
|
|
3386
|
+
case 9:
|
|
3387
|
+
embeddingResult = _v.sent();
|
|
3388
|
+
result = embeddingResult;
|
|
3389
|
+
resultString = embeddingResult.content.join(',');
|
|
3390
|
+
return [3 /*break*/, 11];
|
|
3391
|
+
case 10: throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Unknown model variant \"".concat(currentTemplate.modelRequirements.modelVariant, "\"\n\n ").concat(block(pipelineIdentification), "\n\n\n "); }));
|
|
3392
|
+
case 11: return [3 /*break*/, 26];
|
|
3393
|
+
case 12:
|
|
3394
|
+
if (arrayableToArray(tools.script).length === 0) {
|
|
3395
|
+
throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n No script execution tools are available\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
3396
|
+
}
|
|
3397
|
+
if (!currentTemplate.contentLanguage) {
|
|
3398
|
+
throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Script language is not defined for prompt template \"".concat(currentTemplate.name, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
3399
|
+
}
|
|
3400
|
+
// TODO: DRY [1]
|
|
3401
|
+
scriptPipelineExecutionErrors = [];
|
|
3402
|
+
_v.label = 13;
|
|
3403
|
+
case 13:
|
|
3404
|
+
_v.trys.push([13, 20, 21, 22]);
|
|
3405
|
+
_l = (e_5 = void 0, __values(arrayableToArray(tools.script))), _m = _l.next();
|
|
3406
|
+
_v.label = 14;
|
|
3407
|
+
case 14:
|
|
3408
|
+
if (!!_m.done) return [3 /*break*/, 19];
|
|
3409
|
+
scriptTools = _m.value;
|
|
3410
|
+
_v.label = 15;
|
|
3411
|
+
case 15:
|
|
3412
|
+
_v.trys.push([15, 17, , 18]);
|
|
3413
|
+
return [4 /*yield*/, scriptTools.execute($deepFreeze({
|
|
3414
|
+
scriptLanguage: currentTemplate.contentLanguage,
|
|
3415
|
+
script: preparedContent,
|
|
3416
|
+
parameters: parameters,
|
|
3417
|
+
}))];
|
|
3418
|
+
case 16:
|
|
3419
|
+
resultString = _v.sent();
|
|
3420
|
+
return [3 /*break*/, 19];
|
|
3421
|
+
case 17:
|
|
3422
|
+
error_2 = _v.sent();
|
|
3423
|
+
if (!(error_2 instanceof Error)) {
|
|
3424
|
+
throw error_2;
|
|
3425
|
+
}
|
|
3426
|
+
if (error_2 instanceof UnexpectedError) {
|
|
3427
|
+
throw error_2;
|
|
3428
|
+
}
|
|
3429
|
+
scriptPipelineExecutionErrors.push(error_2);
|
|
3430
|
+
return [3 /*break*/, 18];
|
|
3431
|
+
case 18:
|
|
3432
|
+
_m = _l.next();
|
|
3433
|
+
return [3 /*break*/, 14];
|
|
3434
|
+
case 19: return [3 /*break*/, 22];
|
|
3435
|
+
case 20:
|
|
3436
|
+
e_5_1 = _v.sent();
|
|
3437
|
+
e_5 = { error: e_5_1 };
|
|
3438
|
+
return [3 /*break*/, 22];
|
|
3439
|
+
case 21:
|
|
3440
|
+
try {
|
|
3441
|
+
if (_m && !_m.done && (_s = _l.return)) _s.call(_l);
|
|
3442
|
+
}
|
|
3443
|
+
finally { if (e_5) throw e_5.error; }
|
|
3444
|
+
return [7 /*endfinally*/];
|
|
3445
|
+
case 22:
|
|
3446
|
+
if (resultString !== null) {
|
|
3447
|
+
return [3 /*break*/, 26];
|
|
3448
|
+
}
|
|
3449
|
+
if (scriptPipelineExecutionErrors.length === 1) {
|
|
3450
|
+
throw scriptPipelineExecutionErrors[0];
|
|
3451
|
+
}
|
|
3452
|
+
else {
|
|
3453
|
+
throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Script execution failed ".concat(scriptPipelineExecutionErrors.length, " times\n\n ").concat(block(pipelineIdentification), "\n\n ").concat(block(scriptPipelineExecutionErrors
|
|
3454
|
+
.map(function (error) { return '- ' + error.message; })
|
|
3455
|
+
.join('\n\n')), "\n "); }));
|
|
3456
|
+
}
|
|
3457
|
+
case 23:
|
|
3458
|
+
if (tools.userInterface === undefined) {
|
|
3459
|
+
throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n User interface tools are not available\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
3460
|
+
}
|
|
3461
|
+
return [4 /*yield*/, tools.userInterface.promptDialog($deepFreeze({
|
|
3462
|
+
promptTitle: currentTemplate.title,
|
|
3463
|
+
promptMessage: replaceParameters(currentTemplate.description || '', parameters),
|
|
3464
|
+
defaultValue: replaceParameters(preparedContent, parameters),
|
|
3465
|
+
// TODO: [π§ ] !! Figure out how to define placeholder in .ptbk.md file
|
|
3466
|
+
placeholder: undefined,
|
|
3467
|
+
priority: priority,
|
|
3468
|
+
}))];
|
|
3469
|
+
case 24:
|
|
3470
|
+
// TODO: [πΉ] When making next attempt for `PROMPT DIALOG`, preserve the previous user input
|
|
3471
|
+
resultString = _v.sent();
|
|
3472
|
+
return [3 /*break*/, 26];
|
|
3473
|
+
case 25: throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Unknown execution type \"".concat(currentTemplate.blockType, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
3474
|
+
case 26:
|
|
3475
|
+
if (!(!isJokerAttempt && currentTemplate.postprocessingFunctionNames)) return [3 /*break*/, 43];
|
|
3476
|
+
_v.label = 27;
|
|
3477
|
+
case 27:
|
|
3478
|
+
_v.trys.push([27, 41, 42, 43]);
|
|
3479
|
+
_o = (e_7 = void 0, __values(currentTemplate.postprocessingFunctionNames)), _p = _o.next();
|
|
3480
|
+
_v.label = 28;
|
|
3481
|
+
case 28:
|
|
3482
|
+
if (!!_p.done) return [3 /*break*/, 40];
|
|
3483
|
+
functionName = _p.value;
|
|
3484
|
+
// TODO: DRY [1]
|
|
3485
|
+
scriptPipelineExecutionErrors = [];
|
|
3486
|
+
postprocessingError = null;
|
|
3487
|
+
_v.label = 29;
|
|
3488
|
+
case 29:
|
|
3489
|
+
_v.trys.push([29, 36, 37, 38]);
|
|
3490
|
+
_q = (e_6 = void 0, __values(arrayableToArray(tools.script))), _r = _q.next();
|
|
3491
|
+
_v.label = 30;
|
|
3492
|
+
case 30:
|
|
3493
|
+
if (!!_r.done) return [3 /*break*/, 35];
|
|
3494
|
+
scriptTools = _r.value;
|
|
3495
|
+
_v.label = 31;
|
|
3496
|
+
case 31:
|
|
3497
|
+
_v.trys.push([31, 33, , 34]);
|
|
3498
|
+
return [4 /*yield*/, scriptTools.execute({
|
|
3499
|
+
scriptLanguage: "javascript" /* <- TODO: Try it in each languages; In future allow postprocessing with arbitrary combination of languages to combine */,
|
|
3500
|
+
script: "".concat(functionName, "(resultString)"),
|
|
3501
|
+
parameters: {
|
|
3502
|
+
resultString: resultString || '',
|
|
3503
|
+
// Note: No ...parametersForTemplate, because working with result only
|
|
3504
|
+
},
|
|
3505
|
+
})];
|
|
3506
|
+
case 32:
|
|
3507
|
+
resultString = _v.sent();
|
|
3508
|
+
postprocessingError = null;
|
|
3509
|
+
return [3 /*break*/, 35];
|
|
3510
|
+
case 33:
|
|
3511
|
+
error_3 = _v.sent();
|
|
3512
|
+
if (!(error_3 instanceof Error)) {
|
|
3513
|
+
throw error_3;
|
|
3514
|
+
}
|
|
3515
|
+
if (error_3 instanceof UnexpectedError) {
|
|
3516
|
+
throw error_3;
|
|
3517
|
+
}
|
|
3518
|
+
postprocessingError = error_3;
|
|
3519
|
+
scriptPipelineExecutionErrors.push(error_3);
|
|
3520
|
+
return [3 /*break*/, 34];
|
|
3521
|
+
case 34:
|
|
3522
|
+
_r = _q.next();
|
|
3523
|
+
return [3 /*break*/, 30];
|
|
3524
|
+
case 35: return [3 /*break*/, 38];
|
|
3525
|
+
case 36:
|
|
3526
|
+
e_6_1 = _v.sent();
|
|
3527
|
+
e_6 = { error: e_6_1 };
|
|
3528
|
+
return [3 /*break*/, 38];
|
|
3529
|
+
case 37:
|
|
3530
|
+
try {
|
|
3531
|
+
if (_r && !_r.done && (_u = _q.return)) _u.call(_q);
|
|
3532
|
+
}
|
|
3533
|
+
finally { if (e_6) throw e_6.error; }
|
|
3534
|
+
return [7 /*endfinally*/];
|
|
3535
|
+
case 38:
|
|
3536
|
+
if (postprocessingError) {
|
|
3537
|
+
throw postprocessingError;
|
|
3538
|
+
}
|
|
3539
|
+
_v.label = 39;
|
|
3540
|
+
case 39:
|
|
3541
|
+
_p = _o.next();
|
|
3542
|
+
return [3 /*break*/, 28];
|
|
3543
|
+
case 40: return [3 /*break*/, 43];
|
|
3544
|
+
case 41:
|
|
3545
|
+
e_7_1 = _v.sent();
|
|
3546
|
+
e_7 = { error: e_7_1 };
|
|
3547
|
+
return [3 /*break*/, 43];
|
|
3548
|
+
case 42:
|
|
3549
|
+
try {
|
|
3550
|
+
if (_p && !_p.done && (_t = _o.return)) _t.call(_o);
|
|
3551
|
+
}
|
|
3552
|
+
finally { if (e_7) throw e_7.error; }
|
|
3553
|
+
return [7 /*endfinally*/];
|
|
3554
|
+
case 43:
|
|
3555
|
+
// TODO: [π] Unite object for expecting amount and format
|
|
3556
|
+
if (currentTemplate.expectFormat) {
|
|
3557
|
+
if (currentTemplate.expectFormat === 'JSON') {
|
|
3558
|
+
if (!isValidJsonString(resultString || '')) {
|
|
3559
|
+
throw new ExpectError(spaceTrim$1(function (block) { return "\n Expected valid JSON string\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
3560
|
+
}
|
|
3561
|
+
}
|
|
3562
|
+
}
|
|
3563
|
+
// TODO: [π] Unite object for expecting amount and format
|
|
3564
|
+
if (currentTemplate.expectations) {
|
|
3565
|
+
checkExpectations(currentTemplate.expectations, resultString || '');
|
|
3566
|
+
}
|
|
3567
|
+
return [2 /*return*/, "break-attempts"];
|
|
3568
|
+
case 44:
|
|
3569
|
+
error_4 = _v.sent();
|
|
3570
|
+
if (!(error_4 instanceof ExpectError)) {
|
|
3571
|
+
throw error_4;
|
|
3572
|
+
}
|
|
3573
|
+
expectError = error_4;
|
|
3574
|
+
return [3 /*break*/, 46];
|
|
3575
|
+
case 45:
|
|
3576
|
+
if (!isJokerAttempt &&
|
|
3577
|
+
currentTemplate.blockType === 'PROMPT_TEMPLATE' &&
|
|
3578
|
+
prompt
|
|
3579
|
+
// <- Note: [2] When some expected parameter is not defined, error will occur in replaceParameters
|
|
3580
|
+
// In that case we donβt want to make a report about it because itβs not a llm execution error
|
|
3581
|
+
) {
|
|
3582
|
+
// TODO: [π§ ] Maybe put other blockTypes into report
|
|
3583
|
+
executionReport.promptExecutions.push({
|
|
3584
|
+
prompt: __assign({}, prompt),
|
|
3585
|
+
result: result || undefined,
|
|
3586
|
+
error: expectError === null ? undefined : serializeError(expectError),
|
|
3587
|
+
});
|
|
3588
|
+
}
|
|
3589
|
+
return [7 /*endfinally*/];
|
|
3590
|
+
case 46:
|
|
3591
|
+
if (expectError !== null && attempt === maxAttempts - 1) {
|
|
3592
|
+
throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n LLM execution failed ".concat(maxExecutionAttempts, "x\n\n ---\n Last error ").concat((expectError === null || expectError === void 0 ? void 0 : expectError.name) || '', ":\n ").concat(block((expectError === null || expectError === void 0 ? void 0 : expectError.message) || ''), "\n\n Last result:\n ").concat(resultString, "\n ---\n "); }));
|
|
3593
|
+
}
|
|
3594
|
+
return [2 /*return*/];
|
|
3595
|
+
}
|
|
3596
|
+
});
|
|
3597
|
+
};
|
|
3294
3598
|
attempt = -jokerParameterNames.length;
|
|
3295
|
-
|
|
3599
|
+
_h.label = 4;
|
|
3296
3600
|
case 4:
|
|
3297
|
-
if (!(attempt < maxAttempts)) return [3 /*break*/,
|
|
3298
|
-
|
|
3299
|
-
jokerParameterName = jokerParameterNames[jokerParameterNames.length + attempt];
|
|
3300
|
-
if (isJokerAttempt && !jokerParameterName) {
|
|
3301
|
-
throw new UnexpectedError("Joker not found in attempt ".concat(attempt));
|
|
3302
|
-
}
|
|
3303
|
-
result = null;
|
|
3304
|
-
resultString = null;
|
|
3305
|
-
expectError = null;
|
|
3306
|
-
if (isJokerAttempt) {
|
|
3307
|
-
if (parameters[jokerParameterName] === undefined) {
|
|
3308
|
-
throw new PipelineExecutionError("Joker parameter {".concat(jokerParameterName, "} not defined"));
|
|
3309
|
-
// <- TODO: This is maybe `PipelineLogicError` which should be detected in `validatePipeline` and here just thrown as `UnexpectedError`
|
|
3310
|
-
}
|
|
3311
|
-
else {
|
|
3312
|
-
resultString = parameters[jokerParameterName];
|
|
3313
|
-
}
|
|
3314
|
-
}
|
|
3315
|
-
_u.label = 5;
|
|
3601
|
+
if (!(attempt < maxAttempts)) return [3 /*break*/, 7];
|
|
3602
|
+
return [5 /*yield**/, _loop_5(attempt)];
|
|
3316
3603
|
case 5:
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
switch (_f) {
|
|
3321
|
-
case 'SIMPLE_TEMPLATE': return [3 /*break*/, 6];
|
|
3322
|
-
case 'PROMPT_TEMPLATE': return [3 /*break*/, 7];
|
|
3323
|
-
case 'SCRIPT': return [3 /*break*/, 16];
|
|
3324
|
-
case 'PROMPT_DIALOG': return [3 /*break*/, 27];
|
|
3604
|
+
state_2 = _h.sent();
|
|
3605
|
+
switch (state_2) {
|
|
3606
|
+
case "break-attempts": return [3 /*break*/, 7];
|
|
3325
3607
|
}
|
|
3326
|
-
|
|
3608
|
+
_h.label = 6;
|
|
3327
3609
|
case 6:
|
|
3328
|
-
resultString = replaceParameters(preparedContent, parameters);
|
|
3329
|
-
return [3 /*break*/, 30];
|
|
3330
|
-
case 7:
|
|
3331
|
-
prompt = {
|
|
3332
|
-
title: currentTemplate.title,
|
|
3333
|
-
pipelineUrl: "".concat(preparedPipeline.pipelineUrl
|
|
3334
|
-
? preparedPipeline.pipelineUrl
|
|
3335
|
-
: 'anonymous' /* <- TODO: [π§ ] How to deal with anonymous pipelines, do here some auto-url like SHA-256 based ad-hoc identifier? */, "#").concat(currentTemplate.name),
|
|
3336
|
-
parameters: parameters,
|
|
3337
|
-
content: preparedContent,
|
|
3338
|
-
modelRequirements: currentTemplate.modelRequirements,
|
|
3339
|
-
expectations: __assign(__assign({}, (preparedPipeline.personas.find(function (_a) {
|
|
3340
|
-
var name = _a.name;
|
|
3341
|
-
return name === currentTemplate.personaName;
|
|
3342
|
-
}) || {})), currentTemplate.expectations),
|
|
3343
|
-
expectFormat: currentTemplate.expectFormat,
|
|
3344
|
-
postprocessingFunctionNames: currentTemplate.postprocessingFunctionNames,
|
|
3345
|
-
}; // <- TODO: Not very good type guard
|
|
3346
|
-
_g = currentTemplate.modelRequirements.modelVariant;
|
|
3347
|
-
switch (_g) {
|
|
3348
|
-
case 'CHAT': return [3 /*break*/, 8];
|
|
3349
|
-
case 'COMPLETION': return [3 /*break*/, 10];
|
|
3350
|
-
case 'EMBEDDING': return [3 /*break*/, 12];
|
|
3351
|
-
}
|
|
3352
|
-
return [3 /*break*/, 14];
|
|
3353
|
-
case 8: return [4 /*yield*/, llmTools.callChatModel($deepFreeze(prompt))];
|
|
3354
|
-
case 9:
|
|
3355
|
-
chatResult = _u.sent();
|
|
3356
|
-
// TODO: [π¬] Destroy chatThread
|
|
3357
|
-
result = chatResult;
|
|
3358
|
-
resultString = chatResult.content;
|
|
3359
|
-
return [3 /*break*/, 15];
|
|
3360
|
-
case 10: return [4 /*yield*/, llmTools.callCompletionModel($deepFreeze(prompt))];
|
|
3361
|
-
case 11:
|
|
3362
|
-
completionResult = _u.sent();
|
|
3363
|
-
result = completionResult;
|
|
3364
|
-
resultString = completionResult.content;
|
|
3365
|
-
return [3 /*break*/, 15];
|
|
3366
|
-
case 12: return [4 /*yield*/, llmTools.callEmbeddingModel($deepFreeze(prompt))];
|
|
3367
|
-
case 13:
|
|
3368
|
-
embeddingResult = _u.sent();
|
|
3369
|
-
result = embeddingResult;
|
|
3370
|
-
resultString = embeddingResult.content.join(',');
|
|
3371
|
-
return [3 /*break*/, 15];
|
|
3372
|
-
case 14: throw new PipelineExecutionError("Unknown model variant \"".concat(currentTemplate.modelRequirements.modelVariant, "\""));
|
|
3373
|
-
case 15: return [3 /*break*/, 30];
|
|
3374
|
-
case 16:
|
|
3375
|
-
if (arrayableToArray(tools.script).length === 0) {
|
|
3376
|
-
throw new PipelineExecutionError('No script execution tools are available');
|
|
3377
|
-
}
|
|
3378
|
-
if (!currentTemplate.contentLanguage) {
|
|
3379
|
-
throw new PipelineExecutionError("Script language is not defined for prompt template \"".concat(currentTemplate.name, "\""));
|
|
3380
|
-
}
|
|
3381
|
-
// TODO: DRY [1]
|
|
3382
|
-
scriptPipelineExecutionErrors = [];
|
|
3383
|
-
_u.label = 17;
|
|
3384
|
-
case 17:
|
|
3385
|
-
_u.trys.push([17, 24, 25, 26]);
|
|
3386
|
-
_h = (e_4 = void 0, __values(arrayableToArray(tools.script))), _j = _h.next();
|
|
3387
|
-
_u.label = 18;
|
|
3388
|
-
case 18:
|
|
3389
|
-
if (!!_j.done) return [3 /*break*/, 23];
|
|
3390
|
-
scriptTools = _j.value;
|
|
3391
|
-
_u.label = 19;
|
|
3392
|
-
case 19:
|
|
3393
|
-
_u.trys.push([19, 21, , 22]);
|
|
3394
|
-
return [4 /*yield*/, scriptTools.execute($deepFreeze({
|
|
3395
|
-
scriptLanguage: currentTemplate.contentLanguage,
|
|
3396
|
-
script: preparedContent,
|
|
3397
|
-
parameters: parameters,
|
|
3398
|
-
}))];
|
|
3399
|
-
case 20:
|
|
3400
|
-
resultString = _u.sent();
|
|
3401
|
-
return [3 /*break*/, 23];
|
|
3402
|
-
case 21:
|
|
3403
|
-
error_2 = _u.sent();
|
|
3404
|
-
if (!(error_2 instanceof Error)) {
|
|
3405
|
-
throw error_2;
|
|
3406
|
-
}
|
|
3407
|
-
if (error_2 instanceof UnexpectedError) {
|
|
3408
|
-
throw error_2;
|
|
3409
|
-
}
|
|
3410
|
-
scriptPipelineExecutionErrors.push(error_2);
|
|
3411
|
-
return [3 /*break*/, 22];
|
|
3412
|
-
case 22:
|
|
3413
|
-
_j = _h.next();
|
|
3414
|
-
return [3 /*break*/, 18];
|
|
3415
|
-
case 23: return [3 /*break*/, 26];
|
|
3416
|
-
case 24:
|
|
3417
|
-
e_4_1 = _u.sent();
|
|
3418
|
-
e_4 = { error: e_4_1 };
|
|
3419
|
-
return [3 /*break*/, 26];
|
|
3420
|
-
case 25:
|
|
3421
|
-
try {
|
|
3422
|
-
if (_j && !_j.done && (_q = _h.return)) _q.call(_h);
|
|
3423
|
-
}
|
|
3424
|
-
finally { if (e_4) throw e_4.error; }
|
|
3425
|
-
return [7 /*endfinally*/];
|
|
3426
|
-
case 26:
|
|
3427
|
-
if (resultString !== null) {
|
|
3428
|
-
return [3 /*break*/, 30];
|
|
3429
|
-
}
|
|
3430
|
-
if (scriptPipelineExecutionErrors.length === 1) {
|
|
3431
|
-
throw scriptPipelineExecutionErrors[0];
|
|
3432
|
-
}
|
|
3433
|
-
else {
|
|
3434
|
-
throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Script execution failed ".concat(scriptPipelineExecutionErrors.length, " times\n\n ").concat(block(scriptPipelineExecutionErrors
|
|
3435
|
-
.map(function (error) { return '- ' + error.message; })
|
|
3436
|
-
.join('\n\n')), "\n "); }));
|
|
3437
|
-
}
|
|
3438
|
-
case 27:
|
|
3439
|
-
if (tools.userInterface === undefined) {
|
|
3440
|
-
throw new PipelineExecutionError('User interface tools are not available');
|
|
3441
|
-
}
|
|
3442
|
-
return [4 /*yield*/, tools.userInterface.promptDialog($deepFreeze({
|
|
3443
|
-
promptTitle: currentTemplate.title,
|
|
3444
|
-
promptMessage: replaceParameters(currentTemplate.description || '', parameters),
|
|
3445
|
-
defaultValue: replaceParameters(preparedContent, parameters),
|
|
3446
|
-
// TODO: [π§ ] !! Figure out how to define placeholder in .ptbk.md file
|
|
3447
|
-
placeholder: undefined,
|
|
3448
|
-
priority: priority,
|
|
3449
|
-
}))];
|
|
3450
|
-
case 28:
|
|
3451
|
-
// TODO: [πΉ] When making next attempt for `PROMPT DIALOG`, preserve the previous user input
|
|
3452
|
-
resultString = _u.sent();
|
|
3453
|
-
return [3 /*break*/, 30];
|
|
3454
|
-
case 29: throw new PipelineExecutionError("Unknown execution type \"".concat(currentTemplate.blockType, "\""));
|
|
3455
|
-
case 30:
|
|
3456
|
-
if (!(!isJokerAttempt && currentTemplate.postprocessingFunctionNames)) return [3 /*break*/, 47];
|
|
3457
|
-
_u.label = 31;
|
|
3458
|
-
case 31:
|
|
3459
|
-
_u.trys.push([31, 45, 46, 47]);
|
|
3460
|
-
_k = (e_6 = void 0, __values(currentTemplate.postprocessingFunctionNames)), _l = _k.next();
|
|
3461
|
-
_u.label = 32;
|
|
3462
|
-
case 32:
|
|
3463
|
-
if (!!_l.done) return [3 /*break*/, 44];
|
|
3464
|
-
functionName = _l.value;
|
|
3465
|
-
// TODO: DRY [1]
|
|
3466
|
-
scriptPipelineExecutionErrors = [];
|
|
3467
|
-
postprocessingError = null;
|
|
3468
|
-
_u.label = 33;
|
|
3469
|
-
case 33:
|
|
3470
|
-
_u.trys.push([33, 40, 41, 42]);
|
|
3471
|
-
_m = (e_5 = void 0, __values(arrayableToArray(tools.script))), _o = _m.next();
|
|
3472
|
-
_u.label = 34;
|
|
3473
|
-
case 34:
|
|
3474
|
-
if (!!_o.done) return [3 /*break*/, 39];
|
|
3475
|
-
scriptTools = _o.value;
|
|
3476
|
-
_u.label = 35;
|
|
3477
|
-
case 35:
|
|
3478
|
-
_u.trys.push([35, 37, , 38]);
|
|
3479
|
-
return [4 /*yield*/, scriptTools.execute({
|
|
3480
|
-
scriptLanguage: "javascript" /* <- TODO: Try it in each languages; In future allow postprocessing with arbitrary combination of languages to combine */,
|
|
3481
|
-
script: "".concat(functionName, "(resultString)"),
|
|
3482
|
-
parameters: {
|
|
3483
|
-
resultString: resultString || '',
|
|
3484
|
-
// Note: No ...parametersForTemplate, because working with result only
|
|
3485
|
-
},
|
|
3486
|
-
})];
|
|
3487
|
-
case 36:
|
|
3488
|
-
resultString = _u.sent();
|
|
3489
|
-
postprocessingError = null;
|
|
3490
|
-
return [3 /*break*/, 39];
|
|
3491
|
-
case 37:
|
|
3492
|
-
error_3 = _u.sent();
|
|
3493
|
-
if (!(error_3 instanceof Error)) {
|
|
3494
|
-
throw error_3;
|
|
3495
|
-
}
|
|
3496
|
-
if (error_3 instanceof UnexpectedError) {
|
|
3497
|
-
throw error_3;
|
|
3498
|
-
}
|
|
3499
|
-
postprocessingError = error_3;
|
|
3500
|
-
scriptPipelineExecutionErrors.push(error_3);
|
|
3501
|
-
return [3 /*break*/, 38];
|
|
3502
|
-
case 38:
|
|
3503
|
-
_o = _m.next();
|
|
3504
|
-
return [3 /*break*/, 34];
|
|
3505
|
-
case 39: return [3 /*break*/, 42];
|
|
3506
|
-
case 40:
|
|
3507
|
-
e_5_1 = _u.sent();
|
|
3508
|
-
e_5 = { error: e_5_1 };
|
|
3509
|
-
return [3 /*break*/, 42];
|
|
3510
|
-
case 41:
|
|
3511
|
-
try {
|
|
3512
|
-
if (_o && !_o.done && (_s = _m.return)) _s.call(_m);
|
|
3513
|
-
}
|
|
3514
|
-
finally { if (e_5) throw e_5.error; }
|
|
3515
|
-
return [7 /*endfinally*/];
|
|
3516
|
-
case 42:
|
|
3517
|
-
if (postprocessingError) {
|
|
3518
|
-
throw postprocessingError;
|
|
3519
|
-
}
|
|
3520
|
-
_u.label = 43;
|
|
3521
|
-
case 43:
|
|
3522
|
-
_l = _k.next();
|
|
3523
|
-
return [3 /*break*/, 32];
|
|
3524
|
-
case 44: return [3 /*break*/, 47];
|
|
3525
|
-
case 45:
|
|
3526
|
-
e_6_1 = _u.sent();
|
|
3527
|
-
e_6 = { error: e_6_1 };
|
|
3528
|
-
return [3 /*break*/, 47];
|
|
3529
|
-
case 46:
|
|
3530
|
-
try {
|
|
3531
|
-
if (_l && !_l.done && (_r = _k.return)) _r.call(_k);
|
|
3532
|
-
}
|
|
3533
|
-
finally { if (e_6) throw e_6.error; }
|
|
3534
|
-
return [7 /*endfinally*/];
|
|
3535
|
-
case 47:
|
|
3536
|
-
// TODO: [π] Unite object for expecting amount and format
|
|
3537
|
-
if (currentTemplate.expectFormat) {
|
|
3538
|
-
if (currentTemplate.expectFormat === 'JSON') {
|
|
3539
|
-
if (!isValidJsonString(resultString || '')) {
|
|
3540
|
-
throw new ExpectError('Expected valid JSON string');
|
|
3541
|
-
}
|
|
3542
|
-
}
|
|
3543
|
-
}
|
|
3544
|
-
// TODO: [π] Unite object for expecting amount and format
|
|
3545
|
-
if (currentTemplate.expectations) {
|
|
3546
|
-
checkExpectations(currentTemplate.expectations, resultString || '');
|
|
3547
|
-
}
|
|
3548
|
-
return [3 /*break*/, 52];
|
|
3549
|
-
case 48:
|
|
3550
|
-
error_4 = _u.sent();
|
|
3551
|
-
if (!(error_4 instanceof ExpectError)) {
|
|
3552
|
-
throw error_4;
|
|
3553
|
-
}
|
|
3554
|
-
if (error_4 instanceof UnexpectedError) {
|
|
3555
|
-
throw error_4;
|
|
3556
|
-
}
|
|
3557
|
-
expectError = error_4;
|
|
3558
|
-
return [3 /*break*/, 50];
|
|
3559
|
-
case 49:
|
|
3560
|
-
if (!isJokerAttempt &&
|
|
3561
|
-
currentTemplate.blockType === 'PROMPT_TEMPLATE' &&
|
|
3562
|
-
prompt
|
|
3563
|
-
// <- Note: [2] When some expected parameter is not defined, error will occur in replaceParameters
|
|
3564
|
-
// In that case we donβt want to make a report about it because itβs not a llm execution error
|
|
3565
|
-
) {
|
|
3566
|
-
// TODO: [π§ ] Maybe put other blockTypes into report
|
|
3567
|
-
executionReport.promptExecutions.push({
|
|
3568
|
-
prompt: __assign({}, prompt),
|
|
3569
|
-
result: result || undefined,
|
|
3570
|
-
error: expectError === null ? undefined : serializeError(expectError),
|
|
3571
|
-
});
|
|
3572
|
-
}
|
|
3573
|
-
return [7 /*endfinally*/];
|
|
3574
|
-
case 50:
|
|
3575
|
-
if (expectError !== null && attempt === maxAttempts - 1) {
|
|
3576
|
-
throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n LLM execution failed ".concat(maxExecutionAttempts, "x\n\n ---\n Last error ").concat((expectError === null || expectError === void 0 ? void 0 : expectError.name) || '', ":\n ").concat(block((expectError === null || expectError === void 0 ? void 0 : expectError.message) || ''), "\n\n Last result:\n ").concat(resultString, "\n ---\n "); }));
|
|
3577
|
-
}
|
|
3578
|
-
_u.label = 51;
|
|
3579
|
-
case 51:
|
|
3580
3610
|
attempt++;
|
|
3581
3611
|
return [3 /*break*/, 4];
|
|
3582
|
-
case
|
|
3612
|
+
case 7:
|
|
3583
3613
|
if (resultString === null) {
|
|
3584
|
-
throw new UnexpectedError(
|
|
3614
|
+
throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Something went wrong and prompt result is null\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
3585
3615
|
}
|
|
3586
3616
|
if (onProgress /* <- [3] */) {
|
|
3587
3617
|
onProgress({
|
|
@@ -3595,7 +3625,7 @@ function createPipelineExecutor(options) {
|
|
|
3595
3625
|
// <- [3]
|
|
3596
3626
|
});
|
|
3597
3627
|
}
|
|
3598
|
-
parametersToPass = Object.freeze(__assign(__assign({}, parametersToPass), (
|
|
3628
|
+
parametersToPass = Object.freeze(__assign(__assign({}, parametersToPass), (_g = {}, _g[currentTemplate.resultingParameterName] = resultString /* <- Note: Not need to detect parameter collision here because pipeline checks logic consistency during construction */, _g)));
|
|
3599
3629
|
return [2 /*return*/];
|
|
3600
3630
|
}
|
|
3601
3631
|
});
|
|
@@ -3604,6 +3634,14 @@ function createPipelineExecutor(options) {
|
|
|
3604
3634
|
function filterJustOutputParameters() {
|
|
3605
3635
|
var e_8, _a;
|
|
3606
3636
|
var outputParameters = {};
|
|
3637
|
+
var _loop_6 = function (parameter) {
|
|
3638
|
+
if (parametersToPass[parameter.name] === undefined) {
|
|
3639
|
+
// [4]
|
|
3640
|
+
warnings.push(new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Parameter {".concat(parameter.name, "} should be an output parameter, but it was not generated during pipeline execution\n\n ").concat(block(pipelineIdentification), "\n "); })));
|
|
3641
|
+
return "continue";
|
|
3642
|
+
}
|
|
3643
|
+
outputParameters[parameter.name] = parametersToPass[parameter.name] || '';
|
|
3644
|
+
};
|
|
3607
3645
|
try {
|
|
3608
3646
|
// Note: Filter ONLY output parameters
|
|
3609
3647
|
for (var _b = __values(preparedPipeline.parameters.filter(function (_a) {
|
|
@@ -3611,12 +3649,7 @@ function createPipelineExecutor(options) {
|
|
|
3611
3649
|
return isOutput;
|
|
3612
3650
|
})), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
3613
3651
|
var parameter = _c.value;
|
|
3614
|
-
|
|
3615
|
-
// [4]
|
|
3616
|
-
warnings.push(new PipelineExecutionError("Parameter {".concat(parameter.name, "} should be an output parameter, but it was not generated during pipeline execution")));
|
|
3617
|
-
continue;
|
|
3618
|
-
}
|
|
3619
|
-
outputParameters[parameter.name] = parametersToPass[parameter.name] || '';
|
|
3652
|
+
_loop_6(parameter);
|
|
3620
3653
|
}
|
|
3621
3654
|
}
|
|
3622
3655
|
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
@@ -3688,13 +3721,13 @@ function createPipelineExecutor(options) {
|
|
|
3688
3721
|
return name === parameterName;
|
|
3689
3722
|
});
|
|
3690
3723
|
if (parameter === undefined) {
|
|
3691
|
-
warnings.push(new PipelineExecutionError("Extra parameter {".concat(parameterName, "} is being passed which is not part of the pipeline.")));
|
|
3724
|
+
warnings.push(new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Extra parameter {".concat(parameterName, "} is being passed which is not part of the pipeline.\n\n ").concat(block(pipelineIdentification), "\n "); })));
|
|
3692
3725
|
}
|
|
3693
3726
|
else if (parameter.isInput === false) {
|
|
3694
|
-
return { value: $asDeeplyFrozenSerializableJson("Unuccessful PipelineExecutorResult (with extra parameter {".concat(parameter.name, "}) PipelineExecutorResult"), {
|
|
3727
|
+
return { value: $asDeeplyFrozenSerializableJson(spaceTrim$1(function (block) { return "\n Unuccessful PipelineExecutorResult (with extra parameter {".concat(parameter.name, "}) PipelineExecutorResult\n\n ").concat(block(pipelineIdentification), "\n "); }), {
|
|
3695
3728
|
isSuccessful: false,
|
|
3696
3729
|
errors: __spreadArray([
|
|
3697
|
-
new PipelineExecutionError("Parameter {".concat(parameter.name, "} is passed as input parameter but it is not input"))
|
|
3730
|
+
new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Parameter {".concat(parameter.name, "} is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
|
|
3698
3731
|
], __read(errors), false).map(serializeError),
|
|
3699
3732
|
warnings: warnings.map(serializeError),
|
|
3700
3733
|
executionReport: executionReport,
|
|
@@ -3743,7 +3776,7 @@ function createPipelineExecutor(options) {
|
|
|
3743
3776
|
case 0:
|
|
3744
3777
|
if (loopLimit-- < 0) {
|
|
3745
3778
|
// Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
|
|
3746
|
-
throw new UnexpectedError(
|
|
3779
|
+
throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Loop limit reached during resolving parameters pipeline execution\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
3747
3780
|
}
|
|
3748
3781
|
currentTemplate = unresovedTemplates_1.find(function (template) {
|
|
3749
3782
|
return template.dependentParameterNames.every(function (name) {
|
|
@@ -3753,7 +3786,7 @@ function createPipelineExecutor(options) {
|
|
|
3753
3786
|
if (!(!currentTemplate && resolving_1.length === 0)) return [3 /*break*/, 1];
|
|
3754
3787
|
throw new UnexpectedError(
|
|
3755
3788
|
// TODO: [π] DRY
|
|
3756
|
-
spaceTrim$1(function (block) { return "\n Can not resolve some parameters:\n\n Can not resolve:\n ".concat(block(unresovedTemplates_1
|
|
3789
|
+
spaceTrim$1(function (block) { return "\n Can not resolve some parameters:\n\n ".concat(block(pipelineIdentification), "\n\n Can not resolve:\n ").concat(block(unresovedTemplates_1
|
|
3757
3790
|
.map(function (_a) {
|
|
3758
3791
|
var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
|
|
3759
3792
|
return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
|
|
@@ -3833,6 +3866,7 @@ function createPipelineExecutor(options) {
|
|
|
3833
3866
|
return pipelineExecutor;
|
|
3834
3867
|
}
|
|
3835
3868
|
/**
|
|
3869
|
+
* TODO: !!! Identify not only pipeline BUT exact template ${block(pipelineIdentification)}
|
|
3836
3870
|
* TODO: Use isVerbose here (not only pass to `preparePipeline`)
|
|
3837
3871
|
* TODO: [π§ ][π³] Use here `countTotalUsage` and put preparation and prepared pipiline to report
|
|
3838
3872
|
* TODO: [πͺ] Use maxParallelCount here (not only pass to `preparePipeline`)
|
|
@@ -4372,6 +4406,8 @@ function preparePipeline(pipeline, options) {
|
|
|
4372
4406
|
* TODO: [π] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
4373
4407
|
* TODO: [π§] In future one preparation can take data from previous preparation and save tokens and time
|
|
4374
4408
|
* TODO: [π ] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
4409
|
+
* TODO: [π§ ][β] Maybe if expecting JSON (In Anthropic Claude and other models without non-json) and its not specified in prompt content, append the instructions
|
|
4410
|
+
* @see https://docs.anthropic.com/en/docs/test-and-evaluate/strengthen-guardrails/increase-consistency#specify-the-desired-output-format
|
|
4375
4411
|
*/
|
|
4376
4412
|
|
|
4377
4413
|
/**
|
|
@@ -7589,5 +7625,5 @@ function executionReportJsonToString(executionReportJson, options) {
|
|
|
7589
7625
|
* TODO: [π§ ] Should be in generated file GENERATOR_WARNING
|
|
7590
7626
|
*/
|
|
7591
7627
|
|
|
7592
|
-
export { $llmToolsMetadataRegister, $llmToolsRegister, BlockTypes, CLAIM, CallbackInterfaceTools, CollectionError, DEFAULT_REMOTE_URL, DEFAULT_REMOTE_URL_PATH, ERRORS, EXECUTIONS_CACHE_DIRNAME, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, IS_VERBOSE, LimitReachedError, MAX_EXECUTION_ATTEMPTS, MAX_FILENAME_LENGTH, MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, MAX_PARALLEL_COUNT, MODEL_VARIANTS, MemoryStorage, NotFoundError, NotYetImplementedError, PIPELINE_COLLECTION_BASE_FILENAME, PROMPTBOOK_VERSION, ParsingError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, RESERVED_PARAMETER_NAMES, UnexpectedError, ZERO_USAGE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _OpenAiMetadataRegistration, addUsage, assertsExecutionSuccessful, cacheLlmTools, collectionToJson, countTotalUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, isPassingExpectations, isPipelinePrepared, joinLlmExecutionTools, limitTotalUsage, pipelineJsonToString, pipelineStringToJson, pipelineStringToJsonSync, prepareKnowledgeFromMarkdown, prepareKnowledgePieces, preparePersona, preparePipeline, prepareTemplates, prettifyPipelineString, stringifyPipelineJson, unpreparePipeline, usageToHuman, usageToWorktime, validatePipeline };
|
|
7628
|
+
export { $llmToolsMetadataRegister, $llmToolsRegister, BlockTypes, CLAIM, CallbackInterfaceTools, CollectionError, DEFAULT_REMOTE_URL, DEFAULT_REMOTE_URL_PATH, ERRORS, EXECUTIONS_CACHE_DIRNAME, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, IS_VERBOSE, LimitReachedError, MAX_EXECUTION_ATTEMPTS, MAX_FILENAME_LENGTH, MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, MAX_PARALLEL_COUNT, MODEL_VARIANTS, MemoryStorage, NotFoundError, NotYetImplementedError, PIPELINE_COLLECTION_BASE_FILENAME, PROMPTBOOK_VERSION, ParsingError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, RESERVED_PARAMETER_NAMES, UnexpectedError, ZERO_USAGE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _OpenAiMetadataRegistration, addUsage, assertsExecutionSuccessful, cacheLlmTools, collectionToJson, countTotalUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, isPassingExpectations, isPipelinePrepared, joinLlmExecutionTools, limitTotalUsage, pipelineJsonToString, pipelineStringToJson, pipelineStringToJsonSync, prepareKnowledgeFromMarkdown, prepareKnowledgePieces, preparePersona, preparePipeline, prepareTemplates, prettifyPipelineString, stringifyPipelineJson, unpreparePipeline, usageToHuman, usageToWorktime, validatePipeline };
|
|
7593
7629
|
//# sourceMappingURL=index.es.js.map
|