@promptbook/core 0.68.0-3 → 0.68.0-5
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/README.md +2 -2
- package/esm/index.es.js +219 -186
- package/esm/index.es.js.map +1 -1
- package/esm/typings/promptbook-collection/index.d.ts +3 -3
- package/esm/typings/src/_packages/core.index.d.ts +4 -4
- package/esm/typings/src/_packages/types.index.d.ts +4 -2
- package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +1 -1
- package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/KNOWLEDGE/knowledgeCommandParser.d.ts +3 -0
- package/esm/typings/src/commands/TEMPLATE/TemplateCommand.d.ts +11 -0
- package/esm/typings/src/commands/TEMPLATE/TemplateTypes.d.ts +15 -0
- package/esm/typings/src/commands/TEMPLATE/templateCommandParser.d.ts +20 -0
- package/esm/typings/src/commands/X_ACTION/actionCommandParser.d.ts +3 -0
- package/esm/typings/src/commands/X_INSTRUMENT/instrumentCommandParser.d.ts +3 -0
- package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +0 -3
- package/esm/typings/src/commands/_common/getParserForCommand.d.ts +11 -0
- package/esm/typings/src/commands/_common/stringifyCommand.d.ts +11 -0
- package/esm/typings/src/commands/_common/stringifyCommand.test.d.ts +1 -0
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +2 -2
- package/esm/typings/src/commands/index.d.ts +1 -1
- package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
- package/esm/typings/src/conversion/pipelineStringToJson.d.ts +1 -1
- package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +1 -1
- package/esm/typings/src/conversion/utils/extractParameterNamesFromTemplate.d.ts +1 -1
- package/esm/typings/src/conversion/validation/pipelineStringToJson-parseErrors.test.d.ts +4 -0
- package/esm/typings/src/conversion/validation/validatePipeline-logicErrors.test.d.ts +1 -1
- package/esm/typings/src/conversion/validation/validatePipeline.test.d.ts +3 -0
- package/esm/typings/src/errors/PipelineLogicError.d.ts +1 -1
- package/esm/typings/src/execution/CommonExecutionToolsOptions.d.ts +1 -1
- package/esm/typings/src/execution/ScriptExecutionTools.d.ts +1 -1
- package/esm/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/DialogTemplateJson.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -0
- package/esm/typings/src/types/PipelineJson/PromptTemplateJson.d.ts +2 -2
- package/esm/typings/src/types/PipelineJson/ScriptTemplateJson.d.ts +2 -2
- package/esm/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/TemplateJsonCommon.d.ts +2 -2
- package/esm/typings/src/types/TaskProgress.d.ts +2 -2
- package/esm/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +0 -1
- package/package.json +1 -1
- package/umd/index.umd.js +219 -186
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/commands/BLOCK/BlockCommand.d.ts +0 -11
- package/esm/typings/src/commands/BLOCK/BlockTypes.d.ts +0 -15
- package/esm/typings/src/commands/BLOCK/blockCommandParser.d.ts +0 -9
- /package/esm/typings/src/commands/{BLOCK/blockCommand.test.d.ts → TEMPLATE/templateCommand.test.d.ts} +0 -0
- /package/esm/typings/src/{conversion/validation/pipelineStringToJson-syntaxErrors.test.d.ts → commands/_common/getParserForCommand.test.d.ts} +0 -0
package/umd/index.umd.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
/**
|
|
17
17
|
* The version of the Promptbook library
|
|
18
18
|
*/
|
|
19
|
-
var PROMPTBOOK_VERSION = '0.68.0-
|
|
19
|
+
var PROMPTBOOK_VERSION = '0.68.0-4';
|
|
20
20
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
21
21
|
|
|
22
22
|
/*! *****************************************************************************
|
|
@@ -272,7 +272,7 @@
|
|
|
272
272
|
/* Note: Not using:> name, */
|
|
273
273
|
title_1 = template.title, description_1 = template.description,
|
|
274
274
|
/* Note: dependentParameterNames, */
|
|
275
|
-
jokers = template.jokerParameterNames,
|
|
275
|
+
jokers = template.jokerParameterNames, templateType = template.templateType, content = template.content, postprocessing = template.postprocessingFunctionNames, expectations = template.expectations, format = template.format, resultingParameterName = template.resultingParameterName;
|
|
276
276
|
pipelineString += '\n\n';
|
|
277
277
|
pipelineString += "## ".concat(title_1);
|
|
278
278
|
if (description_1) {
|
|
@@ -282,7 +282,7 @@
|
|
|
282
282
|
// TODO:> const commands: Array<Command>
|
|
283
283
|
var commands_1 = [];
|
|
284
284
|
var contentLanguage = 'text';
|
|
285
|
-
if (
|
|
285
|
+
if (templateType === 'PROMPT_TEMPLATE') {
|
|
286
286
|
var modelRequirements = template.modelRequirements;
|
|
287
287
|
var _l = modelRequirements || {}, modelName = _l.modelName, modelVariant = _l.modelVariant;
|
|
288
288
|
commands_1.push("EXECUTE PROMPT TEMPLATE");
|
|
@@ -293,12 +293,12 @@
|
|
|
293
293
|
commands_1.push("MODEL NAME `".concat(modelName, "`"));
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
|
-
else if (
|
|
296
|
+
else if (templateType === 'SIMPLE_TEMPLATE') {
|
|
297
297
|
commands_1.push("SIMPLE TEMPLATE");
|
|
298
298
|
// Note: Nothing special here
|
|
299
299
|
}
|
|
300
|
-
else if (
|
|
301
|
-
commands_1.push("
|
|
300
|
+
else if (templateType === 'SCRIPT_TEMPLATE') {
|
|
301
|
+
commands_1.push("SCRIPT TEMPLATE");
|
|
302
302
|
if (template.contentLanguage) {
|
|
303
303
|
contentLanguage = template.contentLanguage;
|
|
304
304
|
}
|
|
@@ -306,8 +306,8 @@
|
|
|
306
306
|
contentLanguage = '';
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
|
-
else if (
|
|
310
|
-
commands_1.push("DIALOG
|
|
309
|
+
else if (templateType === 'DIALOG_TEMPLATE') {
|
|
310
|
+
commands_1.push("DIALOG TEMPLATE");
|
|
311
311
|
// Note: Nothing special here
|
|
312
312
|
} // <- }else if([🅱]
|
|
313
313
|
if (jokers) {
|
|
@@ -406,7 +406,7 @@
|
|
|
406
406
|
return parameterString;
|
|
407
407
|
}
|
|
408
408
|
/**
|
|
409
|
-
* TODO:
|
|
409
|
+
* TODO: [🛋] Implement new features and commands into `pipelineJsonToString` + `templateParameterJsonToString` , use `stringifyCommand`
|
|
410
410
|
* TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
|
|
411
411
|
* TODO: [🏛] Maybe make some markdown builder
|
|
412
412
|
* TODO: [🏛] Escape all
|
|
@@ -782,7 +782,7 @@
|
|
|
782
782
|
*/
|
|
783
783
|
|
|
784
784
|
/**
|
|
785
|
-
* This error indicates that the promptbook object has valid syntax but contains logical errors (like circular dependencies)
|
|
785
|
+
* This error indicates that the promptbook object has valid syntax (=can be parsed) but contains logical errors (like circular dependencies)
|
|
786
786
|
*
|
|
787
787
|
* @public exported from `@promptbook/core`
|
|
788
788
|
*/
|
|
@@ -1364,7 +1364,7 @@
|
|
|
1364
1364
|
* Creates PipelineCollection from array of PipelineJson or PipelineString
|
|
1365
1365
|
*
|
|
1366
1366
|
* Note: Functions `collectionToJson` and `createCollectionFromJson` are complementary
|
|
1367
|
-
* Note:
|
|
1367
|
+
* Note: Syntax, parsing, and logic consistency checks are performed on all sources during build
|
|
1368
1368
|
*
|
|
1369
1369
|
* @param promptbookSources
|
|
1370
1370
|
* @returns PipelineCollection
|
|
@@ -1581,12 +1581,12 @@
|
|
|
1581
1581
|
}
|
|
1582
1582
|
|
|
1583
1583
|
/**
|
|
1584
|
-
*
|
|
1584
|
+
* Template type describes the way how the template is templated
|
|
1585
1585
|
*
|
|
1586
|
-
* @see https://github.com/webgptorg/promptbook#
|
|
1586
|
+
* @see https://github.com/webgptorg/promptbook#template-type
|
|
1587
1587
|
* @public exported from `@promptbook/core`
|
|
1588
1588
|
*/
|
|
1589
|
-
var
|
|
1589
|
+
var TemplateTypes = [
|
|
1590
1590
|
'PROMPT_TEMPLATE',
|
|
1591
1591
|
'SIMPLE_TEMPLATE',
|
|
1592
1592
|
'SCRIPT_TEMPLATE',
|
|
@@ -1794,7 +1794,7 @@
|
|
|
1794
1794
|
});
|
|
1795
1795
|
}
|
|
1796
1796
|
|
|
1797
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.68.0-
|
|
1797
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.68.0-4",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.68.0-4",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.68.0-4",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.68.0-4",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Sample\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
|
|
1798
1798
|
|
|
1799
1799
|
var defaultDiacriticsRemovalMap = [
|
|
1800
1800
|
{
|
|
@@ -2381,7 +2381,7 @@
|
|
|
2381
2381
|
*/
|
|
2382
2382
|
function extractParameterNamesFromTemplate(template) {
|
|
2383
2383
|
var e_1, _a, e_2, _b, e_3, _c;
|
|
2384
|
-
var title = template.title, description = template.description,
|
|
2384
|
+
var title = template.title, description = template.description, templateType = template.templateType, content = template.content, preparedContent = template.preparedContent, jokerParameterNames = template.jokerParameterNames;
|
|
2385
2385
|
var parameterNames = new Set();
|
|
2386
2386
|
try {
|
|
2387
2387
|
for (var _d = __values(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(extractParameterNames(title)), false), __read(extractParameterNames(description || '')), false), __read(extractParameterNames(content)), false), __read(extractParameterNames(preparedContent || '')), false)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
@@ -2396,7 +2396,7 @@
|
|
|
2396
2396
|
}
|
|
2397
2397
|
finally { if (e_1) throw e_1.error; }
|
|
2398
2398
|
}
|
|
2399
|
-
if (
|
|
2399
|
+
if (templateType === 'SCRIPT_TEMPLATE') {
|
|
2400
2400
|
try {
|
|
2401
2401
|
for (var _f = __values(extractVariables(content)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
2402
2402
|
var parameterName = _g.value;
|
|
@@ -3398,7 +3398,7 @@
|
|
|
3398
3398
|
title: title,
|
|
3399
3399
|
isStarted: false,
|
|
3400
3400
|
isDone: false,
|
|
3401
|
-
|
|
3401
|
+
templateType: currentTemplate.templateType,
|
|
3402
3402
|
parameterName: currentTemplate.resultingParameterName,
|
|
3403
3403
|
parameterValue: null,
|
|
3404
3404
|
// <- [3]
|
|
@@ -3463,7 +3463,7 @@
|
|
|
3463
3463
|
result = null;
|
|
3464
3464
|
resultString = null;
|
|
3465
3465
|
expectError = null;
|
|
3466
|
-
maxAttempts = currentTemplate.
|
|
3466
|
+
maxAttempts = currentTemplate.templateType === 'DIALOG_TEMPLATE' ? Infinity : maxExecutionAttempts;
|
|
3467
3467
|
jokerParameterNames = currentTemplate.jokerParameterNames || [];
|
|
3468
3468
|
preparedContent = (currentTemplate.preparedContent || '{content}')
|
|
3469
3469
|
.split('{content}')
|
|
@@ -3495,7 +3495,7 @@
|
|
|
3495
3495
|
case 1:
|
|
3496
3496
|
_v.trys.push([1, 44, 45, 46]);
|
|
3497
3497
|
if (!!isJokerAttempt) return [3 /*break*/, 26];
|
|
3498
|
-
_j = currentTemplate.
|
|
3498
|
+
_j = currentTemplate.templateType;
|
|
3499
3499
|
switch (_j) {
|
|
3500
3500
|
case 'SIMPLE_TEMPLATE': return [3 /*break*/, 2];
|
|
3501
3501
|
case 'PROMPT_TEMPLATE': return [3 /*break*/, 3];
|
|
@@ -3629,10 +3629,10 @@
|
|
|
3629
3629
|
priority: priority,
|
|
3630
3630
|
}))];
|
|
3631
3631
|
case 24:
|
|
3632
|
-
// TODO: [🌹] When making next attempt for `DIALOG
|
|
3632
|
+
// TODO: [🌹] When making next attempt for `DIALOG TEMPLATE`, preserve the previous user input
|
|
3633
3633
|
resultString = _v.sent();
|
|
3634
3634
|
return [3 /*break*/, 26];
|
|
3635
|
-
case 25: throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Unknown execution type \"".concat(currentTemplate.
|
|
3635
|
+
case 25: throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Unknown execution type \"".concat(currentTemplate.templateType, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
3636
3636
|
case 26:
|
|
3637
3637
|
if (!(!isJokerAttempt && currentTemplate.postprocessingFunctionNames)) return [3 /*break*/, 43];
|
|
3638
3638
|
_v.label = 27;
|
|
@@ -3747,12 +3747,12 @@
|
|
|
3747
3747
|
return [3 /*break*/, 46];
|
|
3748
3748
|
case 45:
|
|
3749
3749
|
if (!isJokerAttempt &&
|
|
3750
|
-
currentTemplate.
|
|
3750
|
+
currentTemplate.templateType === 'PROMPT_TEMPLATE' &&
|
|
3751
3751
|
prompt
|
|
3752
3752
|
// <- Note: [2] When some expected parameter is not defined, error will occur in replaceParameters
|
|
3753
3753
|
// In that case we don’t want to make a report about it because it’s not a llm execution error
|
|
3754
3754
|
) {
|
|
3755
|
-
// TODO: [🧠] Maybe put other
|
|
3755
|
+
// TODO: [🧠] Maybe put other templateTypes into report
|
|
3756
3756
|
executionReport.promptExecutions.push({
|
|
3757
3757
|
prompt: __assign({}, prompt),
|
|
3758
3758
|
result: result || undefined,
|
|
@@ -3803,7 +3803,7 @@
|
|
|
3803
3803
|
title: title,
|
|
3804
3804
|
isStarted: true,
|
|
3805
3805
|
isDone: true,
|
|
3806
|
-
|
|
3806
|
+
templateType: currentTemplate.templateType,
|
|
3807
3807
|
parameterName: currentTemplate.resultingParameterName,
|
|
3808
3808
|
parameterValue: resultString,
|
|
3809
3809
|
// <- [3]
|
|
@@ -4771,7 +4771,7 @@
|
|
|
4771
4771
|
*/
|
|
4772
4772
|
stringify: function (command) {
|
|
4773
4773
|
keepUnused(command);
|
|
4774
|
-
return "
|
|
4774
|
+
return "---"; // <- TODO: [🛋] Implement
|
|
4775
4775
|
},
|
|
4776
4776
|
/**
|
|
4777
4777
|
* Reads the KNOWLEDGE command from the `PipelineJson`
|
|
@@ -4780,114 +4780,122 @@
|
|
|
4780
4780
|
*/
|
|
4781
4781
|
takeFromPipelineJson: function (pipelineJson) {
|
|
4782
4782
|
keepUnused(pipelineJson);
|
|
4783
|
-
throw new NotYetImplementedError("Not implemented yet
|
|
4783
|
+
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
4784
4784
|
},
|
|
4785
4785
|
};
|
|
4786
|
+
/**
|
|
4787
|
+
* Note: [⛱] There are two types of KNOWLEDGE commands *...(read more in [⛱])*
|
|
4788
|
+
*/
|
|
4786
4789
|
|
|
4787
4790
|
/**
|
|
4788
|
-
* Parses the
|
|
4791
|
+
* Parses the template command
|
|
4789
4792
|
*
|
|
4790
|
-
* @see ./
|
|
4793
|
+
* @see ./TEMPLATE-README.md for more details
|
|
4791
4794
|
* @private within the commands folder
|
|
4792
4795
|
*/
|
|
4793
|
-
var
|
|
4796
|
+
var templateCommandParser = {
|
|
4794
4797
|
/**
|
|
4795
4798
|
* Name of the command
|
|
4796
4799
|
*/
|
|
4797
|
-
name: '
|
|
4800
|
+
name: 'TEMPLATE',
|
|
4798
4801
|
/**
|
|
4799
|
-
* Aliases for the
|
|
4802
|
+
* Aliases for the TEMPLATE command
|
|
4800
4803
|
*/
|
|
4801
4804
|
aliasNames: [
|
|
4802
|
-
'
|
|
4803
|
-
'
|
|
4804
|
-
'
|
|
4805
|
-
'
|
|
4805
|
+
'PROMPT',
|
|
4806
|
+
'SIMPLE',
|
|
4807
|
+
'SCRIPT',
|
|
4808
|
+
'DIALOG',
|
|
4806
4809
|
'SAMPLE',
|
|
4807
4810
|
'EXAMPLE',
|
|
4808
4811
|
'KNOWLEDGE',
|
|
4809
4812
|
'INSTRUMENT',
|
|
4810
|
-
'ACTION',
|
|
4811
|
-
// <- [🅱]
|
|
4813
|
+
'ACTION', // <- Note: [⛱]
|
|
4812
4814
|
],
|
|
4813
4815
|
/**
|
|
4814
|
-
* Aliases for the
|
|
4816
|
+
* Aliases for the TEMPLATE command
|
|
4815
4817
|
*/
|
|
4816
|
-
deprecatedNames: ['EXECUTE'],
|
|
4818
|
+
deprecatedNames: ['BLOCK', 'EXECUTE'],
|
|
4817
4819
|
/**
|
|
4818
4820
|
* BOILERPLATE command can be used in:
|
|
4819
4821
|
*/
|
|
4820
4822
|
isUsedInPipelineHead: false,
|
|
4821
4823
|
isUsedInPipelineTemplate: true,
|
|
4822
4824
|
/**
|
|
4823
|
-
* Description of the
|
|
4825
|
+
* Description of the TEMPLATE command
|
|
4824
4826
|
*/
|
|
4825
|
-
description: "What should the code
|
|
4827
|
+
description: "What should the code template template do",
|
|
4826
4828
|
/**
|
|
4827
4829
|
* Link to discussion
|
|
4828
4830
|
*/
|
|
4829
4831
|
documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/64',
|
|
4830
4832
|
/**
|
|
4831
|
-
* Example usages of the
|
|
4833
|
+
* Example usages of the TEMPLATE command
|
|
4832
4834
|
*/
|
|
4833
4835
|
examples: [
|
|
4834
|
-
//
|
|
4835
|
-
'PROMPT
|
|
4836
|
-
'SIMPLE
|
|
4837
|
-
'SCRIPT
|
|
4838
|
-
'DIALOG
|
|
4836
|
+
// Short form:
|
|
4837
|
+
'PROMPT',
|
|
4838
|
+
'SIMPLE',
|
|
4839
|
+
'SCRIPT',
|
|
4840
|
+
'DIALOG',
|
|
4839
4841
|
// <- [🅱]
|
|
4840
|
-
|
|
4841
|
-
'
|
|
4842
|
-
'
|
|
4843
|
-
'
|
|
4844
|
-
|
|
4842
|
+
'SAMPLE',
|
|
4843
|
+
'KNOWLEDGE',
|
|
4844
|
+
'INSTRUMENT',
|
|
4845
|
+
'ACTION',
|
|
4846
|
+
// -----------------
|
|
4847
|
+
// Recommended (reversed) form:
|
|
4848
|
+
'PROMPT TEMPLATE',
|
|
4849
|
+
'SIMPLE TEMPLATE',
|
|
4850
|
+
'SCRIPT TEMPLATE',
|
|
4851
|
+
'DIALOG TEMPLATE',
|
|
4845
4852
|
// <- [🅱]
|
|
4846
|
-
|
|
4847
|
-
'
|
|
4848
|
-
'
|
|
4849
|
-
'
|
|
4850
|
-
|
|
4853
|
+
'SAMPLE TEMPLATE',
|
|
4854
|
+
'KNOWLEDGE TEMPLATE',
|
|
4855
|
+
'INSTRUMENT TEMPLATE',
|
|
4856
|
+
'ACTION TEMPLATE',
|
|
4857
|
+
// -----------------
|
|
4858
|
+
// Standard form:
|
|
4859
|
+
'TEMPLATE PROMPT',
|
|
4860
|
+
'TEMPLATE SIMPLE',
|
|
4861
|
+
'TEMPLATE SCRIPT',
|
|
4862
|
+
'TEMPLATE DIALOG',
|
|
4851
4863
|
// <- [🅱]
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
'
|
|
4856
|
-
// 'Instrument', // <- Note: [⛱]
|
|
4857
|
-
'Action BLOCK',
|
|
4858
|
-
// 'Action', // <- Note: [⛱]
|
|
4859
|
-
//---
|
|
4860
|
-
/* <- TODO: [🧠] Maybe dynamic */
|
|
4864
|
+
'SAMPLE TEMPLATE',
|
|
4865
|
+
'KNOWLEDGE TEMPLATE',
|
|
4866
|
+
'INSTRUMENT TEMPLATE',
|
|
4867
|
+
'ACTION TEMPLATE',
|
|
4861
4868
|
],
|
|
4862
4869
|
// TODO: [♓️] order: -10 /* <- Note: Putting before other commands */
|
|
4863
4870
|
/**
|
|
4864
|
-
* Parses the
|
|
4871
|
+
* Parses the TEMPLATE command
|
|
4865
4872
|
*/
|
|
4866
4873
|
parse: function (input) {
|
|
4867
4874
|
var normalized = input.normalized;
|
|
4868
4875
|
normalized = normalized.split('EXAMPLE').join('SAMPLE');
|
|
4869
|
-
var
|
|
4870
|
-
|
|
4871
|
-
|
|
4876
|
+
var templateTypes = TemplateTypes.filter(function (templateType) {
|
|
4877
|
+
return normalized.includes(templateType.split('_TEMPLATE').join(''));
|
|
4878
|
+
});
|
|
4879
|
+
if (templateTypes.length !== 1) {
|
|
4880
|
+
throw new ParseError(spaceTrim__default["default"](function (template) { return "\n Unknown template type in TEMPLATE command\n\n Supported template types are:\n ".concat(template(TemplateTypes.join(', ')), "\n "); }));
|
|
4872
4881
|
}
|
|
4873
|
-
var
|
|
4882
|
+
var templateType = templateTypes[0];
|
|
4874
4883
|
return {
|
|
4875
|
-
type: '
|
|
4876
|
-
|
|
4884
|
+
type: 'TEMPLATE',
|
|
4885
|
+
templateType: templateType,
|
|
4877
4886
|
};
|
|
4878
4887
|
},
|
|
4879
4888
|
/**
|
|
4880
|
-
* Apply the
|
|
4889
|
+
* Apply the TEMPLATE command to the `pipelineJson`
|
|
4881
4890
|
*
|
|
4882
4891
|
* Note: `$` is used to indicate that this function mutates given `templateJson`
|
|
4883
4892
|
*/
|
|
4884
4893
|
$applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
throw new ParseError(spaceTrim__default["default"]("\n Block type is already defined in the template.\n It can be defined only once.\n "));
|
|
4894
|
+
if ($templateJson.isTemplateTypeSet === true) {
|
|
4895
|
+
throw new ParseError(spaceTrim__default["default"]("\n Template type is already defined in the template.\n It can be defined only once.\n "));
|
|
4888
4896
|
}
|
|
4889
|
-
$templateJson.
|
|
4890
|
-
// TODO:
|
|
4897
|
+
$templateJson.isTemplateTypeSet = true;
|
|
4898
|
+
// TODO: [🍧] Rearrange better - but at bottom and unwrap from function
|
|
4891
4899
|
var expectResultingParameterName = function () {
|
|
4892
4900
|
if ($templateJson.resultingParameterName) {
|
|
4893
4901
|
return;
|
|
@@ -4897,7 +4905,7 @@
|
|
|
4897
4905
|
if ($templateJson.content === undefined) {
|
|
4898
4906
|
throw new UnexpectedError("Content is missing in the templateJson - probbably commands are applied in wrong order");
|
|
4899
4907
|
}
|
|
4900
|
-
if (command.
|
|
4908
|
+
if (command.templateType === 'SAMPLE') {
|
|
4901
4909
|
expectResultingParameterName();
|
|
4902
4910
|
var parameter = $pipelineJson.parameters.find(function (param) { return param.name === $templateJson.resultingParameterName; });
|
|
4903
4911
|
if (parameter === undefined) {
|
|
@@ -4905,66 +4913,61 @@
|
|
|
4905
4913
|
}
|
|
4906
4914
|
parameter.sampleValues = parameter.sampleValues || [];
|
|
4907
4915
|
parameter.sampleValues.push($templateJson.content);
|
|
4908
|
-
|
|
4909
|
-
// continue templates;
|
|
4910
|
-
$templateJson.isTemplateBlock = false;
|
|
4916
|
+
$templateJson.isTemplate = false;
|
|
4911
4917
|
return;
|
|
4912
4918
|
}
|
|
4913
|
-
if (command.
|
|
4919
|
+
if (command.templateType === 'KNOWLEDGE') {
|
|
4914
4920
|
knowledgeCommandParser.$applyToPipelineJson({
|
|
4915
4921
|
type: 'KNOWLEDGE',
|
|
4916
4922
|
sourceContent: $templateJson.content, // <- TODO: [🐝] !!! Work with KNOWLEDGE which not referring to the source file or website, but its content itself
|
|
4917
4923
|
}, $pipelineJson);
|
|
4918
|
-
|
|
4919
|
-
// continue templates;
|
|
4920
|
-
$templateJson.isTemplateBlock = false;
|
|
4924
|
+
$templateJson.isTemplate = false;
|
|
4921
4925
|
return;
|
|
4922
4926
|
}
|
|
4923
|
-
if (command.
|
|
4927
|
+
if (command.templateType === 'ACTION') {
|
|
4924
4928
|
console.error(new NotYetImplementedError('Actions are not implemented yet'));
|
|
4925
|
-
|
|
4926
|
-
// continue templates;
|
|
4927
|
-
$templateJson.isTemplateBlock = false;
|
|
4929
|
+
$templateJson.isTemplate = false;
|
|
4928
4930
|
return;
|
|
4929
4931
|
}
|
|
4930
|
-
if (command.
|
|
4932
|
+
if (command.templateType === 'INSTRUMENT') {
|
|
4931
4933
|
console.error(new NotYetImplementedError('Instruments are not implemented yet'));
|
|
4932
|
-
|
|
4933
|
-
// continue templates;
|
|
4934
|
-
$templateJson.isTemplateBlock = false;
|
|
4934
|
+
$templateJson.isTemplate = false;
|
|
4935
4935
|
return;
|
|
4936
4936
|
}
|
|
4937
4937
|
expectResultingParameterName();
|
|
4938
|
-
$templateJson.
|
|
4939
|
-
|
|
4940
|
-
TODO: !!!!!! Chat model variant should be applied in `createPipelineExecutor`
|
|
4941
|
-
if (command.blockType ==='PROMPT_TEMPLATE' && templateModelRequirements.modelVariant === undefined) {
|
|
4942
|
-
templateModelRequirements.modelVariant = 'CHAT';
|
|
4943
|
-
}
|
|
4944
|
-
*/
|
|
4945
|
-
// !!!!!!
|
|
4946
|
-
// isBlockTypeSet = true; //<- Note: [2]
|
|
4947
|
-
$templateJson.isTemplateBlock = true;
|
|
4938
|
+
$templateJson.templateType = command.templateType;
|
|
4939
|
+
$templateJson.isTemplate = true;
|
|
4948
4940
|
},
|
|
4949
4941
|
/**
|
|
4950
|
-
* Converts the
|
|
4942
|
+
* Converts the TEMPLATE command back to string
|
|
4951
4943
|
*
|
|
4952
4944
|
* Note: This is used in `pipelineJsonToString` utility
|
|
4953
4945
|
*/
|
|
4954
4946
|
stringify: function (command) {
|
|
4955
4947
|
keepUnused(command);
|
|
4956
|
-
return "
|
|
4948
|
+
return "---"; // <- TODO: [🛋] Implement
|
|
4957
4949
|
},
|
|
4958
4950
|
/**
|
|
4959
|
-
* Reads the
|
|
4951
|
+
* Reads the TEMPLATE command from the `TemplateJson`
|
|
4960
4952
|
*
|
|
4961
4953
|
* Note: This is used in `pipelineJsonToString` utility
|
|
4962
4954
|
*/
|
|
4963
4955
|
takeFromTemplateJson: function ($templateJson) {
|
|
4964
4956
|
keepUnused($templateJson);
|
|
4965
|
-
throw new NotYetImplementedError("Not implemented yet
|
|
4957
|
+
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
4966
4958
|
},
|
|
4967
4959
|
};
|
|
4960
|
+
/**
|
|
4961
|
+
* Note: [⛱] There are two types of KNOWLEDGE, ACTION and INSTRUMENT commands:
|
|
4962
|
+
* 1) There are commands `KNOWLEDGE`, `ACTION` and `INSTRUMENT` used in the pipeline head, they just define the knowledge, action or instrument as single line after the command
|
|
4963
|
+
* - KNOWLEDGE Look at https://en.wikipedia.org/wiki/Artificial_intelligence
|
|
4964
|
+
* 2) `KNOWLEDGE TEMPLATE` which has short form `KNOWLEDGE` is used in the template, does not refer the line itself, but the content of the template
|
|
4965
|
+
* - KNOWLEDGE TEMPLATE
|
|
4966
|
+
*
|
|
4967
|
+
* ```
|
|
4968
|
+
* Look at https://en.wikipedia.org/wiki/Artificial_intelligence
|
|
4969
|
+
* ```
|
|
4970
|
+
*/
|
|
4968
4971
|
|
|
4969
4972
|
/**
|
|
4970
4973
|
* Units of text measurement
|
|
@@ -5183,7 +5186,7 @@
|
|
|
5183
5186
|
*/
|
|
5184
5187
|
stringify: function (command) {
|
|
5185
5188
|
keepUnused(command);
|
|
5186
|
-
return "
|
|
5189
|
+
return "---"; // <- TODO: [🛋] Implement
|
|
5187
5190
|
},
|
|
5188
5191
|
/**
|
|
5189
5192
|
* Reads the FORMAT command from the `TemplateJson`
|
|
@@ -5192,7 +5195,7 @@
|
|
|
5192
5195
|
*/
|
|
5193
5196
|
takeFromTemplateJson: function ($templateJson) {
|
|
5194
5197
|
keepUnused($templateJson);
|
|
5195
|
-
throw new NotYetImplementedError("Not implemented yet
|
|
5198
|
+
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
5196
5199
|
},
|
|
5197
5200
|
};
|
|
5198
5201
|
|
|
@@ -5277,7 +5280,7 @@
|
|
|
5277
5280
|
},
|
|
5278
5281
|
};
|
|
5279
5282
|
/**
|
|
5280
|
-
* TODO: [🍭] Make .ptbk.md file with examples of the FOREACH command and also with wrong
|
|
5283
|
+
* TODO: [🍭] Make .ptbk.md file with examples of the FOREACH command and also with wrong parsing and logic
|
|
5281
5284
|
*/
|
|
5282
5285
|
|
|
5283
5286
|
/**
|
|
@@ -5341,7 +5344,7 @@
|
|
|
5341
5344
|
*/
|
|
5342
5345
|
stringify: function (command) {
|
|
5343
5346
|
keepUnused(command);
|
|
5344
|
-
return "
|
|
5347
|
+
return "---"; // <- TODO: [🛋] Implement
|
|
5345
5348
|
},
|
|
5346
5349
|
/**
|
|
5347
5350
|
* Reads the FORMAT command from the `TemplateJson`
|
|
@@ -5350,7 +5353,7 @@
|
|
|
5350
5353
|
*/
|
|
5351
5354
|
takeFromTemplateJson: function ($templateJson) {
|
|
5352
5355
|
keepUnused($templateJson);
|
|
5353
|
-
throw new NotYetImplementedError("Not implemented yet
|
|
5356
|
+
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
5354
5357
|
},
|
|
5355
5358
|
};
|
|
5356
5359
|
|
|
@@ -5413,7 +5416,7 @@
|
|
|
5413
5416
|
*/
|
|
5414
5417
|
stringify: function (command) {
|
|
5415
5418
|
keepUnused(command);
|
|
5416
|
-
return "
|
|
5419
|
+
return "---"; // <- TODO: [🛋] Implement
|
|
5417
5420
|
},
|
|
5418
5421
|
/**
|
|
5419
5422
|
* Reads the JOKER command from the `TemplateJson`
|
|
@@ -5422,7 +5425,7 @@
|
|
|
5422
5425
|
*/
|
|
5423
5426
|
takeFromTemplateJson: function ($templateJson) {
|
|
5424
5427
|
keepUnused($templateJson);
|
|
5425
|
-
throw new NotYetImplementedError("Not implemented yet
|
|
5428
|
+
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
5426
5429
|
},
|
|
5427
5430
|
};
|
|
5428
5431
|
|
|
@@ -5502,7 +5505,7 @@
|
|
|
5502
5505
|
};
|
|
5503
5506
|
}
|
|
5504
5507
|
else {
|
|
5505
|
-
throw new ParseError(spaceTrim__default["default"](function (block) { return "\n Unknown model key in command.\n\n Supported model keys are:\n ".concat(block(['variant', 'name'].join(', ')), "\n\n Example:\n
|
|
5508
|
+
throw new ParseError(spaceTrim__default["default"](function (block) { return "\n Unknown model key in command.\n\n Supported model keys are:\n ".concat(block(['variant', 'name'].join(', ')), "\n\n Example:\n - MODEL VARIANT Chat\n - MODEL NAME gpt-4\n "); }));
|
|
5506
5509
|
}
|
|
5507
5510
|
},
|
|
5508
5511
|
/**
|
|
@@ -5511,8 +5514,16 @@
|
|
|
5511
5514
|
* Note: `$` is used to indicate that this function mutates given `pipelineJson`
|
|
5512
5515
|
*/
|
|
5513
5516
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
5514
|
-
// TODO: !!!!!! Error on redefine
|
|
5515
5517
|
$pipelineJson.defaultModelRequirements = $pipelineJson.defaultModelRequirements || {};
|
|
5518
|
+
// TODO: [🚜] DRY
|
|
5519
|
+
if ($pipelineJson.defaultModelRequirements[command.key] !== undefined) {
|
|
5520
|
+
if ($pipelineJson.defaultModelRequirements[command.key] === command.value) {
|
|
5521
|
+
console.warn("Multiple commands `MODEL ".concat(command.key, " ").concat(command.value, "` in the pipeline head"));
|
|
5522
|
+
}
|
|
5523
|
+
else {
|
|
5524
|
+
throw new ParseError(spaceTrim__default["default"]("\n Redefinition of MODEL `".concat(command.key, "` in the pipeline head\n\n You have used:\n - MODEL ").concat(command.key, " ").concat($pipelineJson.defaultModelRequirements[command.key], "\n - MODEL ").concat(command.key, " ").concat(command.value, "\n ")));
|
|
5525
|
+
}
|
|
5526
|
+
}
|
|
5516
5527
|
$pipelineJson.defaultModelRequirements[command.key] = command.value;
|
|
5517
5528
|
},
|
|
5518
5529
|
/**
|
|
@@ -5520,13 +5531,23 @@
|
|
|
5520
5531
|
*
|
|
5521
5532
|
* Note: `$` is used to indicate that this function mutates given `templateJson`
|
|
5522
5533
|
*/
|
|
5523
|
-
$applyToTemplateJson: function (command, $templateJson) {
|
|
5524
|
-
if ($templateJson.
|
|
5534
|
+
$applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
|
|
5535
|
+
if ($templateJson.templateType !== 'PROMPT_TEMPLATE') {
|
|
5525
5536
|
throw new ParseError("MODEL command can only be used in PROMPT_TEMPLATE block");
|
|
5526
5537
|
}
|
|
5527
|
-
// TODO: !!!!!! Error on redefine
|
|
5528
|
-
// TODO: Warn if setting same as default in `$pipelineJson`
|
|
5529
5538
|
$templateJson.modelRequirements = $templateJson.modelRequirements || {};
|
|
5539
|
+
// TODO: [🚜] DRY
|
|
5540
|
+
if ($templateJson.modelRequirements[command.key] !== undefined) {
|
|
5541
|
+
if ($templateJson.modelRequirements[command.key] === command.value) {
|
|
5542
|
+
console.warn("Multiple commands `MODEL ".concat(command.key, " ").concat(command.value, "` in the template \"").concat($templateJson.title || $templateJson.name, "\""));
|
|
5543
|
+
}
|
|
5544
|
+
else {
|
|
5545
|
+
throw new ParseError(spaceTrim__default["default"]("\n Redefinition of MODEL `".concat(command.key, "` in the template \"").concat($templateJson.title || $templateJson.name, "\"\n\n You have used:\n - MODEL ").concat(command.key, " ").concat($templateJson.modelRequirements[command.key], "\n - MODEL ").concat(command.key, " ").concat(command.value, "\n ")));
|
|
5546
|
+
}
|
|
5547
|
+
}
|
|
5548
|
+
if (command.value === ($pipelineJson.defaultModelRequirements || {})[command.key]) {
|
|
5549
|
+
console.log(spaceTrim__default["default"]("\n Setting MODEL `".concat(command.key, "` in the template \"").concat($templateJson.title || $templateJson.name, "\" to the same value as in the pipeline head\n\n In pipeline head:\n - MODEL ").concat(command.key, " ").concat(($pipelineJson.defaultModelRequirements || {})[command.key], "\n\n But same value is used in the template:\n - MODEL ").concat(command.key, " ").concat(command.value, "\n ")));
|
|
5550
|
+
}
|
|
5530
5551
|
$templateJson.modelRequirements[command.key] = command.value;
|
|
5531
5552
|
},
|
|
5532
5553
|
/**
|
|
@@ -5536,7 +5557,7 @@
|
|
|
5536
5557
|
*/
|
|
5537
5558
|
stringify: function (command) {
|
|
5538
5559
|
keepUnused(command);
|
|
5539
|
-
return "
|
|
5560
|
+
return "---"; // <- TODO: [🛋] Implement
|
|
5540
5561
|
},
|
|
5541
5562
|
/**
|
|
5542
5563
|
* Reads the MODEL command from the `PipelineJson`
|
|
@@ -5545,7 +5566,7 @@
|
|
|
5545
5566
|
*/
|
|
5546
5567
|
takeFromPipelineJson: function (pipelineJson) {
|
|
5547
5568
|
keepUnused(pipelineJson);
|
|
5548
|
-
throw new NotYetImplementedError("Not implemented yet
|
|
5569
|
+
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
5549
5570
|
},
|
|
5550
5571
|
/**
|
|
5551
5572
|
* Reads the MODEL command from the `TemplateJson`
|
|
@@ -5554,7 +5575,7 @@
|
|
|
5554
5575
|
*/
|
|
5555
5576
|
takeFromTemplateJson: function ($templateJson) {
|
|
5556
5577
|
keepUnused($templateJson);
|
|
5557
|
-
throw new NotYetImplementedError("Not implemented yet
|
|
5578
|
+
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
5558
5579
|
},
|
|
5559
5580
|
};
|
|
5560
5581
|
|
|
@@ -5645,7 +5666,7 @@
|
|
|
5645
5666
|
*/
|
|
5646
5667
|
stringify: function (command) {
|
|
5647
5668
|
keepUnused(command);
|
|
5648
|
-
return "
|
|
5669
|
+
return "---"; // <- TODO: [🛋] Implement
|
|
5649
5670
|
},
|
|
5650
5671
|
/**
|
|
5651
5672
|
* Reads the PARAMETER command from the `PipelineJson`
|
|
@@ -5654,7 +5675,7 @@
|
|
|
5654
5675
|
*/
|
|
5655
5676
|
takeFromPipelineJson: function (pipelineJson) {
|
|
5656
5677
|
keepUnused(pipelineJson);
|
|
5657
|
-
throw new NotYetImplementedError("Not implemented yet
|
|
5678
|
+
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
5658
5679
|
},
|
|
5659
5680
|
/**
|
|
5660
5681
|
* Reads the PARAMETER command from the `TemplateJson`
|
|
@@ -5663,7 +5684,7 @@
|
|
|
5663
5684
|
*/
|
|
5664
5685
|
takeFromTemplateJson: function ($templateJson) {
|
|
5665
5686
|
keepUnused($templateJson);
|
|
5666
|
-
throw new NotYetImplementedError("Not implemented yet
|
|
5687
|
+
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
5667
5688
|
},
|
|
5668
5689
|
};
|
|
5669
5690
|
|
|
@@ -5735,7 +5756,7 @@
|
|
|
5735
5756
|
*/
|
|
5736
5757
|
stringify: function (command) {
|
|
5737
5758
|
keepUnused(command);
|
|
5738
|
-
return "
|
|
5759
|
+
return "---"; // <- TODO: [🛋] Implement
|
|
5739
5760
|
},
|
|
5740
5761
|
/**
|
|
5741
5762
|
* Reads the PERSONA command from the `PipelineJson`
|
|
@@ -5744,7 +5765,7 @@
|
|
|
5744
5765
|
*/
|
|
5745
5766
|
takeFromPipelineJson: function (pipelineJson) {
|
|
5746
5767
|
keepUnused(pipelineJson);
|
|
5747
|
-
throw new NotYetImplementedError("Not implemented yet
|
|
5768
|
+
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
5748
5769
|
},
|
|
5749
5770
|
/**
|
|
5750
5771
|
* Reads the PERSONA command from the `TemplateJson`
|
|
@@ -5753,7 +5774,7 @@
|
|
|
5753
5774
|
*/
|
|
5754
5775
|
takeFromTemplateJson: function ($templateJson) {
|
|
5755
5776
|
keepUnused($templateJson);
|
|
5756
|
-
throw new NotYetImplementedError("Not implemented yet
|
|
5777
|
+
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
5757
5778
|
},
|
|
5758
5779
|
};
|
|
5759
5780
|
/**
|
|
@@ -5764,7 +5785,7 @@
|
|
|
5764
5785
|
function $applyToTemplateJson(command, $templateJson, $pipelineJson) {
|
|
5765
5786
|
var personaName = command.personaName, personaDescription = command.personaDescription;
|
|
5766
5787
|
if ($templateJson !== null) {
|
|
5767
|
-
if ($templateJson.
|
|
5788
|
+
if ($templateJson.templateType !== 'PROMPT_TEMPLATE') {
|
|
5768
5789
|
throw new ParseError("PERSONA command can be used only in PROMPT_TEMPLATE block");
|
|
5769
5790
|
}
|
|
5770
5791
|
$templateJson.personaName = personaName;
|
|
@@ -5872,7 +5893,7 @@
|
|
|
5872
5893
|
*/
|
|
5873
5894
|
stringify: function (command) {
|
|
5874
5895
|
keepUnused(command);
|
|
5875
|
-
return "
|
|
5896
|
+
return "---"; // <- TODO: [🛋] Implement
|
|
5876
5897
|
},
|
|
5877
5898
|
/**
|
|
5878
5899
|
* Reads the POSTPROCESS command from the `TemplateJson`
|
|
@@ -5881,7 +5902,7 @@
|
|
|
5881
5902
|
*/
|
|
5882
5903
|
takeFromTemplateJson: function ($templateJson) {
|
|
5883
5904
|
keepUnused($templateJson);
|
|
5884
|
-
throw new NotYetImplementedError("Not implemented yet
|
|
5905
|
+
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
5885
5906
|
},
|
|
5886
5907
|
};
|
|
5887
5908
|
|
|
@@ -5949,7 +5970,7 @@
|
|
|
5949
5970
|
*/
|
|
5950
5971
|
stringify: function (command) {
|
|
5951
5972
|
keepUnused(command);
|
|
5952
|
-
return "
|
|
5973
|
+
return "---"; // <- TODO: [🛋] Implement
|
|
5953
5974
|
},
|
|
5954
5975
|
/**
|
|
5955
5976
|
* Reads the PROMPTBOOK_VERSION command from the `PipelineJson`
|
|
@@ -5958,7 +5979,7 @@
|
|
|
5958
5979
|
*/
|
|
5959
5980
|
takeFromPipelineJson: function (pipelineJson) {
|
|
5960
5981
|
keepUnused(pipelineJson);
|
|
5961
|
-
throw new NotYetImplementedError("Not implemented yet
|
|
5982
|
+
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
5962
5983
|
},
|
|
5963
5984
|
};
|
|
5964
5985
|
|
|
@@ -6008,7 +6029,7 @@
|
|
|
6008
6029
|
if (pipelineUrl === undefined) {
|
|
6009
6030
|
throw new ParseError("URL is required");
|
|
6010
6031
|
}
|
|
6011
|
-
// TODO: [🧠][🚲] This should be maybe tested as logic not
|
|
6032
|
+
// TODO: [🧠][🚲] This should be maybe tested as logic not parse
|
|
6012
6033
|
if (!isValidPipelineUrl(pipelineUrl)) {
|
|
6013
6034
|
throw new ParseError("Invalid pipeline URL \"".concat(pipelineUrl, "\""));
|
|
6014
6035
|
}
|
|
@@ -6052,7 +6073,7 @@
|
|
|
6052
6073
|
*/
|
|
6053
6074
|
stringify: function (command) {
|
|
6054
6075
|
keepUnused(command);
|
|
6055
|
-
return "
|
|
6076
|
+
return "---"; // <- TODO: [🛋] Implement
|
|
6056
6077
|
},
|
|
6057
6078
|
/**
|
|
6058
6079
|
* Reads the URL command from the `PipelineJson`
|
|
@@ -6061,7 +6082,7 @@
|
|
|
6061
6082
|
*/
|
|
6062
6083
|
takeFromPipelineJson: function (pipelineJson) {
|
|
6063
6084
|
keepUnused(pipelineJson);
|
|
6064
|
-
throw new NotYetImplementedError("Not implemented yet
|
|
6085
|
+
throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
|
|
6065
6086
|
},
|
|
6066
6087
|
};
|
|
6067
6088
|
|
|
@@ -6110,7 +6131,7 @@
|
|
|
6110
6131
|
*/
|
|
6111
6132
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
6112
6133
|
keepUnused(command, $pipelineJson);
|
|
6113
|
-
console.error(new NotYetImplementedError('Actions are not implemented yet'));
|
|
6134
|
+
console.error(new NotYetImplementedError('[🛠] Actions are not implemented yet'));
|
|
6114
6135
|
},
|
|
6115
6136
|
/**
|
|
6116
6137
|
* Converts the ACTION command back to string
|
|
@@ -6119,7 +6140,7 @@
|
|
|
6119
6140
|
*/
|
|
6120
6141
|
stringify: function (command) {
|
|
6121
6142
|
keepUnused(command);
|
|
6122
|
-
|
|
6143
|
+
throw new NotYetImplementedError('[🛠] Actions are not implemented yet');
|
|
6123
6144
|
},
|
|
6124
6145
|
/**
|
|
6125
6146
|
* Reads the ACTION command from the `PipelineJson`
|
|
@@ -6128,9 +6149,12 @@
|
|
|
6128
6149
|
*/
|
|
6129
6150
|
takeFromPipelineJson: function (pipelineJson) {
|
|
6130
6151
|
keepUnused(pipelineJson);
|
|
6131
|
-
throw new NotYetImplementedError(
|
|
6152
|
+
throw new NotYetImplementedError('[🛠] Actions are not implemented yet');
|
|
6132
6153
|
},
|
|
6133
6154
|
};
|
|
6155
|
+
/**
|
|
6156
|
+
* Note: [⛱] There are two types of ACTION commands *...(read more in [⛱])*
|
|
6157
|
+
*/
|
|
6134
6158
|
|
|
6135
6159
|
/**
|
|
6136
6160
|
* Parses the instrument command
|
|
@@ -6165,6 +6189,7 @@
|
|
|
6165
6189
|
*/
|
|
6166
6190
|
parse: function (input) {
|
|
6167
6191
|
var args = input.args;
|
|
6192
|
+
// TODO: [🛠] Implement
|
|
6168
6193
|
TODO_USE(args);
|
|
6169
6194
|
return {
|
|
6170
6195
|
type: 'INSTRUMENT',
|
|
@@ -6177,7 +6202,7 @@
|
|
|
6177
6202
|
*/
|
|
6178
6203
|
$applyToPipelineJson: function (command, $pipelineJson) {
|
|
6179
6204
|
keepUnused(command, $pipelineJson);
|
|
6180
|
-
console.error(new NotYetImplementedError('Instruments are not implemented yet'));
|
|
6205
|
+
console.error(new NotYetImplementedError('[🛠] Instruments are not implemented yet'));
|
|
6181
6206
|
},
|
|
6182
6207
|
/**
|
|
6183
6208
|
* Converts the INSTRUMENT command back to string
|
|
@@ -6186,7 +6211,7 @@
|
|
|
6186
6211
|
*/
|
|
6187
6212
|
stringify: function (command) {
|
|
6188
6213
|
keepUnused(command);
|
|
6189
|
-
|
|
6214
|
+
throw new NotYetImplementedError('[🛠] Instruments are not implemented yet');
|
|
6190
6215
|
},
|
|
6191
6216
|
/**
|
|
6192
6217
|
* Reads the INSTRUMENT command from the `PipelineJson`
|
|
@@ -6195,9 +6220,12 @@
|
|
|
6195
6220
|
*/
|
|
6196
6221
|
takeFromPipelineJson: function (pipelineJson) {
|
|
6197
6222
|
keepUnused(pipelineJson);
|
|
6198
|
-
throw new NotYetImplementedError(
|
|
6223
|
+
throw new NotYetImplementedError('[🛠] Instruments are not implemented yet');
|
|
6199
6224
|
},
|
|
6200
6225
|
};
|
|
6226
|
+
/**
|
|
6227
|
+
* Note: [⛱] There are two types of INSTRUMENT commands *...(read more in [⛱])*
|
|
6228
|
+
*/
|
|
6201
6229
|
|
|
6202
6230
|
/**
|
|
6203
6231
|
* Parses the boilerplate command
|
|
@@ -6275,7 +6303,7 @@
|
|
|
6275
6303
|
*/
|
|
6276
6304
|
stringify: function (command) {
|
|
6277
6305
|
keepUnused(command);
|
|
6278
|
-
return "
|
|
6306
|
+
return "---"; // <- TODO: [🛋] Implement
|
|
6279
6307
|
},
|
|
6280
6308
|
/**
|
|
6281
6309
|
* Reads the BOILERPLATE command from the `PipelineJson`
|
|
@@ -6296,9 +6324,6 @@
|
|
|
6296
6324
|
throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
|
|
6297
6325
|
},
|
|
6298
6326
|
};
|
|
6299
|
-
/**
|
|
6300
|
-
* TODO: !!!!!! Make .ptbk.md file with examples of the BOILERPLATE command and fail
|
|
6301
|
-
*/
|
|
6302
6327
|
|
|
6303
6328
|
/**
|
|
6304
6329
|
* All available command parsers
|
|
@@ -6306,7 +6331,7 @@
|
|
|
6306
6331
|
* @private internal index of `parseCommand`
|
|
6307
6332
|
*/
|
|
6308
6333
|
var COMMANDS = [
|
|
6309
|
-
|
|
6334
|
+
templateCommandParser,
|
|
6310
6335
|
expectCommandParser,
|
|
6311
6336
|
formatCommandParser,
|
|
6312
6337
|
jokerCommandParser,
|
|
@@ -6321,8 +6346,28 @@
|
|
|
6321
6346
|
personaCommandParser,
|
|
6322
6347
|
foreachCommandParser,
|
|
6323
6348
|
boilerplateCommandParser, // <- TODO: !! Only in development, remove in production
|
|
6349
|
+
// <- Note: [♓️] This is the order of the commands in the pipeline, BUT its not used in parsing and before usage maybe it should be done better
|
|
6324
6350
|
];
|
|
6325
6351
|
|
|
6352
|
+
/**
|
|
6353
|
+
* Gets the parser for the command
|
|
6354
|
+
*
|
|
6355
|
+
* @returns the parser for the command
|
|
6356
|
+
* @throws {UnexpectedError} if the parser is not found
|
|
6357
|
+
*
|
|
6358
|
+
* @private within the pipelineStringToJson
|
|
6359
|
+
*/
|
|
6360
|
+
function getParserForCommand(command) {
|
|
6361
|
+
var commandParser = COMMANDS.find(function (commandParser) { return commandParser.name === command.type; });
|
|
6362
|
+
if (commandParser === undefined) {
|
|
6363
|
+
throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Command ".concat(command.type, " parser is not found\n\n ").concat(block(JSON.stringify(command, null, 4)
|
|
6364
|
+
.split('\n')
|
|
6365
|
+
.map(function (line) { return "> ".concat(line); })
|
|
6366
|
+
.join('\n')), "\n "); }));
|
|
6367
|
+
}
|
|
6368
|
+
return commandParser;
|
|
6369
|
+
}
|
|
6370
|
+
|
|
6326
6371
|
/**
|
|
6327
6372
|
* Removes Markdown formatting tags from a string.
|
|
6328
6373
|
*
|
|
@@ -6458,7 +6503,7 @@
|
|
|
6458
6503
|
.map(function (item) { return item.trim(); });
|
|
6459
6504
|
if (items.length === 0 || items[0] === '') {
|
|
6460
6505
|
throw new ParseError(spaceTrim.spaceTrim(function (block) {
|
|
6461
|
-
return "\n Malformed command:\n
|
|
6506
|
+
return "\n Malformed command:\n - ".concat(raw, "\n\n Supported commands are:\n ").concat(block(getSupportedCommandsMessage()), "\n\n ");
|
|
6462
6507
|
}));
|
|
6463
6508
|
}
|
|
6464
6509
|
// Note: Taking command name from beginning of the line
|
|
@@ -6485,7 +6530,7 @@
|
|
|
6485
6530
|
}
|
|
6486
6531
|
}
|
|
6487
6532
|
throw new ParseError(spaceTrim.spaceTrim(function (block) {
|
|
6488
|
-
return "\n Malformed or unknown command:\n
|
|
6533
|
+
return "\n Malformed or unknown command:\n - ".concat(raw, "\n\n Supported commands are:\n ").concat(block(getSupportedCommandsMessage()), "\n\n ");
|
|
6489
6534
|
}));
|
|
6490
6535
|
}
|
|
6491
6536
|
/**
|
|
@@ -6529,7 +6574,7 @@
|
|
|
6529
6574
|
throw error;
|
|
6530
6575
|
}
|
|
6531
6576
|
throw new ParseError(spaceTrim.spaceTrim(function (block) {
|
|
6532
|
-
return "\n Invalid ".concat(commandName, " command:\n ").concat(
|
|
6577
|
+
return "\n Invalid ".concat(commandName, " command:\n\n Your command:\n - ").concat(raw, "\n\n The detailed error:\n ").concat(block(error.message), "\n\n Usage of ").concat(commandName, ":\n ").concat(block(commandParser.examples.map(function (example) { return "- ".concat(example); }).join('\n')), "\n\n All supported commands are:\n ").concat(block(getSupportedCommandsMessage()), "\n\n ");
|
|
6533
6578
|
}));
|
|
6534
6579
|
}
|
|
6535
6580
|
}
|
|
@@ -6792,7 +6837,7 @@
|
|
|
6792
6837
|
* - `pipelineStringToJsonSync` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
|
|
6793
6838
|
* - `preparePipeline` - just one step in the compilation process
|
|
6794
6839
|
*
|
|
6795
|
-
* Note: This function does not validate logic of the pipeline only the
|
|
6840
|
+
* Note: This function does not validate logic of the pipeline only the parsing
|
|
6796
6841
|
* Note: This function acts as compilation process
|
|
6797
6842
|
*
|
|
6798
6843
|
* @param pipelineString {Promptbook} in string markdown format (.ptbk.md)
|
|
@@ -6889,10 +6934,7 @@
|
|
|
6889
6934
|
var _loop_1 = function (listItem) {
|
|
6890
6935
|
// TODO: [🥥] Maybe move this logic to `$parseAndApplyPipelineHeadCommands`
|
|
6891
6936
|
var command = parseCommand(listItem, 'PIPELINE_HEAD');
|
|
6892
|
-
var commandParser =
|
|
6893
|
-
if (commandParser === undefined) {
|
|
6894
|
-
throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Command ".concat(command.type, " parser is not found \uD83C\uDF4E\n\n ").concat(block(getPipelineIdentification()), "\n "); }));
|
|
6895
|
-
}
|
|
6937
|
+
var commandParser = getParserForCommand(command);
|
|
6896
6938
|
if (commandParser.isUsedInPipelineHead !== true /* <- Note: [🦦][4] */) {
|
|
6897
6939
|
throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n Command ".concat(command.type, " is not allowed in the head of the promptbook ONLY at the pipeline template\n\n ").concat(block(getPipelineIdentification()), "\n "); })); // <- TODO: [🚞]
|
|
6898
6940
|
}
|
|
@@ -6941,9 +6983,9 @@
|
|
|
6941
6983
|
description_1 = undefined;
|
|
6942
6984
|
}
|
|
6943
6985
|
var $templateJson = {
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6986
|
+
isTemplateTypeSet: false,
|
|
6987
|
+
isTemplate: true,
|
|
6988
|
+
templateType: undefined /* <- Note: [🍙] Putting here placeholder to keep `templateType` on top at final JSON */,
|
|
6947
6989
|
name: titleToName(section.title),
|
|
6948
6990
|
title: section.title,
|
|
6949
6991
|
description: description_1,
|
|
@@ -6965,15 +7007,12 @@
|
|
|
6965
7007
|
// Note: If block type is not set, set it to 'PROMPT_TEMPLATE'
|
|
6966
7008
|
if (commands.some(function (_a) {
|
|
6967
7009
|
var command = _a.command;
|
|
6968
|
-
return command.type === '
|
|
7010
|
+
return command.type === 'TEMPLATE';
|
|
6969
7011
|
}) === false) {
|
|
6970
|
-
|
|
7012
|
+
templateCommandParser.$applyToTemplateJson({ type: 'TEMPLATE', templateType: 'PROMPT_TEMPLATE' }, $templateJson, $pipelineJson);
|
|
6971
7013
|
}
|
|
6972
7014
|
var _loop_3 = function (listItem, command) {
|
|
6973
|
-
var commandParser =
|
|
6974
|
-
if (commandParser === undefined) {
|
|
6975
|
-
throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Command ".concat(command.type, " parser is not found \uD83C\uDF4F\n\n ").concat(block(getPipelineIdentification()), "\n "); }));
|
|
6976
|
-
}
|
|
7015
|
+
var commandParser = getParserForCommand(command);
|
|
6977
7016
|
if (commandParser.isUsedInPipelineTemplate !== true /* <- Note: [🦦][4] */) {
|
|
6978
7017
|
throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n Command ".concat(command.type, " is not allowed in the template of the promptbook ONLY at the pipeline head\n\n ").concat(block(getPipelineIdentification()), "\n "); })); // <- TODO: [🚞]
|
|
6979
7018
|
}
|
|
@@ -6988,16 +7027,13 @@
|
|
|
6988
7027
|
}
|
|
6989
7028
|
throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n Command ".concat(command.type, " failed to apply to the template\n\n The error:\n ").concat(block(error.message), "\n\n Current state of the template:\n ").concat(block(JSON.stringify($templateJson, null, 4)), "\n <- Maybe wrong order of commands?\n\n Raw command:\n - ").concat(listItem, "\n\n Usage of ").concat(command.type, ":\n ").concat(block(commandParser.examples.map(function (example) { return "- ".concat(example); }).join('\n')), "\n\n ").concat(block(getPipelineIdentification()), "\n "); })); // <- TODO: [🚞]
|
|
6990
7029
|
}
|
|
6991
|
-
// TODO: !!!!!! Multiple problematic things in BLOCK command - blockCommandParser.$applyToTemplateJson
|
|
6992
7030
|
if (command.type === 'PARAMETER') {
|
|
6993
7031
|
defineParam(command);
|
|
6994
7032
|
// <- Note: [🍣]
|
|
6995
7033
|
}
|
|
6996
7034
|
};
|
|
6997
7035
|
try {
|
|
6998
|
-
// TODO
|
|
6999
|
-
// TODO: !!!!!! Test error situation when `MODEL` is used before `SIMPLE BLOCK`
|
|
7000
|
-
// TODO [♓️] List commands and before apply order them
|
|
7036
|
+
// TODO [♓️] List commands and before apply order them to achieve order-agnostic commands
|
|
7001
7037
|
for (var commands_1 = (e_3 = void 0, __values(commands)), commands_1_1 = commands_1.next(); !commands_1_1.done; commands_1_1 = commands_1.next()) {
|
|
7002
7038
|
var _f = commands_1_1.value, listItem = _f.listItem, command = _f.command;
|
|
7003
7039
|
_loop_3(listItem, command);
|
|
@@ -7010,8 +7046,8 @@
|
|
|
7010
7046
|
}
|
|
7011
7047
|
finally { if (e_3) throw e_3.error; }
|
|
7012
7048
|
}
|
|
7013
|
-
// TODO: [🍧]
|
|
7014
|
-
if ($templateJson.
|
|
7049
|
+
// TODO: [🍧] Should be done in TEMPLATE command
|
|
7050
|
+
if ($templateJson.templateType === 'SCRIPT_TEMPLATE') {
|
|
7015
7051
|
if (!language) {
|
|
7016
7052
|
throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n You must specify the language of the script in the SCRIPT TEMPLATE\n\n ".concat(block(getPipelineIdentification()), "\n "); }));
|
|
7017
7053
|
}
|
|
@@ -7023,15 +7059,13 @@
|
|
|
7023
7059
|
}
|
|
7024
7060
|
$templateJson.dependentParameterNames = Array.from(extractParameterNamesFromTemplate($templateJson));
|
|
7025
7061
|
/*
|
|
7026
|
-
// TODO: [🍧]
|
|
7027
|
-
|
|
7028
|
-
// TODO: [🍧] !!!!!! `PERSONA` command should behave same as `MODEL` command - only usable in prompt template
|
|
7029
|
-
if ($templateJson.blockType !== 'PROMPT_TEMPLATE' && $templateJson.modelRequirements !== undefined) {
|
|
7062
|
+
// TODO: [🍧] This should be checked in `MODEL` command + better error message
|
|
7063
|
+
if ($templateJson.templateType !== 'PROMPT_TEMPLATE' && $templateJson.modelRequirements !== undefined) {
|
|
7030
7064
|
throw new UnexpectedError(
|
|
7031
7065
|
spaceTrim(
|
|
7032
7066
|
(block) => `
|
|
7033
7067
|
Model requirements are defined for the block type ${
|
|
7034
|
-
$templateJson.
|
|
7068
|
+
$templateJson.templateType
|
|
7035
7069
|
} which is not a PROMPT TEMPLATE
|
|
7036
7070
|
|
|
7037
7071
|
This should be avoided by the \`modelCommandParser\`
|
|
@@ -7042,9 +7076,9 @@
|
|
|
7042
7076
|
);
|
|
7043
7077
|
}
|
|
7044
7078
|
*/
|
|
7045
|
-
if ($templateJson.
|
|
7046
|
-
delete $templateJson.
|
|
7047
|
-
delete $templateJson.
|
|
7079
|
+
if ($templateJson.isTemplate) {
|
|
7080
|
+
delete $templateJson.isTemplateTypeSet;
|
|
7081
|
+
delete $templateJson.isTemplate;
|
|
7048
7082
|
// TODO: [🍙] Maybe do reorder of `$templateJson` here
|
|
7049
7083
|
$pipelineJson.templates.push($templateJson);
|
|
7050
7084
|
}
|
|
@@ -7052,7 +7086,7 @@
|
|
|
7052
7086
|
try {
|
|
7053
7087
|
// =============================================================
|
|
7054
7088
|
// Note: 4️⃣ Process each template of the pipeline
|
|
7055
|
-
|
|
7089
|
+
for (var pipelineSections_1 = __values(pipelineSections), pipelineSections_1_1 = pipelineSections_1.next(); !pipelineSections_1_1.done; pipelineSections_1_1 = pipelineSections_1.next()) {
|
|
7056
7090
|
var section = pipelineSections_1_1.value;
|
|
7057
7091
|
_loop_2(section);
|
|
7058
7092
|
}
|
|
@@ -7125,7 +7159,7 @@
|
|
|
7125
7159
|
* - `pipelineStringToJsonSync` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
|
|
7126
7160
|
* - `preparePipeline` - just one step in the compilation process
|
|
7127
7161
|
*
|
|
7128
|
-
* Note: This function does not validate logic of the pipeline only the
|
|
7162
|
+
* Note: This function does not validate logic of the pipeline only the parsing
|
|
7129
7163
|
* Note: This function acts as compilation process
|
|
7130
7164
|
*
|
|
7131
7165
|
* @param pipelineString {Promptbook} in string markdown format (.ptbk.md)
|
|
@@ -7185,7 +7219,6 @@
|
|
|
7185
7219
|
return content.replace(heading, "<!--".concat(sectionName, "-->\n").concat(warningLine, "\n").concat(sectionContent, "\n<!--/").concat(sectionName, "-->\n\n").concat(heading));
|
|
7186
7220
|
}
|
|
7187
7221
|
/**
|
|
7188
|
-
* TODO: !!!!!! Somw way how to connect this with commands
|
|
7189
7222
|
* TODO: [🏛] This can be part of markdown builder
|
|
7190
7223
|
*/
|
|
7191
7224
|
|
|
@@ -8405,7 +8438,6 @@
|
|
|
8405
8438
|
|
|
8406
8439
|
exports.$llmToolsMetadataRegister = $llmToolsMetadataRegister;
|
|
8407
8440
|
exports.$llmToolsRegister = $llmToolsRegister;
|
|
8408
|
-
exports.BlockTypes = BlockTypes;
|
|
8409
8441
|
exports.CLAIM = CLAIM;
|
|
8410
8442
|
exports.CallbackInterfaceTools = CallbackInterfaceTools;
|
|
8411
8443
|
exports.CollectionError = CollectionError;
|
|
@@ -8436,6 +8468,7 @@
|
|
|
8436
8468
|
exports.PipelineUrlError = PipelineUrlError;
|
|
8437
8469
|
exports.PrefixStorage = PrefixStorage;
|
|
8438
8470
|
exports.RESERVED_PARAMETER_NAMES = RESERVED_PARAMETER_NAMES;
|
|
8471
|
+
exports.TemplateTypes = TemplateTypes;
|
|
8439
8472
|
exports.UnexpectedError = UnexpectedError;
|
|
8440
8473
|
exports.ZERO_USAGE = ZERO_USAGE;
|
|
8441
8474
|
exports._AnthropicClaudeMetadataRegistration = _AnthropicClaudeMetadataRegistration;
|