@promptbook/node 0.75.0-2 → 0.75.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/README.md +46 -30
- package/esm/index.es.js +178 -105
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +16 -4
- package/esm/typings/src/_packages/types.index.d.ts +8 -6
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/commands/EXPECT/ExpectCommand.d.ts +1 -1
- package/esm/typings/src/commands/SECTION/SectionCommand.d.ts +1 -1
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +0 -2
- package/esm/typings/src/config.d.ts +34 -2
- package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
- package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +2 -2
- package/esm/typings/src/conversion/utils/extractParameterNamesFromTask.d.ts +3 -3
- package/esm/typings/src/conversion/utils/renameParameter.d.ts +2 -2
- package/esm/typings/src/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +1 -1
- package/esm/typings/src/execution/ScriptExecutionTools.d.ts +1 -1
- package/esm/typings/src/formfactors/_boilerplate/BoilerplateFormfactorDefinition.d.ts +2 -2
- package/esm/typings/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +3 -0
- package/esm/typings/src/formfactors/chatbot/ChatbotFormfactorDefinition.d.ts +32 -2
- package/esm/typings/src/formfactors/generator/GeneratorFormfactorDefinition.d.ts +14 -0
- package/esm/typings/src/formfactors/generic/GenericFormfactorDefinition.d.ts +2 -2
- package/esm/typings/src/formfactors/index.d.ts +72 -10
- package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +2 -2
- package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +12 -2
- package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +12 -2
- package/esm/typings/src/pipeline/PipelineInterface/PipelineInterface.d.ts +5 -4
- package/esm/typings/src/pipeline/PipelineInterface/constants.d.ts +2 -2
- package/esm/typings/src/pipeline/PipelineJson/{TaskJsonCommon.d.ts → CommonTaskJson.d.ts} +13 -13
- package/esm/typings/src/pipeline/PipelineJson/DialogTaskJson.d.ts +2 -2
- package/esm/typings/src/pipeline/PipelineJson/ParameterJson.d.ts +2 -0
- package/esm/typings/src/pipeline/PipelineJson/PersonaJson.d.ts +1 -1
- package/esm/typings/src/pipeline/PipelineJson/PipelineJson.d.ts +2 -2
- package/esm/typings/src/pipeline/PipelineJson/PromptTaskJson.d.ts +2 -2
- package/esm/typings/src/pipeline/PipelineJson/ScriptTaskJson.d.ts +2 -2
- package/esm/typings/src/pipeline/PipelineJson/SimpleTaskJson.d.ts +2 -2
- package/esm/typings/src/pipeline/PipelineJson/TaskJson.d.ts +1 -1
- package/esm/typings/src/pipeline/PipelineString.d.ts +1 -1
- package/esm/typings/src/prepare/isPipelinePrepared.d.ts +1 -1
- package/esm/typings/src/prepare/prepareTasks.d.ts +5 -5
- package/esm/typings/src/types/Prompt.d.ts +3 -3
- package/esm/typings/src/types/SectionType.d.ts +21 -0
- package/esm/typings/src/types/TaskProgress.d.ts +1 -1
- package/esm/typings/src/types/TaskType.d.ts +15 -0
- package/esm/typings/src/types/typeAliases.d.ts +1 -1
- package/esm/typings/src/utils/organization/TODO_remove_as.d.ts +6 -0
- package/esm/typings/src/utils/organization/spaceTrim.d.ts +11 -0
- package/esm/typings/src/utils/parameters/extractParameterNames.d.ts +1 -1
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +178 -105
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/commands/SECTION/SectionType.d.ts +0 -13
- /package/esm/typings/{promptbook-collection → books}/index.d.ts +0 -0
package/umd/index.umd.js
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
*
|
|
44
44
|
* @see https://github.com/webgptorg/promptbook
|
|
45
45
|
*/
|
|
46
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.75.0
|
|
46
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.75.0';
|
|
47
47
|
/**
|
|
48
48
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
49
49
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -381,7 +381,6 @@
|
|
|
381
381
|
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
382
382
|
*/
|
|
383
383
|
|
|
384
|
-
// <- TODO: [🐊] Pick the best claim
|
|
385
384
|
/**
|
|
386
385
|
* When the title is not provided, the default title is used
|
|
387
386
|
*
|
|
@@ -566,7 +565,7 @@
|
|
|
566
565
|
return isInput;
|
|
567
566
|
})), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
568
567
|
var parameter = _h.value;
|
|
569
|
-
commands.push("INPUT PARAMETER ".concat(
|
|
568
|
+
commands.push("INPUT PARAMETER ".concat(taskParameterJsonToString(parameter)));
|
|
570
569
|
}
|
|
571
570
|
}
|
|
572
571
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
@@ -582,7 +581,7 @@
|
|
|
582
581
|
return isOutput;
|
|
583
582
|
})), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
584
583
|
var parameter = _k.value;
|
|
585
|
-
commands.push("OUTPUT PARAMETER ".concat(
|
|
584
|
+
commands.push("OUTPUT PARAMETER ".concat(taskParameterJsonToString(parameter)));
|
|
586
585
|
}
|
|
587
586
|
}
|
|
588
587
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
@@ -596,12 +595,12 @@
|
|
|
596
595
|
pipelineString += commands.map(function (command) { return "- ".concat(command); }).join('\n');
|
|
597
596
|
try {
|
|
598
597
|
for (var tasks_1 = __values(tasks), tasks_1_1 = tasks_1.next(); !tasks_1_1.done; tasks_1_1 = tasks_1.next()) {
|
|
599
|
-
var
|
|
598
|
+
var task = tasks_1_1.value;
|
|
600
599
|
var
|
|
601
600
|
/* Note: Not using:> name, */
|
|
602
|
-
title_1 =
|
|
601
|
+
title_1 = task.title, description_1 = task.description,
|
|
603
602
|
/* Note: dependentParameterNames, */
|
|
604
|
-
jokers =
|
|
603
|
+
jokers = task.jokerParameterNames, taskType = task.taskType, content = task.content, postprocessing = task.postprocessingFunctionNames, expectations = task.expectations, format = task.format, resultingParameterName = task.resultingParameterName;
|
|
605
604
|
pipelineString += '\n\n';
|
|
606
605
|
pipelineString += "## ".concat(title_1);
|
|
607
606
|
if (description_1) {
|
|
@@ -611,9 +610,10 @@
|
|
|
611
610
|
var commands_1 = [];
|
|
612
611
|
var contentLanguage = 'text';
|
|
613
612
|
if (taskType === 'PROMPT_TASK') {
|
|
614
|
-
var modelRequirements =
|
|
613
|
+
var modelRequirements = task.modelRequirements;
|
|
615
614
|
var _l = modelRequirements || {}, modelName = _l.modelName, modelVariant = _l.modelVariant;
|
|
616
|
-
|
|
615
|
+
// Note: Do nothing, it is default
|
|
616
|
+
// commands.push(`PROMPT`);
|
|
617
617
|
if (modelVariant) {
|
|
618
618
|
commands_1.push("MODEL VARIANT ".concat(capitalize(modelVariant)));
|
|
619
619
|
}
|
|
@@ -626,16 +626,16 @@
|
|
|
626
626
|
// Note: Nothing special here
|
|
627
627
|
}
|
|
628
628
|
else if (taskType === 'SCRIPT_TASK') {
|
|
629
|
-
commands_1.push("SCRIPT
|
|
630
|
-
if (
|
|
631
|
-
contentLanguage =
|
|
629
|
+
commands_1.push("SCRIPT");
|
|
630
|
+
if (task.contentLanguage) {
|
|
631
|
+
contentLanguage = task.contentLanguage;
|
|
632
632
|
}
|
|
633
633
|
else {
|
|
634
634
|
contentLanguage = '';
|
|
635
635
|
}
|
|
636
636
|
}
|
|
637
637
|
else if (taskType === 'DIALOG_TASK') {
|
|
638
|
-
commands_1.push("DIALOG
|
|
638
|
+
commands_1.push("DIALOG");
|
|
639
639
|
// Note: Nothing special here
|
|
640
640
|
} // <- }else if([🅱]
|
|
641
641
|
if (jokers) {
|
|
@@ -710,7 +710,7 @@
|
|
|
710
710
|
pipelineString += '\n';
|
|
711
711
|
pipelineString += '```';
|
|
712
712
|
pipelineString += '\n\n';
|
|
713
|
-
pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: [main] !!! If the parameter here has description, add it and use
|
|
713
|
+
pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: [main] !!! If the parameter here has description, add it and use taskParameterJsonToString
|
|
714
714
|
}
|
|
715
715
|
}
|
|
716
716
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
@@ -725,8 +725,8 @@
|
|
|
725
725
|
/**
|
|
726
726
|
* @private internal utility of `pipelineJsonToString`
|
|
727
727
|
*/
|
|
728
|
-
function
|
|
729
|
-
var name =
|
|
728
|
+
function taskParameterJsonToString(taskParameterJson) {
|
|
729
|
+
var name = taskParameterJson.name, description = taskParameterJson.description;
|
|
730
730
|
var parameterString = "{".concat(name, "}");
|
|
731
731
|
if (description) {
|
|
732
732
|
parameterString = "".concat(parameterString, " ").concat(description);
|
|
@@ -734,7 +734,7 @@
|
|
|
734
734
|
return parameterString;
|
|
735
735
|
}
|
|
736
736
|
/**
|
|
737
|
-
* TODO: [🛋] Implement new features and commands into `pipelineJsonToString` + `
|
|
737
|
+
* TODO: [🛋] Implement new features and commands into `pipelineJsonToString` + `taskParameterJsonToString` , use `stringifyCommand`
|
|
738
738
|
* TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
|
|
739
739
|
* TODO: [🏛] Maybe make some markdown builder
|
|
740
740
|
* TODO: [🏛] Escape all
|
|
@@ -1379,7 +1379,7 @@
|
|
|
1379
1379
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
1380
1380
|
*/
|
|
1381
1381
|
|
|
1382
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",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:"./
|
|
1382
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",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:"./books/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",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:"./books/prepare-knowledge-keywords.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",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:"./books/prepare-knowledge-title.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",formfactorName:"GENERIC",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}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\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:"./books/prepare-persona.book.md"}];
|
|
1383
1383
|
|
|
1384
1384
|
/**
|
|
1385
1385
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
@@ -1772,20 +1772,20 @@
|
|
|
1772
1772
|
}
|
|
1773
1773
|
finally { if (e_3) throw e_3.error; }
|
|
1774
1774
|
}
|
|
1775
|
-
var
|
|
1775
|
+
var unresovedTasks = __spreadArray([], __read(pipeline.tasks), false);
|
|
1776
1776
|
var loopLimit = LOOP_LIMIT;
|
|
1777
1777
|
var _loop_3 = function () {
|
|
1778
1778
|
if (loopLimit-- < 0) {
|
|
1779
1779
|
// Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
|
|
1780
1780
|
throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Loop limit reached during detection of circular dependencies in `validatePipeline`\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
1781
1781
|
}
|
|
1782
|
-
var
|
|
1782
|
+
var currentlyResovedTasks = unresovedTasks.filter(function (task) {
|
|
1783
1783
|
return task.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
|
|
1784
1784
|
});
|
|
1785
|
-
if (
|
|
1785
|
+
if (currentlyResovedTasks.length === 0) {
|
|
1786
1786
|
throw new PipelineLogicError(
|
|
1787
1787
|
// TODO: [🐎] DRY
|
|
1788
|
-
spaceTrim.spaceTrim(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(
|
|
1788
|
+
spaceTrim.spaceTrim(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTasks
|
|
1789
1789
|
.map(function (_a) {
|
|
1790
1790
|
var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
|
|
1791
1791
|
return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
|
|
@@ -1804,13 +1804,13 @@
|
|
|
1804
1804
|
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
1805
1805
|
.join('\n')), "\n\n\n "); }));
|
|
1806
1806
|
}
|
|
1807
|
-
resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(
|
|
1807
|
+
resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTasks.map(function (_a) {
|
|
1808
1808
|
var resultingParameterName = _a.resultingParameterName;
|
|
1809
1809
|
return resultingParameterName;
|
|
1810
1810
|
})), false);
|
|
1811
|
-
|
|
1811
|
+
unresovedTasks = unresovedTasks.filter(function (task) { return !currentlyResovedTasks.includes(task); });
|
|
1812
1812
|
};
|
|
1813
|
-
while (
|
|
1813
|
+
while (unresovedTasks.length > 0) {
|
|
1814
1814
|
_loop_3();
|
|
1815
1815
|
}
|
|
1816
1816
|
// TODO: !!!!!! Test that pipeline interface implements declared formfactor interface
|
|
@@ -1872,7 +1872,7 @@
|
|
|
1872
1872
|
/**
|
|
1873
1873
|
* Parses the task and returns the list of all parameter names
|
|
1874
1874
|
*
|
|
1875
|
-
* @param template the
|
|
1875
|
+
* @param template the string template with parameters in {curly} braces
|
|
1876
1876
|
* @returns the list of parameter names
|
|
1877
1877
|
* @public exported from `@promptbook/utils`
|
|
1878
1878
|
*/
|
|
@@ -1906,13 +1906,13 @@
|
|
|
1906
1906
|
var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources, tasks = pipeline.tasks;
|
|
1907
1907
|
personas = personas.map(function (persona) { return (__assign(__assign({}, persona), { modelRequirements: undefined, preparationIds: undefined })); });
|
|
1908
1908
|
knowledgeSources = knowledgeSources.map(function (knowledgeSource) { return (__assign(__assign({}, knowledgeSource), { preparationIds: undefined })); });
|
|
1909
|
-
tasks = tasks.map(function (
|
|
1910
|
-
var dependentParameterNames =
|
|
1911
|
-
var parameterNames = extractParameterNames(
|
|
1909
|
+
tasks = tasks.map(function (task) {
|
|
1910
|
+
var dependentParameterNames = task.dependentParameterNames;
|
|
1911
|
+
var parameterNames = extractParameterNames(task.preparedContent || '');
|
|
1912
1912
|
dependentParameterNames = dependentParameterNames.filter(function (dependentParameterName) { return !parameterNames.has(dependentParameterName); });
|
|
1913
|
-
var
|
|
1914
|
-
delete
|
|
1915
|
-
return
|
|
1913
|
+
var taskUnprepared = __assign(__assign({}, task), { dependentParameterNames: dependentParameterNames });
|
|
1914
|
+
delete taskUnprepared.preparedContent;
|
|
1915
|
+
return taskUnprepared;
|
|
1916
1916
|
});
|
|
1917
1917
|
return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), { tasks: tasks, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }));
|
|
1918
1918
|
}
|
|
@@ -2205,7 +2205,7 @@
|
|
|
2205
2205
|
* TODO: [🐠] Maybe base this on `makeValidator`
|
|
2206
2206
|
* TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
|
|
2207
2207
|
* TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
|
|
2208
|
-
* - [🏍] ? Is context in each
|
|
2208
|
+
* - [🏍] ? Is context in each task
|
|
2209
2209
|
* - [♨] Are examples prepared
|
|
2210
2210
|
* - [♨] Are tasks prepared
|
|
2211
2211
|
*/
|
|
@@ -2277,16 +2277,16 @@
|
|
|
2277
2277
|
*/
|
|
2278
2278
|
|
|
2279
2279
|
/**
|
|
2280
|
-
* Parses the
|
|
2280
|
+
* Parses the task and returns the set of all used parameters
|
|
2281
2281
|
*
|
|
2282
|
-
* @param
|
|
2282
|
+
* @param task the task with used parameters
|
|
2283
2283
|
* @returns the set of parameter names
|
|
2284
2284
|
* @throws {ParseError} if the script is invalid
|
|
2285
2285
|
* @public exported from `@promptbook/utils`
|
|
2286
2286
|
*/
|
|
2287
|
-
function extractParameterNamesFromTask(
|
|
2287
|
+
function extractParameterNamesFromTask(task) {
|
|
2288
2288
|
var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
|
|
2289
|
-
var title =
|
|
2289
|
+
var title = task.title, description = task.description, taskType = task.taskType, content = task.content, preparedContent = task.preparedContent, jokerParameterNames = task.jokerParameterNames, foreach = task.foreach;
|
|
2290
2290
|
var parameterNames = new Set();
|
|
2291
2291
|
try {
|
|
2292
2292
|
for (var _e = __values(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(extractParameterNames(title)), false), __read(extractParameterNames(description || '')), false), __read(extractParameterNames(content)), false), __read(extractParameterNames(preparedContent || '')), false)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
@@ -5331,10 +5331,10 @@
|
|
|
5331
5331
|
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a;
|
|
5332
5332
|
tasks = pipeline.tasks, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
|
|
5333
5333
|
tasksPrepared = new Array(tasks.length);
|
|
5334
|
-
return [4 /*yield*/, forEachAsync(tasks, { maxParallelCount: maxParallelCount /* <- TODO: [🪂] When there are subtasks, this maximul limit can be broken */ }, function (
|
|
5335
|
-
var dependentParameterNames, preparedContent,
|
|
5334
|
+
return [4 /*yield*/, forEachAsync(tasks, { maxParallelCount: maxParallelCount /* <- TODO: [🪂] When there are subtasks, this maximul limit can be broken */ }, function (task, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
5335
|
+
var dependentParameterNames, preparedContent, preparedTask;
|
|
5336
5336
|
return __generator(this, function (_a) {
|
|
5337
|
-
dependentParameterNames =
|
|
5337
|
+
dependentParameterNames = task.dependentParameterNames;
|
|
5338
5338
|
preparedContent = undefined;
|
|
5339
5339
|
if (knowledgePiecesCount > 0 && !dependentParameterNames.includes('knowledge')) {
|
|
5340
5340
|
preparedContent = spaceTrim.spaceTrim("\n {content}\n\n ## Knowledge\n\n {knowledge}\n ");
|
|
@@ -5343,8 +5343,8 @@
|
|
|
5343
5343
|
'knowledge',
|
|
5344
5344
|
], false);
|
|
5345
5345
|
}
|
|
5346
|
-
|
|
5347
|
-
tasksPrepared[index] =
|
|
5346
|
+
preparedTask = __assign(__assign({}, task), { dependentParameterNames: dependentParameterNames, preparedContent: preparedContent });
|
|
5347
|
+
tasksPrepared[index] = preparedTask;
|
|
5348
5348
|
return [2 /*return*/];
|
|
5349
5349
|
});
|
|
5350
5350
|
}); })];
|
|
@@ -5356,8 +5356,8 @@
|
|
|
5356
5356
|
});
|
|
5357
5357
|
}
|
|
5358
5358
|
/**
|
|
5359
|
-
* TODO: [🧠] Add context to each
|
|
5360
|
-
* TODO: [🧠] What is better name `
|
|
5359
|
+
* TODO: [🧠] Add context to each task (if missing)
|
|
5360
|
+
* TODO: [🧠] What is better name `prepareTask` or `prepareTaskAndParameters`
|
|
5361
5361
|
* TODO: [♨][main] !!! Prepare index the examples and maybe tasks
|
|
5362
5362
|
* TODO: Write tests for `preparePipeline`
|
|
5363
5363
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
@@ -5443,7 +5443,7 @@
|
|
|
5443
5443
|
})];
|
|
5444
5444
|
case 3:
|
|
5445
5445
|
tasksPrepared = (_c.sent()).tasksPrepared;
|
|
5446
|
-
// ----- /
|
|
5446
|
+
// ----- /Tasks preparation -----
|
|
5447
5447
|
// Note: Count total usage
|
|
5448
5448
|
currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
|
|
5449
5449
|
return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { tasks: __spreadArray([], __read(tasksPrepared), false),
|
|
@@ -5462,6 +5462,40 @@
|
|
|
5462
5462
|
* @see https://docs.anthropic.com/en/docs/test-and-evaluate/strengthen-guardrails/increase-consistency#specify-the-desired-output-format
|
|
5463
5463
|
*/
|
|
5464
5464
|
|
|
5465
|
+
/**
|
|
5466
|
+
* All available task types
|
|
5467
|
+
*
|
|
5468
|
+
* There is is distinction between task types and section types
|
|
5469
|
+
* - Every section in markdown has its SectionType
|
|
5470
|
+
* - Some sections are tasks but other can be non-task sections
|
|
5471
|
+
*
|
|
5472
|
+
* @public exported from `@promptbook/core`
|
|
5473
|
+
*/
|
|
5474
|
+
var TaskTypes = [
|
|
5475
|
+
'PROMPT',
|
|
5476
|
+
'SIMPLE',
|
|
5477
|
+
'SCRIPT',
|
|
5478
|
+
'DIALOG',
|
|
5479
|
+
// <- [🅱]
|
|
5480
|
+
];
|
|
5481
|
+
|
|
5482
|
+
/**
|
|
5483
|
+
* All available sections which are not tasks
|
|
5484
|
+
*
|
|
5485
|
+
* @public exported from `@promptbook/core`
|
|
5486
|
+
*/
|
|
5487
|
+
var NonTaskSectionTypes = ['EXAMPLE', 'KNOWLEDGE', 'INSTRUMENT', 'ACTION'];
|
|
5488
|
+
/**
|
|
5489
|
+
* All available section types
|
|
5490
|
+
*
|
|
5491
|
+
* There is is distinction between task types and section types
|
|
5492
|
+
* - Every section in markdown has its SectionType
|
|
5493
|
+
* - Some sections are tasks but other can be non-task sections
|
|
5494
|
+
*
|
|
5495
|
+
* @public exported from `@promptbook/core`
|
|
5496
|
+
*/
|
|
5497
|
+
var SectionTypes = __spreadArray(__spreadArray([], __read(TaskTypes.map(function (TaskType) { return "".concat(TaskType, "_TASK"); })), false), __read(NonTaskSectionTypes), false);
|
|
5498
|
+
|
|
5465
5499
|
/**
|
|
5466
5500
|
* Parses the knowledge command
|
|
5467
5501
|
*
|
|
@@ -5554,24 +5588,6 @@
|
|
|
5554
5588
|
* Note: [⛱] There are two types of KNOWLEDGE commands *...(read more in [⛱])*
|
|
5555
5589
|
*/
|
|
5556
5590
|
|
|
5557
|
-
/**
|
|
5558
|
-
* Section type describes the way how the section is sectiond
|
|
5559
|
-
*
|
|
5560
|
-
* @public exported from `@promptbook/core`
|
|
5561
|
-
*/
|
|
5562
|
-
var SectionTypes = [
|
|
5563
|
-
'PROMPT_TASK',
|
|
5564
|
-
'SIMPLE_TASK',
|
|
5565
|
-
'SCRIPT_TASK',
|
|
5566
|
-
'DIALOG_TASK',
|
|
5567
|
-
'EXAMPLE',
|
|
5568
|
-
'KNOWLEDGE',
|
|
5569
|
-
'INSTRUMENT',
|
|
5570
|
-
'ACTION',
|
|
5571
|
-
// <- [🅱]
|
|
5572
|
-
];
|
|
5573
|
-
// <- TODO: !!!!!! Make alongside `SectionType` the `TaskType`, `TaskType` + [⛱] and ACRY
|
|
5574
|
-
|
|
5575
5591
|
/**
|
|
5576
5592
|
* Parses the section command
|
|
5577
5593
|
*
|
|
@@ -5659,7 +5675,10 @@
|
|
|
5659
5675
|
var normalized = input.normalized;
|
|
5660
5676
|
normalized = normalized.split('SAMPLE').join('EXAMPLE');
|
|
5661
5677
|
normalized = normalized.split('EXECUTE_').join('');
|
|
5662
|
-
|
|
5678
|
+
normalized = normalized.split('DIALOGUE').join('DIALOG');
|
|
5679
|
+
var taskTypes = SectionTypes.filter(function (sectionType) {
|
|
5680
|
+
return normalized.includes(sectionType.split('_TASK').join(''));
|
|
5681
|
+
});
|
|
5663
5682
|
if (taskTypes.length !== 1) {
|
|
5664
5683
|
throw new ParseError(spaceTrim__default["default"](function (block) { return "\n Unknown section type \"".concat(normalized, "\"\n\n Supported section types are:\n ").concat(block(SectionTypes.join(', ')), "\n "); }));
|
|
5665
5684
|
}
|
|
@@ -6018,7 +6037,7 @@
|
|
|
6018
6037
|
/**
|
|
6019
6038
|
* Description of the FORMAT command
|
|
6020
6039
|
*/
|
|
6021
|
-
description: spaceTrim__default["default"]("\n Expect command describes the desired output of the
|
|
6040
|
+
description: spaceTrim__default["default"]("\n Expect command describes the desired output of the task *(after post-processing)*\n It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs or some other shape of the output.\n "),
|
|
6022
6041
|
/**
|
|
6023
6042
|
* Link to documentation
|
|
6024
6043
|
*/
|
|
@@ -6504,7 +6523,7 @@
|
|
|
6504
6523
|
/**
|
|
6505
6524
|
* Description of the FORMAT command
|
|
6506
6525
|
*/
|
|
6507
|
-
description: spaceTrim__default["default"]("\n Format command describes the desired output of the
|
|
6526
|
+
description: spaceTrim__default["default"]("\n Format command describes the desired output of the task (after post-processing)\n It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs or some other shape of the output.\n "),
|
|
6508
6527
|
/**
|
|
6509
6528
|
* Link to documentation
|
|
6510
6529
|
*/
|
|
@@ -6568,19 +6587,45 @@
|
|
|
6568
6587
|
description: "@@@",
|
|
6569
6588
|
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/174",
|
|
6570
6589
|
pipelineInterface: {
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6590
|
+
inputParameters: [
|
|
6591
|
+
{
|
|
6592
|
+
name: 'previousTitle',
|
|
6593
|
+
description: "Previous title of the conversation",
|
|
6594
|
+
isInput: true,
|
|
6595
|
+
isOutput: false,
|
|
6596
|
+
},
|
|
6597
|
+
{
|
|
6598
|
+
name: 'previousConversationSummary',
|
|
6599
|
+
description: "Previous conversation summary",
|
|
6600
|
+
isInput: true,
|
|
6601
|
+
isOutput: false,
|
|
6602
|
+
},
|
|
6603
|
+
{ name: 'userMessage', description: "User message", isInput: true, isOutput: false },
|
|
6604
|
+
],
|
|
6605
|
+
outputParameters: [
|
|
6606
|
+
{ name: 'title', description: "Title of the conversation", isInput: false, isOutput: true },
|
|
6607
|
+
{ name: 'conversationSummary', description: "Summary of the conversation", isInput: false, isOutput: true },
|
|
6608
|
+
{ name: 'chatbotResponse', description: "Chatbot response", isInput: false, isOutput: true },
|
|
6609
|
+
],
|
|
6610
|
+
},
|
|
6611
|
+
};
|
|
6582
6612
|
|
|
6583
|
-
|
|
6613
|
+
/**
|
|
6614
|
+
* Generator is form of app that @@@
|
|
6615
|
+
*
|
|
6616
|
+
* @public exported from `@promptbook/core`
|
|
6617
|
+
*/
|
|
6618
|
+
var GeneratorFormfactorDefinition = {
|
|
6619
|
+
name: 'GENERATOR',
|
|
6620
|
+
description: "@@@",
|
|
6621
|
+
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/184",
|
|
6622
|
+
pipelineInterface: {
|
|
6623
|
+
inputParameters: [
|
|
6624
|
+
/* @@@ */
|
|
6625
|
+
],
|
|
6626
|
+
outputParameters: [
|
|
6627
|
+
/* @@@ */
|
|
6628
|
+
],
|
|
6584
6629
|
},
|
|
6585
6630
|
};
|
|
6586
6631
|
|
|
@@ -6592,8 +6637,8 @@
|
|
|
6592
6637
|
* @public exported from `@promptbook/core`
|
|
6593
6638
|
*/
|
|
6594
6639
|
var GENERIC_PIPELINE_INTERFACE = {
|
|
6595
|
-
|
|
6596
|
-
|
|
6640
|
+
inputParameters: [],
|
|
6641
|
+
outputParameters: [],
|
|
6597
6642
|
};
|
|
6598
6643
|
/**
|
|
6599
6644
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -6621,10 +6666,10 @@
|
|
|
6621
6666
|
description: "@@@",
|
|
6622
6667
|
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/177",
|
|
6623
6668
|
pipelineInterface: {
|
|
6624
|
-
|
|
6669
|
+
inputParameters: [
|
|
6625
6670
|
/* @@@ */
|
|
6626
6671
|
],
|
|
6627
|
-
|
|
6672
|
+
outputParameters: [
|
|
6628
6673
|
/* @@@ */
|
|
6629
6674
|
],
|
|
6630
6675
|
},
|
|
@@ -6640,8 +6685,22 @@
|
|
|
6640
6685
|
description: "@@@",
|
|
6641
6686
|
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/176",
|
|
6642
6687
|
pipelineInterface: {
|
|
6643
|
-
|
|
6644
|
-
|
|
6688
|
+
inputParameters: [
|
|
6689
|
+
{
|
|
6690
|
+
name: 'inputSheet',
|
|
6691
|
+
description: "Input sheet to be processed as csv",
|
|
6692
|
+
isInput: true,
|
|
6693
|
+
isOutput: false,
|
|
6694
|
+
},
|
|
6695
|
+
],
|
|
6696
|
+
outputParameters: [
|
|
6697
|
+
{
|
|
6698
|
+
name: 'outputSheet',
|
|
6699
|
+
description: "Output sheet as csv",
|
|
6700
|
+
isInput: false,
|
|
6701
|
+
isOutput: true,
|
|
6702
|
+
},
|
|
6703
|
+
],
|
|
6645
6704
|
},
|
|
6646
6705
|
};
|
|
6647
6706
|
|
|
@@ -6655,9 +6714,23 @@
|
|
|
6655
6714
|
description: "@@@",
|
|
6656
6715
|
documentationUrl: "https://github.com/webgptorg/promptbook/discussions/175",
|
|
6657
6716
|
pipelineInterface: {
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6717
|
+
inputParameters: [
|
|
6718
|
+
{
|
|
6719
|
+
name: 'inputMessage',
|
|
6720
|
+
description: "Input message to be translated",
|
|
6721
|
+
isInput: true,
|
|
6722
|
+
isOutput: false,
|
|
6723
|
+
},
|
|
6724
|
+
],
|
|
6725
|
+
outputParameters: [
|
|
6726
|
+
{
|
|
6727
|
+
name: 'outputMessage',
|
|
6728
|
+
description: "Translated output message",
|
|
6729
|
+
isInput: false,
|
|
6730
|
+
isOutput: true,
|
|
6731
|
+
},
|
|
6732
|
+
],
|
|
6733
|
+
// <- TODO: [🤓] Maybe add {summary}
|
|
6661
6734
|
// <- TODO: [🧠] maybe change to {inputText}, {inputText} / or make system for any name of first input and first outpur parameter
|
|
6662
6735
|
},
|
|
6663
6736
|
};
|
|
@@ -6673,6 +6746,7 @@
|
|
|
6673
6746
|
TranslatorFormfactorDefinition,
|
|
6674
6747
|
SheetsFormfactorDefinition,
|
|
6675
6748
|
MatcherFormfactorDefinition,
|
|
6749
|
+
GeneratorFormfactorDefinition,
|
|
6676
6750
|
];
|
|
6677
6751
|
/**
|
|
6678
6752
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -6785,7 +6859,7 @@
|
|
|
6785
6859
|
/**
|
|
6786
6860
|
* Description of the JOKER command
|
|
6787
6861
|
*/
|
|
6788
|
-
description: "Joker parameter is used instead of executing the
|
|
6862
|
+
description: "Joker parameter is used instead of executing the task result if jokers value meets the expectations requirements",
|
|
6789
6863
|
/**
|
|
6790
6864
|
* Link to documentation
|
|
6791
6865
|
*/
|
|
@@ -7013,7 +7087,7 @@
|
|
|
7013
7087
|
/**
|
|
7014
7088
|
* Description of the PARAMETER command
|
|
7015
7089
|
*/
|
|
7016
|
-
description: "Describes one parameter of the
|
|
7090
|
+
description: "Describes one parameter of the task",
|
|
7017
7091
|
/**
|
|
7018
7092
|
* Link to documentation
|
|
7019
7093
|
*/
|
|
@@ -7369,7 +7443,7 @@
|
|
|
7369
7443
|
spaceTrim(
|
|
7370
7444
|
`
|
|
7371
7445
|
URL must not contain hash
|
|
7372
|
-
Hash is used for identification of the
|
|
7446
|
+
Hash is used for identification of the section of the pipeline
|
|
7373
7447
|
`,
|
|
7374
7448
|
),
|
|
7375
7449
|
);
|
|
@@ -7425,7 +7499,7 @@
|
|
|
7425
7499
|
/**
|
|
7426
7500
|
* Description of the ACTION command
|
|
7427
7501
|
*/
|
|
7428
|
-
description: "Actions influences from the pipeline or
|
|
7502
|
+
description: "Actions influences from the pipeline or task into external world. Like turning on a light, sending an email, etc.",
|
|
7429
7503
|
/**
|
|
7430
7504
|
* Link to documentation
|
|
7431
7505
|
*/
|
|
@@ -7491,7 +7565,7 @@
|
|
|
7491
7565
|
/**
|
|
7492
7566
|
* Description of the INSTRUMENT command
|
|
7493
7567
|
*/
|
|
7494
|
-
description: "Instrument command is used to specify the instrument to be used in the pipeline or
|
|
7568
|
+
description: "Instrument command is used to specify the instrument to be used in the pipeline or task like search, calculate, etc.",
|
|
7495
7569
|
/**
|
|
7496
7570
|
* Link to documentation
|
|
7497
7571
|
*/
|
|
@@ -7625,7 +7699,6 @@
|
|
|
7625
7699
|
normalized = normalized.split('(').join('');
|
|
7626
7700
|
normalized = normalized.split(')').join('');
|
|
7627
7701
|
normalized = normalizeTo_SCREAMING_CASE(normalized);
|
|
7628
|
-
normalized = normalized.split('DIALOGUE').join('DIALOG'); // <- TODO: !!!!!! Move to sectionCommandParser
|
|
7629
7702
|
var items = raw
|
|
7630
7703
|
.trim()
|
|
7631
7704
|
// Note: [🐡]
|
|
@@ -7813,7 +7886,7 @@
|
|
|
7813
7886
|
function extractOneBlockFromMarkdown(markdown) {
|
|
7814
7887
|
var codeBlocks = extractAllBlocksFromMarkdown(markdown);
|
|
7815
7888
|
if (codeBlocks.length !== 1) {
|
|
7816
|
-
throw new ParseError(spaceTrim__default["default"](function (block) { return "\n There should be exactly 1 code block in
|
|
7889
|
+
throw new ParseError(spaceTrim__default["default"](function (block) { return "\n There should be exactly 1 code block in task section, found ".concat(codeBlocks.length, " code blocks\n\n ").concat(block(codeBlocks.map(function (block, i) { return "Block ".concat(i + 1, ":\n").concat(block.content); }).join('\n\n\n')), "\n "); }));
|
|
7817
7890
|
}
|
|
7818
7891
|
return codeBlocks[0];
|
|
7819
7892
|
}
|
|
@@ -8120,7 +8193,7 @@
|
|
|
8120
8193
|
var command = parseCommand(listItem, 'PIPELINE_HEAD');
|
|
8121
8194
|
var commandParser = getParserForCommand(command);
|
|
8122
8195
|
if (commandParser.isUsedInPipelineHead !== true /* <- Note: [🦦][4] */) {
|
|
8123
|
-
throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n Command ".concat(command.type, " is not allowed in the head of the
|
|
8196
|
+
throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n Command `".concat(command.type, "` is not allowed in the head of the pipeline ONLY at the pipeline task\n\n ").concat(block(getPipelineIdentification()), "\n "); })); // <- TODO: [🚞]
|
|
8124
8197
|
}
|
|
8125
8198
|
try {
|
|
8126
8199
|
commandParser.$applyToPipelineJson(command, $pipelineJson);
|
|
@@ -8152,7 +8225,7 @@
|
|
|
8152
8225
|
}
|
|
8153
8226
|
var _loop_2 = function (section) {
|
|
8154
8227
|
var e_5, _l, e_6, _m;
|
|
8155
|
-
// TODO: Parse
|
|
8228
|
+
// TODO: Parse section's description (the content out of the codeblock and lists)
|
|
8156
8229
|
var listItems_2 = extractAllListItemsFromMarkdown(section.content);
|
|
8157
8230
|
var _o = extractOneBlockFromMarkdown(section.content), language = _o.language, content = _o.content;
|
|
8158
8231
|
// TODO: [🎾][1] DRY description
|
|
@@ -8183,7 +8256,7 @@
|
|
|
8183
8256
|
resultingParameterNameMatch.groups.resultingParamName !== undefined) {
|
|
8184
8257
|
$taskJson.resultingParameterName = resultingParameterNameMatch.groups.resultingParamName;
|
|
8185
8258
|
}
|
|
8186
|
-
// TODO: [🥥] Maybe move this logic to `$
|
|
8259
|
+
// TODO: [🥥] Maybe move this logic to `$parseAndApplyPipelineTaskCommands`
|
|
8187
8260
|
var commands = listItems_2.map(function (listItem) { return ({
|
|
8188
8261
|
listItem: listItem,
|
|
8189
8262
|
command: parseCommand(listItem, 'PIPELINE_TASK'),
|
|
@@ -8198,7 +8271,7 @@
|
|
|
8198
8271
|
var _loop_4 = function (listItem, command) {
|
|
8199
8272
|
var commandParser = getParserForCommand(command);
|
|
8200
8273
|
if (commandParser.isUsedInPipelineTask !== true /* <- Note: [🦦][4] */) {
|
|
8201
|
-
throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n Command ".concat(command.type, " is not allowed in the
|
|
8274
|
+
throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n Command `".concat(command.type, "` is not allowed in the task of the promptbook ONLY at the pipeline head\n\n ").concat(block(getPipelineIdentification()), "\n "); })); // <- TODO: [🚞]
|
|
8202
8275
|
}
|
|
8203
8276
|
try {
|
|
8204
8277
|
commandParser.$applyToTaskJson(
|
|
@@ -8209,7 +8282,7 @@
|
|
|
8209
8282
|
if (!(error instanceof ParseError)) {
|
|
8210
8283
|
throw error;
|
|
8211
8284
|
}
|
|
8212
|
-
throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n Command ".concat(command.type, " failed to apply to the
|
|
8285
|
+
throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n Command `".concat(command.type, "` failed to apply to the task\n\n The error:\n ").concat(block(error.message), "\n\n Current state of the task:\n ").concat(block(JSON.stringify($taskJson, 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: [🚞]
|
|
8213
8286
|
}
|
|
8214
8287
|
if (command.type === 'PARAMETER') {
|
|
8215
8288
|
defineParam(command);
|
|
@@ -8230,10 +8303,10 @@
|
|
|
8230
8303
|
}
|
|
8231
8304
|
finally { if (e_5) throw e_5.error; }
|
|
8232
8305
|
}
|
|
8233
|
-
// TODO: [🍧] Should be done in
|
|
8306
|
+
// TODO: [🍧] Should be done in SECTION command
|
|
8234
8307
|
if ($taskJson.taskType === 'SCRIPT_TASK') {
|
|
8235
8308
|
if (!language) {
|
|
8236
|
-
throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n You must specify the language of the script in the SCRIPT
|
|
8309
|
+
throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n You must specify the language of the script in the `SCRIPT` task\n\n ".concat(block(getPipelineIdentification()), "\n "); }));
|
|
8237
8310
|
}
|
|
8238
8311
|
if (!SUPPORTED_SCRIPT_LANGUAGES.includes(language)) {
|
|
8239
8312
|
throw new ParseError(spaceTrim.spaceTrim(function (block) { return "\n Script language ".concat(language, " is not supported.\n\n Supported languages are:\n ").concat(block(SUPPORTED_SCRIPT_LANGUAGES.join(', ')), "\n\n "); }));
|
|
@@ -8244,7 +8317,7 @@
|
|
|
8244
8317
|
try {
|
|
8245
8318
|
for (var _q = (e_6 = void 0, __values($taskJson.dependentParameterNames)), _r = _q.next(); !_r.done; _r = _q.next()) {
|
|
8246
8319
|
var parameterName = _r.value;
|
|
8247
|
-
// TODO: [🧠] This definition should be made first in the
|
|
8320
|
+
// TODO: [🧠] This definition should be made first in the task
|
|
8248
8321
|
defineParam({
|
|
8249
8322
|
parameterName: parameterName,
|
|
8250
8323
|
parameterDescription: null,
|
|
@@ -8269,7 +8342,7 @@
|
|
|
8269
8342
|
(block) => `
|
|
8270
8343
|
Model requirements are defined for the block type ${
|
|
8271
8344
|
$taskJson.taskType
|
|
8272
|
-
} which is not a PROMPT
|
|
8345
|
+
} which is not a \`PROMPT\` task
|
|
8273
8346
|
|
|
8274
8347
|
This should be avoided by the \`modelCommandParser\`
|
|
8275
8348
|
|
|
@@ -8288,7 +8361,7 @@
|
|
|
8288
8361
|
};
|
|
8289
8362
|
try {
|
|
8290
8363
|
// =============================================================
|
|
8291
|
-
// Note: 4️⃣ Process each
|
|
8364
|
+
// Note: 4️⃣ Process each section of the pipeline
|
|
8292
8365
|
for (var pipelineSections_1 = __values(pipelineSections), pipelineSections_1_1 = pipelineSections_1.next(); !pipelineSections_1_1.done; pipelineSections_1_1 = pipelineSections_1.next()) {
|
|
8293
8366
|
var section = pipelineSections_1_1.value;
|
|
8294
8367
|
_loop_2(section);
|
|
@@ -8305,7 +8378,7 @@
|
|
|
8305
8378
|
// Note: 5️⃣ Mark parameters as INPUT if not explicitly set
|
|
8306
8379
|
if ($pipelineJson.parameters.every(function (parameter) { return !parameter.isInput; })) {
|
|
8307
8380
|
var _loop_3 = function (parameter) {
|
|
8308
|
-
var isThisParameterResulting = $pipelineJson.tasks.some(function (
|
|
8381
|
+
var isThisParameterResulting = $pipelineJson.tasks.some(function (task) { return task.resultingParameterName === parameter.name; });
|
|
8309
8382
|
if (!isThisParameterResulting) {
|
|
8310
8383
|
parameter.isInput = true;
|
|
8311
8384
|
}
|