@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/umd/index.umd.js
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
*
|
|
25
25
|
* @see https://github.com/webgptorg/promptbook
|
|
26
26
|
*/
|
|
27
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
27
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.75.0-0';
|
|
28
28
|
/**
|
|
29
29
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
30
30
|
*/
|
|
@@ -820,6 +820,7 @@
|
|
|
820
820
|
// Note: In normal situations, we check the pipeline logic:
|
|
821
821
|
true);
|
|
822
822
|
/**
|
|
823
|
+
* TODO: Extract `constants.ts` from `config.ts`
|
|
823
824
|
* TODO: [🧠][🧜♂️] Maybe join remoteUrl and path into single value
|
|
824
825
|
*/
|
|
825
826
|
|
|
@@ -1081,18 +1082,18 @@
|
|
|
1081
1082
|
}
|
|
1082
1083
|
var _loop_1 = function (parameter) {
|
|
1083
1084
|
if (parameter.isInput && parameter.isOutput) {
|
|
1084
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n\n Parameter {".concat(parameter.name, "} can not be both input and output\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1085
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n\n Parameter `{".concat(parameter.name, "}` can not be both input and output\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1085
1086
|
}
|
|
1086
1087
|
// Note: Testing that parameter is either intermediate or output BUT not created and unused
|
|
1087
1088
|
if (!parameter.isInput &&
|
|
1088
1089
|
!parameter.isOutput &&
|
|
1089
1090
|
!pipeline.templates.some(function (template) { return template.dependentParameterNames.includes(parameter.name); })) {
|
|
1090
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim(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 "); }));
|
|
1091
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(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 "); }));
|
|
1091
1092
|
}
|
|
1092
1093
|
// Note: Testing that parameter is either input or result of some template
|
|
1093
1094
|
if (!parameter.isInput &&
|
|
1094
1095
|
!pipeline.templates.some(function (template) { return template.resultingParameterName === parameter.name; })) {
|
|
1095
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim(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, "}
|
|
1096
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(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 "); }));
|
|
1096
1097
|
}
|
|
1097
1098
|
};
|
|
1098
1099
|
try {
|
|
@@ -1120,7 +1121,7 @@
|
|
|
1120
1121
|
var _loop_2 = function (template) {
|
|
1121
1122
|
var e_4, _h, e_5, _j;
|
|
1122
1123
|
if (definedParameters.has(template.resultingParameterName)) {
|
|
1123
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(template.resultingParameterName, "} is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1124
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(template.resultingParameterName, "}` is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1124
1125
|
}
|
|
1125
1126
|
if (RESERVED_PARAMETER_NAMES.includes(template.resultingParameterName)) {
|
|
1126
1127
|
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter name {".concat(template.resultingParameterName, "} is reserved, please use different name\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
@@ -1133,7 +1134,7 @@
|
|
|
1133
1134
|
}
|
|
1134
1135
|
var _loop_4 = function (joker) {
|
|
1135
1136
|
if (!template.dependentParameterNames.includes(joker)) {
|
|
1136
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim(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 "); }));
|
|
1137
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(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 "); }));
|
|
1137
1138
|
}
|
|
1138
1139
|
};
|
|
1139
1140
|
try {
|
|
@@ -1228,14 +1229,24 @@
|
|
|
1228
1229
|
if (currentlyResovedTemplates.length === 0) {
|
|
1229
1230
|
throw new PipelineLogicError(
|
|
1230
1231
|
// TODO: [🐎] DRY
|
|
1231
|
-
spaceTrim.spaceTrim(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
|
|
1232
|
+
spaceTrim.spaceTrim(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
|
|
1232
1233
|
.map(function (_a) {
|
|
1233
1234
|
var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
|
|
1234
|
-
return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
|
|
1235
|
-
.map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
|
|
1235
|
+
return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
|
|
1236
|
+
.map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
|
|
1236
1237
|
.join(' and '));
|
|
1237
1238
|
})
|
|
1238
|
-
.join('\n')), "\n\n Resolved
|
|
1239
|
+
.join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameters
|
|
1240
|
+
.filter(function (name) {
|
|
1241
|
+
return !RESERVED_PARAMETER_NAMES.includes(name);
|
|
1242
|
+
})
|
|
1243
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
1244
|
+
.join('\n')), "\n\n\n **Reserved (which are available):**\n ").concat(block(resovedParameters
|
|
1245
|
+
.filter(function (name) {
|
|
1246
|
+
return RESERVED_PARAMETER_NAMES.includes(name);
|
|
1247
|
+
})
|
|
1248
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
1249
|
+
.join('\n')), "\n\n\n "); }));
|
|
1239
1250
|
}
|
|
1240
1251
|
resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTemplates.map(function (_a) {
|
|
1241
1252
|
var resultingParameterName = _a.resultingParameterName;
|
|
@@ -1246,6 +1257,7 @@
|
|
|
1246
1257
|
while (unresovedTemplates.length > 0) {
|
|
1247
1258
|
_loop_3();
|
|
1248
1259
|
}
|
|
1260
|
+
// TODO: !!!!!! Test that pipeline interface implements declared formfactor interface
|
|
1249
1261
|
}
|
|
1250
1262
|
/**
|
|
1251
1263
|
* TODO: !! [🧞♀️] Do not allow joker + foreach
|
|
@@ -2238,8 +2250,8 @@
|
|
|
2238
2250
|
else if (errors.length > 1) {
|
|
2239
2251
|
throw new PipelineExecutionError(
|
|
2240
2252
|
// TODO: Tell which execution tools failed like
|
|
2241
|
-
// 1) OpenAI throw PipelineExecutionError: Parameter {knowledge} is not defined
|
|
2242
|
-
// 2) AnthropicClaude throw PipelineExecutionError: Parameter {knowledge} is not defined
|
|
2253
|
+
// 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
2254
|
+
// 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
2243
2255
|
// 3) ...
|
|
2244
2256
|
spaceTrim__default["default"](function (block) { return "\n All execution tools failed:\n\n ".concat(block(errors
|
|
2245
2257
|
.map(function (error, i) { return "".concat(i + 1, ") **").concat(error.name || 'Error', ":** ").concat(error.message); })
|
|
@@ -3238,11 +3250,11 @@
|
|
|
3238
3250
|
for (var _b = __values(Object.entries(parameters)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
3239
3251
|
var _d = __read(_c.value, 2), parameterName = _d[0], parameterValue = _d[1];
|
|
3240
3252
|
if (parameterValue === RESERVED_PARAMETER_MISSING_VALUE) {
|
|
3241
|
-
throw new UnexpectedError("Parameter {".concat(parameterName, "} has missing value"));
|
|
3253
|
+
throw new UnexpectedError("Parameter `{".concat(parameterName, "}` has missing value"));
|
|
3242
3254
|
}
|
|
3243
3255
|
else if (parameterValue === RESERVED_PARAMETER_RESTRICTED) {
|
|
3244
3256
|
// TODO: [🍵]
|
|
3245
|
-
throw new UnexpectedError("Parameter {".concat(parameterName, "} is restricted to use"));
|
|
3257
|
+
throw new UnexpectedError("Parameter `{".concat(parameterName, "}` is restricted to use"));
|
|
3246
3258
|
}
|
|
3247
3259
|
}
|
|
3248
3260
|
}
|
|
@@ -3269,11 +3281,11 @@
|
|
|
3269
3281
|
throw new PipelineExecutionError('Parameter is already opened or not closed');
|
|
3270
3282
|
}
|
|
3271
3283
|
if (parameters[parameterName] === undefined) {
|
|
3272
|
-
throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
|
|
3284
|
+
throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
|
|
3273
3285
|
}
|
|
3274
3286
|
var parameterValue = parameters[parameterName];
|
|
3275
3287
|
if (parameterValue === undefined) {
|
|
3276
|
-
throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
|
|
3288
|
+
throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
|
|
3277
3289
|
}
|
|
3278
3290
|
parameterValue = parameterValue.toString();
|
|
3279
3291
|
if (parameterValue.includes('\n') && /^\s*\W{0,3}\s*$/.test(precol)) {
|
|
@@ -3329,6 +3341,9 @@
|
|
|
3329
3341
|
* @public exported from `@promptbook/utils`
|
|
3330
3342
|
*/
|
|
3331
3343
|
var LINES_PER_STANDARD_PAGE = 44;
|
|
3344
|
+
/**
|
|
3345
|
+
* TODO: [🧠] Should be this `constants.ts` or `config.ts`?
|
|
3346
|
+
*/
|
|
3332
3347
|
|
|
3333
3348
|
/**
|
|
3334
3349
|
* Counts number of lines in the text
|
|
@@ -4343,7 +4358,7 @@
|
|
|
4343
4358
|
else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
|
|
4344
4359
|
// Houston, we have a problem
|
|
4345
4360
|
// Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
|
|
4346
|
-
throw new UnexpectedError(spaceTrim.spaceTrim(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 "); }));
|
|
4361
|
+
throw new UnexpectedError(spaceTrim.spaceTrim(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 "); }));
|
|
4347
4362
|
}
|
|
4348
4363
|
};
|
|
4349
4364
|
try {
|
|
@@ -4422,7 +4437,7 @@
|
|
|
4422
4437
|
var _loop_1 = function (parameter) {
|
|
4423
4438
|
if (parametersToPass[parameter.name] === undefined) {
|
|
4424
4439
|
// [4]
|
|
4425
|
-
$warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim(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 "); })));
|
|
4440
|
+
$warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim(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 "); })));
|
|
4426
4441
|
return "continue";
|
|
4427
4442
|
}
|
|
4428
4443
|
outputParameters[parameter.name] = parametersToPass[parameter.name] || '';
|
|
@@ -4509,7 +4524,7 @@
|
|
|
4509
4524
|
case 6: return [2 /*return*/, $asDeeplyFrozenSerializableJson("Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"), {
|
|
4510
4525
|
isSuccessful: false,
|
|
4511
4526
|
errors: __spreadArray([
|
|
4512
|
-
new PipelineExecutionError("Parameter {".concat(parameter.name, "} is required as an input parameter"))
|
|
4527
|
+
new PipelineExecutionError("Parameter `{".concat(parameter.name, "}` is required as an input parameter"))
|
|
4513
4528
|
], __read(errors), false).map(serializeError),
|
|
4514
4529
|
warnings: [],
|
|
4515
4530
|
executionReport: executionReport,
|
|
@@ -4557,7 +4572,7 @@
|
|
|
4557
4572
|
case 3: return [2 /*return*/, { value: $asDeeplyFrozenSerializableJson(spaceTrim.spaceTrim(function (block) { return "\n Unuccessful PipelineExecutorResult (with extra parameter {".concat(parameter.name, "}) PipelineExecutorResult\n\n ").concat(block(pipelineIdentification), "\n "); }), {
|
|
4558
4573
|
isSuccessful: false,
|
|
4559
4574
|
errors: __spreadArray([
|
|
4560
|
-
new PipelineExecutionError(spaceTrim.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 "); }))
|
|
4575
|
+
new PipelineExecutionError(spaceTrim.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 "); }))
|
|
4561
4576
|
], __read(errors), false).map(serializeError),
|
|
4562
4577
|
warnings: warnings.map(serializeError),
|
|
4563
4578
|
executionReport: executionReport,
|
|
@@ -4631,14 +4646,24 @@
|
|
|
4631
4646
|
if (!(!currentTemplate && resolving_1.length === 0)) return [3 /*break*/, 1];
|
|
4632
4647
|
throw new UnexpectedError(
|
|
4633
4648
|
// TODO: [🐎] DRY
|
|
4634
|
-
spaceTrim.spaceTrim(function (block) { return "\n Can not resolve some parameters:\n\n ".concat(block(pipelineIdentification), "\n\n Can not resolve
|
|
4649
|
+
spaceTrim.spaceTrim(function (block) { return "\n Can not resolve some parameters:\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTemplates_1
|
|
4635
4650
|
.map(function (_a) {
|
|
4636
4651
|
var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
|
|
4637
|
-
return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
|
|
4638
|
-
.map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
|
|
4652
|
+
return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
|
|
4653
|
+
.map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
|
|
4639
4654
|
.join(' and '));
|
|
4640
4655
|
})
|
|
4641
|
-
.join('\n')), "\n\n Resolved
|
|
4656
|
+
.join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameterNames_1
|
|
4657
|
+
.filter(function (name) {
|
|
4658
|
+
return !RESERVED_PARAMETER_NAMES.includes(name);
|
|
4659
|
+
})
|
|
4660
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
4661
|
+
.join('\n')), "\n\n **Reserved (which are available):**\n ").concat(block(resovedParameterNames_1
|
|
4662
|
+
.filter(function (name) {
|
|
4663
|
+
return RESERVED_PARAMETER_NAMES.includes(name);
|
|
4664
|
+
})
|
|
4665
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
4666
|
+
.join('\n')), "\n\n *Note: This should be catched in `validatePipeline`*\n "); }));
|
|
4642
4667
|
case 1:
|
|
4643
4668
|
if (!!currentTemplate) return [3 /*break*/, 3];
|
|
4644
4669
|
/* [🤹♂️] */ return [4 /*yield*/, Promise.race(resolving_1)];
|
|
@@ -6837,9 +6862,35 @@
|
|
|
6837
6862
|
* @public exported from `@promptbook/core`
|
|
6838
6863
|
*/
|
|
6839
6864
|
var ChatFormfactorDefinition = {
|
|
6840
|
-
name: '
|
|
6865
|
+
name: 'CHATBOT',
|
|
6866
|
+
aliasNames: ['CHAT'],
|
|
6841
6867
|
description: "@@@",
|
|
6842
6868
|
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
|
|
6869
|
+
pipelineInterface: {
|
|
6870
|
+
inputParameterNames: ['previousTitle', 'previousConversationSummary', 'userMessage'],
|
|
6871
|
+
outputParameterNames: ['title', 'conversationSummary', 'chatbotResponse'],
|
|
6872
|
+
/*
|
|
6873
|
+
<- TODO: !!!!!! Change to
|
|
6874
|
+
|
|
6875
|
+
- INPUT PARAMETER `{previousTitle}` Previous title of the conversation
|
|
6876
|
+
- INPUT PARAMETER `{previousConversationSummary}` Previous conversation summary
|
|
6877
|
+
- INPUT PARAMETER `{userMessage}` User message
|
|
6878
|
+
- OUTPUT PARAMETER `{title}` Title of the conversation
|
|
6879
|
+
- OUTPUT PARAMETER `{conversationSummary}` Summary of the conversation
|
|
6880
|
+
- OUTPUT PARAMETER `{chatbotResponse}` Chatbot response
|
|
6881
|
+
|
|
6882
|
+
*/
|
|
6883
|
+
},
|
|
6884
|
+
};
|
|
6885
|
+
|
|
6886
|
+
/**
|
|
6887
|
+
* @@@
|
|
6888
|
+
*
|
|
6889
|
+
* @public exported from `@promptbook/core`
|
|
6890
|
+
*/
|
|
6891
|
+
var GENERIC_PIPELINE_INTERFACE = {
|
|
6892
|
+
inputParameterNames: [],
|
|
6893
|
+
outputParameterNames: [],
|
|
6843
6894
|
};
|
|
6844
6895
|
|
|
6845
6896
|
/**
|
|
@@ -6851,6 +6902,37 @@
|
|
|
6851
6902
|
name: 'GENERIC',
|
|
6852
6903
|
description: "@@@",
|
|
6853
6904
|
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
|
|
6905
|
+
pipelineInterface: GENERIC_PIPELINE_INTERFACE,
|
|
6906
|
+
};
|
|
6907
|
+
|
|
6908
|
+
/**
|
|
6909
|
+
* Sheets is form of app that @@@
|
|
6910
|
+
*
|
|
6911
|
+
* @public exported from `@promptbook/core`
|
|
6912
|
+
*/
|
|
6913
|
+
var SheetsFormfactorDefinition = {
|
|
6914
|
+
name: 'SHEETS',
|
|
6915
|
+
description: "@@@",
|
|
6916
|
+
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
|
|
6917
|
+
pipelineInterface: {
|
|
6918
|
+
inputParameterNames: ['inputSheet'],
|
|
6919
|
+
outputParameterNames: ['outputSheet'],
|
|
6920
|
+
},
|
|
6921
|
+
};
|
|
6922
|
+
|
|
6923
|
+
/**
|
|
6924
|
+
* Translator is form of app that @@@
|
|
6925
|
+
*
|
|
6926
|
+
* @public exported from `@promptbook/core`
|
|
6927
|
+
*/
|
|
6928
|
+
var TranslatorFormfactorDefinition = {
|
|
6929
|
+
name: 'TRANSLATOR',
|
|
6930
|
+
description: "@@@",
|
|
6931
|
+
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
|
|
6932
|
+
pipelineInterface: {
|
|
6933
|
+
inputParameterNames: ['inputMessage'],
|
|
6934
|
+
outputParameterNames: ['outputMessage'],
|
|
6935
|
+
},
|
|
6854
6936
|
};
|
|
6855
6937
|
|
|
6856
6938
|
/**
|
|
@@ -6858,7 +6940,12 @@
|
|
|
6858
6940
|
*
|
|
6859
6941
|
* @public exported from `@promptbook/core`
|
|
6860
6942
|
*/
|
|
6861
|
-
var FORMFACTOR_DEFINITIONS = [
|
|
6943
|
+
var FORMFACTOR_DEFINITIONS = [
|
|
6944
|
+
GenericFormfactorDefinition,
|
|
6945
|
+
ChatFormfactorDefinition,
|
|
6946
|
+
TranslatorFormfactorDefinition,
|
|
6947
|
+
SheetsFormfactorDefinition,
|
|
6948
|
+
];
|
|
6862
6949
|
|
|
6863
6950
|
/**
|
|
6864
6951
|
* Parses the formfactor command
|
|
@@ -6893,7 +6980,7 @@
|
|
|
6893
6980
|
/**
|
|
6894
6981
|
* Example usages of the FORMFACTOR command
|
|
6895
6982
|
*/
|
|
6896
|
-
examples: ['FORMFACTOR
|
|
6983
|
+
examples: ['FORMFACTOR Chatbot', 'FF Chat'],
|
|
6897
6984
|
/**
|
|
6898
6985
|
* Parses the FORMFACTOR command
|
|
6899
6986
|
*/
|
|
@@ -6902,16 +6989,19 @@
|
|
|
6902
6989
|
if (args.length !== 1) {
|
|
6903
6990
|
throw new ParseError("FORMFACTOR command requires exactly one argument");
|
|
6904
6991
|
}
|
|
6905
|
-
var
|
|
6906
|
-
|
|
6907
|
-
|
|
6992
|
+
var formfactorNameCandidate = args[0].toUpperCase();
|
|
6993
|
+
var formfactor = FORMFACTOR_DEFINITIONS.find(function (definition) {
|
|
6994
|
+
return __spreadArray([definition.name], __read(__assign({ aliasNames: [] }, definition).aliasNames), false).includes(formfactorNameCandidate);
|
|
6995
|
+
});
|
|
6996
|
+
if (formfactor === undefined) {
|
|
6997
|
+
throw new ParseError(spaceTrim__default["default"](function (block) { return "\n Unknown formfactor name \"".concat(formfactorNameCandidate, "\"\n\n Available formfactors:\n ").concat(block(FORMFACTOR_DEFINITIONS.map(function (_a) {
|
|
6908
6998
|
var name = _a.name;
|
|
6909
6999
|
return "- ".concat(name);
|
|
6910
7000
|
}).join('\n')), "\n "); }));
|
|
6911
7001
|
}
|
|
6912
7002
|
return {
|
|
6913
7003
|
type: 'FORMFACTOR',
|
|
6914
|
-
formfactorName:
|
|
7004
|
+
formfactorName: formfactor.name,
|
|
6915
7005
|
};
|
|
6916
7006
|
},
|
|
6917
7007
|
/**
|
|
@@ -7211,7 +7301,7 @@
|
|
|
7211
7301
|
// <- TODO: When [🥶] fixed, change to:
|
|
7212
7302
|
// > const parameterDescriptionRaw = rawArgs.split(parameterNameRaw).join('').trim();
|
|
7213
7303
|
if (parameterDescriptionRaw && parameterDescriptionRaw.match(/\{(?<embeddedParameterName>[a-z0-9_]+)\}/im)) {
|
|
7214
|
-
throw new ParseError(spaceTrim__default["default"](function (block) { return "\n Parameter {".concat(parameterNameRaw, "} can not contain another parameter in description\n\n The description:\n ").concat(block(parameterDescriptionRaw), "\n "); }));
|
|
7304
|
+
throw new ParseError(spaceTrim__default["default"](function (block) { return "\n Parameter `{".concat(parameterNameRaw, "}` can not contain another parameter in description\n\n The description:\n ").concat(block(parameterDescriptionRaw), "\n "); }));
|
|
7215
7305
|
}
|
|
7216
7306
|
var isInput = normalized.startsWith('INPUT');
|
|
7217
7307
|
var isOutput = normalized.startsWith('OUTPUT');
|
|
@@ -8257,7 +8347,7 @@
|
|
|
8257
8347
|
existingParameter.description &&
|
|
8258
8348
|
existingParameter.description !== parameterDescription &&
|
|
8259
8349
|
parameterDescription) {
|
|
8260
|
-
throw new ParseError(spaceTrim.spaceTrim(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 "); }));
|
|
8350
|
+
throw new ParseError(spaceTrim.spaceTrim(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 "); }));
|
|
8261
8351
|
}
|
|
8262
8352
|
if (existingParameter) {
|
|
8263
8353
|
if (parameterDescription) {
|
|
@@ -8916,6 +9006,21 @@
|
|
|
8916
9006
|
* TODO: [🏛] Maybe make some markdown builder
|
|
8917
9007
|
*/
|
|
8918
9008
|
|
|
9009
|
+
/**
|
|
9010
|
+
* Boilerplate is form of app that @@@
|
|
9011
|
+
*
|
|
9012
|
+
* @public exported from `@promptbook/core`
|
|
9013
|
+
*/
|
|
9014
|
+
var BoilerplateFormfactorDefinition = {
|
|
9015
|
+
name: 'BOILERPLATE',
|
|
9016
|
+
description: "@@@",
|
|
9017
|
+
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
|
|
9018
|
+
pipelineInterface: {
|
|
9019
|
+
inputParameterNames: [],
|
|
9020
|
+
outputParameterNames: [],
|
|
9021
|
+
},
|
|
9022
|
+
};
|
|
9023
|
+
|
|
8919
9024
|
/**
|
|
8920
9025
|
* @@@
|
|
8921
9026
|
*
|
|
@@ -9513,7 +9618,7 @@
|
|
|
9513
9618
|
}
|
|
9514
9619
|
finally { if (e_2) throw e_2.error; }
|
|
9515
9620
|
}
|
|
9516
|
-
return
|
|
9621
|
+
return $deepFreeze(pipelineInterface);
|
|
9517
9622
|
}
|
|
9518
9623
|
/**
|
|
9519
9624
|
* TODO: !!!!!! Write unit test
|
|
@@ -10076,6 +10181,7 @@
|
|
|
10076
10181
|
exports.AbstractFormatError = AbstractFormatError;
|
|
10077
10182
|
exports.BOOK_LANGUAGE_VERSION = BOOK_LANGUAGE_VERSION;
|
|
10078
10183
|
exports.BlackholeStorage = BlackholeStorage;
|
|
10184
|
+
exports.BoilerplateFormfactorDefinition = BoilerplateFormfactorDefinition;
|
|
10079
10185
|
exports.CLAIM = CLAIM;
|
|
10080
10186
|
exports.CallbackInterfaceTools = CallbackInterfaceTools;
|
|
10081
10187
|
exports.ChatFormfactorDefinition = ChatFormfactorDefinition;
|
|
@@ -10102,6 +10208,7 @@
|
|
|
10102
10208
|
exports.ExecutionReportStringOptionsDefaults = ExecutionReportStringOptionsDefaults;
|
|
10103
10209
|
exports.ExpectError = ExpectError;
|
|
10104
10210
|
exports.FORMFACTOR_DEFINITIONS = FORMFACTOR_DEFINITIONS;
|
|
10211
|
+
exports.GENERIC_PIPELINE_INTERFACE = GENERIC_PIPELINE_INTERFACE;
|
|
10105
10212
|
exports.GenericFormfactorDefinition = GenericFormfactorDefinition;
|
|
10106
10213
|
exports.KnowledgeScrapeError = KnowledgeScrapeError;
|
|
10107
10214
|
exports.LimitReachedError = LimitReachedError;
|
|
@@ -10120,8 +10227,10 @@
|
|
|
10120
10227
|
exports.PipelineUrlError = PipelineUrlError;
|
|
10121
10228
|
exports.PrefixStorage = PrefixStorage;
|
|
10122
10229
|
exports.RESERVED_PARAMETER_NAMES = RESERVED_PARAMETER_NAMES;
|
|
10230
|
+
exports.SheetsFormfactorDefinition = SheetsFormfactorDefinition;
|
|
10123
10231
|
exports.TemplateTypes = TemplateTypes;
|
|
10124
10232
|
exports.TextFormatDefinition = TextFormatDefinition;
|
|
10233
|
+
exports.TranslatorFormfactorDefinition = TranslatorFormfactorDefinition;
|
|
10125
10234
|
exports.UNCERTAIN_USAGE = UNCERTAIN_USAGE;
|
|
10126
10235
|
exports.UnexpectedError = UnexpectedError;
|
|
10127
10236
|
exports.ZERO_USAGE = ZERO_USAGE;
|