@promptbook/core 0.75.0-0 → 0.75.0-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/index.es.js +140 -35
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +8 -0
- package/esm/typings/src/_packages/utils.index.d.ts +2 -2
- package/esm/typings/src/config.d.ts +1 -0
- package/esm/typings/src/formfactors/_boilerplate/BoilerplateFormfactorDefinition.d.ts +14 -0
- package/esm/typings/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +6 -1
- package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +1 -1
- package/esm/typings/src/formfactors/chat/ChatFormfactorDefinition.d.ts +6 -1
- package/esm/typings/src/formfactors/generic/GenericFormfactorDefinition.d.ts +4 -0
- package/esm/typings/src/formfactors/index.d.ts +26 -1
- package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +14 -0
- package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +14 -0
- package/esm/typings/src/pipeline/pipeline-interface/PipelineInterface.d.ts +2 -2
- package/esm/typings/src/pipeline/pipeline-interface/constants.d.ts +9 -0
- package/esm/typings/src/utils/expectation-counters/{config.d.ts → constants.d.ts} +3 -0
- package/package.json +1 -1
- package/umd/index.umd.js +143 -34
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -22,7 +22,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
22
22
|
*
|
|
23
23
|
* @see https://github.com/webgptorg/promptbook
|
|
24
24
|
*/
|
|
25
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
25
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.75.0-0';
|
|
26
26
|
/**
|
|
27
27
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
28
28
|
*/
|
|
@@ -818,6 +818,7 @@ var IS_PIPELINE_LOGIC_VALIDATED = just(
|
|
|
818
818
|
// Note: In normal situations, we check the pipeline logic:
|
|
819
819
|
true);
|
|
820
820
|
/**
|
|
821
|
+
* TODO: Extract `constants.ts` from `config.ts`
|
|
821
822
|
* TODO: [🧠][🧜♂️] Maybe join remoteUrl and path into single value
|
|
822
823
|
*/
|
|
823
824
|
|
|
@@ -1079,18 +1080,18 @@ function validatePipelineCore(pipeline) {
|
|
|
1079
1080
|
}
|
|
1080
1081
|
var _loop_1 = function (parameter) {
|
|
1081
1082
|
if (parameter.isInput && parameter.isOutput) {
|
|
1082
|
-
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n\n Parameter {".concat(parameter.name, "} can not be both input and output\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1083
|
+
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n\n Parameter `{".concat(parameter.name, "}` can not be both input and output\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1083
1084
|
}
|
|
1084
1085
|
// Note: Testing that parameter is either intermediate or output BUT not created and unused
|
|
1085
1086
|
if (!parameter.isInput &&
|
|
1086
1087
|
!parameter.isOutput &&
|
|
1087
1088
|
!pipeline.templates.some(function (template) { return template.dependentParameterNames.includes(parameter.name); })) {
|
|
1088
|
-
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter {".concat(parameter.name, "} is created but not used\n\n You can declare {").concat(parameter.name, "} as output parameter by adding in the header:\n - OUTPUT PARAMETER `{").concat(parameter.name, "}` ").concat(parameter.description || '', "\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
1089
|
+
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is created but not used\n\n You can declare {").concat(parameter.name, "} as output parameter by adding in the header:\n - OUTPUT PARAMETER `{").concat(parameter.name, "}` ").concat(parameter.description || '', "\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
1089
1090
|
}
|
|
1090
1091
|
// Note: Testing that parameter is either input or result of some template
|
|
1091
1092
|
if (!parameter.isInput &&
|
|
1092
1093
|
!pipeline.templates.some(function (template) { return template.resultingParameterName === parameter.name; })) {
|
|
1093
|
-
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter {".concat(parameter.name, "} is declared but not defined\n\n You can do one of these:\n 1) Remove declaration of {").concat(parameter.name, "}
|
|
1094
|
+
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is declared but not defined\n\n You can do one of these:\n 1) Remove declaration of `{").concat(parameter.name, "}`\n 2) Add template that results in `-> {").concat(parameter.name, "}`\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1094
1095
|
}
|
|
1095
1096
|
};
|
|
1096
1097
|
try {
|
|
@@ -1118,7 +1119,7 @@ function validatePipelineCore(pipeline) {
|
|
|
1118
1119
|
var _loop_2 = function (template) {
|
|
1119
1120
|
var e_4, _h, e_5, _j;
|
|
1120
1121
|
if (definedParameters.has(template.resultingParameterName)) {
|
|
1121
|
-
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter {".concat(template.resultingParameterName, "} is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1122
|
+
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter `{".concat(template.resultingParameterName, "}` is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1122
1123
|
}
|
|
1123
1124
|
if (RESERVED_PARAMETER_NAMES.includes(template.resultingParameterName)) {
|
|
1124
1125
|
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter name {".concat(template.resultingParameterName, "} is reserved, please use different name\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
@@ -1131,7 +1132,7 @@ function validatePipelineCore(pipeline) {
|
|
|
1131
1132
|
}
|
|
1132
1133
|
var _loop_4 = function (joker) {
|
|
1133
1134
|
if (!template.dependentParameterNames.includes(joker)) {
|
|
1134
|
-
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter {".concat(joker, "} is used for {").concat(template.resultingParameterName, "} as joker but not in `dependentParameterNames`\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1135
|
+
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter `{".concat(joker, "}` is used for {").concat(template.resultingParameterName, "} as joker but not in `dependentParameterNames`\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1135
1136
|
}
|
|
1136
1137
|
};
|
|
1137
1138
|
try {
|
|
@@ -1226,14 +1227,24 @@ function validatePipelineCore(pipeline) {
|
|
|
1226
1227
|
if (currentlyResovedTemplates.length === 0) {
|
|
1227
1228
|
throw new PipelineLogicError(
|
|
1228
1229
|
// TODO: [🐎] DRY
|
|
1229
|
-
spaceTrim$1(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n ".concat(block(pipelineIdentification), "\n\n Can not resolve
|
|
1230
|
+
spaceTrim$1(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTemplates
|
|
1230
1231
|
.map(function (_a) {
|
|
1231
1232
|
var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
|
|
1232
|
-
return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
|
|
1233
|
-
.map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
|
|
1233
|
+
return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
|
|
1234
|
+
.map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
|
|
1234
1235
|
.join(' and '));
|
|
1235
1236
|
})
|
|
1236
|
-
.join('\n')), "\n\n Resolved
|
|
1237
|
+
.join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameters
|
|
1238
|
+
.filter(function (name) {
|
|
1239
|
+
return !RESERVED_PARAMETER_NAMES.includes(name);
|
|
1240
|
+
})
|
|
1241
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
1242
|
+
.join('\n')), "\n\n\n **Reserved (which are available):**\n ").concat(block(resovedParameters
|
|
1243
|
+
.filter(function (name) {
|
|
1244
|
+
return RESERVED_PARAMETER_NAMES.includes(name);
|
|
1245
|
+
})
|
|
1246
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
1247
|
+
.join('\n')), "\n\n\n "); }));
|
|
1237
1248
|
}
|
|
1238
1249
|
resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTemplates.map(function (_a) {
|
|
1239
1250
|
var resultingParameterName = _a.resultingParameterName;
|
|
@@ -1244,6 +1255,7 @@ function validatePipelineCore(pipeline) {
|
|
|
1244
1255
|
while (unresovedTemplates.length > 0) {
|
|
1245
1256
|
_loop_3();
|
|
1246
1257
|
}
|
|
1258
|
+
// TODO: !!!!!! Test that pipeline interface implements declared formfactor interface
|
|
1247
1259
|
}
|
|
1248
1260
|
/**
|
|
1249
1261
|
* TODO: !! [🧞♀️] Do not allow joker + foreach
|
|
@@ -2236,8 +2248,8 @@ var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
|
2236
2248
|
else if (errors.length > 1) {
|
|
2237
2249
|
throw new PipelineExecutionError(
|
|
2238
2250
|
// TODO: Tell which execution tools failed like
|
|
2239
|
-
// 1) OpenAI throw PipelineExecutionError: Parameter {knowledge} is not defined
|
|
2240
|
-
// 2) AnthropicClaude throw PipelineExecutionError: Parameter {knowledge} is not defined
|
|
2251
|
+
// 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
2252
|
+
// 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
2241
2253
|
// 3) ...
|
|
2242
2254
|
spaceTrim(function (block) { return "\n All execution tools failed:\n\n ".concat(block(errors
|
|
2243
2255
|
.map(function (error, i) { return "".concat(i + 1, ") **").concat(error.name || 'Error', ":** ").concat(error.message); })
|
|
@@ -3236,11 +3248,11 @@ function replaceParameters(template, parameters) {
|
|
|
3236
3248
|
for (var _b = __values(Object.entries(parameters)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
3237
3249
|
var _d = __read(_c.value, 2), parameterName = _d[0], parameterValue = _d[1];
|
|
3238
3250
|
if (parameterValue === RESERVED_PARAMETER_MISSING_VALUE) {
|
|
3239
|
-
throw new UnexpectedError("Parameter {".concat(parameterName, "} has missing value"));
|
|
3251
|
+
throw new UnexpectedError("Parameter `{".concat(parameterName, "}` has missing value"));
|
|
3240
3252
|
}
|
|
3241
3253
|
else if (parameterValue === RESERVED_PARAMETER_RESTRICTED) {
|
|
3242
3254
|
// TODO: [🍵]
|
|
3243
|
-
throw new UnexpectedError("Parameter {".concat(parameterName, "} is restricted to use"));
|
|
3255
|
+
throw new UnexpectedError("Parameter `{".concat(parameterName, "}` is restricted to use"));
|
|
3244
3256
|
}
|
|
3245
3257
|
}
|
|
3246
3258
|
}
|
|
@@ -3267,11 +3279,11 @@ function replaceParameters(template, parameters) {
|
|
|
3267
3279
|
throw new PipelineExecutionError('Parameter is already opened or not closed');
|
|
3268
3280
|
}
|
|
3269
3281
|
if (parameters[parameterName] === undefined) {
|
|
3270
|
-
throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
|
|
3282
|
+
throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
|
|
3271
3283
|
}
|
|
3272
3284
|
var parameterValue = parameters[parameterName];
|
|
3273
3285
|
if (parameterValue === undefined) {
|
|
3274
|
-
throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
|
|
3286
|
+
throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
|
|
3275
3287
|
}
|
|
3276
3288
|
parameterValue = parameterValue.toString();
|
|
3277
3289
|
if (parameterValue.includes('\n') && /^\s*\W{0,3}\s*$/.test(precol)) {
|
|
@@ -3327,6 +3339,9 @@ var CHARACTERS_PER_STANDARD_LINE = 63;
|
|
|
3327
3339
|
* @public exported from `@promptbook/utils`
|
|
3328
3340
|
*/
|
|
3329
3341
|
var LINES_PER_STANDARD_PAGE = 44;
|
|
3342
|
+
/**
|
|
3343
|
+
* TODO: [🧠] Should be this `constants.ts` or `config.ts`?
|
|
3344
|
+
*/
|
|
3330
3345
|
|
|
3331
3346
|
/**
|
|
3332
3347
|
* Counts number of lines in the text
|
|
@@ -4341,7 +4356,7 @@ function executeTemplate(options) {
|
|
|
4341
4356
|
else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
|
|
4342
4357
|
// Houston, we have a problem
|
|
4343
4358
|
// Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
|
|
4344
|
-
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 "); }));
|
|
4359
|
+
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 "); }));
|
|
4345
4360
|
}
|
|
4346
4361
|
};
|
|
4347
4362
|
try {
|
|
@@ -4420,7 +4435,7 @@ function filterJustOutputParameters(options) {
|
|
|
4420
4435
|
var _loop_1 = function (parameter) {
|
|
4421
4436
|
if (parametersToPass[parameter.name] === undefined) {
|
|
4422
4437
|
// [4]
|
|
4423
|
-
$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 "); })));
|
|
4438
|
+
$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 "); })));
|
|
4424
4439
|
return "continue";
|
|
4425
4440
|
}
|
|
4426
4441
|
outputParameters[parameter.name] = parametersToPass[parameter.name] || '';
|
|
@@ -4507,7 +4522,7 @@ function executePipeline(options) {
|
|
|
4507
4522
|
case 6: return [2 /*return*/, $asDeeplyFrozenSerializableJson("Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"), {
|
|
4508
4523
|
isSuccessful: false,
|
|
4509
4524
|
errors: __spreadArray([
|
|
4510
|
-
new PipelineExecutionError("Parameter {".concat(parameter.name, "} is required as an input parameter"))
|
|
4525
|
+
new PipelineExecutionError("Parameter `{".concat(parameter.name, "}` is required as an input parameter"))
|
|
4511
4526
|
], __read(errors), false).map(serializeError),
|
|
4512
4527
|
warnings: [],
|
|
4513
4528
|
executionReport: executionReport,
|
|
@@ -4555,7 +4570,7 @@ function executePipeline(options) {
|
|
|
4555
4570
|
case 3: return [2 /*return*/, { value: $asDeeplyFrozenSerializableJson(spaceTrim$1(function (block) { return "\n Unuccessful PipelineExecutorResult (with extra parameter {".concat(parameter.name, "}) PipelineExecutorResult\n\n ").concat(block(pipelineIdentification), "\n "); }), {
|
|
4556
4571
|
isSuccessful: false,
|
|
4557
4572
|
errors: __spreadArray([
|
|
4558
|
-
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 "); }))
|
|
4573
|
+
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 "); }))
|
|
4559
4574
|
], __read(errors), false).map(serializeError),
|
|
4560
4575
|
warnings: warnings.map(serializeError),
|
|
4561
4576
|
executionReport: executionReport,
|
|
@@ -4629,14 +4644,24 @@ function executePipeline(options) {
|
|
|
4629
4644
|
if (!(!currentTemplate && resolving_1.length === 0)) return [3 /*break*/, 1];
|
|
4630
4645
|
throw new UnexpectedError(
|
|
4631
4646
|
// TODO: [🐎] DRY
|
|
4632
|
-
spaceTrim$1(function (block) { return "\n Can not resolve some parameters:\n\n ".concat(block(pipelineIdentification), "\n\n Can not resolve
|
|
4647
|
+
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
|
|
4633
4648
|
.map(function (_a) {
|
|
4634
4649
|
var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
|
|
4635
|
-
return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
|
|
4636
|
-
.map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
|
|
4650
|
+
return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
|
|
4651
|
+
.map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
|
|
4637
4652
|
.join(' and '));
|
|
4638
4653
|
})
|
|
4639
|
-
.join('\n')), "\n\n Resolved
|
|
4654
|
+
.join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameterNames_1
|
|
4655
|
+
.filter(function (name) {
|
|
4656
|
+
return !RESERVED_PARAMETER_NAMES.includes(name);
|
|
4657
|
+
})
|
|
4658
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
4659
|
+
.join('\n')), "\n\n **Reserved (which are available):**\n ").concat(block(resovedParameterNames_1
|
|
4660
|
+
.filter(function (name) {
|
|
4661
|
+
return RESERVED_PARAMETER_NAMES.includes(name);
|
|
4662
|
+
})
|
|
4663
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
4664
|
+
.join('\n')), "\n\n *Note: This should be catched in `validatePipeline`*\n "); }));
|
|
4640
4665
|
case 1:
|
|
4641
4666
|
if (!!currentTemplate) return [3 /*break*/, 3];
|
|
4642
4667
|
/* [🤹♂️] */ return [4 /*yield*/, Promise.race(resolving_1)];
|
|
@@ -6835,9 +6860,35 @@ var formatCommandParser = {
|
|
|
6835
6860
|
* @public exported from `@promptbook/core`
|
|
6836
6861
|
*/
|
|
6837
6862
|
var ChatFormfactorDefinition = {
|
|
6838
|
-
name: '
|
|
6863
|
+
name: 'CHATBOT',
|
|
6864
|
+
aliasNames: ['CHAT'],
|
|
6839
6865
|
description: "@@@",
|
|
6840
6866
|
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
|
|
6867
|
+
pipelineInterface: {
|
|
6868
|
+
inputParameterNames: ['previousTitle', 'previousConversationSummary', 'userMessage'],
|
|
6869
|
+
outputParameterNames: ['title', 'conversationSummary', 'chatbotResponse'],
|
|
6870
|
+
/*
|
|
6871
|
+
<- TODO: !!!!!! Change to
|
|
6872
|
+
|
|
6873
|
+
- INPUT PARAMETER `{previousTitle}` Previous title of the conversation
|
|
6874
|
+
- INPUT PARAMETER `{previousConversationSummary}` Previous conversation summary
|
|
6875
|
+
- INPUT PARAMETER `{userMessage}` User message
|
|
6876
|
+
- OUTPUT PARAMETER `{title}` Title of the conversation
|
|
6877
|
+
- OUTPUT PARAMETER `{conversationSummary}` Summary of the conversation
|
|
6878
|
+
- OUTPUT PARAMETER `{chatbotResponse}` Chatbot response
|
|
6879
|
+
|
|
6880
|
+
*/
|
|
6881
|
+
},
|
|
6882
|
+
};
|
|
6883
|
+
|
|
6884
|
+
/**
|
|
6885
|
+
* @@@
|
|
6886
|
+
*
|
|
6887
|
+
* @public exported from `@promptbook/core`
|
|
6888
|
+
*/
|
|
6889
|
+
var GENERIC_PIPELINE_INTERFACE = {
|
|
6890
|
+
inputParameterNames: [],
|
|
6891
|
+
outputParameterNames: [],
|
|
6841
6892
|
};
|
|
6842
6893
|
|
|
6843
6894
|
/**
|
|
@@ -6849,6 +6900,37 @@ var GenericFormfactorDefinition = {
|
|
|
6849
6900
|
name: 'GENERIC',
|
|
6850
6901
|
description: "@@@",
|
|
6851
6902
|
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
|
|
6903
|
+
pipelineInterface: GENERIC_PIPELINE_INTERFACE,
|
|
6904
|
+
};
|
|
6905
|
+
|
|
6906
|
+
/**
|
|
6907
|
+
* Sheets is form of app that @@@
|
|
6908
|
+
*
|
|
6909
|
+
* @public exported from `@promptbook/core`
|
|
6910
|
+
*/
|
|
6911
|
+
var SheetsFormfactorDefinition = {
|
|
6912
|
+
name: 'SHEETS',
|
|
6913
|
+
description: "@@@",
|
|
6914
|
+
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
|
|
6915
|
+
pipelineInterface: {
|
|
6916
|
+
inputParameterNames: ['inputSheet'],
|
|
6917
|
+
outputParameterNames: ['outputSheet'],
|
|
6918
|
+
},
|
|
6919
|
+
};
|
|
6920
|
+
|
|
6921
|
+
/**
|
|
6922
|
+
* Translator is form of app that @@@
|
|
6923
|
+
*
|
|
6924
|
+
* @public exported from `@promptbook/core`
|
|
6925
|
+
*/
|
|
6926
|
+
var TranslatorFormfactorDefinition = {
|
|
6927
|
+
name: 'TRANSLATOR',
|
|
6928
|
+
description: "@@@",
|
|
6929
|
+
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
|
|
6930
|
+
pipelineInterface: {
|
|
6931
|
+
inputParameterNames: ['inputMessage'],
|
|
6932
|
+
outputParameterNames: ['outputMessage'],
|
|
6933
|
+
},
|
|
6852
6934
|
};
|
|
6853
6935
|
|
|
6854
6936
|
/**
|
|
@@ -6856,7 +6938,12 @@ var GenericFormfactorDefinition = {
|
|
|
6856
6938
|
*
|
|
6857
6939
|
* @public exported from `@promptbook/core`
|
|
6858
6940
|
*/
|
|
6859
|
-
var FORMFACTOR_DEFINITIONS = [
|
|
6941
|
+
var FORMFACTOR_DEFINITIONS = [
|
|
6942
|
+
GenericFormfactorDefinition,
|
|
6943
|
+
ChatFormfactorDefinition,
|
|
6944
|
+
TranslatorFormfactorDefinition,
|
|
6945
|
+
SheetsFormfactorDefinition,
|
|
6946
|
+
];
|
|
6860
6947
|
|
|
6861
6948
|
/**
|
|
6862
6949
|
* Parses the formfactor command
|
|
@@ -6891,7 +6978,7 @@ var formfactorCommandParser = {
|
|
|
6891
6978
|
/**
|
|
6892
6979
|
* Example usages of the FORMFACTOR command
|
|
6893
6980
|
*/
|
|
6894
|
-
examples: ['FORMFACTOR
|
|
6981
|
+
examples: ['FORMFACTOR Chatbot', 'FF Chat'],
|
|
6895
6982
|
/**
|
|
6896
6983
|
* Parses the FORMFACTOR command
|
|
6897
6984
|
*/
|
|
@@ -6900,16 +6987,19 @@ var formfactorCommandParser = {
|
|
|
6900
6987
|
if (args.length !== 1) {
|
|
6901
6988
|
throw new ParseError("FORMFACTOR command requires exactly one argument");
|
|
6902
6989
|
}
|
|
6903
|
-
var
|
|
6904
|
-
|
|
6905
|
-
|
|
6990
|
+
var formfactorNameCandidate = args[0].toUpperCase();
|
|
6991
|
+
var formfactor = FORMFACTOR_DEFINITIONS.find(function (definition) {
|
|
6992
|
+
return __spreadArray([definition.name], __read(__assign({ aliasNames: [] }, definition).aliasNames), false).includes(formfactorNameCandidate);
|
|
6993
|
+
});
|
|
6994
|
+
if (formfactor === undefined) {
|
|
6995
|
+
throw new ParseError(spaceTrim(function (block) { return "\n Unknown formfactor name \"".concat(formfactorNameCandidate, "\"\n\n Available formfactors:\n ").concat(block(FORMFACTOR_DEFINITIONS.map(function (_a) {
|
|
6906
6996
|
var name = _a.name;
|
|
6907
6997
|
return "- ".concat(name);
|
|
6908
6998
|
}).join('\n')), "\n "); }));
|
|
6909
6999
|
}
|
|
6910
7000
|
return {
|
|
6911
7001
|
type: 'FORMFACTOR',
|
|
6912
|
-
formfactorName:
|
|
7002
|
+
formfactorName: formfactor.name,
|
|
6913
7003
|
};
|
|
6914
7004
|
},
|
|
6915
7005
|
/**
|
|
@@ -7209,7 +7299,7 @@ var parameterCommandParser = {
|
|
|
7209
7299
|
// <- TODO: When [🥶] fixed, change to:
|
|
7210
7300
|
// > const parameterDescriptionRaw = rawArgs.split(parameterNameRaw).join('').trim();
|
|
7211
7301
|
if (parameterDescriptionRaw && parameterDescriptionRaw.match(/\{(?<embeddedParameterName>[a-z0-9_]+)\}/im)) {
|
|
7212
|
-
throw new ParseError(spaceTrim(function (block) { return "\n Parameter {".concat(parameterNameRaw, "} can not contain another parameter in description\n\n The description:\n ").concat(block(parameterDescriptionRaw), "\n "); }));
|
|
7302
|
+
throw new ParseError(spaceTrim(function (block) { return "\n Parameter `{".concat(parameterNameRaw, "}` can not contain another parameter in description\n\n The description:\n ").concat(block(parameterDescriptionRaw), "\n "); }));
|
|
7213
7303
|
}
|
|
7214
7304
|
var isInput = normalized.startsWith('INPUT');
|
|
7215
7305
|
var isOutput = normalized.startsWith('OUTPUT');
|
|
@@ -8255,7 +8345,7 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
8255
8345
|
existingParameter.description &&
|
|
8256
8346
|
existingParameter.description !== parameterDescription &&
|
|
8257
8347
|
parameterDescription) {
|
|
8258
|
-
throw new ParseError(spaceTrim$1(function (block) { return "\n Parameter {".concat(parameterName, "} is defined multiple times with different description:\n\n ").concat(block(getPipelineIdentification()), "\n\n First definition:\n ").concat(block(existingParameter.description || '[undefined]'), "\n\n Second definition:\n ").concat(block(parameterDescription || '[undefined]'), "\n "); }));
|
|
8348
|
+
throw new ParseError(spaceTrim$1(function (block) { return "\n Parameter `{".concat(parameterName, "}` is defined multiple times with different description:\n\n ").concat(block(getPipelineIdentification()), "\n\n First definition:\n ").concat(block(existingParameter.description || '[undefined]'), "\n\n Second definition:\n ").concat(block(parameterDescription || '[undefined]'), "\n "); }));
|
|
8259
8349
|
}
|
|
8260
8350
|
if (existingParameter) {
|
|
8261
8351
|
if (parameterDescription) {
|
|
@@ -8914,6 +9004,21 @@ function usageToHuman(usage) {
|
|
|
8914
9004
|
* TODO: [🏛] Maybe make some markdown builder
|
|
8915
9005
|
*/
|
|
8916
9006
|
|
|
9007
|
+
/**
|
|
9008
|
+
* Boilerplate is form of app that @@@
|
|
9009
|
+
*
|
|
9010
|
+
* @public exported from `@promptbook/core`
|
|
9011
|
+
*/
|
|
9012
|
+
var BoilerplateFormfactorDefinition = {
|
|
9013
|
+
name: 'BOILERPLATE',
|
|
9014
|
+
description: "@@@",
|
|
9015
|
+
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
|
|
9016
|
+
pipelineInterface: {
|
|
9017
|
+
inputParameterNames: [],
|
|
9018
|
+
outputParameterNames: [],
|
|
9019
|
+
},
|
|
9020
|
+
};
|
|
9021
|
+
|
|
8917
9022
|
/**
|
|
8918
9023
|
* @@@
|
|
8919
9024
|
*
|
|
@@ -9511,7 +9616,7 @@ function getPipelineInterface(pipeline) {
|
|
|
9511
9616
|
}
|
|
9512
9617
|
finally { if (e_2) throw e_2.error; }
|
|
9513
9618
|
}
|
|
9514
|
-
return
|
|
9619
|
+
return $deepFreeze(pipelineInterface);
|
|
9515
9620
|
}
|
|
9516
9621
|
/**
|
|
9517
9622
|
* TODO: !!!!!! Write unit test
|
|
@@ -10067,5 +10172,5 @@ function executionReportJsonToString(executionReportJson, options) {
|
|
|
10067
10172
|
* TODO: [🧠] Should be in generated file GENERATOR_WARNING
|
|
10068
10173
|
*/
|
|
10069
10174
|
|
|
10070
|
-
export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, AbstractFormatError, BOOK_LANGUAGE_VERSION, BlackholeStorage, CLAIM, CallbackInterfaceTools, ChatFormfactorDefinition, CollectionError, CsvFormatDefinition, CsvFormatError, DEFAULT_CSV_SETTINGS, DEFAULT_EXECUTIONS_CACHE_DIRNAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_REMOTE_URL, DEFAULT_REMOTE_URL_PATH, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TITLE, ERRORS, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FORMFACTOR_DEFINITIONS, GenericFormfactorDefinition, KnowledgeScrapeError, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_VARIANTS, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NotFoundError, NotYetImplementedError, PROMPTBOOK_ENGINE_VERSION, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, RESERVED_PARAMETER_NAMES, TemplateTypes, TextFormatDefinition, UNCERTAIN_USAGE, UnexpectedError, ZERO_USAGE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _DocumentScraperMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, addUsage, assertsExecutionSuccessful, cacheLlmTools, collectionToJson, countTotalUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, getPipelineInterface, isPassingExpectations, isPipelineImplementingInterface, isPipelineInterfacesEqual, isPipelinePrepared, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, pipelineJsonToString, pipelineStringToJson, pipelineStringToJsonSync, prepareKnowledgePieces, preparePersona, preparePipeline, prepareTemplates, prettifyPipelineString, stringifyPipelineJson, unpreparePipeline, usageToHuman, usageToWorktime, validatePipeline };
|
|
10175
|
+
export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, AbstractFormatError, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateFormfactorDefinition, CLAIM, CallbackInterfaceTools, ChatFormfactorDefinition, CollectionError, CsvFormatDefinition, CsvFormatError, DEFAULT_CSV_SETTINGS, DEFAULT_EXECUTIONS_CACHE_DIRNAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_REMOTE_URL, DEFAULT_REMOTE_URL_PATH, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TITLE, ERRORS, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FORMFACTOR_DEFINITIONS, GENERIC_PIPELINE_INTERFACE, GenericFormfactorDefinition, KnowledgeScrapeError, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_VARIANTS, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NotFoundError, NotYetImplementedError, PROMPTBOOK_ENGINE_VERSION, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, RESERVED_PARAMETER_NAMES, SheetsFormfactorDefinition, TemplateTypes, TextFormatDefinition, TranslatorFormfactorDefinition, UNCERTAIN_USAGE, UnexpectedError, ZERO_USAGE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _DocumentScraperMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, addUsage, assertsExecutionSuccessful, cacheLlmTools, collectionToJson, countTotalUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, getPipelineInterface, isPassingExpectations, isPipelineImplementingInterface, isPipelineInterfacesEqual, isPipelinePrepared, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, pipelineJsonToString, pipelineStringToJson, pipelineStringToJsonSync, prepareKnowledgePieces, preparePersona, preparePipeline, prepareTemplates, prettifyPipelineString, stringifyPipelineJson, unpreparePipeline, usageToHuman, usageToWorktime, validatePipeline };
|
|
10071
10176
|
//# sourceMappingURL=index.es.js.map
|