@promptbook/node 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 +126 -122
- 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 +126 -122
- 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/esm/index.es.js
CHANGED
|
@@ -654,7 +654,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
654
654
|
});
|
|
655
655
|
}
|
|
656
656
|
|
|
657
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-
|
|
657
|
+
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"}];
|
|
658
658
|
|
|
659
659
|
/**
|
|
660
660
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
@@ -732,7 +732,7 @@ function isValidPromptbookVersion(version) {
|
|
|
732
732
|
if ( /* version === '1.0.0' || */version === '2.0.0' || version === '3.0.0') {
|
|
733
733
|
return false;
|
|
734
734
|
}
|
|
735
|
-
// <- TODO:
|
|
735
|
+
// <- TODO: !!! Check isValidPromptbookVersion against PROMPTBOOK_VERSIONS
|
|
736
736
|
return true;
|
|
737
737
|
}
|
|
738
738
|
|
|
@@ -857,52 +857,63 @@ function isValidPipelineUrl(url) {
|
|
|
857
857
|
*/
|
|
858
858
|
function validatePipeline(pipeline) {
|
|
859
859
|
// TODO: [🧠] Maybe test if promptbook is a promise and make specific error case for that
|
|
860
|
-
var e_1, _a, e_2, _b, e_3, _c
|
|
860
|
+
var e_1, _a, e_2, _b, e_3, _c;
|
|
861
|
+
var pipelineIdentification = (function () {
|
|
862
|
+
// Note: This is a 😐 implementation of [🚞]
|
|
863
|
+
var _ = [];
|
|
864
|
+
if (pipeline.sourceFile !== undefined) {
|
|
865
|
+
_.push("File: ".concat(pipeline.sourceFile));
|
|
866
|
+
}
|
|
867
|
+
if (pipeline.pipelineUrl !== undefined) {
|
|
868
|
+
_.push("Url: ".concat(pipeline.pipelineUrl));
|
|
869
|
+
}
|
|
870
|
+
return _.join('\n');
|
|
871
|
+
})();
|
|
861
872
|
if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
|
|
862
873
|
// <- Note: [🚲]
|
|
863
|
-
throw new PipelineLogicError("Invalid promptbook URL \"".concat(pipeline.pipelineUrl, "\""));
|
|
874
|
+
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Invalid promptbook URL \"".concat(pipeline.pipelineUrl, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
864
875
|
}
|
|
865
876
|
if (!isValidPromptbookVersion(pipeline.promptbookVersion)) {
|
|
866
877
|
// <- Note: [🚲]
|
|
867
|
-
throw new PipelineLogicError("Invalid
|
|
878
|
+
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.promptbookVersion, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
868
879
|
}
|
|
869
880
|
// TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
|
|
870
881
|
if (!Array.isArray(pipeline.parameters)) {
|
|
871
882
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
872
|
-
throw new ParsingError(spaceTrim$1("\n
|
|
883
|
+
throw new ParsingError(spaceTrim$1(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 "); }));
|
|
873
884
|
}
|
|
874
885
|
// TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
|
|
875
886
|
if (!Array.isArray(pipeline.promptTemplates)) {
|
|
876
887
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
877
|
-
throw new ParsingError(spaceTrim$1("\n
|
|
888
|
+
throw new ParsingError(spaceTrim$1(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 "); }));
|
|
878
889
|
}
|
|
879
890
|
var _loop_1 = function (parameter) {
|
|
880
891
|
if (parameter.isInput && parameter.isOutput) {
|
|
881
|
-
throw new PipelineLogicError("Parameter {".concat(parameter.name, "} can not be both input and output"));
|
|
892
|
+
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n\n Parameter {".concat(parameter.name, "} can not be both input and output\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
882
893
|
}
|
|
883
894
|
// Note: Testing that parameter is either intermediate or output BUT not created and unused
|
|
884
895
|
if (!parameter.isInput &&
|
|
885
896
|
!parameter.isOutput &&
|
|
886
897
|
!pipeline.promptTemplates.some(function (template) { return template.dependentParameterNames.includes(parameter.name); })) {
|
|
887
|
-
throw new PipelineLogicError(spaceTrim$1("\n
|
|
898
|
+
throw new PipelineLogicError(spaceTrim$1(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 "); }));
|
|
888
899
|
}
|
|
889
900
|
// Note: Testing that parameter is either input or result of some template
|
|
890
901
|
if (!parameter.isInput &&
|
|
891
902
|
!pipeline.promptTemplates.some(function (template) { return template.resultingParameterName === parameter.name; })) {
|
|
892
|
-
throw new PipelineLogicError(spaceTrim$1("\n
|
|
903
|
+
throw new PipelineLogicError(spaceTrim$1(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 "); }));
|
|
893
904
|
}
|
|
894
905
|
};
|
|
895
906
|
try {
|
|
896
907
|
// Note: Check each parameter individually
|
|
897
|
-
for (var
|
|
898
|
-
var parameter =
|
|
908
|
+
for (var _d = __values(pipeline.parameters), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
909
|
+
var parameter = _e.value;
|
|
899
910
|
_loop_1(parameter);
|
|
900
911
|
}
|
|
901
912
|
}
|
|
902
913
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
903
914
|
finally {
|
|
904
915
|
try {
|
|
905
|
-
if (
|
|
916
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
906
917
|
}
|
|
907
918
|
finally { if (e_1) throw e_1.error; }
|
|
908
919
|
}
|
|
@@ -914,70 +925,80 @@ function validatePipeline(pipeline) {
|
|
|
914
925
|
var name = _a.name;
|
|
915
926
|
return name;
|
|
916
927
|
}));
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
928
|
+
var _loop_2 = function (template) {
|
|
929
|
+
var e_4, _h, e_5, _j;
|
|
930
|
+
if (definedParameters.has(template.resultingParameterName)) {
|
|
931
|
+
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter {".concat(template.resultingParameterName, "} is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
932
|
+
}
|
|
933
|
+
if (RESERVED_PARAMETER_NAMES.includes(template.resultingParameterName)) {
|
|
934
|
+
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter name {".concat(template.resultingParameterName, "} is reserved, please use different name\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
935
|
+
}
|
|
936
|
+
definedParameters.add(template.resultingParameterName);
|
|
937
|
+
if (template.blockType === 'PROMPT_TEMPLATE' && template.modelRequirements.modelVariant === undefined) {
|
|
938
|
+
throw new PipelineLogicError(spaceTrim$1(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 "); }));
|
|
939
|
+
}
|
|
940
|
+
if (template.jokerParameterNames && template.jokerParameterNames.length > 0) {
|
|
941
|
+
if (!template.expectFormat &&
|
|
942
|
+
!template.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
|
|
943
|
+
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Joker parameters are used for {".concat(template.resultingParameterName, "} but no expectations are defined\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
923
944
|
}
|
|
924
|
-
|
|
925
|
-
|
|
945
|
+
var _loop_4 = function (joker) {
|
|
946
|
+
if (!template.dependentParameterNames.includes(joker)) {
|
|
947
|
+
throw new PipelineLogicError(spaceTrim$1(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 "); }));
|
|
948
|
+
}
|
|
949
|
+
};
|
|
950
|
+
try {
|
|
951
|
+
for (var _k = (e_4 = void 0, __values(template.jokerParameterNames)), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
952
|
+
var joker = _l.value;
|
|
953
|
+
_loop_4(joker);
|
|
954
|
+
}
|
|
926
955
|
}
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
956
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
957
|
+
finally {
|
|
958
|
+
try {
|
|
959
|
+
if (_l && !_l.done && (_h = _k.return)) _h.call(_k);
|
|
960
|
+
}
|
|
961
|
+
finally { if (e_4) throw e_4.error; }
|
|
930
962
|
}
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
963
|
+
}
|
|
964
|
+
if (template.expectations) {
|
|
965
|
+
var _loop_5 = function (unit, min, max) {
|
|
966
|
+
if (min !== undefined && max !== undefined && min > max) {
|
|
967
|
+
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Min expectation (=".concat(min, ") of ").concat(unit, " is higher than max expectation (=").concat(max, ")\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
935
968
|
}
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
var joker = _l.value;
|
|
939
|
-
if (!template.dependentParameterNames.includes(joker)) {
|
|
940
|
-
throw new PipelineLogicError("Parameter {".concat(joker, "} is used for {").concat(template.resultingParameterName, "} as joker but not in dependentParameterNames"));
|
|
941
|
-
}
|
|
942
|
-
}
|
|
969
|
+
if (min !== undefined && min < 0) {
|
|
970
|
+
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Min expectation of ".concat(unit, " must be zero or positive\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
943
971
|
}
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
972
|
+
if (max !== undefined && max <= 0) {
|
|
973
|
+
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Max expectation of ".concat(unit, " must be positive\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
974
|
+
}
|
|
975
|
+
};
|
|
976
|
+
try {
|
|
977
|
+
for (var _m = (e_5 = void 0, __values(Object.entries(template.expectations))), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
978
|
+
var _p = __read(_o.value, 2), unit = _p[0], _q = _p[1], min = _q.min, max = _q.max;
|
|
979
|
+
_loop_5(unit, min, max);
|
|
950
980
|
}
|
|
951
981
|
}
|
|
952
|
-
|
|
982
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
983
|
+
finally {
|
|
953
984
|
try {
|
|
954
|
-
|
|
955
|
-
var _p = __read(_o.value, 2), unit = _p[0], _q = _p[1], min = _q.min, max = _q.max;
|
|
956
|
-
if (min !== undefined && max !== undefined && min > max) {
|
|
957
|
-
throw new PipelineLogicError("Min expectation (=".concat(min, ") of ").concat(unit, " is higher than max expectation (=").concat(max, ")"));
|
|
958
|
-
}
|
|
959
|
-
if (min !== undefined && min < 0) {
|
|
960
|
-
throw new PipelineLogicError("Min expectation of ".concat(unit, " must be zero or positive"));
|
|
961
|
-
}
|
|
962
|
-
if (max !== undefined && max <= 0) {
|
|
963
|
-
throw new PipelineLogicError("Max expectation of ".concat(unit, " must be positive"));
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
968
|
-
finally {
|
|
969
|
-
try {
|
|
970
|
-
if (_o && !_o.done && (_d = _m.return)) _d.call(_m);
|
|
971
|
-
}
|
|
972
|
-
finally { if (e_4) throw e_4.error; }
|
|
985
|
+
if (_o && !_o.done && (_j = _m.return)) _j.call(_m);
|
|
973
986
|
}
|
|
987
|
+
finally { if (e_5) throw e_5.error; }
|
|
974
988
|
}
|
|
975
989
|
}
|
|
990
|
+
};
|
|
991
|
+
try {
|
|
992
|
+
// Note: Checking each template individually
|
|
993
|
+
for (var _f = __values(pipeline.promptTemplates), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
994
|
+
var template = _g.value;
|
|
995
|
+
_loop_2(template);
|
|
996
|
+
}
|
|
976
997
|
}
|
|
977
998
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
978
999
|
finally {
|
|
979
1000
|
try {
|
|
980
|
-
if (
|
|
1001
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
981
1002
|
}
|
|
982
1003
|
finally { if (e_2) throw e_2.error; }
|
|
983
1004
|
}
|
|
@@ -998,20 +1019,20 @@ function validatePipeline(pipeline) {
|
|
|
998
1019
|
resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), [reservedParameterName], false);
|
|
999
1020
|
}
|
|
1000
1021
|
}
|
|
1001
|
-
catch (
|
|
1022
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1002
1023
|
finally {
|
|
1003
1024
|
try {
|
|
1004
|
-
if (RESERVED_PARAMETER_NAMES_1_1 && !RESERVED_PARAMETER_NAMES_1_1.done && (
|
|
1025
|
+
if (RESERVED_PARAMETER_NAMES_1_1 && !RESERVED_PARAMETER_NAMES_1_1.done && (_c = RESERVED_PARAMETER_NAMES_1.return)) _c.call(RESERVED_PARAMETER_NAMES_1);
|
|
1005
1026
|
}
|
|
1006
|
-
finally { if (
|
|
1027
|
+
finally { if (e_3) throw e_3.error; }
|
|
1007
1028
|
}
|
|
1008
1029
|
var unresovedTemplates = __spreadArray([], __read(pipeline.promptTemplates), false);
|
|
1009
1030
|
// <- TODO: [🧠][🥜]
|
|
1010
1031
|
var loopLimit = LOOP_LIMIT;
|
|
1011
|
-
var
|
|
1032
|
+
var _loop_3 = function () {
|
|
1012
1033
|
if (loopLimit-- < 0) {
|
|
1013
1034
|
// Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
|
|
1014
|
-
throw new UnexpectedError(
|
|
1035
|
+
throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Loop limit reached during detection of circular dependencies in `validatePipeline`\n\n ".concat(block(pipelineIdentification), "\n "); }));
|
|
1015
1036
|
}
|
|
1016
1037
|
var currentlyResovedTemplates = unresovedTemplates.filter(function (template) {
|
|
1017
1038
|
return template.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
|
|
@@ -1026,7 +1047,7 @@ function validatePipeline(pipeline) {
|
|
|
1026
1047
|
.map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
|
|
1027
1048
|
.join(' and '));
|
|
1028
1049
|
})
|
|
1029
|
-
.join('\n')), "\n\n Resolved:\n ").concat(block(resovedParameters.map(function (name) { return "- Parameter {".concat(name, "}"); }).join('\n')), "\n "); }));
|
|
1050
|
+
.join('\n')), "\n\n Resolved:\n ").concat(block(resovedParameters.map(function (name) { return "- Parameter {".concat(name, "}"); }).join('\n')), "\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1030
1051
|
}
|
|
1031
1052
|
resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTemplates.map(function (_a) {
|
|
1032
1053
|
var resultingParameterName = _a.resultingParameterName;
|
|
@@ -1035,7 +1056,7 @@ function validatePipeline(pipeline) {
|
|
|
1035
1056
|
unresovedTemplates = unresovedTemplates.filter(function (template) { return !currentlyResovedTemplates.includes(template); });
|
|
1036
1057
|
};
|
|
1037
1058
|
while (unresovedTemplates.length > 0) {
|
|
1038
|
-
|
|
1059
|
+
_loop_3();
|
|
1039
1060
|
}
|
|
1040
1061
|
return pipeline;
|
|
1041
1062
|
}
|
|
@@ -1051,12 +1072,12 @@ function validatePipeline(pipeline) {
|
|
|
1051
1072
|
* > ex port function validatePipeline(promptbook: really_unknown): asserts promptbook is PipelineJson {
|
|
1052
1073
|
*/
|
|
1053
1074
|
/**
|
|
1054
|
-
* TODO: [
|
|
1055
|
-
* TODO: [
|
|
1056
|
-
* TODO: [
|
|
1057
|
-
* TODO: !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
|
|
1058
|
-
* TODO: !!!! Validate that reserved parameter is not used as joker
|
|
1059
|
-
* TODO: [🧠]
|
|
1075
|
+
* TODO: [🐣] !!!! Validate that all samples match expectations
|
|
1076
|
+
* TODO: [🐣][🐝] !!!! Validate that knowledge is valid (non-void)
|
|
1077
|
+
* TODO: [🐣] !!!! Validate that persona can be used only with CHAT variant
|
|
1078
|
+
* TODO: [🐣] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
|
|
1079
|
+
* TODO: [🐣] !!!! Validate that reserved parameter is not used as joker
|
|
1080
|
+
* TODO: [🧠] Validation not only logic itself but imports around - files and websites and rerefenced pipelines exists
|
|
1060
1081
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
1061
1082
|
*/
|
|
1062
1083
|
|
|
@@ -1094,7 +1115,7 @@ var ReferenceError$1 = /** @class */ (function (_super) {
|
|
|
1094
1115
|
* @param template the template with parameters in {curly} braces
|
|
1095
1116
|
* @returns the list of parameter names
|
|
1096
1117
|
*/
|
|
1097
|
-
function
|
|
1118
|
+
function extractParameterNames(template) {
|
|
1098
1119
|
var e_1, _a;
|
|
1099
1120
|
var matches = template.matchAll(/{\w+}/g);
|
|
1100
1121
|
var parameterNames = new Set();
|
|
@@ -1114,9 +1135,6 @@ function extractParameters(template) {
|
|
|
1114
1135
|
}
|
|
1115
1136
|
return parameterNames;
|
|
1116
1137
|
}
|
|
1117
|
-
/**
|
|
1118
|
-
* TODO: !!!!! Rename to extractParameterNames
|
|
1119
|
-
*/
|
|
1120
1138
|
|
|
1121
1139
|
/**
|
|
1122
1140
|
* Unprepare just strips the preparation data of the pipeline
|
|
@@ -1127,7 +1145,7 @@ function unpreparePipeline(pipeline) {
|
|
|
1127
1145
|
knowledgeSources = knowledgeSources.map(function (knowledgeSource) { return (__assign(__assign({}, knowledgeSource), { preparationIds: undefined })); });
|
|
1128
1146
|
promptTemplates = promptTemplates.map(function (promptTemplate) {
|
|
1129
1147
|
var dependentParameterNames = promptTemplate.dependentParameterNames;
|
|
1130
|
-
var parameterNames =
|
|
1148
|
+
var parameterNames = extractParameterNames(promptTemplate.preparedContent || '');
|
|
1131
1149
|
dependentParameterNames = dependentParameterNames.filter(function (dependentParameterName) { return !parameterNames.has(dependentParameterName); });
|
|
1132
1150
|
var promptTemplateUnprepared = __assign(__assign({}, promptTemplate), { dependentParameterNames: dependentParameterNames });
|
|
1133
1151
|
delete promptTemplateUnprepared.preparedContent;
|
|
@@ -1684,12 +1702,12 @@ function extractVariables(script) {
|
|
|
1684
1702
|
* @returns the set of parameter names
|
|
1685
1703
|
* @throws {ParsingError} if the script is invalid
|
|
1686
1704
|
*/
|
|
1687
|
-
function
|
|
1705
|
+
function extractParameterNamesFromPromptTemplate(promptTemplate) {
|
|
1688
1706
|
var e_1, _a, e_2, _b, e_3, _c;
|
|
1689
1707
|
var title = promptTemplate.title, description = promptTemplate.description, blockType = promptTemplate.blockType, content = promptTemplate.content, preparedContent = promptTemplate.preparedContent, jokerParameterNames = promptTemplate.jokerParameterNames;
|
|
1690
1708
|
var parameterNames = new Set();
|
|
1691
1709
|
try {
|
|
1692
|
-
for (var _d = __values(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(
|
|
1710
|
+
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()) {
|
|
1693
1711
|
var parameterName = _e.value;
|
|
1694
1712
|
parameterNames.add(parameterName);
|
|
1695
1713
|
}
|
|
@@ -1757,7 +1775,7 @@ var ExpectError = /** @class */ (function (_super) {
|
|
|
1757
1775
|
/**
|
|
1758
1776
|
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
1759
1777
|
*/
|
|
1760
|
-
function isValidJsonString(value /* <-[👨⚖️] */) {
|
|
1778
|
+
function isValidJsonString(value /* <- [👨⚖️] */) {
|
|
1761
1779
|
try {
|
|
1762
1780
|
JSON.parse(value);
|
|
1763
1781
|
return true;
|
|
@@ -2041,9 +2059,9 @@ function isPipelinePrepared(pipeline) {
|
|
|
2041
2059
|
* TODO: [🔼] Export via core or utils
|
|
2042
2060
|
* TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
|
|
2043
2061
|
* TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
|
|
2044
|
-
* - Is context in each template
|
|
2045
|
-
* - Are samples prepared
|
|
2046
|
-
* - Are templates prepared
|
|
2062
|
+
* - [🏍] ? Is context in each template
|
|
2063
|
+
* - [♨] Are samples prepared
|
|
2064
|
+
* - [♨] Are templates prepared
|
|
2047
2065
|
*/
|
|
2048
2066
|
|
|
2049
2067
|
/**
|
|
@@ -2250,7 +2268,7 @@ function union() {
|
|
|
2250
2268
|
/**
|
|
2251
2269
|
* The version of the Promptbook library
|
|
2252
2270
|
*/
|
|
2253
|
-
var PROMPTBOOK_VERSION = '0.61.0-
|
|
2271
|
+
var PROMPTBOOK_VERSION = '0.61.0-26';
|
|
2254
2272
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
2255
2273
|
|
|
2256
2274
|
/**
|
|
@@ -2380,7 +2398,7 @@ function createPipelineExecutor(options) {
|
|
|
2380
2398
|
pipeline = rawPipeline;
|
|
2381
2399
|
}
|
|
2382
2400
|
else {
|
|
2383
|
-
// TODO:
|
|
2401
|
+
// TODO: !!!!! This should be maybe warning in report
|
|
2384
2402
|
console.warn(spaceTrim$1("\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 ")));
|
|
2385
2403
|
}
|
|
2386
2404
|
var pipelineExecutor = function (inputParameters, onProgress) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -2390,7 +2408,7 @@ function createPipelineExecutor(options) {
|
|
|
2390
2408
|
return __awaiter(this, void 0, void 0, function () {
|
|
2391
2409
|
return __generator(this, function (_a) {
|
|
2392
2410
|
TODO_USE(template);
|
|
2393
|
-
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO:
|
|
2411
|
+
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [🏍] Implement */];
|
|
2394
2412
|
});
|
|
2395
2413
|
});
|
|
2396
2414
|
}
|
|
@@ -2398,7 +2416,7 @@ function createPipelineExecutor(options) {
|
|
|
2398
2416
|
template) {
|
|
2399
2417
|
return __awaiter(this, void 0, void 0, function () {
|
|
2400
2418
|
return __generator(this, function (_a) {
|
|
2401
|
-
// TODO:
|
|
2419
|
+
// TODO: [♨] Implement Better - use real index and keyword search
|
|
2402
2420
|
TODO_USE(template);
|
|
2403
2421
|
return [2 /*return*/, pipeline.knowledgePieces.map(function (_a) {
|
|
2404
2422
|
var content = _a.content;
|
|
@@ -2411,9 +2429,9 @@ function createPipelineExecutor(options) {
|
|
|
2411
2429
|
template) {
|
|
2412
2430
|
return __awaiter(this, void 0, void 0, function () {
|
|
2413
2431
|
return __generator(this, function (_a) {
|
|
2414
|
-
// TODO:
|
|
2432
|
+
// TODO: [♨] Implement Better - use real index and keyword search
|
|
2415
2433
|
TODO_USE(template);
|
|
2416
|
-
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO:
|
|
2434
|
+
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [♨] Implement */];
|
|
2417
2435
|
});
|
|
2418
2436
|
});
|
|
2419
2437
|
}
|
|
@@ -2489,7 +2507,7 @@ function createPipelineExecutor(options) {
|
|
|
2489
2507
|
_u.sent();
|
|
2490
2508
|
_u.label = 2;
|
|
2491
2509
|
case 2:
|
|
2492
|
-
usedParameterNames =
|
|
2510
|
+
usedParameterNames = extractParameterNamesFromPromptTemplate(currentTemplate);
|
|
2493
2511
|
dependentParameterNames = new Set(currentTemplate.dependentParameterNames);
|
|
2494
2512
|
if (union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)).size !== 0) {
|
|
2495
2513
|
throw new UnexpectedError(spaceTrim$1("\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 ")));
|
|
@@ -2875,14 +2893,7 @@ function createPipelineExecutor(options) {
|
|
|
2875
2893
|
) {
|
|
2876
2894
|
// TODO: [🧠] Maybe put other blockTypes into report
|
|
2877
2895
|
executionReport.promptExecutions.push({
|
|
2878
|
-
prompt: {
|
|
2879
|
-
title: currentTemplate.title /* <- Note: If title in pipeline contains emojis, pass it innto report */,
|
|
2880
|
-
content: prompt.content,
|
|
2881
|
-
modelRequirements: prompt.modelRequirements,
|
|
2882
|
-
expectations: prompt.expectations,
|
|
2883
|
-
expectFormat: prompt.expectFormat,
|
|
2884
|
-
// <- Note: Do want to pass ONLY wanted information to the report
|
|
2885
|
-
},
|
|
2896
|
+
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 }),
|
|
2886
2897
|
result: result || undefined,
|
|
2887
2898
|
error: expectError || undefined,
|
|
2888
2899
|
});
|
|
@@ -3146,8 +3157,8 @@ function createPipelineExecutor(options) {
|
|
|
3146
3157
|
return pipelineExecutor;
|
|
3147
3158
|
}
|
|
3148
3159
|
/**
|
|
3149
|
-
* TODO:
|
|
3150
|
-
* TODO:
|
|
3160
|
+
* TODO: !!!!! return `preparedPipeline` from execution
|
|
3161
|
+
* TODO: !!!!! `isNotPreparedWarningSupressed`
|
|
3151
3162
|
* TODO: Use isVerbose here (not only pass to `preparePipeline`)
|
|
3152
3163
|
* TODO: [🪂] Use maxParallelCount here (not only pass to `preparePipeline`)
|
|
3153
3164
|
* TODO: [♈] Probbably move expectations from templates to parameters
|
|
@@ -3156,7 +3167,7 @@ function createPipelineExecutor(options) {
|
|
|
3156
3167
|
* Note: CreatePipelineExecutorOptions are just connected to PipelineExecutor so do not extract to types folder
|
|
3157
3168
|
* TODO: [🧠][3] transparent = (report intermediate parameters) / opaque execution = (report only output parameters) progress reporting mode
|
|
3158
3169
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
3159
|
-
* TODO: [💷]
|
|
3170
|
+
* TODO: [🧠][💷] `assertsExecutionSuccessful` should be the method of `PipelineExecutor` result BUT maybe NOT to preserve pure JSON object
|
|
3160
3171
|
*/
|
|
3161
3172
|
|
|
3162
3173
|
/**
|
|
@@ -3432,7 +3443,7 @@ function prepareTemplates(pipeline, options) {
|
|
|
3432
3443
|
case 0:
|
|
3433
3444
|
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a;
|
|
3434
3445
|
promptTemplates = pipeline.promptTemplates, parameters = pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
|
|
3435
|
-
// TODO:
|
|
3446
|
+
// TODO: !!!!!! Apply samples to each template (if missing and is for the template defined)
|
|
3436
3447
|
TODO_USE(parameters);
|
|
3437
3448
|
promptTemplatesPrepared = new Array(promptTemplates.length);
|
|
3438
3449
|
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 () {
|
|
@@ -3462,7 +3473,7 @@ function prepareTemplates(pipeline, options) {
|
|
|
3462
3473
|
/**
|
|
3463
3474
|
* TODO: [🧠] Add context to each template (if missing)
|
|
3464
3475
|
* TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
|
|
3465
|
-
* TODO:
|
|
3476
|
+
* TODO: [♨] !!! Prepare index the samples and maybe templates
|
|
3466
3477
|
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
3467
3478
|
* TODO: Write tests for `preparePipeline`
|
|
3468
3479
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
@@ -3541,7 +3552,7 @@ function preparePipeline(pipeline, options) {
|
|
|
3541
3552
|
* TODO: Write tests for `preparePipeline`
|
|
3542
3553
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
3543
3554
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
3544
|
-
* TODO: [🎐]
|
|
3555
|
+
* TODO: [🎐] !!!!!! Use here countTotalUsage
|
|
3545
3556
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
3546
3557
|
*/
|
|
3547
3558
|
|
|
@@ -4362,11 +4373,8 @@ var promptbookVersionCommandParser = {
|
|
|
4362
4373
|
/**
|
|
4363
4374
|
* Name of the command
|
|
4364
4375
|
*/
|
|
4365
|
-
name: '
|
|
4366
|
-
|
|
4367
|
-
Note: [📇] No need to put here "PROMPTBOOK" alias here
|
|
4368
|
-
aliasNames: ['PROMPTBOOK_VERSION'],
|
|
4369
|
-
*/
|
|
4376
|
+
name: 'PROMPTBOOK_VERSION',
|
|
4377
|
+
aliasNames: ['PTBK_VERSION', 'PTBK_V', 'PTBKV'],
|
|
4370
4378
|
/**
|
|
4371
4379
|
* BOILERPLATE command can be used in:
|
|
4372
4380
|
*/
|
|
@@ -4382,7 +4390,7 @@ var promptbookVersionCommandParser = {
|
|
|
4382
4390
|
/**
|
|
4383
4391
|
* Example usages of the PROMPTBOOK_VERSION command
|
|
4384
4392
|
*/
|
|
4385
|
-
examples: ["PROMPTBOOK VERSION ".concat(PROMPTBOOK_VERSION), "
|
|
4393
|
+
examples: ["PROMPTBOOK VERSION ".concat(PROMPTBOOK_VERSION), "PTBKV ".concat(PROMPTBOOK_VERSION)],
|
|
4386
4394
|
/**
|
|
4387
4395
|
* Parses the PROMPTBOOK_VERSION command
|
|
4388
4396
|
*/
|
|
@@ -4416,8 +4424,9 @@ var urlCommandParser = {
|
|
|
4416
4424
|
* Name of the command
|
|
4417
4425
|
*/
|
|
4418
4426
|
name: 'URL',
|
|
4427
|
+
aliasNames: ['PIPELINE_URL'],
|
|
4419
4428
|
/*
|
|
4420
|
-
Note: [🛵] No need for alias name because it is already preprocessed
|
|
4429
|
+
Note: [🛵] No need for this alias name because it is already preprocessed
|
|
4421
4430
|
aliasNames: ['HTTPS'],
|
|
4422
4431
|
*/
|
|
4423
4432
|
/**
|
|
@@ -4436,6 +4445,7 @@ var urlCommandParser = {
|
|
|
4436
4445
|
* Example usages of the URL command
|
|
4437
4446
|
*/
|
|
4438
4447
|
examples: [
|
|
4448
|
+
'PIPELINE URL https://promptbook.studio/library/write-cv.ptbk.md',
|
|
4439
4449
|
'URL https://promptbook.studio/library/write-cv.ptbk.md',
|
|
4440
4450
|
'https://promptbook.studio/library/write-cv.ptbk.md',
|
|
4441
4451
|
],
|
|
@@ -4674,10 +4684,6 @@ function parseCommand(raw, usagePlace) {
|
|
|
4674
4684
|
.split(' ')
|
|
4675
4685
|
.map(function (part) { return part.trim(); })
|
|
4676
4686
|
.filter(function (item) { return item !== ''; })
|
|
4677
|
-
// Note: [📇]:
|
|
4678
|
-
.filter(function (item) { return !/^PTBK$/i.test(item); })
|
|
4679
|
-
.filter(function (item) { return !/^PIPELINE$/i.test(item); })
|
|
4680
|
-
.filter(function (item) { return !/^PROMPTBOOK$/i.test(item); })
|
|
4681
4687
|
.map(removeMarkdownFormatting)
|
|
4682
4688
|
.map(function (item) { return item.trim(); });
|
|
4683
4689
|
if (items.length === 0 || items[0] === '') {
|
|
@@ -5392,7 +5398,7 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
5392
5398
|
if (templateModelRequirements.modelVariant === undefined) {
|
|
5393
5399
|
templateModelRequirements.modelVariant = 'CHAT';
|
|
5394
5400
|
}
|
|
5395
|
-
templateJson.dependentParameterNames = Array.from(
|
|
5401
|
+
templateJson.dependentParameterNames = Array.from(extractParameterNamesFromPromptTemplate(templateJson));
|
|
5396
5402
|
// TODO: [🍧][❔] Remove this condition - modelRequirements should be put here via BLOCK command not removed when PROMPT_TEMPLATE
|
|
5397
5403
|
if (templateJson.blockType !== 'PROMPT_TEMPLATE') {
|
|
5398
5404
|
delete templateJson.modelRequirements;
|
|
@@ -5875,7 +5881,6 @@ function listAllFiles(path, isRecursive) {
|
|
|
5875
5881
|
});
|
|
5876
5882
|
}
|
|
5877
5883
|
/**
|
|
5878
|
-
* TODO: !!!! [🧠] Library precompilation and do not mix markdown and json pipelines
|
|
5879
5884
|
* Note: [🟢] This code should never be published outside of `@pipeline/node`
|
|
5880
5885
|
*/
|
|
5881
5886
|
|
|
@@ -6226,7 +6231,7 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
|
|
|
6226
6231
|
return AnthropicClaudeExecutionTools;
|
|
6227
6232
|
}());
|
|
6228
6233
|
/**
|
|
6229
|
-
* TODO:
|
|
6234
|
+
* TODO: [🍆] JSON mode
|
|
6230
6235
|
* TODO: [🧠] Maybe handle errors via transformAnthropicError (like transformAzureError)
|
|
6231
6236
|
* TODO: Maybe Create some common util for callChatModel and callCompletionModel
|
|
6232
6237
|
* TODO: Maybe make custom OpenaiError
|
|
@@ -6817,7 +6822,6 @@ var OpenAiExecutionTools = /** @class */ (function () {
|
|
|
6817
6822
|
rawRequest = {
|
|
6818
6823
|
input: replaceParameters(content, __assign(__assign({}, parameters), { modelName: modelName })),
|
|
6819
6824
|
model: modelName,
|
|
6820
|
-
// TODO: !!!! Test model 3 and dimensions
|
|
6821
6825
|
};
|
|
6822
6826
|
start = getCurrentIsoDate();
|
|
6823
6827
|
if (this.options.isVerbose) {
|