@promptbook/cli 0.61.0-25 → 0.61.0-27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/index.es.js +127 -123
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/utils.index.d.ts +4 -4
- package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +0 -1
- package/esm/typings/src/conversion/utils/{extractParametersFromPromptTemplate.d.ts → extractParameterNamesFromPromptTemplate.d.ts} +1 -1
- package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -1
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +6 -6
- package/esm/typings/src/execution/PipelineExecutor.d.ts +1 -1
- package/esm/typings/src/execution/createPipelineExecutor.d.ts +3 -3
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -1
- package/esm/typings/src/prepare/isPipelinePrepared.d.ts +3 -3
- package/esm/typings/src/prepare/preparePipeline.d.ts +1 -1
- package/esm/typings/src/prepare/prepareTemplates.d.ts +1 -1
- package/esm/typings/src/types/ModelRequirements.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -1
- package/esm/typings/src/utils/{extractParameters.d.ts → extractParameterNames.d.ts} +1 -4
- package/package.json +2 -2
- package/umd/index.umd.js +127 -123
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/src/_packages/utils.index.d.ts +4 -4
- package/umd/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +0 -1
- package/umd/typings/src/conversion/utils/{extractParametersFromPromptTemplate.d.ts → extractParameterNamesFromPromptTemplate.d.ts} +1 -1
- package/umd/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -1
- package/umd/typings/src/conversion/validation/validatePipeline.d.ts +6 -6
- package/umd/typings/src/execution/PipelineExecutor.d.ts +1 -1
- package/umd/typings/src/execution/createPipelineExecutor.d.ts +3 -3
- package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -1
- package/umd/typings/src/prepare/isPipelinePrepared.d.ts +3 -3
- package/umd/typings/src/prepare/preparePipeline.d.ts +1 -1
- package/umd/typings/src/prepare/prepareTemplates.d.ts +1 -1
- package/umd/typings/src/types/ModelRequirements.d.ts +1 -1
- package/umd/typings/src/types/PipelineJson/PipelineJson.d.ts +1 -1
- package/umd/typings/src/utils/{extractParameters.d.ts → extractParameterNames.d.ts} +1 -4
- /package/esm/typings/src/conversion/utils/{extractParametersFromPromptTemplate.test.d.ts → extractParameterNamesFromPromptTemplate.test.d.ts} +0 -0
- /package/esm/typings/src/utils/{extractParameters.test.d.ts → extractParameterNames.test.d.ts} +0 -0
- /package/umd/typings/src/conversion/utils/{extractParametersFromPromptTemplate.test.d.ts → extractParameterNamesFromPromptTemplate.test.d.ts} +0 -0
- /package/umd/typings/src/utils/{extractParameters.test.d.ts → extractParameterNames.test.d.ts} +0 -0
package/umd/index.umd.js
CHANGED
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
/**
|
|
155
155
|
* The version of the Promptbook library
|
|
156
156
|
*/
|
|
157
|
-
var PROMPTBOOK_VERSION = '0.61.0-
|
|
157
|
+
var PROMPTBOOK_VERSION = '0.61.0-26';
|
|
158
158
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
159
159
|
|
|
160
160
|
/**
|
|
@@ -751,7 +751,7 @@
|
|
|
751
751
|
});
|
|
752
752
|
}
|
|
753
753
|
|
|
754
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-
|
|
754
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-26",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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}",dependentParameterNames:["knowledgeContent"],resultingParameterName:"knowledgePieces"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-26",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.61.0-26",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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}",dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-26",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.61.0-26",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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}",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-26",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.61.0-26",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}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",modelRequirements:{modelVariant:"CHAT",modelName:"gpt-4-turbo"},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### Option `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Option `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### Option `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}",expectFormat:"JSON",dependentParameterNames:["availableModelNames","personaDescription"],resultingParameterName:"modelRequirements"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.61.0-26",modelUsage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
|
|
755
755
|
|
|
756
756
|
/**
|
|
757
757
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
@@ -829,7 +829,7 @@
|
|
|
829
829
|
if ( /* version === '1.0.0' || */version === '2.0.0' || version === '3.0.0') {
|
|
830
830
|
return false;
|
|
831
831
|
}
|
|
832
|
-
// <- TODO:
|
|
832
|
+
// <- TODO: !!! Check isValidPromptbookVersion against PROMPTBOOK_VERSIONS
|
|
833
833
|
return true;
|
|
834
834
|
}
|
|
835
835
|
|
|
@@ -954,52 +954,63 @@
|
|
|
954
954
|
*/
|
|
955
955
|
function validatePipeline(pipeline) {
|
|
956
956
|
// TODO: [🧠] Maybe test if promptbook is a promise and make specific error case for that
|
|
957
|
-
var e_1, _a, e_2, _b, e_3, _c
|
|
957
|
+
var e_1, _a, e_2, _b, e_3, _c;
|
|
958
|
+
var pipelineIdentification = (function () {
|
|
959
|
+
// Note: This is a 😐 implementation of [🚞]
|
|
960
|
+
var _ = [];
|
|
961
|
+
if (pipeline.sourceFile !== undefined) {
|
|
962
|
+
_.push("File: ".concat(pipeline.sourceFile));
|
|
963
|
+
}
|
|
964
|
+
if (pipeline.pipelineUrl !== undefined) {
|
|
965
|
+
_.push("Url: ".concat(pipeline.pipelineUrl));
|
|
966
|
+
}
|
|
967
|
+
return _.join('\n');
|
|
968
|
+
})();
|
|
958
969
|
if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
|
|
959
970
|
// <- Note: [🚲]
|
|
960
|
-
throw new PipelineLogicError("Invalid promptbook URL \"".concat(pipeline.pipelineUrl, "\""));
|
|
971
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Invalid promptbook URL \"".concat(pipeline.pipelineUrl, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
961
972
|
}
|
|
962
973
|
if (!isValidPromptbookVersion(pipeline.promptbookVersion)) {
|
|
963
974
|
// <- Note: [🚲]
|
|
964
|
-
throw new PipelineLogicError("Invalid
|
|
975
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.promptbookVersion, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
965
976
|
}
|
|
966
977
|
// TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
|
|
967
978
|
if (!Array.isArray(pipeline.parameters)) {
|
|
968
979
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
969
|
-
throw new ParsingError(spaceTrim.spaceTrim("\n
|
|
980
|
+
throw new ParsingError(spaceTrim.spaceTrim(function (block) { return "\n Promptbook is valid JSON but with wrong structure\n\n `promptbook.parameters` expected to be an array, but got ".concat(typeof pipeline.parameters, "\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
970
981
|
}
|
|
971
982
|
// TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
|
|
972
983
|
if (!Array.isArray(pipeline.promptTemplates)) {
|
|
973
984
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
974
|
-
throw new ParsingError(spaceTrim.spaceTrim("\n
|
|
985
|
+
throw new ParsingError(spaceTrim.spaceTrim(function (block) { return "\n Promptbook is valid JSON but with wrong structure\n\n `promptbook.promptTemplates` expected to be an array, but got ".concat(typeof pipeline.promptTemplates, "\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
975
986
|
}
|
|
976
987
|
var _loop_1 = function (parameter) {
|
|
977
988
|
if (parameter.isInput && parameter.isOutput) {
|
|
978
|
-
throw new PipelineLogicError("Parameter {".concat(parameter.name, "} can not be both input and output"));
|
|
989
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n\n Parameter {".concat(parameter.name, "} can not be both input and output\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
979
990
|
}
|
|
980
991
|
// Note: Testing that parameter is either intermediate or output BUT not created and unused
|
|
981
992
|
if (!parameter.isInput &&
|
|
982
993
|
!parameter.isOutput &&
|
|
983
994
|
!pipeline.promptTemplates.some(function (template) { return template.dependentParameterNames.includes(parameter.name); })) {
|
|
984
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim("\n
|
|
995
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} is created but not used\n\n You can declare {").concat(parameter.name, "} as output parameter by adding in the header:\n - OUTPUT PARAMETER `{").concat(parameter.name, "}` ").concat(parameter.description || '', "\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
985
996
|
}
|
|
986
997
|
// Note: Testing that parameter is either input or result of some template
|
|
987
998
|
if (!parameter.isInput &&
|
|
988
999
|
!pipeline.promptTemplates.some(function (template) { return template.resultingParameterName === parameter.name; })) {
|
|
989
|
-
throw new PipelineLogicError(spaceTrim.spaceTrim("\n
|
|
1000
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} is declared but not defined\n\n You can do one of these:\n - Remove declaration of {").concat(parameter.name, "}\n - Add prompt template that results in -> {").concat(parameter.name, "}\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
990
1001
|
}
|
|
991
1002
|
};
|
|
992
1003
|
try {
|
|
993
1004
|
// Note: Check each parameter individually
|
|
994
|
-
for (var
|
|
995
|
-
var parameter =
|
|
1005
|
+
for (var _d = __values(pipeline.parameters), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
1006
|
+
var parameter = _e.value;
|
|
996
1007
|
_loop_1(parameter);
|
|
997
1008
|
}
|
|
998
1009
|
}
|
|
999
1010
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1000
1011
|
finally {
|
|
1001
1012
|
try {
|
|
1002
|
-
if (
|
|
1013
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
1003
1014
|
}
|
|
1004
1015
|
finally { if (e_1) throw e_1.error; }
|
|
1005
1016
|
}
|
|
@@ -1011,70 +1022,80 @@
|
|
|
1011
1022
|
var name = _a.name;
|
|
1012
1023
|
return name;
|
|
1013
1024
|
}));
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1025
|
+
var _loop_2 = function (template) {
|
|
1026
|
+
var e_4, _h, e_5, _j;
|
|
1027
|
+
if (definedParameters.has(template.resultingParameterName)) {
|
|
1028
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(template.resultingParameterName, "} is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1029
|
+
}
|
|
1030
|
+
if (RESERVED_PARAMETER_NAMES.includes(template.resultingParameterName)) {
|
|
1031
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter name {".concat(template.resultingParameterName, "} is reserved, please use different name\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1032
|
+
}
|
|
1033
|
+
definedParameters.add(template.resultingParameterName);
|
|
1034
|
+
if (template.blockType === 'PROMPT_TEMPLATE' && template.modelRequirements.modelVariant === undefined) {
|
|
1035
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n\n You must specify MODEL VARIANT in the prompt template \"".concat(template.title, "\"\n\n For example:\n - MODEL VARIANT Chat\n - MODEL NAME `gpt-4-1106-preview`").concat(/* <- TODO: Dynamic listing of command examples */ '', "\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1036
|
+
}
|
|
1037
|
+
if (template.jokerParameterNames && template.jokerParameterNames.length > 0) {
|
|
1038
|
+
if (!template.expectFormat &&
|
|
1039
|
+
!template.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
|
|
1040
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Joker parameters are used for {".concat(template.resultingParameterName, "} but no expectations are defined\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1020
1041
|
}
|
|
1021
|
-
|
|
1022
|
-
|
|
1042
|
+
var _loop_4 = function (joker) {
|
|
1043
|
+
if (!template.dependentParameterNames.includes(joker)) {
|
|
1044
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(joker, "} is used for {").concat(template.resultingParameterName, "} as joker but not in `dependentParameterNames`\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1045
|
+
}
|
|
1046
|
+
};
|
|
1047
|
+
try {
|
|
1048
|
+
for (var _k = (e_4 = void 0, __values(template.jokerParameterNames)), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
1049
|
+
var joker = _l.value;
|
|
1050
|
+
_loop_4(joker);
|
|
1051
|
+
}
|
|
1023
1052
|
}
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1053
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1054
|
+
finally {
|
|
1055
|
+
try {
|
|
1056
|
+
if (_l && !_l.done && (_h = _k.return)) _h.call(_k);
|
|
1057
|
+
}
|
|
1058
|
+
finally { if (e_4) throw e_4.error; }
|
|
1027
1059
|
}
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1060
|
+
}
|
|
1061
|
+
if (template.expectations) {
|
|
1062
|
+
var _loop_5 = function (unit, min, max) {
|
|
1063
|
+
if (min !== undefined && max !== undefined && min > max) {
|
|
1064
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Min expectation (=".concat(min, ") of ").concat(unit, " is higher than max expectation (=").concat(max, ")\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1032
1065
|
}
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
var joker = _l.value;
|
|
1036
|
-
if (!template.dependentParameterNames.includes(joker)) {
|
|
1037
|
-
throw new PipelineLogicError("Parameter {".concat(joker, "} is used for {").concat(template.resultingParameterName, "} as joker but not in dependentParameterNames"));
|
|
1038
|
-
}
|
|
1039
|
-
}
|
|
1066
|
+
if (min !== undefined && min < 0) {
|
|
1067
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Min expectation of ".concat(unit, " must be zero or positive\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1040
1068
|
}
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1069
|
+
if (max !== undefined && max <= 0) {
|
|
1070
|
+
throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Max expectation of ".concat(unit, " must be positive\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1071
|
+
}
|
|
1072
|
+
};
|
|
1073
|
+
try {
|
|
1074
|
+
for (var _m = (e_5 = void 0, __values(Object.entries(template.expectations))), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
1075
|
+
var _p = __read(_o.value, 2), unit = _p[0], _q = _p[1], min = _q.min, max = _q.max;
|
|
1076
|
+
_loop_5(unit, min, max);
|
|
1047
1077
|
}
|
|
1048
1078
|
}
|
|
1049
|
-
|
|
1079
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
1080
|
+
finally {
|
|
1050
1081
|
try {
|
|
1051
|
-
|
|
1052
|
-
var _p = __read(_o.value, 2), unit = _p[0], _q = _p[1], min = _q.min, max = _q.max;
|
|
1053
|
-
if (min !== undefined && max !== undefined && min > max) {
|
|
1054
|
-
throw new PipelineLogicError("Min expectation (=".concat(min, ") of ").concat(unit, " is higher than max expectation (=").concat(max, ")"));
|
|
1055
|
-
}
|
|
1056
|
-
if (min !== undefined && min < 0) {
|
|
1057
|
-
throw new PipelineLogicError("Min expectation of ".concat(unit, " must be zero or positive"));
|
|
1058
|
-
}
|
|
1059
|
-
if (max !== undefined && max <= 0) {
|
|
1060
|
-
throw new PipelineLogicError("Max expectation of ".concat(unit, " must be positive"));
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1065
|
-
finally {
|
|
1066
|
-
try {
|
|
1067
|
-
if (_o && !_o.done && (_d = _m.return)) _d.call(_m);
|
|
1068
|
-
}
|
|
1069
|
-
finally { if (e_4) throw e_4.error; }
|
|
1082
|
+
if (_o && !_o.done && (_j = _m.return)) _j.call(_m);
|
|
1070
1083
|
}
|
|
1084
|
+
finally { if (e_5) throw e_5.error; }
|
|
1071
1085
|
}
|
|
1072
1086
|
}
|
|
1087
|
+
};
|
|
1088
|
+
try {
|
|
1089
|
+
// Note: Checking each template individually
|
|
1090
|
+
for (var _f = __values(pipeline.promptTemplates), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
1091
|
+
var template = _g.value;
|
|
1092
|
+
_loop_2(template);
|
|
1093
|
+
}
|
|
1073
1094
|
}
|
|
1074
1095
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1075
1096
|
finally {
|
|
1076
1097
|
try {
|
|
1077
|
-
if (
|
|
1098
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
1078
1099
|
}
|
|
1079
1100
|
finally { if (e_2) throw e_2.error; }
|
|
1080
1101
|
}
|
|
@@ -1095,20 +1116,20 @@
|
|
|
1095
1116
|
resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), [reservedParameterName], false);
|
|
1096
1117
|
}
|
|
1097
1118
|
}
|
|
1098
|
-
catch (
|
|
1119
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1099
1120
|
finally {
|
|
1100
1121
|
try {
|
|
1101
|
-
if (RESERVED_PARAMETER_NAMES_1_1 && !RESERVED_PARAMETER_NAMES_1_1.done && (
|
|
1122
|
+
if (RESERVED_PARAMETER_NAMES_1_1 && !RESERVED_PARAMETER_NAMES_1_1.done && (_c = RESERVED_PARAMETER_NAMES_1.return)) _c.call(RESERVED_PARAMETER_NAMES_1);
|
|
1102
1123
|
}
|
|
1103
|
-
finally { if (
|
|
1124
|
+
finally { if (e_3) throw e_3.error; }
|
|
1104
1125
|
}
|
|
1105
1126
|
var unresovedTemplates = __spreadArray([], __read(pipeline.promptTemplates), false);
|
|
1106
1127
|
// <- TODO: [🧠][🥜]
|
|
1107
1128
|
var loopLimit = LOOP_LIMIT;
|
|
1108
|
-
var
|
|
1129
|
+
var _loop_3 = function () {
|
|
1109
1130
|
if (loopLimit-- < 0) {
|
|
1110
1131
|
// Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
|
|
1111
|
-
throw new UnexpectedError(
|
|
1132
|
+
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 "); }));
|
|
1112
1133
|
}
|
|
1113
1134
|
var currentlyResovedTemplates = unresovedTemplates.filter(function (template) {
|
|
1114
1135
|
return template.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
|
|
@@ -1123,7 +1144,7 @@
|
|
|
1123
1144
|
.map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
|
|
1124
1145
|
.join(' and '));
|
|
1125
1146
|
})
|
|
1126
|
-
.join('\n')), "\n\n Resolved:\n ").concat(block(resovedParameters.map(function (name) { return "- Parameter {".concat(name, "}"); }).join('\n')), "\n "); }));
|
|
1147
|
+
.join('\n')), "\n\n Resolved:\n ").concat(block(resovedParameters.map(function (name) { return "- Parameter {".concat(name, "}"); }).join('\n')), "\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1127
1148
|
}
|
|
1128
1149
|
resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTemplates.map(function (_a) {
|
|
1129
1150
|
var resultingParameterName = _a.resultingParameterName;
|
|
@@ -1132,7 +1153,7 @@
|
|
|
1132
1153
|
unresovedTemplates = unresovedTemplates.filter(function (template) { return !currentlyResovedTemplates.includes(template); });
|
|
1133
1154
|
};
|
|
1134
1155
|
while (unresovedTemplates.length > 0) {
|
|
1135
|
-
|
|
1156
|
+
_loop_3();
|
|
1136
1157
|
}
|
|
1137
1158
|
return pipeline;
|
|
1138
1159
|
}
|
|
@@ -1148,12 +1169,12 @@
|
|
|
1148
1169
|
* > ex port function validatePipeline(promptbook: really_unknown): asserts promptbook is PipelineJson {
|
|
1149
1170
|
*/
|
|
1150
1171
|
/**
|
|
1151
|
-
* TODO: [
|
|
1152
|
-
* TODO: [
|
|
1153
|
-
* TODO: [
|
|
1154
|
-
* TODO: !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
|
|
1155
|
-
* TODO: !!!! Validate that reserved parameter is not used as joker
|
|
1156
|
-
* TODO: [🧠]
|
|
1172
|
+
* TODO: [🐣] !!!! Validate that all samples match expectations
|
|
1173
|
+
* TODO: [🐣][🐝] !!!! Validate that knowledge is valid (non-void)
|
|
1174
|
+
* TODO: [🐣] !!!! Validate that persona can be used only with CHAT variant
|
|
1175
|
+
* TODO: [🐣] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
|
|
1176
|
+
* TODO: [🐣] !!!! Validate that reserved parameter is not used as joker
|
|
1177
|
+
* TODO: [🧠] Validation not only logic itself but imports around - files and websites and rerefenced pipelines exists
|
|
1157
1178
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
1158
1179
|
*/
|
|
1159
1180
|
|
|
@@ -1191,7 +1212,7 @@
|
|
|
1191
1212
|
* @param template the template with parameters in {curly} braces
|
|
1192
1213
|
* @returns the list of parameter names
|
|
1193
1214
|
*/
|
|
1194
|
-
function
|
|
1215
|
+
function extractParameterNames(template) {
|
|
1195
1216
|
var e_1, _a;
|
|
1196
1217
|
var matches = template.matchAll(/{\w+}/g);
|
|
1197
1218
|
var parameterNames = new Set();
|
|
@@ -1211,9 +1232,6 @@
|
|
|
1211
1232
|
}
|
|
1212
1233
|
return parameterNames;
|
|
1213
1234
|
}
|
|
1214
|
-
/**
|
|
1215
|
-
* TODO: !!!!! Rename to extractParameterNames
|
|
1216
|
-
*/
|
|
1217
1235
|
|
|
1218
1236
|
/**
|
|
1219
1237
|
* Unprepare just strips the preparation data of the pipeline
|
|
@@ -1224,7 +1242,7 @@
|
|
|
1224
1242
|
knowledgeSources = knowledgeSources.map(function (knowledgeSource) { return (__assign(__assign({}, knowledgeSource), { preparationIds: undefined })); });
|
|
1225
1243
|
promptTemplates = promptTemplates.map(function (promptTemplate) {
|
|
1226
1244
|
var dependentParameterNames = promptTemplate.dependentParameterNames;
|
|
1227
|
-
var parameterNames =
|
|
1245
|
+
var parameterNames = extractParameterNames(promptTemplate.preparedContent || '');
|
|
1228
1246
|
dependentParameterNames = dependentParameterNames.filter(function (dependentParameterName) { return !parameterNames.has(dependentParameterName); });
|
|
1229
1247
|
var promptTemplateUnprepared = __assign(__assign({}, promptTemplate), { dependentParameterNames: dependentParameterNames });
|
|
1230
1248
|
delete promptTemplateUnprepared.preparedContent;
|
|
@@ -1781,12 +1799,12 @@
|
|
|
1781
1799
|
* @returns the set of parameter names
|
|
1782
1800
|
* @throws {ParsingError} if the script is invalid
|
|
1783
1801
|
*/
|
|
1784
|
-
function
|
|
1802
|
+
function extractParameterNamesFromPromptTemplate(promptTemplate) {
|
|
1785
1803
|
var e_1, _a, e_2, _b, e_3, _c;
|
|
1786
1804
|
var title = promptTemplate.title, description = promptTemplate.description, blockType = promptTemplate.blockType, content = promptTemplate.content, preparedContent = promptTemplate.preparedContent, jokerParameterNames = promptTemplate.jokerParameterNames;
|
|
1787
1805
|
var parameterNames = new Set();
|
|
1788
1806
|
try {
|
|
1789
|
-
for (var _d = __values(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(
|
|
1807
|
+
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()) {
|
|
1790
1808
|
var parameterName = _e.value;
|
|
1791
1809
|
parameterNames.add(parameterName);
|
|
1792
1810
|
}
|
|
@@ -1854,7 +1872,7 @@
|
|
|
1854
1872
|
/**
|
|
1855
1873
|
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
1856
1874
|
*/
|
|
1857
|
-
function isValidJsonString(value /* <-[👨⚖️] */) {
|
|
1875
|
+
function isValidJsonString(value /* <- [👨⚖️] */) {
|
|
1858
1876
|
try {
|
|
1859
1877
|
JSON.parse(value);
|
|
1860
1878
|
return true;
|
|
@@ -2138,9 +2156,9 @@
|
|
|
2138
2156
|
* TODO: [🔼] Export via core or utils
|
|
2139
2157
|
* TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
|
|
2140
2158
|
* TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
|
|
2141
|
-
* - Is context in each template
|
|
2142
|
-
* - Are samples prepared
|
|
2143
|
-
* - Are templates prepared
|
|
2159
|
+
* - [🏍] ? Is context in each template
|
|
2160
|
+
* - [♨] Are samples prepared
|
|
2161
|
+
* - [♨] Are templates prepared
|
|
2144
2162
|
*/
|
|
2145
2163
|
|
|
2146
2164
|
/**
|
|
@@ -2471,7 +2489,7 @@
|
|
|
2471
2489
|
pipeline = rawPipeline;
|
|
2472
2490
|
}
|
|
2473
2491
|
else {
|
|
2474
|
-
// TODO:
|
|
2492
|
+
// TODO: !!!!! This should be maybe warning in report
|
|
2475
2493
|
console.warn(spaceTrim.spaceTrim("\n Pipeline ".concat(rawPipeline.pipelineUrl || rawPipeline.sourceFile || rawPipeline.title, " is not prepared\n\n ").concat(rawPipeline.sourceFile, "\n\n It will be prepared ad-hoc before the first execution\n But it is recommended to prepare the pipeline during collection preparation\n\n @see more at https://ptbk.io/prepare-pipeline\n ")));
|
|
2476
2494
|
}
|
|
2477
2495
|
var pipelineExecutor = function (inputParameters, onProgress) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -2481,7 +2499,7 @@
|
|
|
2481
2499
|
return __awaiter(this, void 0, void 0, function () {
|
|
2482
2500
|
return __generator(this, function (_a) {
|
|
2483
2501
|
TODO_USE(template);
|
|
2484
|
-
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO:
|
|
2502
|
+
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [🏍] Implement */];
|
|
2485
2503
|
});
|
|
2486
2504
|
});
|
|
2487
2505
|
}
|
|
@@ -2489,7 +2507,7 @@
|
|
|
2489
2507
|
template) {
|
|
2490
2508
|
return __awaiter(this, void 0, void 0, function () {
|
|
2491
2509
|
return __generator(this, function (_a) {
|
|
2492
|
-
// TODO:
|
|
2510
|
+
// TODO: [♨] Implement Better - use real index and keyword search
|
|
2493
2511
|
TODO_USE(template);
|
|
2494
2512
|
return [2 /*return*/, pipeline.knowledgePieces.map(function (_a) {
|
|
2495
2513
|
var content = _a.content;
|
|
@@ -2502,9 +2520,9 @@
|
|
|
2502
2520
|
template) {
|
|
2503
2521
|
return __awaiter(this, void 0, void 0, function () {
|
|
2504
2522
|
return __generator(this, function (_a) {
|
|
2505
|
-
// TODO:
|
|
2523
|
+
// TODO: [♨] Implement Better - use real index and keyword search
|
|
2506
2524
|
TODO_USE(template);
|
|
2507
|
-
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO:
|
|
2525
|
+
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [♨] Implement */];
|
|
2508
2526
|
});
|
|
2509
2527
|
});
|
|
2510
2528
|
}
|
|
@@ -2580,7 +2598,7 @@
|
|
|
2580
2598
|
_u.sent();
|
|
2581
2599
|
_u.label = 2;
|
|
2582
2600
|
case 2:
|
|
2583
|
-
usedParameterNames =
|
|
2601
|
+
usedParameterNames = extractParameterNamesFromPromptTemplate(currentTemplate);
|
|
2584
2602
|
dependentParameterNames = new Set(currentTemplate.dependentParameterNames);
|
|
2585
2603
|
if (union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)).size !== 0) {
|
|
2586
2604
|
throw new UnexpectedError(spaceTrim.spaceTrim("\n Dependent parameters are not consistent used parameters:\n\n Dependent parameters:\n ".concat(Array.from(dependentParameterNames).join(', '), "\n\n Used parameters:\n ").concat(Array.from(usedParameterNames).join(', '), "\n\n ")));
|
|
@@ -2966,14 +2984,7 @@
|
|
|
2966
2984
|
) {
|
|
2967
2985
|
// TODO: [🧠] Maybe put other blockTypes into report
|
|
2968
2986
|
executionReport.promptExecutions.push({
|
|
2969
|
-
prompt: {
|
|
2970
|
-
title: currentTemplate.title /* <- Note: If title in pipeline contains emojis, pass it innto report */,
|
|
2971
|
-
content: prompt.content,
|
|
2972
|
-
modelRequirements: prompt.modelRequirements,
|
|
2973
|
-
expectations: prompt.expectations,
|
|
2974
|
-
expectFormat: prompt.expectFormat,
|
|
2975
|
-
// <- Note: Do want to pass ONLY wanted information to the report
|
|
2976
|
-
},
|
|
2987
|
+
prompt: __assign(__assign({ '!!! All information': null }, prompt), { '!!! Wanted information': null, title: currentTemplate.title /* <- Note: If title in pipeline contains emojis, pass it innto report */, content: prompt.content, modelRequirements: prompt.modelRequirements, expectations: prompt.expectations, expectFormat: prompt.expectFormat }),
|
|
2977
2988
|
result: result || undefined,
|
|
2978
2989
|
error: expectError || undefined,
|
|
2979
2990
|
});
|
|
@@ -3237,8 +3248,8 @@
|
|
|
3237
3248
|
return pipelineExecutor;
|
|
3238
3249
|
}
|
|
3239
3250
|
/**
|
|
3240
|
-
* TODO:
|
|
3241
|
-
* TODO:
|
|
3251
|
+
* TODO: !!!!! return `preparedPipeline` from execution
|
|
3252
|
+
* TODO: !!!!! `isNotPreparedWarningSupressed`
|
|
3242
3253
|
* TODO: Use isVerbose here (not only pass to `preparePipeline`)
|
|
3243
3254
|
* TODO: [🪂] Use maxParallelCount here (not only pass to `preparePipeline`)
|
|
3244
3255
|
* TODO: [♈] Probbably move expectations from templates to parameters
|
|
@@ -3247,7 +3258,7 @@
|
|
|
3247
3258
|
* Note: CreatePipelineExecutorOptions are just connected to PipelineExecutor so do not extract to types folder
|
|
3248
3259
|
* TODO: [🧠][3] transparent = (report intermediate parameters) / opaque execution = (report only output parameters) progress reporting mode
|
|
3249
3260
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
3250
|
-
* TODO: [💷]
|
|
3261
|
+
* TODO: [🧠][💷] `assertsExecutionSuccessful` should be the method of `PipelineExecutor` result BUT maybe NOT to preserve pure JSON object
|
|
3251
3262
|
*/
|
|
3252
3263
|
|
|
3253
3264
|
/**
|
|
@@ -3523,7 +3534,7 @@
|
|
|
3523
3534
|
case 0:
|
|
3524
3535
|
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a;
|
|
3525
3536
|
promptTemplates = pipeline.promptTemplates, parameters = pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
|
|
3526
|
-
// TODO:
|
|
3537
|
+
// TODO: !!!!!! Apply samples to each template (if missing and is for the template defined)
|
|
3527
3538
|
TODO_USE(parameters);
|
|
3528
3539
|
promptTemplatesPrepared = new Array(promptTemplates.length);
|
|
3529
3540
|
return [4 /*yield*/, forEachAsync(promptTemplates, { maxParallelCount: maxParallelCount /* <- TODO: [🪂] When there are subtasks, this maximul limit can be broken */ }, function (template, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -3553,7 +3564,7 @@
|
|
|
3553
3564
|
/**
|
|
3554
3565
|
* TODO: [🧠] Add context to each template (if missing)
|
|
3555
3566
|
* TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
|
|
3556
|
-
* TODO:
|
|
3567
|
+
* TODO: [♨] !!! Prepare index the samples and maybe templates
|
|
3557
3568
|
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
3558
3569
|
* TODO: Write tests for `preparePipeline`
|
|
3559
3570
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
@@ -3632,7 +3643,7 @@
|
|
|
3632
3643
|
* TODO: Write tests for `preparePipeline`
|
|
3633
3644
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
3634
3645
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
3635
|
-
* TODO: [🎐]
|
|
3646
|
+
* TODO: [🎐] !!!!!! Use here countTotalUsage
|
|
3636
3647
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
3637
3648
|
*/
|
|
3638
3649
|
|
|
@@ -4453,11 +4464,8 @@
|
|
|
4453
4464
|
/**
|
|
4454
4465
|
* Name of the command
|
|
4455
4466
|
*/
|
|
4456
|
-
name: '
|
|
4457
|
-
|
|
4458
|
-
Note: [📇] No need to put here "PROMPTBOOK" alias here
|
|
4459
|
-
aliasNames: ['PROMPTBOOK_VERSION'],
|
|
4460
|
-
*/
|
|
4467
|
+
name: 'PROMPTBOOK_VERSION',
|
|
4468
|
+
aliasNames: ['PTBK_VERSION', 'PTBK_V', 'PTBKV'],
|
|
4461
4469
|
/**
|
|
4462
4470
|
* BOILERPLATE command can be used in:
|
|
4463
4471
|
*/
|
|
@@ -4473,7 +4481,7 @@
|
|
|
4473
4481
|
/**
|
|
4474
4482
|
* Example usages of the PROMPTBOOK_VERSION command
|
|
4475
4483
|
*/
|
|
4476
|
-
examples: ["PROMPTBOOK VERSION ".concat(PROMPTBOOK_VERSION), "
|
|
4484
|
+
examples: ["PROMPTBOOK VERSION ".concat(PROMPTBOOK_VERSION), "PTBKV ".concat(PROMPTBOOK_VERSION)],
|
|
4477
4485
|
/**
|
|
4478
4486
|
* Parses the PROMPTBOOK_VERSION command
|
|
4479
4487
|
*/
|
|
@@ -4507,8 +4515,9 @@
|
|
|
4507
4515
|
* Name of the command
|
|
4508
4516
|
*/
|
|
4509
4517
|
name: 'URL',
|
|
4518
|
+
aliasNames: ['PIPELINE_URL'],
|
|
4510
4519
|
/*
|
|
4511
|
-
Note: [🛵] No need for alias name because it is already preprocessed
|
|
4520
|
+
Note: [🛵] No need for this alias name because it is already preprocessed
|
|
4512
4521
|
aliasNames: ['HTTPS'],
|
|
4513
4522
|
*/
|
|
4514
4523
|
/**
|
|
@@ -4527,6 +4536,7 @@
|
|
|
4527
4536
|
* Example usages of the URL command
|
|
4528
4537
|
*/
|
|
4529
4538
|
examples: [
|
|
4539
|
+
'PIPELINE URL https://promptbook.studio/library/write-cv.ptbk.md',
|
|
4530
4540
|
'URL https://promptbook.studio/library/write-cv.ptbk.md',
|
|
4531
4541
|
'https://promptbook.studio/library/write-cv.ptbk.md',
|
|
4532
4542
|
],
|
|
@@ -4765,10 +4775,6 @@
|
|
|
4765
4775
|
.split(' ')
|
|
4766
4776
|
.map(function (part) { return part.trim(); })
|
|
4767
4777
|
.filter(function (item) { return item !== ''; })
|
|
4768
|
-
// Note: [📇]:
|
|
4769
|
-
.filter(function (item) { return !/^PTBK$/i.test(item); })
|
|
4770
|
-
.filter(function (item) { return !/^PIPELINE$/i.test(item); })
|
|
4771
|
-
.filter(function (item) { return !/^PROMPTBOOK$/i.test(item); })
|
|
4772
4778
|
.map(removeMarkdownFormatting)
|
|
4773
4779
|
.map(function (item) { return item.trim(); });
|
|
4774
4780
|
if (items.length === 0 || items[0] === '') {
|
|
@@ -5483,7 +5489,7 @@
|
|
|
5483
5489
|
if (templateModelRequirements.modelVariant === undefined) {
|
|
5484
5490
|
templateModelRequirements.modelVariant = 'CHAT';
|
|
5485
5491
|
}
|
|
5486
|
-
templateJson.dependentParameterNames = Array.from(
|
|
5492
|
+
templateJson.dependentParameterNames = Array.from(extractParameterNamesFromPromptTemplate(templateJson));
|
|
5487
5493
|
// TODO: [🍧][❔] Remove this condition - modelRequirements should be put here via BLOCK command not removed when PROMPT_TEMPLATE
|
|
5488
5494
|
if (templateJson.blockType !== 'PROMPT_TEMPLATE') {
|
|
5489
5495
|
delete templateJson.modelRequirements;
|
|
@@ -5950,7 +5956,6 @@
|
|
|
5950
5956
|
});
|
|
5951
5957
|
}
|
|
5952
5958
|
/**
|
|
5953
|
-
* TODO: !!!! [🧠] Library precompilation and do not mix markdown and json pipelines
|
|
5954
5959
|
* Note: [🟢] This code should never be published outside of `@pipeline/node`
|
|
5955
5960
|
*/
|
|
5956
5961
|
|
|
@@ -6406,7 +6411,7 @@
|
|
|
6406
6411
|
return AnthropicClaudeExecutionTools;
|
|
6407
6412
|
}());
|
|
6408
6413
|
/**
|
|
6409
|
-
* TODO:
|
|
6414
|
+
* TODO: [🍆] JSON mode
|
|
6410
6415
|
* TODO: [🧠] Maybe handle errors via transformAnthropicError (like transformAzureError)
|
|
6411
6416
|
* TODO: Maybe Create some common util for callChatModel and callCompletionModel
|
|
6412
6417
|
* TODO: Maybe make custom OpenaiError
|
|
@@ -6997,7 +7002,6 @@
|
|
|
6997
7002
|
rawRequest = {
|
|
6998
7003
|
input: replaceParameters(content, __assign(__assign({}, parameters), { modelName: modelName })),
|
|
6999
7004
|
model: modelName,
|
|
7000
|
-
// TODO: !!!! Test model 3 and dimensions
|
|
7001
7005
|
};
|
|
7002
7006
|
start = getCurrentIsoDate();
|
|
7003
7007
|
if (this.options.isVerbose) {
|
|
@@ -7338,7 +7342,7 @@
|
|
|
7338
7342
|
return pipelineJsonStringified;
|
|
7339
7343
|
}
|
|
7340
7344
|
/**
|
|
7341
|
-
* TODO:
|
|
7345
|
+
* TODO: [🐝] Not Working propperly @see https://promptbook.studio/samples/mixed-knowledge.ptbk.md
|
|
7342
7346
|
* TODO: [🧠][0] Maybe rename to `stringifyPipelineJson`, `stringifyIndexedJson`,...
|
|
7343
7347
|
* TODO: [🧠] Maybe more elegant solution than replacing via regex
|
|
7344
7348
|
* TODO: [🍙] Make some standart order of json properties
|