@promptbook/node 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 +2 -2
- package/umd/index.umd.js +125 -35
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -26,7 +26,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
26
26
|
*
|
|
27
27
|
* @see https://github.com/webgptorg/promptbook
|
|
28
28
|
*/
|
|
29
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
29
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.75.0-0';
|
|
30
30
|
/**
|
|
31
31
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
32
32
|
*/
|
|
@@ -470,6 +470,7 @@ var IS_PIPELINE_LOGIC_VALIDATED = just(
|
|
|
470
470
|
// Note: In normal situations, we check the pipeline logic:
|
|
471
471
|
true);
|
|
472
472
|
/**
|
|
473
|
+
* TODO: Extract `constants.ts` from `config.ts`
|
|
473
474
|
* TODO: [🧠][🧜♂️] Maybe join remoteUrl and path into single value
|
|
474
475
|
*/
|
|
475
476
|
|
|
@@ -1280,8 +1281,8 @@ var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
|
1280
1281
|
else if (errors.length > 1) {
|
|
1281
1282
|
throw new PipelineExecutionError(
|
|
1282
1283
|
// TODO: Tell which execution tools failed like
|
|
1283
|
-
// 1) OpenAI throw PipelineExecutionError: Parameter {knowledge} is not defined
|
|
1284
|
-
// 2) AnthropicClaude throw PipelineExecutionError: Parameter {knowledge} is not defined
|
|
1284
|
+
// 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
1285
|
+
// 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
1285
1286
|
// 3) ...
|
|
1286
1287
|
spaceTrim$1(function (block) { return "\n All execution tools failed:\n\n ".concat(block(errors
|
|
1287
1288
|
.map(function (error, i) { return "".concat(i + 1, ") **").concat(error.name || 'Error', ":** ").concat(error.message); })
|
|
@@ -1616,18 +1617,18 @@ function validatePipelineCore(pipeline) {
|
|
|
1616
1617
|
}
|
|
1617
1618
|
var _loop_1 = function (parameter) {
|
|
1618
1619
|
if (parameter.isInput && parameter.isOutput) {
|
|
1619
|
-
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 "); }));
|
|
1620
|
+
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 "); }));
|
|
1620
1621
|
}
|
|
1621
1622
|
// Note: Testing that parameter is either intermediate or output BUT not created and unused
|
|
1622
1623
|
if (!parameter.isInput &&
|
|
1623
1624
|
!parameter.isOutput &&
|
|
1624
1625
|
!pipeline.templates.some(function (template) { return template.dependentParameterNames.includes(parameter.name); })) {
|
|
1625
|
-
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 "); }));
|
|
1626
|
+
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 "); }));
|
|
1626
1627
|
}
|
|
1627
1628
|
// Note: Testing that parameter is either input or result of some template
|
|
1628
1629
|
if (!parameter.isInput &&
|
|
1629
1630
|
!pipeline.templates.some(function (template) { return template.resultingParameterName === parameter.name; })) {
|
|
1630
|
-
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, "}
|
|
1631
|
+
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 "); }));
|
|
1631
1632
|
}
|
|
1632
1633
|
};
|
|
1633
1634
|
try {
|
|
@@ -1655,7 +1656,7 @@ function validatePipelineCore(pipeline) {
|
|
|
1655
1656
|
var _loop_2 = function (template) {
|
|
1656
1657
|
var e_4, _h, e_5, _j;
|
|
1657
1658
|
if (definedParameters.has(template.resultingParameterName)) {
|
|
1658
|
-
throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter {".concat(template.resultingParameterName, "} is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1659
|
+
throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter `{".concat(template.resultingParameterName, "}` is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1659
1660
|
}
|
|
1660
1661
|
if (RESERVED_PARAMETER_NAMES.includes(template.resultingParameterName)) {
|
|
1661
1662
|
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 "); }));
|
|
@@ -1668,7 +1669,7 @@ function validatePipelineCore(pipeline) {
|
|
|
1668
1669
|
}
|
|
1669
1670
|
var _loop_4 = function (joker) {
|
|
1670
1671
|
if (!template.dependentParameterNames.includes(joker)) {
|
|
1671
|
-
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 "); }));
|
|
1672
|
+
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 "); }));
|
|
1672
1673
|
}
|
|
1673
1674
|
};
|
|
1674
1675
|
try {
|
|
@@ -1763,14 +1764,24 @@ function validatePipelineCore(pipeline) {
|
|
|
1763
1764
|
if (currentlyResovedTemplates.length === 0) {
|
|
1764
1765
|
throw new PipelineLogicError(
|
|
1765
1766
|
// TODO: [🐎] DRY
|
|
1766
|
-
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
|
|
1767
|
+
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
|
|
1767
1768
|
.map(function (_a) {
|
|
1768
1769
|
var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
|
|
1769
|
-
return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
|
|
1770
|
-
.map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
|
|
1770
|
+
return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
|
|
1771
|
+
.map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
|
|
1771
1772
|
.join(' and '));
|
|
1772
1773
|
})
|
|
1773
|
-
.join('\n')), "\n\n Resolved
|
|
1774
|
+
.join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameters
|
|
1775
|
+
.filter(function (name) {
|
|
1776
|
+
return !RESERVED_PARAMETER_NAMES.includes(name);
|
|
1777
|
+
})
|
|
1778
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
1779
|
+
.join('\n')), "\n\n\n **Reserved (which are available):**\n ").concat(block(resovedParameters
|
|
1780
|
+
.filter(function (name) {
|
|
1781
|
+
return RESERVED_PARAMETER_NAMES.includes(name);
|
|
1782
|
+
})
|
|
1783
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
1784
|
+
.join('\n')), "\n\n\n "); }));
|
|
1774
1785
|
}
|
|
1775
1786
|
resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTemplates.map(function (_a) {
|
|
1776
1787
|
var resultingParameterName = _a.resultingParameterName;
|
|
@@ -1781,6 +1792,7 @@ function validatePipelineCore(pipeline) {
|
|
|
1781
1792
|
while (unresovedTemplates.length > 0) {
|
|
1782
1793
|
_loop_3();
|
|
1783
1794
|
}
|
|
1795
|
+
// TODO: !!!!!! Test that pipeline interface implements declared formfactor interface
|
|
1784
1796
|
}
|
|
1785
1797
|
/**
|
|
1786
1798
|
* TODO: !! [🧞♀️] Do not allow joker + foreach
|
|
@@ -2916,11 +2928,11 @@ function replaceParameters(template, parameters) {
|
|
|
2916
2928
|
for (var _b = __values(Object.entries(parameters)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2917
2929
|
var _d = __read(_c.value, 2), parameterName = _d[0], parameterValue = _d[1];
|
|
2918
2930
|
if (parameterValue === RESERVED_PARAMETER_MISSING_VALUE) {
|
|
2919
|
-
throw new UnexpectedError("Parameter {".concat(parameterName, "} has missing value"));
|
|
2931
|
+
throw new UnexpectedError("Parameter `{".concat(parameterName, "}` has missing value"));
|
|
2920
2932
|
}
|
|
2921
2933
|
else if (parameterValue === RESERVED_PARAMETER_RESTRICTED) {
|
|
2922
2934
|
// TODO: [🍵]
|
|
2923
|
-
throw new UnexpectedError("Parameter {".concat(parameterName, "} is restricted to use"));
|
|
2935
|
+
throw new UnexpectedError("Parameter `{".concat(parameterName, "}` is restricted to use"));
|
|
2924
2936
|
}
|
|
2925
2937
|
}
|
|
2926
2938
|
}
|
|
@@ -2947,11 +2959,11 @@ function replaceParameters(template, parameters) {
|
|
|
2947
2959
|
throw new PipelineExecutionError('Parameter is already opened or not closed');
|
|
2948
2960
|
}
|
|
2949
2961
|
if (parameters[parameterName] === undefined) {
|
|
2950
|
-
throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
|
|
2962
|
+
throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
|
|
2951
2963
|
}
|
|
2952
2964
|
var parameterValue = parameters[parameterName];
|
|
2953
2965
|
if (parameterValue === undefined) {
|
|
2954
|
-
throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
|
|
2966
|
+
throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
|
|
2955
2967
|
}
|
|
2956
2968
|
parameterValue = parameterValue.toString();
|
|
2957
2969
|
if (parameterValue.includes('\n') && /^\s*\W{0,3}\s*$/.test(precol)) {
|
|
@@ -3007,6 +3019,9 @@ var CHARACTERS_PER_STANDARD_LINE = 63;
|
|
|
3007
3019
|
* @public exported from `@promptbook/utils`
|
|
3008
3020
|
*/
|
|
3009
3021
|
var LINES_PER_STANDARD_PAGE = 44;
|
|
3022
|
+
/**
|
|
3023
|
+
* TODO: [🧠] Should be this `constants.ts` or `config.ts`?
|
|
3024
|
+
*/
|
|
3010
3025
|
|
|
3011
3026
|
/**
|
|
3012
3027
|
* Counts number of lines in the text
|
|
@@ -3999,7 +4014,7 @@ function executeTemplate(options) {
|
|
|
3999
4014
|
else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
|
|
4000
4015
|
// Houston, we have a problem
|
|
4001
4016
|
// Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
|
|
4002
|
-
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 "); }));
|
|
4017
|
+
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 "); }));
|
|
4003
4018
|
}
|
|
4004
4019
|
};
|
|
4005
4020
|
try {
|
|
@@ -4078,7 +4093,7 @@ function filterJustOutputParameters(options) {
|
|
|
4078
4093
|
var _loop_1 = function (parameter) {
|
|
4079
4094
|
if (parametersToPass[parameter.name] === undefined) {
|
|
4080
4095
|
// [4]
|
|
4081
|
-
$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 "); })));
|
|
4096
|
+
$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 "); })));
|
|
4082
4097
|
return "continue";
|
|
4083
4098
|
}
|
|
4084
4099
|
outputParameters[parameter.name] = parametersToPass[parameter.name] || '';
|
|
@@ -4165,7 +4180,7 @@ function executePipeline(options) {
|
|
|
4165
4180
|
case 6: return [2 /*return*/, $asDeeplyFrozenSerializableJson("Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"), {
|
|
4166
4181
|
isSuccessful: false,
|
|
4167
4182
|
errors: __spreadArray([
|
|
4168
|
-
new PipelineExecutionError("Parameter {".concat(parameter.name, "} is required as an input parameter"))
|
|
4183
|
+
new PipelineExecutionError("Parameter `{".concat(parameter.name, "}` is required as an input parameter"))
|
|
4169
4184
|
], __read(errors), false).map(serializeError),
|
|
4170
4185
|
warnings: [],
|
|
4171
4186
|
executionReport: executionReport,
|
|
@@ -4213,7 +4228,7 @@ function executePipeline(options) {
|
|
|
4213
4228
|
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 "); }), {
|
|
4214
4229
|
isSuccessful: false,
|
|
4215
4230
|
errors: __spreadArray([
|
|
4216
|
-
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 "); }))
|
|
4231
|
+
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 "); }))
|
|
4217
4232
|
], __read(errors), false).map(serializeError),
|
|
4218
4233
|
warnings: warnings.map(serializeError),
|
|
4219
4234
|
executionReport: executionReport,
|
|
@@ -4287,14 +4302,24 @@ function executePipeline(options) {
|
|
|
4287
4302
|
if (!(!currentTemplate && resolving_1.length === 0)) return [3 /*break*/, 1];
|
|
4288
4303
|
throw new UnexpectedError(
|
|
4289
4304
|
// TODO: [🐎] DRY
|
|
4290
|
-
spaceTrim(function (block) { return "\n Can not resolve some parameters:\n\n ".concat(block(pipelineIdentification), "\n\n Can not resolve
|
|
4305
|
+
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
|
|
4291
4306
|
.map(function (_a) {
|
|
4292
4307
|
var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
|
|
4293
|
-
return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
|
|
4294
|
-
.map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
|
|
4308
|
+
return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
|
|
4309
|
+
.map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
|
|
4295
4310
|
.join(' and '));
|
|
4296
4311
|
})
|
|
4297
|
-
.join('\n')), "\n\n Resolved
|
|
4312
|
+
.join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameterNames_1
|
|
4313
|
+
.filter(function (name) {
|
|
4314
|
+
return !RESERVED_PARAMETER_NAMES.includes(name);
|
|
4315
|
+
})
|
|
4316
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
4317
|
+
.join('\n')), "\n\n **Reserved (which are available):**\n ").concat(block(resovedParameterNames_1
|
|
4318
|
+
.filter(function (name) {
|
|
4319
|
+
return RESERVED_PARAMETER_NAMES.includes(name);
|
|
4320
|
+
})
|
|
4321
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
4322
|
+
.join('\n')), "\n\n *Note: This should be catched in `validatePipeline`*\n "); }));
|
|
4298
4323
|
case 1:
|
|
4299
4324
|
if (!!currentTemplate) return [3 /*break*/, 3];
|
|
4300
4325
|
/* [🤹♂️] */ return [4 /*yield*/, Promise.race(resolving_1)];
|
|
@@ -6511,9 +6536,35 @@ var formatCommandParser = {
|
|
|
6511
6536
|
* @public exported from `@promptbook/core`
|
|
6512
6537
|
*/
|
|
6513
6538
|
var ChatFormfactorDefinition = {
|
|
6514
|
-
name: '
|
|
6539
|
+
name: 'CHATBOT',
|
|
6540
|
+
aliasNames: ['CHAT'],
|
|
6515
6541
|
description: "@@@",
|
|
6516
6542
|
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
|
|
6543
|
+
pipelineInterface: {
|
|
6544
|
+
inputParameterNames: ['previousTitle', 'previousConversationSummary', 'userMessage'],
|
|
6545
|
+
outputParameterNames: ['title', 'conversationSummary', 'chatbotResponse'],
|
|
6546
|
+
/*
|
|
6547
|
+
<- TODO: !!!!!! Change to
|
|
6548
|
+
|
|
6549
|
+
- INPUT PARAMETER `{previousTitle}` Previous title of the conversation
|
|
6550
|
+
- INPUT PARAMETER `{previousConversationSummary}` Previous conversation summary
|
|
6551
|
+
- INPUT PARAMETER `{userMessage}` User message
|
|
6552
|
+
- OUTPUT PARAMETER `{title}` Title of the conversation
|
|
6553
|
+
- OUTPUT PARAMETER `{conversationSummary}` Summary of the conversation
|
|
6554
|
+
- OUTPUT PARAMETER `{chatbotResponse}` Chatbot response
|
|
6555
|
+
|
|
6556
|
+
*/
|
|
6557
|
+
},
|
|
6558
|
+
};
|
|
6559
|
+
|
|
6560
|
+
/**
|
|
6561
|
+
* @@@
|
|
6562
|
+
*
|
|
6563
|
+
* @public exported from `@promptbook/core`
|
|
6564
|
+
*/
|
|
6565
|
+
var GENERIC_PIPELINE_INTERFACE = {
|
|
6566
|
+
inputParameterNames: [],
|
|
6567
|
+
outputParameterNames: [],
|
|
6517
6568
|
};
|
|
6518
6569
|
|
|
6519
6570
|
/**
|
|
@@ -6525,6 +6576,37 @@ var GenericFormfactorDefinition = {
|
|
|
6525
6576
|
name: 'GENERIC',
|
|
6526
6577
|
description: "@@@",
|
|
6527
6578
|
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
|
|
6579
|
+
pipelineInterface: GENERIC_PIPELINE_INTERFACE,
|
|
6580
|
+
};
|
|
6581
|
+
|
|
6582
|
+
/**
|
|
6583
|
+
* Sheets is form of app that @@@
|
|
6584
|
+
*
|
|
6585
|
+
* @public exported from `@promptbook/core`
|
|
6586
|
+
*/
|
|
6587
|
+
var SheetsFormfactorDefinition = {
|
|
6588
|
+
name: 'SHEETS',
|
|
6589
|
+
description: "@@@",
|
|
6590
|
+
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
|
|
6591
|
+
pipelineInterface: {
|
|
6592
|
+
inputParameterNames: ['inputSheet'],
|
|
6593
|
+
outputParameterNames: ['outputSheet'],
|
|
6594
|
+
},
|
|
6595
|
+
};
|
|
6596
|
+
|
|
6597
|
+
/**
|
|
6598
|
+
* Translator is form of app that @@@
|
|
6599
|
+
*
|
|
6600
|
+
* @public exported from `@promptbook/core`
|
|
6601
|
+
*/
|
|
6602
|
+
var TranslatorFormfactorDefinition = {
|
|
6603
|
+
name: 'TRANSLATOR',
|
|
6604
|
+
description: "@@@",
|
|
6605
|
+
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
|
|
6606
|
+
pipelineInterface: {
|
|
6607
|
+
inputParameterNames: ['inputMessage'],
|
|
6608
|
+
outputParameterNames: ['outputMessage'],
|
|
6609
|
+
},
|
|
6528
6610
|
};
|
|
6529
6611
|
|
|
6530
6612
|
/**
|
|
@@ -6532,7 +6614,12 @@ var GenericFormfactorDefinition = {
|
|
|
6532
6614
|
*
|
|
6533
6615
|
* @public exported from `@promptbook/core`
|
|
6534
6616
|
*/
|
|
6535
|
-
var FORMFACTOR_DEFINITIONS = [
|
|
6617
|
+
var FORMFACTOR_DEFINITIONS = [
|
|
6618
|
+
GenericFormfactorDefinition,
|
|
6619
|
+
ChatFormfactorDefinition,
|
|
6620
|
+
TranslatorFormfactorDefinition,
|
|
6621
|
+
SheetsFormfactorDefinition,
|
|
6622
|
+
];
|
|
6536
6623
|
|
|
6537
6624
|
/**
|
|
6538
6625
|
* Parses the formfactor command
|
|
@@ -6567,7 +6654,7 @@ var formfactorCommandParser = {
|
|
|
6567
6654
|
/**
|
|
6568
6655
|
* Example usages of the FORMFACTOR command
|
|
6569
6656
|
*/
|
|
6570
|
-
examples: ['FORMFACTOR
|
|
6657
|
+
examples: ['FORMFACTOR Chatbot', 'FF Chat'],
|
|
6571
6658
|
/**
|
|
6572
6659
|
* Parses the FORMFACTOR command
|
|
6573
6660
|
*/
|
|
@@ -6576,16 +6663,19 @@ var formfactorCommandParser = {
|
|
|
6576
6663
|
if (args.length !== 1) {
|
|
6577
6664
|
throw new ParseError("FORMFACTOR command requires exactly one argument");
|
|
6578
6665
|
}
|
|
6579
|
-
var
|
|
6580
|
-
|
|
6581
|
-
|
|
6666
|
+
var formfactorNameCandidate = args[0].toUpperCase();
|
|
6667
|
+
var formfactor = FORMFACTOR_DEFINITIONS.find(function (definition) {
|
|
6668
|
+
return __spreadArray([definition.name], __read(__assign({ aliasNames: [] }, definition).aliasNames), false).includes(formfactorNameCandidate);
|
|
6669
|
+
});
|
|
6670
|
+
if (formfactor === undefined) {
|
|
6671
|
+
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) {
|
|
6582
6672
|
var name = _a.name;
|
|
6583
6673
|
return "- ".concat(name);
|
|
6584
6674
|
}).join('\n')), "\n "); }));
|
|
6585
6675
|
}
|
|
6586
6676
|
return {
|
|
6587
6677
|
type: 'FORMFACTOR',
|
|
6588
|
-
formfactorName:
|
|
6678
|
+
formfactorName: formfactor.name,
|
|
6589
6679
|
};
|
|
6590
6680
|
},
|
|
6591
6681
|
/**
|
|
@@ -6885,7 +6975,7 @@ var parameterCommandParser = {
|
|
|
6885
6975
|
// <- TODO: When [🥶] fixed, change to:
|
|
6886
6976
|
// > const parameterDescriptionRaw = rawArgs.split(parameterNameRaw).join('').trim();
|
|
6887
6977
|
if (parameterDescriptionRaw && parameterDescriptionRaw.match(/\{(?<embeddedParameterName>[a-z0-9_]+)\}/im)) {
|
|
6888
|
-
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 "); }));
|
|
6978
|
+
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 "); }));
|
|
6889
6979
|
}
|
|
6890
6980
|
var isInput = normalized.startsWith('INPUT');
|
|
6891
6981
|
var isOutput = normalized.startsWith('OUTPUT');
|
|
@@ -7931,7 +8021,7 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
7931
8021
|
existingParameter.description &&
|
|
7932
8022
|
existingParameter.description !== parameterDescription &&
|
|
7933
8023
|
parameterDescription) {
|
|
7934
|
-
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 "); }));
|
|
8024
|
+
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 "); }));
|
|
7935
8025
|
}
|
|
7936
8026
|
if (existingParameter) {
|
|
7937
8027
|
if (parameterDescription) {
|
|
@@ -9316,10 +9406,10 @@ var JavascriptEvalExecutionTools = /** @class */ (function () {
|
|
|
9316
9406
|
/*
|
|
9317
9407
|
Note: Remapping error
|
|
9318
9408
|
From: [PipelineUrlError: thing is not defined],
|
|
9319
|
-
To: [PipelineExecutionError: Parameter {thing} is not defined],
|
|
9409
|
+
To: [PipelineExecutionError: Parameter `{thing}` is not defined],
|
|
9320
9410
|
*/
|
|
9321
9411
|
if (!statementToEvaluate.includes(undefinedName_1 + '(')) {
|
|
9322
|
-
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)
|
|
9412
|
+
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)
|
|
9323
9413
|
.map(function (key) { return " - ".concat(key, "\n"); })
|
|
9324
9414
|
.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 "); }));
|
|
9325
9415
|
}
|