@promptbook/cli 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 +125 -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 +125 -35
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -37,7 +37,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
37
37
|
*
|
|
38
38
|
* @see https://github.com/webgptorg/promptbook
|
|
39
39
|
*/
|
|
40
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
40
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.75.0-0';
|
|
41
41
|
/**
|
|
42
42
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
43
43
|
*/
|
|
@@ -557,6 +557,7 @@ var IS_PIPELINE_LOGIC_VALIDATED = just(
|
|
|
557
557
|
// Note: In normal situations, we check the pipeline logic:
|
|
558
558
|
true);
|
|
559
559
|
/**
|
|
560
|
+
* TODO: Extract `constants.ts` from `config.ts`
|
|
560
561
|
* TODO: [🧠][🧜♂️] Maybe join remoteUrl and path into single value
|
|
561
562
|
*/
|
|
562
563
|
|
|
@@ -1477,8 +1478,8 @@ var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
|
1477
1478
|
else if (errors.length > 1) {
|
|
1478
1479
|
throw new PipelineExecutionError(
|
|
1479
1480
|
// TODO: Tell which execution tools failed like
|
|
1480
|
-
// 1) OpenAI throw PipelineExecutionError: Parameter {knowledge} is not defined
|
|
1481
|
-
// 2) AnthropicClaude throw PipelineExecutionError: Parameter {knowledge} is not defined
|
|
1481
|
+
// 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
1482
|
+
// 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
1482
1483
|
// 3) ...
|
|
1483
1484
|
spaceTrim$1(function (block) { return "\n All execution tools failed:\n\n ".concat(block(errors
|
|
1484
1485
|
.map(function (error, i) { return "".concat(i + 1, ") **").concat(error.name || 'Error', ":** ").concat(error.message); })
|
|
@@ -1813,18 +1814,18 @@ function validatePipelineCore(pipeline) {
|
|
|
1813
1814
|
}
|
|
1814
1815
|
var _loop_1 = function (parameter) {
|
|
1815
1816
|
if (parameter.isInput && parameter.isOutput) {
|
|
1816
|
-
throw new PipelineLogicError(spaceTrim(function (block) { return "\n\n Parameter {".concat(parameter.name, "} can not be both input and output\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1817
|
+
throw new PipelineLogicError(spaceTrim(function (block) { return "\n\n Parameter `{".concat(parameter.name, "}` can not be both input and output\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1817
1818
|
}
|
|
1818
1819
|
// Note: Testing that parameter is either intermediate or output BUT not created and unused
|
|
1819
1820
|
if (!parameter.isInput &&
|
|
1820
1821
|
!parameter.isOutput &&
|
|
1821
1822
|
!pipeline.templates.some(function (template) { return template.dependentParameterNames.includes(parameter.name); })) {
|
|
1822
|
-
throw new PipelineLogicError(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 "); }));
|
|
1823
|
+
throw new PipelineLogicError(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 "); }));
|
|
1823
1824
|
}
|
|
1824
1825
|
// Note: Testing that parameter is either input or result of some template
|
|
1825
1826
|
if (!parameter.isInput &&
|
|
1826
1827
|
!pipeline.templates.some(function (template) { return template.resultingParameterName === parameter.name; })) {
|
|
1827
|
-
throw new PipelineLogicError(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, "}
|
|
1828
|
+
throw new PipelineLogicError(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 "); }));
|
|
1828
1829
|
}
|
|
1829
1830
|
};
|
|
1830
1831
|
try {
|
|
@@ -1852,7 +1853,7 @@ function validatePipelineCore(pipeline) {
|
|
|
1852
1853
|
var _loop_2 = function (template) {
|
|
1853
1854
|
var e_4, _h, e_5, _j;
|
|
1854
1855
|
if (definedParameters.has(template.resultingParameterName)) {
|
|
1855
|
-
throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter {".concat(template.resultingParameterName, "} is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1856
|
+
throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter `{".concat(template.resultingParameterName, "}` is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1856
1857
|
}
|
|
1857
1858
|
if (RESERVED_PARAMETER_NAMES.includes(template.resultingParameterName)) {
|
|
1858
1859
|
throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter name {".concat(template.resultingParameterName, "} is reserved, please use different name\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
@@ -1865,7 +1866,7 @@ function validatePipelineCore(pipeline) {
|
|
|
1865
1866
|
}
|
|
1866
1867
|
var _loop_4 = function (joker) {
|
|
1867
1868
|
if (!template.dependentParameterNames.includes(joker)) {
|
|
1868
|
-
throw new PipelineLogicError(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 "); }));
|
|
1869
|
+
throw new PipelineLogicError(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 "); }));
|
|
1869
1870
|
}
|
|
1870
1871
|
};
|
|
1871
1872
|
try {
|
|
@@ -1960,14 +1961,24 @@ function validatePipelineCore(pipeline) {
|
|
|
1960
1961
|
if (currentlyResovedTemplates.length === 0) {
|
|
1961
1962
|
throw new PipelineLogicError(
|
|
1962
1963
|
// TODO: [🐎] DRY
|
|
1963
|
-
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
|
|
1964
|
+
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
|
|
1964
1965
|
.map(function (_a) {
|
|
1965
1966
|
var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
|
|
1966
|
-
return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
|
|
1967
|
-
.map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
|
|
1967
|
+
return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
|
|
1968
|
+
.map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
|
|
1968
1969
|
.join(' and '));
|
|
1969
1970
|
})
|
|
1970
|
-
.join('\n')), "\n\n Resolved
|
|
1971
|
+
.join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameters
|
|
1972
|
+
.filter(function (name) {
|
|
1973
|
+
return !RESERVED_PARAMETER_NAMES.includes(name);
|
|
1974
|
+
})
|
|
1975
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
1976
|
+
.join('\n')), "\n\n\n **Reserved (which are available):**\n ").concat(block(resovedParameters
|
|
1977
|
+
.filter(function (name) {
|
|
1978
|
+
return RESERVED_PARAMETER_NAMES.includes(name);
|
|
1979
|
+
})
|
|
1980
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
1981
|
+
.join('\n')), "\n\n\n "); }));
|
|
1971
1982
|
}
|
|
1972
1983
|
resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTemplates.map(function (_a) {
|
|
1973
1984
|
var resultingParameterName = _a.resultingParameterName;
|
|
@@ -1978,6 +1989,7 @@ function validatePipelineCore(pipeline) {
|
|
|
1978
1989
|
while (unresovedTemplates.length > 0) {
|
|
1979
1990
|
_loop_3();
|
|
1980
1991
|
}
|
|
1992
|
+
// TODO: !!!!!! Test that pipeline interface implements declared formfactor interface
|
|
1981
1993
|
}
|
|
1982
1994
|
/**
|
|
1983
1995
|
* TODO: !! [🧞♀️] Do not allow joker + foreach
|
|
@@ -3110,11 +3122,11 @@ function replaceParameters(template, parameters) {
|
|
|
3110
3122
|
for (var _b = __values(Object.entries(parameters)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
3111
3123
|
var _d = __read(_c.value, 2), parameterName = _d[0], parameterValue = _d[1];
|
|
3112
3124
|
if (parameterValue === RESERVED_PARAMETER_MISSING_VALUE) {
|
|
3113
|
-
throw new UnexpectedError("Parameter {".concat(parameterName, "} has missing value"));
|
|
3125
|
+
throw new UnexpectedError("Parameter `{".concat(parameterName, "}` has missing value"));
|
|
3114
3126
|
}
|
|
3115
3127
|
else if (parameterValue === RESERVED_PARAMETER_RESTRICTED) {
|
|
3116
3128
|
// TODO: [🍵]
|
|
3117
|
-
throw new UnexpectedError("Parameter {".concat(parameterName, "} is restricted to use"));
|
|
3129
|
+
throw new UnexpectedError("Parameter `{".concat(parameterName, "}` is restricted to use"));
|
|
3118
3130
|
}
|
|
3119
3131
|
}
|
|
3120
3132
|
}
|
|
@@ -3141,11 +3153,11 @@ function replaceParameters(template, parameters) {
|
|
|
3141
3153
|
throw new PipelineExecutionError('Parameter is already opened or not closed');
|
|
3142
3154
|
}
|
|
3143
3155
|
if (parameters[parameterName] === undefined) {
|
|
3144
|
-
throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
|
|
3156
|
+
throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
|
|
3145
3157
|
}
|
|
3146
3158
|
var parameterValue = parameters[parameterName];
|
|
3147
3159
|
if (parameterValue === undefined) {
|
|
3148
|
-
throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
|
|
3160
|
+
throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
|
|
3149
3161
|
}
|
|
3150
3162
|
parameterValue = parameterValue.toString();
|
|
3151
3163
|
if (parameterValue.includes('\n') && /^\s*\W{0,3}\s*$/.test(precol)) {
|
|
@@ -3201,6 +3213,9 @@ var CHARACTERS_PER_STANDARD_LINE = 63;
|
|
|
3201
3213
|
* @public exported from `@promptbook/utils`
|
|
3202
3214
|
*/
|
|
3203
3215
|
var LINES_PER_STANDARD_PAGE = 44;
|
|
3216
|
+
/**
|
|
3217
|
+
* TODO: [🧠] Should be this `constants.ts` or `config.ts`?
|
|
3218
|
+
*/
|
|
3204
3219
|
|
|
3205
3220
|
/**
|
|
3206
3221
|
* Counts number of lines in the text
|
|
@@ -4193,7 +4208,7 @@ function executeTemplate(options) {
|
|
|
4193
4208
|
else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
|
|
4194
4209
|
// Houston, we have a problem
|
|
4195
4210
|
// Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
|
|
4196
|
-
throw new UnexpectedError(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 "); }));
|
|
4211
|
+
throw new UnexpectedError(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 "); }));
|
|
4197
4212
|
}
|
|
4198
4213
|
};
|
|
4199
4214
|
try {
|
|
@@ -4272,7 +4287,7 @@ function filterJustOutputParameters(options) {
|
|
|
4272
4287
|
var _loop_1 = function (parameter) {
|
|
4273
4288
|
if (parametersToPass[parameter.name] === undefined) {
|
|
4274
4289
|
// [4]
|
|
4275
|
-
$warnings.push(new PipelineExecutionError(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 "); })));
|
|
4290
|
+
$warnings.push(new PipelineExecutionError(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 "); })));
|
|
4276
4291
|
return "continue";
|
|
4277
4292
|
}
|
|
4278
4293
|
outputParameters[parameter.name] = parametersToPass[parameter.name] || '';
|
|
@@ -4359,7 +4374,7 @@ function executePipeline(options) {
|
|
|
4359
4374
|
case 6: return [2 /*return*/, $asDeeplyFrozenSerializableJson("Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"), {
|
|
4360
4375
|
isSuccessful: false,
|
|
4361
4376
|
errors: __spreadArray([
|
|
4362
|
-
new PipelineExecutionError("Parameter {".concat(parameter.name, "} is required as an input parameter"))
|
|
4377
|
+
new PipelineExecutionError("Parameter `{".concat(parameter.name, "}` is required as an input parameter"))
|
|
4363
4378
|
], __read(errors), false).map(serializeError),
|
|
4364
4379
|
warnings: [],
|
|
4365
4380
|
executionReport: executionReport,
|
|
@@ -4407,7 +4422,7 @@ function executePipeline(options) {
|
|
|
4407
4422
|
case 3: return [2 /*return*/, { value: $asDeeplyFrozenSerializableJson(spaceTrim(function (block) { return "\n Unuccessful PipelineExecutorResult (with extra parameter {".concat(parameter.name, "}) PipelineExecutorResult\n\n ").concat(block(pipelineIdentification), "\n "); }), {
|
|
4408
4423
|
isSuccessful: false,
|
|
4409
4424
|
errors: __spreadArray([
|
|
4410
|
-
new PipelineExecutionError(spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
|
|
4425
|
+
new PipelineExecutionError(spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
|
|
4411
4426
|
], __read(errors), false).map(serializeError),
|
|
4412
4427
|
warnings: warnings.map(serializeError),
|
|
4413
4428
|
executionReport: executionReport,
|
|
@@ -4481,14 +4496,24 @@ function executePipeline(options) {
|
|
|
4481
4496
|
if (!(!currentTemplate && resolving_1.length === 0)) return [3 /*break*/, 1];
|
|
4482
4497
|
throw new UnexpectedError(
|
|
4483
4498
|
// TODO: [🐎] DRY
|
|
4484
|
-
spaceTrim(function (block) { return "\n Can not resolve some parameters:\n\n ".concat(block(pipelineIdentification), "\n\n Can not resolve
|
|
4499
|
+
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
|
|
4485
4500
|
.map(function (_a) {
|
|
4486
4501
|
var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
|
|
4487
|
-
return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
|
|
4488
|
-
.map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
|
|
4502
|
+
return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
|
|
4503
|
+
.map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
|
|
4489
4504
|
.join(' and '));
|
|
4490
4505
|
})
|
|
4491
|
-
.join('\n')), "\n\n Resolved
|
|
4506
|
+
.join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameterNames_1
|
|
4507
|
+
.filter(function (name) {
|
|
4508
|
+
return !RESERVED_PARAMETER_NAMES.includes(name);
|
|
4509
|
+
})
|
|
4510
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
4511
|
+
.join('\n')), "\n\n **Reserved (which are available):**\n ").concat(block(resovedParameterNames_1
|
|
4512
|
+
.filter(function (name) {
|
|
4513
|
+
return RESERVED_PARAMETER_NAMES.includes(name);
|
|
4514
|
+
})
|
|
4515
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
4516
|
+
.join('\n')), "\n\n *Note: This should be catched in `validatePipeline`*\n "); }));
|
|
4492
4517
|
case 1:
|
|
4493
4518
|
if (!!currentTemplate) return [3 /*break*/, 3];
|
|
4494
4519
|
/* [🤹♂️] */ return [4 /*yield*/, Promise.race(resolving_1)];
|
|
@@ -6705,9 +6730,35 @@ var formatCommandParser = {
|
|
|
6705
6730
|
* @public exported from `@promptbook/core`
|
|
6706
6731
|
*/
|
|
6707
6732
|
var ChatFormfactorDefinition = {
|
|
6708
|
-
name: '
|
|
6733
|
+
name: 'CHATBOT',
|
|
6734
|
+
aliasNames: ['CHAT'],
|
|
6709
6735
|
description: "@@@",
|
|
6710
6736
|
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
|
|
6737
|
+
pipelineInterface: {
|
|
6738
|
+
inputParameterNames: ['previousTitle', 'previousConversationSummary', 'userMessage'],
|
|
6739
|
+
outputParameterNames: ['title', 'conversationSummary', 'chatbotResponse'],
|
|
6740
|
+
/*
|
|
6741
|
+
<- TODO: !!!!!! Change to
|
|
6742
|
+
|
|
6743
|
+
- INPUT PARAMETER `{previousTitle}` Previous title of the conversation
|
|
6744
|
+
- INPUT PARAMETER `{previousConversationSummary}` Previous conversation summary
|
|
6745
|
+
- INPUT PARAMETER `{userMessage}` User message
|
|
6746
|
+
- OUTPUT PARAMETER `{title}` Title of the conversation
|
|
6747
|
+
- OUTPUT PARAMETER `{conversationSummary}` Summary of the conversation
|
|
6748
|
+
- OUTPUT PARAMETER `{chatbotResponse}` Chatbot response
|
|
6749
|
+
|
|
6750
|
+
*/
|
|
6751
|
+
},
|
|
6752
|
+
};
|
|
6753
|
+
|
|
6754
|
+
/**
|
|
6755
|
+
* @@@
|
|
6756
|
+
*
|
|
6757
|
+
* @public exported from `@promptbook/core`
|
|
6758
|
+
*/
|
|
6759
|
+
var GENERIC_PIPELINE_INTERFACE = {
|
|
6760
|
+
inputParameterNames: [],
|
|
6761
|
+
outputParameterNames: [],
|
|
6711
6762
|
};
|
|
6712
6763
|
|
|
6713
6764
|
/**
|
|
@@ -6719,6 +6770,37 @@ var GenericFormfactorDefinition = {
|
|
|
6719
6770
|
name: 'GENERIC',
|
|
6720
6771
|
description: "@@@",
|
|
6721
6772
|
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
|
|
6773
|
+
pipelineInterface: GENERIC_PIPELINE_INTERFACE,
|
|
6774
|
+
};
|
|
6775
|
+
|
|
6776
|
+
/**
|
|
6777
|
+
* Sheets is form of app that @@@
|
|
6778
|
+
*
|
|
6779
|
+
* @public exported from `@promptbook/core`
|
|
6780
|
+
*/
|
|
6781
|
+
var SheetsFormfactorDefinition = {
|
|
6782
|
+
name: 'SHEETS',
|
|
6783
|
+
description: "@@@",
|
|
6784
|
+
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
|
|
6785
|
+
pipelineInterface: {
|
|
6786
|
+
inputParameterNames: ['inputSheet'],
|
|
6787
|
+
outputParameterNames: ['outputSheet'],
|
|
6788
|
+
},
|
|
6789
|
+
};
|
|
6790
|
+
|
|
6791
|
+
/**
|
|
6792
|
+
* Translator is form of app that @@@
|
|
6793
|
+
*
|
|
6794
|
+
* @public exported from `@promptbook/core`
|
|
6795
|
+
*/
|
|
6796
|
+
var TranslatorFormfactorDefinition = {
|
|
6797
|
+
name: 'TRANSLATOR',
|
|
6798
|
+
description: "@@@",
|
|
6799
|
+
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
|
|
6800
|
+
pipelineInterface: {
|
|
6801
|
+
inputParameterNames: ['inputMessage'],
|
|
6802
|
+
outputParameterNames: ['outputMessage'],
|
|
6803
|
+
},
|
|
6722
6804
|
};
|
|
6723
6805
|
|
|
6724
6806
|
/**
|
|
@@ -6726,7 +6808,12 @@ var GenericFormfactorDefinition = {
|
|
|
6726
6808
|
*
|
|
6727
6809
|
* @public exported from `@promptbook/core`
|
|
6728
6810
|
*/
|
|
6729
|
-
var FORMFACTOR_DEFINITIONS = [
|
|
6811
|
+
var FORMFACTOR_DEFINITIONS = [
|
|
6812
|
+
GenericFormfactorDefinition,
|
|
6813
|
+
ChatFormfactorDefinition,
|
|
6814
|
+
TranslatorFormfactorDefinition,
|
|
6815
|
+
SheetsFormfactorDefinition,
|
|
6816
|
+
];
|
|
6730
6817
|
|
|
6731
6818
|
/**
|
|
6732
6819
|
* Parses the formfactor command
|
|
@@ -6761,7 +6848,7 @@ var formfactorCommandParser = {
|
|
|
6761
6848
|
/**
|
|
6762
6849
|
* Example usages of the FORMFACTOR command
|
|
6763
6850
|
*/
|
|
6764
|
-
examples: ['FORMFACTOR
|
|
6851
|
+
examples: ['FORMFACTOR Chatbot', 'FF Chat'],
|
|
6765
6852
|
/**
|
|
6766
6853
|
* Parses the FORMFACTOR command
|
|
6767
6854
|
*/
|
|
@@ -6770,16 +6857,19 @@ var formfactorCommandParser = {
|
|
|
6770
6857
|
if (args.length !== 1) {
|
|
6771
6858
|
throw new ParseError("FORMFACTOR command requires exactly one argument");
|
|
6772
6859
|
}
|
|
6773
|
-
var
|
|
6774
|
-
|
|
6775
|
-
|
|
6860
|
+
var formfactorNameCandidate = args[0].toUpperCase();
|
|
6861
|
+
var formfactor = FORMFACTOR_DEFINITIONS.find(function (definition) {
|
|
6862
|
+
return __spreadArray([definition.name], __read(__assign({ aliasNames: [] }, definition).aliasNames), false).includes(formfactorNameCandidate);
|
|
6863
|
+
});
|
|
6864
|
+
if (formfactor === undefined) {
|
|
6865
|
+
throw new ParseError(spaceTrim$1(function (block) { return "\n Unknown formfactor name \"".concat(formfactorNameCandidate, "\"\n\n Available formfactors:\n ").concat(block(FORMFACTOR_DEFINITIONS.map(function (_a) {
|
|
6776
6866
|
var name = _a.name;
|
|
6777
6867
|
return "- ".concat(name);
|
|
6778
6868
|
}).join('\n')), "\n "); }));
|
|
6779
6869
|
}
|
|
6780
6870
|
return {
|
|
6781
6871
|
type: 'FORMFACTOR',
|
|
6782
|
-
formfactorName:
|
|
6872
|
+
formfactorName: formfactor.name,
|
|
6783
6873
|
};
|
|
6784
6874
|
},
|
|
6785
6875
|
/**
|
|
@@ -7079,7 +7169,7 @@ var parameterCommandParser = {
|
|
|
7079
7169
|
// <- TODO: When [🥶] fixed, change to:
|
|
7080
7170
|
// > const parameterDescriptionRaw = rawArgs.split(parameterNameRaw).join('').trim();
|
|
7081
7171
|
if (parameterDescriptionRaw && parameterDescriptionRaw.match(/\{(?<embeddedParameterName>[a-z0-9_]+)\}/im)) {
|
|
7082
|
-
throw new ParseError(spaceTrim$1(function (block) { return "\n Parameter {".concat(parameterNameRaw, "} can not contain another parameter in description\n\n The description:\n ").concat(block(parameterDescriptionRaw), "\n "); }));
|
|
7172
|
+
throw new ParseError(spaceTrim$1(function (block) { return "\n Parameter `{".concat(parameterNameRaw, "}` can not contain another parameter in description\n\n The description:\n ").concat(block(parameterDescriptionRaw), "\n "); }));
|
|
7083
7173
|
}
|
|
7084
7174
|
var isInput = normalized.startsWith('INPUT');
|
|
7085
7175
|
var isOutput = normalized.startsWith('OUTPUT');
|
|
@@ -8125,7 +8215,7 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
8125
8215
|
existingParameter.description &&
|
|
8126
8216
|
existingParameter.description !== parameterDescription &&
|
|
8127
8217
|
parameterDescription) {
|
|
8128
|
-
throw new ParseError(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 "); }));
|
|
8218
|
+
throw new ParseError(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 "); }));
|
|
8129
8219
|
}
|
|
8130
8220
|
if (existingParameter) {
|
|
8131
8221
|
if (parameterDescription) {
|
|
@@ -9501,10 +9591,10 @@ var JavascriptEvalExecutionTools = /** @class */ (function () {
|
|
|
9501
9591
|
/*
|
|
9502
9592
|
Note: Remapping error
|
|
9503
9593
|
From: [PipelineUrlError: thing is not defined],
|
|
9504
|
-
To: [PipelineExecutionError: Parameter {thing} is not defined],
|
|
9594
|
+
To: [PipelineExecutionError: Parameter `{thing}` is not defined],
|
|
9505
9595
|
*/
|
|
9506
9596
|
if (!statementToEvaluate.includes(undefinedName_1 + '(')) {
|
|
9507
|
-
throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n\n Parameter {".concat(undefinedName_1, "} is not defined\n\n This happen during evaluation of the javascript, which has access to the following parameters as javascript variables:\n\n ").concat(block(Object.keys(parameters)
|
|
9597
|
+
throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n\n Parameter `{".concat(undefinedName_1, "}` is not defined\n\n This happen during evaluation of the javascript, which has access to the following parameters as javascript variables:\n\n ").concat(block(Object.keys(parameters)
|
|
9508
9598
|
.map(function (key) { return " - ".concat(key, "\n"); })
|
|
9509
9599
|
.join('')), "\n\n The script is:\n ```javascript\n ").concat(block(script), "\n ```\n\n Original error message:\n ").concat(block(error_1.message), "\n\n\n "); }));
|
|
9510
9600
|
}
|