@promptbook/core 0.54.0 → 0.54.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/umd/index.umd.js CHANGED
@@ -454,7 +454,7 @@
454
454
  /**
455
455
  * The version of the Promptbook library
456
456
  */
457
- var PROMPTBOOK_VERSION = '0.53.0';
457
+ var PROMPTBOOK_VERSION = '0.54.0';
458
458
 
459
459
  /**
460
460
  * Parses the template and returns the list of all parameter names
@@ -1777,7 +1777,7 @@
1777
1777
  * @returns Promptbook in string format (.ptbk.md)
1778
1778
  */
1779
1779
  function promptbookJsonToString(promptbookJson) {
1780
- var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e;
1780
+ var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
1781
1781
  var title = promptbookJson.title, promptbookUrl = promptbookJson.promptbookUrl, promptbookVersion = promptbookJson.promptbookVersion, description = promptbookJson.description, parameters = promptbookJson.parameters, promptTemplates = promptbookJson.promptTemplates;
1782
1782
  var promptbookString = "# ".concat(title);
1783
1783
  if (description) {
@@ -1792,24 +1792,37 @@
1792
1792
  commands.push("PROMPTBOOK VERSION ".concat(promptbookVersion));
1793
1793
  promptbookString = prettifyMarkdown(promptbookString);
1794
1794
  try {
1795
- for (var parameters_1 = __values(parameters), parameters_1_1 = parameters_1.next(); !parameters_1_1.done; parameters_1_1 = parameters_1.next()) {
1796
- var parameter = parameters_1_1.value;
1797
- var isInput = parameter.isInput, isOutput = parameter.isOutput;
1798
- if (isInput) {
1799
- commands.push("INPUT PARAMETER ".concat(promptTemplateParameterJsonToString(parameter)));
1800
- }
1801
- else if (isOutput) {
1802
- commands.push("OUTPUT PARAMETER ".concat(promptTemplateParameterJsonToString(parameter)));
1803
- }
1795
+ for (var _g = __values(parameters.filter(function (_a) {
1796
+ var isInput = _a.isInput;
1797
+ return isInput;
1798
+ })), _h = _g.next(); !_h.done; _h = _g.next()) {
1799
+ var parameter = _h.value;
1800
+ commands.push("INPUT PARAMETER ".concat(promptTemplateParameterJsonToString(parameter)));
1804
1801
  }
1805
1802
  }
1806
1803
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
1807
1804
  finally {
1808
1805
  try {
1809
- if (parameters_1_1 && !parameters_1_1.done && (_a = parameters_1.return)) _a.call(parameters_1);
1806
+ if (_h && !_h.done && (_a = _g.return)) _a.call(_g);
1810
1807
  }
1811
1808
  finally { if (e_1) throw e_1.error; }
1812
1809
  }
1810
+ try {
1811
+ for (var _j = __values(parameters.filter(function (_a) {
1812
+ var isOutput = _a.isOutput;
1813
+ return isOutput;
1814
+ })), _k = _j.next(); !_k.done; _k = _j.next()) {
1815
+ var parameter = _k.value;
1816
+ commands.push("OUTPUT PARAMETER ".concat(promptTemplateParameterJsonToString(parameter)));
1817
+ }
1818
+ }
1819
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
1820
+ finally {
1821
+ try {
1822
+ if (_k && !_k.done && (_b = _j.return)) _b.call(_j);
1823
+ }
1824
+ finally { if (e_2) throw e_2.error; }
1825
+ }
1813
1826
  promptbookString += '\n\n';
1814
1827
  promptbookString += commands.map(function (command) { return "- ".concat(command); }).join('\n');
1815
1828
  try {
@@ -1859,38 +1872,38 @@
1859
1872
  }
1860
1873
  if (jokers) {
1861
1874
  try {
1862
- for (var jokers_1 = (e_3 = void 0, __values(jokers)), jokers_1_1 = jokers_1.next(); !jokers_1_1.done; jokers_1_1 = jokers_1.next()) {
1875
+ for (var jokers_1 = (e_4 = void 0, __values(jokers)), jokers_1_1 = jokers_1.next(); !jokers_1_1.done; jokers_1_1 = jokers_1.next()) {
1863
1876
  var joker = jokers_1_1.value;
1864
1877
  commands_1.push("JOKER {".concat(joker, "}"));
1865
1878
  }
1866
1879
  }
1867
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
1880
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
1868
1881
  finally {
1869
1882
  try {
1870
- if (jokers_1_1 && !jokers_1_1.done && (_c = jokers_1.return)) _c.call(jokers_1);
1883
+ if (jokers_1_1 && !jokers_1_1.done && (_d = jokers_1.return)) _d.call(jokers_1);
1871
1884
  }
1872
- finally { if (e_3) throw e_3.error; }
1885
+ finally { if (e_4) throw e_4.error; }
1873
1886
  }
1874
1887
  } /* not else */
1875
1888
  if (postprocessing) {
1876
1889
  try {
1877
- for (var postprocessing_1 = (e_4 = void 0, __values(postprocessing)), postprocessing_1_1 = postprocessing_1.next(); !postprocessing_1_1.done; postprocessing_1_1 = postprocessing_1.next()) {
1890
+ for (var postprocessing_1 = (e_5 = void 0, __values(postprocessing)), postprocessing_1_1 = postprocessing_1.next(); !postprocessing_1_1.done; postprocessing_1_1 = postprocessing_1.next()) {
1878
1891
  var postprocessingFunctionName = postprocessing_1_1.value;
1879
1892
  commands_1.push("POSTPROCESSING `".concat(postprocessingFunctionName, "`"));
1880
1893
  }
1881
1894
  }
1882
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
1895
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
1883
1896
  finally {
1884
1897
  try {
1885
- if (postprocessing_1_1 && !postprocessing_1_1.done && (_d = postprocessing_1.return)) _d.call(postprocessing_1);
1898
+ if (postprocessing_1_1 && !postprocessing_1_1.done && (_e = postprocessing_1.return)) _e.call(postprocessing_1);
1886
1899
  }
1887
- finally { if (e_4) throw e_4.error; }
1900
+ finally { if (e_5) throw e_5.error; }
1888
1901
  }
1889
1902
  } /* not else */
1890
1903
  if (expectations) {
1891
1904
  try {
1892
- for (var _f = (e_5 = void 0, __values(Object.entries(expectations))), _g = _f.next(); !_g.done; _g = _f.next()) {
1893
- var _h = __read(_g.value, 2), unit = _h[0], _j = _h[1], min = _j.min, max = _j.max;
1905
+ for (var _l = (e_6 = void 0, __values(Object.entries(expectations))), _m = _l.next(); !_m.done; _m = _l.next()) {
1906
+ var _o = __read(_m.value, 2), unit = _o[0], _p = _o[1], min = _p.min, max = _p.max;
1894
1907
  if (min === max) {
1895
1908
  commands_1.push("EXPECT EXACTLY ".concat(min, " ").concat(capitalize(unit + (min > 1 ? 's' : ''))));
1896
1909
  }
@@ -1904,12 +1917,12 @@
1904
1917
  }
1905
1918
  }
1906
1919
  }
1907
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
1920
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
1908
1921
  finally {
1909
1922
  try {
1910
- if (_g && !_g.done && (_e = _f.return)) _e.call(_f);
1923
+ if (_m && !_m.done && (_f = _l.return)) _f.call(_l);
1911
1924
  }
1912
- finally { if (e_5) throw e_5.error; }
1925
+ finally { if (e_6) throw e_6.error; }
1913
1926
  }
1914
1927
  } /* not else */
1915
1928
  if (expectFormat) {
@@ -1932,12 +1945,12 @@
1932
1945
  promptbookString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: !!! If the parameter here has description, add it and use promptTemplateParameterJsonToString
1933
1946
  }
1934
1947
  }
1935
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
1948
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
1936
1949
  finally {
1937
1950
  try {
1938
- if (promptTemplates_1_1 && !promptTemplates_1_1.done && (_b = promptTemplates_1.return)) _b.call(promptTemplates_1);
1951
+ if (promptTemplates_1_1 && !promptTemplates_1_1.done && (_c = promptTemplates_1.return)) _c.call(promptTemplates_1);
1939
1952
  }
1940
- finally { if (e_2) throw e_2.error; }
1953
+ finally { if (e_3) throw e_3.error; }
1941
1954
  }
1942
1955
  return promptbookString;
1943
1956
  }