@promptbook/core 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 -121
- 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 +1 -1
- package/umd/index.umd.js +127 -121
- 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
|
@@ -575,7 +575,7 @@ function isValidPromptbookVersion(version) {
|
|
|
575
575
|
if ( /* version === '1.0.0' || */version === '2.0.0' || version === '3.0.0') {
|
|
576
576
|
return false;
|
|
577
577
|
}
|
|
578
|
-
// <- TODO:
|
|
578
|
+
// <- TODO: !!! Check isValidPromptbookVersion against PROMPTBOOK_VERSIONS
|
|
579
579
|
return true;
|
|
580
580
|
}
|
|
581
581
|
|
|
@@ -700,52 +700,63 @@ function isValidPipelineUrl(url) {
|
|
|
700
700
|
*/
|
|
701
701
|
function validatePipeline(pipeline) {
|
|
702
702
|
// TODO: [🧠] Maybe test if promptbook is a promise and make specific error case for that
|
|
703
|
-
var e_1, _a, e_2, _b, e_3, _c
|
|
703
|
+
var e_1, _a, e_2, _b, e_3, _c;
|
|
704
|
+
var pipelineIdentification = (function () {
|
|
705
|
+
// Note: This is a 😐 implementation of [🚞]
|
|
706
|
+
var _ = [];
|
|
707
|
+
if (pipeline.sourceFile !== undefined) {
|
|
708
|
+
_.push("File: ".concat(pipeline.sourceFile));
|
|
709
|
+
}
|
|
710
|
+
if (pipeline.pipelineUrl !== undefined) {
|
|
711
|
+
_.push("Url: ".concat(pipeline.pipelineUrl));
|
|
712
|
+
}
|
|
713
|
+
return _.join('\n');
|
|
714
|
+
})();
|
|
704
715
|
if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
|
|
705
716
|
// <- Note: [🚲]
|
|
706
|
-
throw new PipelineLogicError("Invalid promptbook URL \"".concat(pipeline.pipelineUrl, "\""));
|
|
717
|
+
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Invalid promptbook URL \"".concat(pipeline.pipelineUrl, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
707
718
|
}
|
|
708
719
|
if (!isValidPromptbookVersion(pipeline.promptbookVersion)) {
|
|
709
720
|
// <- Note: [🚲]
|
|
710
|
-
throw new PipelineLogicError("Invalid
|
|
721
|
+
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.promptbookVersion, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
711
722
|
}
|
|
712
723
|
// TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
|
|
713
724
|
if (!Array.isArray(pipeline.parameters)) {
|
|
714
725
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
715
|
-
throw new ParsingError(spaceTrim$1("\n
|
|
726
|
+
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 "); }));
|
|
716
727
|
}
|
|
717
728
|
// TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
|
|
718
729
|
if (!Array.isArray(pipeline.promptTemplates)) {
|
|
719
730
|
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
720
|
-
throw new ParsingError(spaceTrim$1("\n
|
|
731
|
+
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 "); }));
|
|
721
732
|
}
|
|
722
733
|
var _loop_1 = function (parameter) {
|
|
723
734
|
if (parameter.isInput && parameter.isOutput) {
|
|
724
|
-
throw new PipelineLogicError("Parameter {".concat(parameter.name, "} can not be both input and output"));
|
|
735
|
+
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 "); }));
|
|
725
736
|
}
|
|
726
737
|
// Note: Testing that parameter is either intermediate or output BUT not created and unused
|
|
727
738
|
if (!parameter.isInput &&
|
|
728
739
|
!parameter.isOutput &&
|
|
729
740
|
!pipeline.promptTemplates.some(function (template) { return template.dependentParameterNames.includes(parameter.name); })) {
|
|
730
|
-
throw new PipelineLogicError(spaceTrim$1("\n
|
|
741
|
+
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 "); }));
|
|
731
742
|
}
|
|
732
743
|
// Note: Testing that parameter is either input or result of some template
|
|
733
744
|
if (!parameter.isInput &&
|
|
734
745
|
!pipeline.promptTemplates.some(function (template) { return template.resultingParameterName === parameter.name; })) {
|
|
735
|
-
throw new PipelineLogicError(spaceTrim$1("\n
|
|
746
|
+
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 "); }));
|
|
736
747
|
}
|
|
737
748
|
};
|
|
738
749
|
try {
|
|
739
750
|
// Note: Check each parameter individually
|
|
740
|
-
for (var
|
|
741
|
-
var parameter =
|
|
751
|
+
for (var _d = __values(pipeline.parameters), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
752
|
+
var parameter = _e.value;
|
|
742
753
|
_loop_1(parameter);
|
|
743
754
|
}
|
|
744
755
|
}
|
|
745
756
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
746
757
|
finally {
|
|
747
758
|
try {
|
|
748
|
-
if (
|
|
759
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
749
760
|
}
|
|
750
761
|
finally { if (e_1) throw e_1.error; }
|
|
751
762
|
}
|
|
@@ -757,70 +768,80 @@ function validatePipeline(pipeline) {
|
|
|
757
768
|
var name = _a.name;
|
|
758
769
|
return name;
|
|
759
770
|
}));
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
771
|
+
var _loop_2 = function (template) {
|
|
772
|
+
var e_4, _h, e_5, _j;
|
|
773
|
+
if (definedParameters.has(template.resultingParameterName)) {
|
|
774
|
+
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter {".concat(template.resultingParameterName, "} is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
775
|
+
}
|
|
776
|
+
if (RESERVED_PARAMETER_NAMES.includes(template.resultingParameterName)) {
|
|
777
|
+
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 "); }));
|
|
778
|
+
}
|
|
779
|
+
definedParameters.add(template.resultingParameterName);
|
|
780
|
+
if (template.blockType === 'PROMPT_TEMPLATE' && template.modelRequirements.modelVariant === undefined) {
|
|
781
|
+
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 "); }));
|
|
782
|
+
}
|
|
783
|
+
if (template.jokerParameterNames && template.jokerParameterNames.length > 0) {
|
|
784
|
+
if (!template.expectFormat &&
|
|
785
|
+
!template.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
|
|
786
|
+
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 "); }));
|
|
766
787
|
}
|
|
767
|
-
|
|
768
|
-
|
|
788
|
+
var _loop_4 = function (joker) {
|
|
789
|
+
if (!template.dependentParameterNames.includes(joker)) {
|
|
790
|
+
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 "); }));
|
|
791
|
+
}
|
|
792
|
+
};
|
|
793
|
+
try {
|
|
794
|
+
for (var _k = (e_4 = void 0, __values(template.jokerParameterNames)), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
795
|
+
var joker = _l.value;
|
|
796
|
+
_loop_4(joker);
|
|
797
|
+
}
|
|
769
798
|
}
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
799
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
800
|
+
finally {
|
|
801
|
+
try {
|
|
802
|
+
if (_l && !_l.done && (_h = _k.return)) _h.call(_k);
|
|
803
|
+
}
|
|
804
|
+
finally { if (e_4) throw e_4.error; }
|
|
773
805
|
}
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
806
|
+
}
|
|
807
|
+
if (template.expectations) {
|
|
808
|
+
var _loop_5 = function (unit, min, max) {
|
|
809
|
+
if (min !== undefined && max !== undefined && min > max) {
|
|
810
|
+
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 "); }));
|
|
778
811
|
}
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
var joker = _l.value;
|
|
782
|
-
if (!template.dependentParameterNames.includes(joker)) {
|
|
783
|
-
throw new PipelineLogicError("Parameter {".concat(joker, "} is used for {").concat(template.resultingParameterName, "} as joker but not in dependentParameterNames"));
|
|
784
|
-
}
|
|
785
|
-
}
|
|
812
|
+
if (min !== undefined && min < 0) {
|
|
813
|
+
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 "); }));
|
|
786
814
|
}
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
815
|
+
if (max !== undefined && max <= 0) {
|
|
816
|
+
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Max expectation of ".concat(unit, " must be positive\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
817
|
+
}
|
|
818
|
+
};
|
|
819
|
+
try {
|
|
820
|
+
for (var _m = (e_5 = void 0, __values(Object.entries(template.expectations))), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
821
|
+
var _p = __read(_o.value, 2), unit = _p[0], _q = _p[1], min = _q.min, max = _q.max;
|
|
822
|
+
_loop_5(unit, min, max);
|
|
793
823
|
}
|
|
794
824
|
}
|
|
795
|
-
|
|
825
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
826
|
+
finally {
|
|
796
827
|
try {
|
|
797
|
-
|
|
798
|
-
var _p = __read(_o.value, 2), unit = _p[0], _q = _p[1], min = _q.min, max = _q.max;
|
|
799
|
-
if (min !== undefined && max !== undefined && min > max) {
|
|
800
|
-
throw new PipelineLogicError("Min expectation (=".concat(min, ") of ").concat(unit, " is higher than max expectation (=").concat(max, ")"));
|
|
801
|
-
}
|
|
802
|
-
if (min !== undefined && min < 0) {
|
|
803
|
-
throw new PipelineLogicError("Min expectation of ".concat(unit, " must be zero or positive"));
|
|
804
|
-
}
|
|
805
|
-
if (max !== undefined && max <= 0) {
|
|
806
|
-
throw new PipelineLogicError("Max expectation of ".concat(unit, " must be positive"));
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
811
|
-
finally {
|
|
812
|
-
try {
|
|
813
|
-
if (_o && !_o.done && (_d = _m.return)) _d.call(_m);
|
|
814
|
-
}
|
|
815
|
-
finally { if (e_4) throw e_4.error; }
|
|
828
|
+
if (_o && !_o.done && (_j = _m.return)) _j.call(_m);
|
|
816
829
|
}
|
|
830
|
+
finally { if (e_5) throw e_5.error; }
|
|
817
831
|
}
|
|
818
832
|
}
|
|
833
|
+
};
|
|
834
|
+
try {
|
|
835
|
+
// Note: Checking each template individually
|
|
836
|
+
for (var _f = __values(pipeline.promptTemplates), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
837
|
+
var template = _g.value;
|
|
838
|
+
_loop_2(template);
|
|
839
|
+
}
|
|
819
840
|
}
|
|
820
841
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
821
842
|
finally {
|
|
822
843
|
try {
|
|
823
|
-
if (
|
|
844
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
824
845
|
}
|
|
825
846
|
finally { if (e_2) throw e_2.error; }
|
|
826
847
|
}
|
|
@@ -841,20 +862,20 @@ function validatePipeline(pipeline) {
|
|
|
841
862
|
resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), [reservedParameterName], false);
|
|
842
863
|
}
|
|
843
864
|
}
|
|
844
|
-
catch (
|
|
865
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
845
866
|
finally {
|
|
846
867
|
try {
|
|
847
|
-
if (RESERVED_PARAMETER_NAMES_1_1 && !RESERVED_PARAMETER_NAMES_1_1.done && (
|
|
868
|
+
if (RESERVED_PARAMETER_NAMES_1_1 && !RESERVED_PARAMETER_NAMES_1_1.done && (_c = RESERVED_PARAMETER_NAMES_1.return)) _c.call(RESERVED_PARAMETER_NAMES_1);
|
|
848
869
|
}
|
|
849
|
-
finally { if (
|
|
870
|
+
finally { if (e_3) throw e_3.error; }
|
|
850
871
|
}
|
|
851
872
|
var unresovedTemplates = __spreadArray([], __read(pipeline.promptTemplates), false);
|
|
852
873
|
// <- TODO: [🧠][🥜]
|
|
853
874
|
var loopLimit = LOOP_LIMIT;
|
|
854
|
-
var
|
|
875
|
+
var _loop_3 = function () {
|
|
855
876
|
if (loopLimit-- < 0) {
|
|
856
877
|
// Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
|
|
857
|
-
throw new UnexpectedError(
|
|
878
|
+
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 "); }));
|
|
858
879
|
}
|
|
859
880
|
var currentlyResovedTemplates = unresovedTemplates.filter(function (template) {
|
|
860
881
|
return template.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
|
|
@@ -869,7 +890,7 @@ function validatePipeline(pipeline) {
|
|
|
869
890
|
.map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
|
|
870
891
|
.join(' and '));
|
|
871
892
|
})
|
|
872
|
-
.join('\n')), "\n\n Resolved:\n ").concat(block(resovedParameters.map(function (name) { return "- Parameter {".concat(name, "}"); }).join('\n')), "\n "); }));
|
|
893
|
+
.join('\n')), "\n\n Resolved:\n ").concat(block(resovedParameters.map(function (name) { return "- Parameter {".concat(name, "}"); }).join('\n')), "\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
873
894
|
}
|
|
874
895
|
resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTemplates.map(function (_a) {
|
|
875
896
|
var resultingParameterName = _a.resultingParameterName;
|
|
@@ -878,7 +899,7 @@ function validatePipeline(pipeline) {
|
|
|
878
899
|
unresovedTemplates = unresovedTemplates.filter(function (template) { return !currentlyResovedTemplates.includes(template); });
|
|
879
900
|
};
|
|
880
901
|
while (unresovedTemplates.length > 0) {
|
|
881
|
-
|
|
902
|
+
_loop_3();
|
|
882
903
|
}
|
|
883
904
|
return pipeline;
|
|
884
905
|
}
|
|
@@ -894,12 +915,12 @@ function validatePipeline(pipeline) {
|
|
|
894
915
|
* > ex port function validatePipeline(promptbook: really_unknown): asserts promptbook is PipelineJson {
|
|
895
916
|
*/
|
|
896
917
|
/**
|
|
897
|
-
* TODO: [
|
|
898
|
-
* TODO: [
|
|
899
|
-
* TODO: [
|
|
900
|
-
* TODO: !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
|
|
901
|
-
* TODO: !!!! Validate that reserved parameter is not used as joker
|
|
902
|
-
* TODO: [🧠]
|
|
918
|
+
* TODO: [🐣] !!!! Validate that all samples match expectations
|
|
919
|
+
* TODO: [🐣][🐝] !!!! Validate that knowledge is valid (non-void)
|
|
920
|
+
* TODO: [🐣] !!!! Validate that persona can be used only with CHAT variant
|
|
921
|
+
* TODO: [🐣] !!!! Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
|
|
922
|
+
* TODO: [🐣] !!!! Validate that reserved parameter is not used as joker
|
|
923
|
+
* TODO: [🧠] Validation not only logic itself but imports around - files and websites and rerefenced pipelines exists
|
|
903
924
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
904
925
|
*/
|
|
905
926
|
|
|
@@ -937,7 +958,7 @@ var ReferenceError$1 = /** @class */ (function (_super) {
|
|
|
937
958
|
* @param template the template with parameters in {curly} braces
|
|
938
959
|
* @returns the list of parameter names
|
|
939
960
|
*/
|
|
940
|
-
function
|
|
961
|
+
function extractParameterNames(template) {
|
|
941
962
|
var e_1, _a;
|
|
942
963
|
var matches = template.matchAll(/{\w+}/g);
|
|
943
964
|
var parameterNames = new Set();
|
|
@@ -957,9 +978,6 @@ function extractParameters(template) {
|
|
|
957
978
|
}
|
|
958
979
|
return parameterNames;
|
|
959
980
|
}
|
|
960
|
-
/**
|
|
961
|
-
* TODO: !!!!! Rename to extractParameterNames
|
|
962
|
-
*/
|
|
963
981
|
|
|
964
982
|
/**
|
|
965
983
|
* Unprepare just strips the preparation data of the pipeline
|
|
@@ -970,7 +988,7 @@ function unpreparePipeline(pipeline) {
|
|
|
970
988
|
knowledgeSources = knowledgeSources.map(function (knowledgeSource) { return (__assign(__assign({}, knowledgeSource), { preparationIds: undefined })); });
|
|
971
989
|
promptTemplates = promptTemplates.map(function (promptTemplate) {
|
|
972
990
|
var dependentParameterNames = promptTemplate.dependentParameterNames;
|
|
973
|
-
var parameterNames =
|
|
991
|
+
var parameterNames = extractParameterNames(promptTemplate.preparedContent || '');
|
|
974
992
|
dependentParameterNames = dependentParameterNames.filter(function (dependentParameterName) { return !parameterNames.has(dependentParameterName); });
|
|
975
993
|
var promptTemplateUnprepared = __assign(__assign({}, promptTemplate), { dependentParameterNames: dependentParameterNames });
|
|
976
994
|
delete promptTemplateUnprepared.preparedContent;
|
|
@@ -1499,7 +1517,7 @@ function forEachAsync(array, options, callbackfunction) {
|
|
|
1499
1517
|
});
|
|
1500
1518
|
}
|
|
1501
1519
|
|
|
1502
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.61.0-
|
|
1520
|
+
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"}];
|
|
1503
1521
|
|
|
1504
1522
|
var defaultDiacriticsRemovalMap = [
|
|
1505
1523
|
{
|
|
@@ -1938,12 +1956,12 @@ function extractVariables(script) {
|
|
|
1938
1956
|
* @returns the set of parameter names
|
|
1939
1957
|
* @throws {ParsingError} if the script is invalid
|
|
1940
1958
|
*/
|
|
1941
|
-
function
|
|
1959
|
+
function extractParameterNamesFromPromptTemplate(promptTemplate) {
|
|
1942
1960
|
var e_1, _a, e_2, _b, e_3, _c;
|
|
1943
1961
|
var title = promptTemplate.title, description = promptTemplate.description, blockType = promptTemplate.blockType, content = promptTemplate.content, preparedContent = promptTemplate.preparedContent, jokerParameterNames = promptTemplate.jokerParameterNames;
|
|
1944
1962
|
var parameterNames = new Set();
|
|
1945
1963
|
try {
|
|
1946
|
-
for (var _d = __values(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(
|
|
1964
|
+
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()) {
|
|
1947
1965
|
var parameterName = _e.value;
|
|
1948
1966
|
parameterNames.add(parameterName);
|
|
1949
1967
|
}
|
|
@@ -2011,7 +2029,7 @@ var ExpectError = /** @class */ (function (_super) {
|
|
|
2011
2029
|
/**
|
|
2012
2030
|
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
2013
2031
|
*/
|
|
2014
|
-
function isValidJsonString(value /* <-[👨⚖️] */) {
|
|
2032
|
+
function isValidJsonString(value /* <- [👨⚖️] */) {
|
|
2015
2033
|
try {
|
|
2016
2034
|
JSON.parse(value);
|
|
2017
2035
|
return true;
|
|
@@ -2295,9 +2313,9 @@ function isPipelinePrepared(pipeline) {
|
|
|
2295
2313
|
* TODO: [🔼] Export via core or utils
|
|
2296
2314
|
* TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
|
|
2297
2315
|
* TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
|
|
2298
|
-
* - Is context in each template
|
|
2299
|
-
* - Are samples prepared
|
|
2300
|
-
* - Are templates prepared
|
|
2316
|
+
* - [🏍] ? Is context in each template
|
|
2317
|
+
* - [♨] Are samples prepared
|
|
2318
|
+
* - [♨] Are templates prepared
|
|
2301
2319
|
*/
|
|
2302
2320
|
|
|
2303
2321
|
/**
|
|
@@ -2504,7 +2522,7 @@ function union() {
|
|
|
2504
2522
|
/**
|
|
2505
2523
|
* The version of the Promptbook library
|
|
2506
2524
|
*/
|
|
2507
|
-
var PROMPTBOOK_VERSION = '0.61.0-
|
|
2525
|
+
var PROMPTBOOK_VERSION = '0.61.0-26';
|
|
2508
2526
|
// TODO: !!!! List here all the versions and annotate + put into script
|
|
2509
2527
|
|
|
2510
2528
|
/**
|
|
@@ -2655,7 +2673,7 @@ function createPipelineExecutor(options) {
|
|
|
2655
2673
|
pipeline = rawPipeline;
|
|
2656
2674
|
}
|
|
2657
2675
|
else {
|
|
2658
|
-
// TODO:
|
|
2676
|
+
// TODO: !!!!! This should be maybe warning in report
|
|
2659
2677
|
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 ")));
|
|
2660
2678
|
}
|
|
2661
2679
|
var pipelineExecutor = function (inputParameters, onProgress) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -2665,7 +2683,7 @@ function createPipelineExecutor(options) {
|
|
|
2665
2683
|
return __awaiter(this, void 0, void 0, function () {
|
|
2666
2684
|
return __generator(this, function (_a) {
|
|
2667
2685
|
TODO_USE(template);
|
|
2668
|
-
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO:
|
|
2686
|
+
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [🏍] Implement */];
|
|
2669
2687
|
});
|
|
2670
2688
|
});
|
|
2671
2689
|
}
|
|
@@ -2673,7 +2691,7 @@ function createPipelineExecutor(options) {
|
|
|
2673
2691
|
template) {
|
|
2674
2692
|
return __awaiter(this, void 0, void 0, function () {
|
|
2675
2693
|
return __generator(this, function (_a) {
|
|
2676
|
-
// TODO:
|
|
2694
|
+
// TODO: [♨] Implement Better - use real index and keyword search
|
|
2677
2695
|
TODO_USE(template);
|
|
2678
2696
|
return [2 /*return*/, pipeline.knowledgePieces.map(function (_a) {
|
|
2679
2697
|
var content = _a.content;
|
|
@@ -2686,9 +2704,9 @@ function createPipelineExecutor(options) {
|
|
|
2686
2704
|
template) {
|
|
2687
2705
|
return __awaiter(this, void 0, void 0, function () {
|
|
2688
2706
|
return __generator(this, function (_a) {
|
|
2689
|
-
// TODO:
|
|
2707
|
+
// TODO: [♨] Implement Better - use real index and keyword search
|
|
2690
2708
|
TODO_USE(template);
|
|
2691
|
-
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO:
|
|
2709
|
+
return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [♨] Implement */];
|
|
2692
2710
|
});
|
|
2693
2711
|
});
|
|
2694
2712
|
}
|
|
@@ -2764,7 +2782,7 @@ function createPipelineExecutor(options) {
|
|
|
2764
2782
|
_u.sent();
|
|
2765
2783
|
_u.label = 2;
|
|
2766
2784
|
case 2:
|
|
2767
|
-
usedParameterNames =
|
|
2785
|
+
usedParameterNames = extractParameterNamesFromPromptTemplate(currentTemplate);
|
|
2768
2786
|
dependentParameterNames = new Set(currentTemplate.dependentParameterNames);
|
|
2769
2787
|
if (union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)).size !== 0) {
|
|
2770
2788
|
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 ")));
|
|
@@ -3150,14 +3168,7 @@ function createPipelineExecutor(options) {
|
|
|
3150
3168
|
) {
|
|
3151
3169
|
// TODO: [🧠] Maybe put other blockTypes into report
|
|
3152
3170
|
executionReport.promptExecutions.push({
|
|
3153
|
-
prompt: {
|
|
3154
|
-
title: currentTemplate.title /* <- Note: If title in pipeline contains emojis, pass it innto report */,
|
|
3155
|
-
content: prompt.content,
|
|
3156
|
-
modelRequirements: prompt.modelRequirements,
|
|
3157
|
-
expectations: prompt.expectations,
|
|
3158
|
-
expectFormat: prompt.expectFormat,
|
|
3159
|
-
// <- Note: Do want to pass ONLY wanted information to the report
|
|
3160
|
-
},
|
|
3171
|
+
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 }),
|
|
3161
3172
|
result: result || undefined,
|
|
3162
3173
|
error: expectError || undefined,
|
|
3163
3174
|
});
|
|
@@ -3421,8 +3432,8 @@ function createPipelineExecutor(options) {
|
|
|
3421
3432
|
return pipelineExecutor;
|
|
3422
3433
|
}
|
|
3423
3434
|
/**
|
|
3424
|
-
* TODO:
|
|
3425
|
-
* TODO:
|
|
3435
|
+
* TODO: !!!!! return `preparedPipeline` from execution
|
|
3436
|
+
* TODO: !!!!! `isNotPreparedWarningSupressed`
|
|
3426
3437
|
* TODO: Use isVerbose here (not only pass to `preparePipeline`)
|
|
3427
3438
|
* TODO: [🪂] Use maxParallelCount here (not only pass to `preparePipeline`)
|
|
3428
3439
|
* TODO: [♈] Probbably move expectations from templates to parameters
|
|
@@ -3431,7 +3442,7 @@ function createPipelineExecutor(options) {
|
|
|
3431
3442
|
* Note: CreatePipelineExecutorOptions are just connected to PipelineExecutor so do not extract to types folder
|
|
3432
3443
|
* TODO: [🧠][3] transparent = (report intermediate parameters) / opaque execution = (report only output parameters) progress reporting mode
|
|
3433
3444
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
3434
|
-
* TODO: [💷]
|
|
3445
|
+
* TODO: [🧠][💷] `assertsExecutionSuccessful` should be the method of `PipelineExecutor` result BUT maybe NOT to preserve pure JSON object
|
|
3435
3446
|
*/
|
|
3436
3447
|
|
|
3437
3448
|
/**
|
|
@@ -3707,7 +3718,7 @@ function prepareTemplates(pipeline, options) {
|
|
|
3707
3718
|
case 0:
|
|
3708
3719
|
_a = options.maxParallelCount, maxParallelCount = _a === void 0 ? MAX_PARALLEL_COUNT : _a;
|
|
3709
3720
|
promptTemplates = pipeline.promptTemplates, parameters = pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
|
|
3710
|
-
// TODO:
|
|
3721
|
+
// TODO: !!!!!! Apply samples to each template (if missing and is for the template defined)
|
|
3711
3722
|
TODO_USE(parameters);
|
|
3712
3723
|
promptTemplatesPrepared = new Array(promptTemplates.length);
|
|
3713
3724
|
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 () {
|
|
@@ -3737,7 +3748,7 @@ function prepareTemplates(pipeline, options) {
|
|
|
3737
3748
|
/**
|
|
3738
3749
|
* TODO: [🧠] Add context to each template (if missing)
|
|
3739
3750
|
* TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
|
|
3740
|
-
* TODO:
|
|
3751
|
+
* TODO: [♨] !!! Prepare index the samples and maybe templates
|
|
3741
3752
|
* TODO: [🔼] !!! Export via `@promptbook/core`
|
|
3742
3753
|
* TODO: Write tests for `preparePipeline`
|
|
3743
3754
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
@@ -3816,7 +3827,7 @@ function preparePipeline(pipeline, options) {
|
|
|
3816
3827
|
* TODO: Write tests for `preparePipeline`
|
|
3817
3828
|
* TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
3818
3829
|
* TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
3819
|
-
* TODO: [🎐]
|
|
3830
|
+
* TODO: [🎐] !!!!!! Use here countTotalUsage
|
|
3820
3831
|
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
3821
3832
|
*/
|
|
3822
3833
|
|
|
@@ -4620,11 +4631,8 @@ var promptbookVersionCommandParser = {
|
|
|
4620
4631
|
/**
|
|
4621
4632
|
* Name of the command
|
|
4622
4633
|
*/
|
|
4623
|
-
name: '
|
|
4624
|
-
|
|
4625
|
-
Note: [📇] No need to put here "PROMPTBOOK" alias here
|
|
4626
|
-
aliasNames: ['PROMPTBOOK_VERSION'],
|
|
4627
|
-
*/
|
|
4634
|
+
name: 'PROMPTBOOK_VERSION',
|
|
4635
|
+
aliasNames: ['PTBK_VERSION', 'PTBK_V', 'PTBKV'],
|
|
4628
4636
|
/**
|
|
4629
4637
|
* BOILERPLATE command can be used in:
|
|
4630
4638
|
*/
|
|
@@ -4640,7 +4648,7 @@ var promptbookVersionCommandParser = {
|
|
|
4640
4648
|
/**
|
|
4641
4649
|
* Example usages of the PROMPTBOOK_VERSION command
|
|
4642
4650
|
*/
|
|
4643
|
-
examples: ["PROMPTBOOK VERSION ".concat(PROMPTBOOK_VERSION), "
|
|
4651
|
+
examples: ["PROMPTBOOK VERSION ".concat(PROMPTBOOK_VERSION), "PTBKV ".concat(PROMPTBOOK_VERSION)],
|
|
4644
4652
|
/**
|
|
4645
4653
|
* Parses the PROMPTBOOK_VERSION command
|
|
4646
4654
|
*/
|
|
@@ -4674,8 +4682,9 @@ var urlCommandParser = {
|
|
|
4674
4682
|
* Name of the command
|
|
4675
4683
|
*/
|
|
4676
4684
|
name: 'URL',
|
|
4685
|
+
aliasNames: ['PIPELINE_URL'],
|
|
4677
4686
|
/*
|
|
4678
|
-
Note: [🛵] No need for alias name because it is already preprocessed
|
|
4687
|
+
Note: [🛵] No need for this alias name because it is already preprocessed
|
|
4679
4688
|
aliasNames: ['HTTPS'],
|
|
4680
4689
|
*/
|
|
4681
4690
|
/**
|
|
@@ -4694,6 +4703,7 @@ var urlCommandParser = {
|
|
|
4694
4703
|
* Example usages of the URL command
|
|
4695
4704
|
*/
|
|
4696
4705
|
examples: [
|
|
4706
|
+
'PIPELINE URL https://promptbook.studio/library/write-cv.ptbk.md',
|
|
4697
4707
|
'URL https://promptbook.studio/library/write-cv.ptbk.md',
|
|
4698
4708
|
'https://promptbook.studio/library/write-cv.ptbk.md',
|
|
4699
4709
|
],
|
|
@@ -4932,10 +4942,6 @@ function parseCommand(raw, usagePlace) {
|
|
|
4932
4942
|
.split(' ')
|
|
4933
4943
|
.map(function (part) { return part.trim(); })
|
|
4934
4944
|
.filter(function (item) { return item !== ''; })
|
|
4935
|
-
// Note: [📇]:
|
|
4936
|
-
.filter(function (item) { return !/^PTBK$/i.test(item); })
|
|
4937
|
-
.filter(function (item) { return !/^PIPELINE$/i.test(item); })
|
|
4938
|
-
.filter(function (item) { return !/^PROMPTBOOK$/i.test(item); })
|
|
4939
4945
|
.map(removeMarkdownFormatting)
|
|
4940
4946
|
.map(function (item) { return item.trim(); });
|
|
4941
4947
|
if (items.length === 0 || items[0] === '') {
|
|
@@ -5650,7 +5656,7 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
5650
5656
|
if (templateModelRequirements.modelVariant === undefined) {
|
|
5651
5657
|
templateModelRequirements.modelVariant = 'CHAT';
|
|
5652
5658
|
}
|
|
5653
|
-
templateJson.dependentParameterNames = Array.from(
|
|
5659
|
+
templateJson.dependentParameterNames = Array.from(extractParameterNamesFromPromptTemplate(templateJson));
|
|
5654
5660
|
// TODO: [🍧][❔] Remove this condition - modelRequirements should be put here via BLOCK command not removed when PROMPT_TEMPLATE
|
|
5655
5661
|
if (templateJson.blockType !== 'PROMPT_TEMPLATE') {
|
|
5656
5662
|
delete templateJson.modelRequirements;
|
|
@@ -5961,7 +5967,7 @@ function stringifyPipelineJson(pipeline) {
|
|
|
5961
5967
|
return pipelineJsonStringified;
|
|
5962
5968
|
}
|
|
5963
5969
|
/**
|
|
5964
|
-
* TODO:
|
|
5970
|
+
* TODO: [🐝] Not Working propperly @see https://promptbook.studio/samples/mixed-knowledge.ptbk.md
|
|
5965
5971
|
* TODO: [🧠][0] Maybe rename to `stringifyPipelineJson`, `stringifyIndexedJson`,...
|
|
5966
5972
|
* TODO: [🧠] Maybe more elegant solution than replacing via regex
|
|
5967
5973
|
* TODO: [🍙] Make some standart order of json properties
|
|
@@ -6358,7 +6364,7 @@ function executionReportJsonToString(executionReportJson, options) {
|
|
|
6358
6364
|
spaceTrim$1(function (block) { return "\n\n ### Prompt\n\n ```\n ".concat(block(escapeMarkdownBlock(promptExecution.prompt.content)), "\n ```\n\n "); });
|
|
6359
6365
|
}
|
|
6360
6366
|
if (promptExecution.result && promptExecution.result.content) {
|
|
6361
|
-
executionReportString += '\n\n\n\n' + '### Result';
|
|
6367
|
+
executionReportString += '\n\n\n\n' + '### Result' + '\n\n';
|
|
6362
6368
|
if (promptExecution.result === undefined) {
|
|
6363
6369
|
executionReportString += '*No result*';
|
|
6364
6370
|
}
|