@promptbook/core 0.77.0-6 → 0.77.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -4
- package/esm/index.es.js +130 -66
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +2 -2
- package/esm/typings/src/cli/test/ptbk.d.ts +1 -1
- package/esm/typings/src/errors/0-index.d.ts +46 -1
- package/esm/typings/src/errors/utils/ErrorJson.d.ts +2 -2
- package/esm/typings/src/execution/AvailableModel.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/createLlmToolsFromConfiguration.test.d.ts +1 -0
- package/esm/typings/src/llm-providers/google/createGoogleExecutionTools.d.ts +0 -4
- package/package.json +1 -1
- package/umd/index.umd.js +130 -66
- package/umd/index.umd.js.map +1 -1
package/README.md
CHANGED
|
@@ -23,10 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
<blockquote style="color: #ff8811">
|
|
27
|
-
<b>⚠ Warning:</b> This is a pre-release version of the library. It is not yet ready for production use. Please look at <a href="https://www.npmjs.com/package/@promptbook/core?activeTab=versions">latest stable release</a>.
|
|
28
|
-
</blockquote>
|
|
29
|
-
|
|
30
26
|
## 📦 Package `@promptbook/core`
|
|
31
27
|
|
|
32
28
|
- Promptbooks are [divided into several](#-packages) packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
package/esm/index.es.js
CHANGED
|
@@ -23,7 +23,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
23
23
|
*
|
|
24
24
|
* @see https://github.com/webgptorg/promptbook
|
|
25
25
|
*/
|
|
26
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.77.0
|
|
26
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.77.0';
|
|
27
27
|
/**
|
|
28
28
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
29
29
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -2494,7 +2494,7 @@ var NotYetImplementedError = /** @class */ (function (_super) {
|
|
|
2494
2494
|
*
|
|
2495
2495
|
* @public exported from `@promptbook/core`
|
|
2496
2496
|
*/
|
|
2497
|
-
var
|
|
2497
|
+
var PROMPTBOOK_ERRORS = {
|
|
2498
2498
|
AbstractFormatError: AbstractFormatError,
|
|
2499
2499
|
CsvFormatError: CsvFormatError,
|
|
2500
2500
|
CollectionError: CollectionError,
|
|
@@ -2512,6 +2512,35 @@ var ERRORS = {
|
|
|
2512
2512
|
UnexpectedError: UnexpectedError,
|
|
2513
2513
|
// TODO: [🪑]> VersionMismatchError,
|
|
2514
2514
|
};
|
|
2515
|
+
/**
|
|
2516
|
+
* Index of all javascript errors
|
|
2517
|
+
*
|
|
2518
|
+
* @private for internal usage
|
|
2519
|
+
*/
|
|
2520
|
+
var COMMON_JAVASCRIPT_ERRORS = {
|
|
2521
|
+
Error: Error,
|
|
2522
|
+
EvalError: EvalError,
|
|
2523
|
+
RangeError: RangeError,
|
|
2524
|
+
ReferenceError: ReferenceError,
|
|
2525
|
+
SyntaxError: SyntaxError,
|
|
2526
|
+
TypeError: TypeError,
|
|
2527
|
+
URIError: URIError,
|
|
2528
|
+
AggregateError: AggregateError,
|
|
2529
|
+
/*
|
|
2530
|
+
Note: Not widely supported
|
|
2531
|
+
> InternalError,
|
|
2532
|
+
> ModuleError,
|
|
2533
|
+
> HeapError,
|
|
2534
|
+
> WebAssemblyCompileError,
|
|
2535
|
+
> WebAssemblyRuntimeError,
|
|
2536
|
+
*/
|
|
2537
|
+
};
|
|
2538
|
+
/**
|
|
2539
|
+
* Index of all errors
|
|
2540
|
+
*
|
|
2541
|
+
* @private for internal usage
|
|
2542
|
+
*/
|
|
2543
|
+
var ALL_ERRORS = __assign(__assign({}, PROMPTBOOK_ERRORS), COMMON_JAVASCRIPT_ERRORS);
|
|
2515
2544
|
/**
|
|
2516
2545
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
2517
2546
|
*/
|
|
@@ -2522,11 +2551,11 @@ var ERRORS = {
|
|
|
2522
2551
|
* @public exported from `@promptbook/utils`
|
|
2523
2552
|
*/
|
|
2524
2553
|
function deserializeError(error) {
|
|
2525
|
-
|
|
2526
|
-
|
|
2554
|
+
var ErrorClass = ALL_ERRORS[error.name];
|
|
2555
|
+
if (ErrorClass === undefined) {
|
|
2556
|
+
return new Error("".concat(error.name, ": ").concat(error.message));
|
|
2527
2557
|
}
|
|
2528
|
-
|
|
2529
|
-
return new CustomError(error.message);
|
|
2558
|
+
return new ErrorClass(error.message);
|
|
2530
2559
|
}
|
|
2531
2560
|
|
|
2532
2561
|
/**
|
|
@@ -2600,8 +2629,8 @@ function isPipelinePrepared(pipeline) {
|
|
|
2600
2629
|
*/
|
|
2601
2630
|
function serializeError(error) {
|
|
2602
2631
|
var name = error.name, message = error.message, stack = error.stack;
|
|
2603
|
-
if (!
|
|
2604
|
-
|
|
2632
|
+
if (!Object.keys(ALL_ERRORS).includes(name)) {
|
|
2633
|
+
console.error(spaceTrim(function (block) { return "\n \n Cannot serialize error with name \"".concat(name, "\"\n\n ").concat(block(stack || message), "\n \n "); }));
|
|
2605
2634
|
}
|
|
2606
2635
|
return {
|
|
2607
2636
|
name: name,
|
|
@@ -8506,7 +8535,7 @@ function titleToName(value) {
|
|
|
8506
8535
|
* @public exported from `@promptbook/core`
|
|
8507
8536
|
*/
|
|
8508
8537
|
function pipelineStringToJsonSync(pipelineString) {
|
|
8509
|
-
var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
|
|
8538
|
+
var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e;
|
|
8510
8539
|
var $pipelineJson = {
|
|
8511
8540
|
title: undefined /* <- Note: [🍙] Putting here placeholder to keep `title` on top at final JSON */,
|
|
8512
8541
|
pipelineUrl: undefined /* <- Note: Putting here placeholder to keep `pipelineUrl` on top at final JSON */,
|
|
@@ -8535,7 +8564,7 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
8535
8564
|
// =============================================================
|
|
8536
8565
|
// Note: 1️⃣ Parsing of the markdown into object
|
|
8537
8566
|
if (pipelineString.startsWith('#!')) {
|
|
8538
|
-
var
|
|
8567
|
+
var _f = __read(pipelineString.split('\n')), shebangLine_1 = _f[0], restLines = _f.slice(1);
|
|
8539
8568
|
if (!(shebangLine_1 || '').includes('ptbk')) {
|
|
8540
8569
|
throw new ParseError(spaceTrim$1(function (block) { return "\n It seems that you try to parse a book file which has non-standard shebang line for book files:\n Shebang line must contain 'ptbk'\n\n You have:\n ".concat(block(shebangLine_1 || '(empty line)'), "\n\n It should look like this:\n #!/usr/bin/env ptbk\n\n ").concat(block(getPipelineIdentification()), "\n "); }));
|
|
8541
8570
|
}
|
|
@@ -8545,7 +8574,7 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
8545
8574
|
pipelineString = flattenMarkdown(pipelineString) /* <- Note: [🥞] */;
|
|
8546
8575
|
pipelineString = pipelineString.replaceAll(/`\{(?<parameterName>[a-z0-9_]+)\}`/gi, '{$<parameterName>}');
|
|
8547
8576
|
pipelineString = pipelineString.replaceAll(/`->\s+\{(?<parameterName>[a-z0-9_]+)\}`/gi, '-> {$<parameterName>}');
|
|
8548
|
-
var
|
|
8577
|
+
var _g = __read(splitMarkdownIntoSections(pipelineString).map(parseMarkdownSection)), pipelineHead = _g[0], pipelineSections = _g.slice(1); /* <- Note: [🥞] */
|
|
8549
8578
|
if (pipelineHead === undefined) {
|
|
8550
8579
|
throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Pipeline head is not defined\n\n ".concat(block(getPipelineIdentification()), "\n\n This should never happen, because the pipeline already flattened\n "); }));
|
|
8551
8580
|
}
|
|
@@ -8636,11 +8665,41 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
8636
8665
|
}
|
|
8637
8666
|
finally { if (e_1) throw e_1.error; }
|
|
8638
8667
|
}
|
|
8668
|
+
// =============================================================
|
|
8669
|
+
// Note: 4️⃣ Prepare unique section names with indexes when needed
|
|
8670
|
+
var sectionCounts = {};
|
|
8671
|
+
try {
|
|
8672
|
+
for (var pipelineSections_1 = __values(pipelineSections), pipelineSections_1_1 = pipelineSections_1.next(); !pipelineSections_1_1.done; pipelineSections_1_1 = pipelineSections_1.next()) {
|
|
8673
|
+
var section = pipelineSections_1_1.value;
|
|
8674
|
+
var name_1 = titleToName(section.title);
|
|
8675
|
+
if (sectionCounts[name_1] === undefined) {
|
|
8676
|
+
sectionCounts[name_1] = { count: 0, currentIndex: 0 };
|
|
8677
|
+
}
|
|
8678
|
+
sectionCounts[name_1].count++;
|
|
8679
|
+
}
|
|
8680
|
+
}
|
|
8681
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
8682
|
+
finally {
|
|
8683
|
+
try {
|
|
8684
|
+
if (pipelineSections_1_1 && !pipelineSections_1_1.done && (_b = pipelineSections_1.return)) _b.call(pipelineSections_1);
|
|
8685
|
+
}
|
|
8686
|
+
finally { if (e_2) throw e_2.error; }
|
|
8687
|
+
}
|
|
8688
|
+
var getUniqueSectionName = function (title) {
|
|
8689
|
+
var name = titleToName(title);
|
|
8690
|
+
var count = sectionCounts[name];
|
|
8691
|
+
if (count.count === 1) {
|
|
8692
|
+
return name;
|
|
8693
|
+
}
|
|
8694
|
+
var nameWithSuffix = "".concat(name, "-").concat(count.currentIndex);
|
|
8695
|
+
count.currentIndex++;
|
|
8696
|
+
return nameWithSuffix;
|
|
8697
|
+
};
|
|
8639
8698
|
var _loop_2 = function (section) {
|
|
8640
|
-
var
|
|
8699
|
+
var e_6, _m, e_7, _o;
|
|
8641
8700
|
// TODO: Parse section's description (the content out of the codeblock and lists)
|
|
8642
8701
|
var listItems_2 = extractAllListItemsFromMarkdown(section.content);
|
|
8643
|
-
var
|
|
8702
|
+
var _p = extractOneBlockFromMarkdown(section.content), language = _p.language, content = _p.content;
|
|
8644
8703
|
// TODO: [🎾][1] DRY description
|
|
8645
8704
|
var description_1 = section.content;
|
|
8646
8705
|
// Note: Remove codeblocks - TODO: [🎾]
|
|
@@ -8656,7 +8715,7 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
8656
8715
|
isSectionTypeSet: false,
|
|
8657
8716
|
isTask: true,
|
|
8658
8717
|
taskType: undefined /* <- Note: [🍙] Putting here placeholder to keep `taskType` on top at final JSON */,
|
|
8659
|
-
name:
|
|
8718
|
+
name: getUniqueSectionName(section.title),
|
|
8660
8719
|
title: section.title,
|
|
8661
8720
|
description: description_1,
|
|
8662
8721
|
content: content,
|
|
@@ -8704,17 +8763,17 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
8704
8763
|
};
|
|
8705
8764
|
try {
|
|
8706
8765
|
// TODO [♓️] List commands and before apply order them to achieve order-agnostic commands
|
|
8707
|
-
for (var commands_1 = (
|
|
8708
|
-
var
|
|
8766
|
+
for (var commands_1 = (e_6 = void 0, __values(commands)), commands_1_1 = commands_1.next(); !commands_1_1.done; commands_1_1 = commands_1.next()) {
|
|
8767
|
+
var _q = commands_1_1.value, listItem = _q.listItem, command = _q.command;
|
|
8709
8768
|
_loop_4(listItem, command);
|
|
8710
8769
|
}
|
|
8711
8770
|
}
|
|
8712
|
-
catch (
|
|
8771
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
8713
8772
|
finally {
|
|
8714
8773
|
try {
|
|
8715
|
-
if (commands_1_1 && !commands_1_1.done && (
|
|
8774
|
+
if (commands_1_1 && !commands_1_1.done && (_m = commands_1.return)) _m.call(commands_1);
|
|
8716
8775
|
}
|
|
8717
|
-
finally { if (
|
|
8776
|
+
finally { if (e_6) throw e_6.error; }
|
|
8718
8777
|
}
|
|
8719
8778
|
// TODO: [🍧] Should be done in SECTION command
|
|
8720
8779
|
if ($taskJson.taskType === 'SCRIPT_TASK') {
|
|
@@ -8728,8 +8787,8 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
8728
8787
|
}
|
|
8729
8788
|
$taskJson.dependentParameterNames = Array.from(extractParameterNamesFromTask($taskJson));
|
|
8730
8789
|
try {
|
|
8731
|
-
for (var
|
|
8732
|
-
var parameterName =
|
|
8790
|
+
for (var _r = (e_7 = void 0, __values($taskJson.dependentParameterNames)), _s = _r.next(); !_s.done; _s = _r.next()) {
|
|
8791
|
+
var parameterName = _s.value;
|
|
8733
8792
|
// TODO: [🧠] This definition should be made first in the task
|
|
8734
8793
|
defineParam({
|
|
8735
8794
|
parameterName: parameterName,
|
|
@@ -8740,12 +8799,12 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
8740
8799
|
});
|
|
8741
8800
|
}
|
|
8742
8801
|
}
|
|
8743
|
-
catch (
|
|
8802
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
8744
8803
|
finally {
|
|
8745
8804
|
try {
|
|
8746
|
-
if (
|
|
8805
|
+
if (_s && !_s.done && (_o = _r.return)) _o.call(_r);
|
|
8747
8806
|
}
|
|
8748
|
-
finally { if (
|
|
8807
|
+
finally { if (e_7) throw e_7.error; }
|
|
8749
8808
|
}
|
|
8750
8809
|
/*
|
|
8751
8810
|
// TODO: [🍧] This should be checked in `MODEL` command + better error message
|
|
@@ -8774,21 +8833,21 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
8774
8833
|
};
|
|
8775
8834
|
try {
|
|
8776
8835
|
// =============================================================
|
|
8777
|
-
// Note:
|
|
8778
|
-
for (var
|
|
8779
|
-
var section =
|
|
8836
|
+
// Note: 5️⃣ Process each section of the pipeline
|
|
8837
|
+
for (var pipelineSections_2 = __values(pipelineSections), pipelineSections_2_1 = pipelineSections_2.next(); !pipelineSections_2_1.done; pipelineSections_2_1 = pipelineSections_2.next()) {
|
|
8838
|
+
var section = pipelineSections_2_1.value;
|
|
8780
8839
|
_loop_2(section);
|
|
8781
8840
|
}
|
|
8782
8841
|
}
|
|
8783
|
-
catch (
|
|
8842
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
8784
8843
|
finally {
|
|
8785
8844
|
try {
|
|
8786
|
-
if (
|
|
8845
|
+
if (pipelineSections_2_1 && !pipelineSections_2_1.done && (_c = pipelineSections_2.return)) _c.call(pipelineSections_2);
|
|
8787
8846
|
}
|
|
8788
|
-
finally { if (
|
|
8847
|
+
finally { if (e_3) throw e_3.error; }
|
|
8789
8848
|
}
|
|
8790
8849
|
// =============================================================
|
|
8791
|
-
// Note:
|
|
8850
|
+
// Note: 6️⃣ Mark parameters as INPUT if not explicitly set
|
|
8792
8851
|
if ($pipelineJson.parameters.every(function (parameter) { return !parameter.isInput; })) {
|
|
8793
8852
|
var _loop_3 = function (parameter) {
|
|
8794
8853
|
var isThisParameterResulting = $pipelineJson.tasks.some(function (task) { return task.resultingParameterName === parameter.name; });
|
|
@@ -8797,42 +8856,42 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
8797
8856
|
}
|
|
8798
8857
|
};
|
|
8799
8858
|
try {
|
|
8800
|
-
for (var
|
|
8801
|
-
var parameter =
|
|
8859
|
+
for (var _h = __values($pipelineJson.parameters), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
8860
|
+
var parameter = _j.value;
|
|
8802
8861
|
_loop_3(parameter);
|
|
8803
8862
|
}
|
|
8804
8863
|
}
|
|
8805
|
-
catch (
|
|
8864
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
8806
8865
|
finally {
|
|
8807
8866
|
try {
|
|
8808
|
-
if (
|
|
8867
|
+
if (_j && !_j.done && (_d = _h.return)) _d.call(_h);
|
|
8809
8868
|
}
|
|
8810
|
-
finally { if (
|
|
8869
|
+
finally { if (e_4) throw e_4.error; }
|
|
8811
8870
|
}
|
|
8812
8871
|
}
|
|
8813
8872
|
// =============================================================
|
|
8814
|
-
// Note:
|
|
8873
|
+
// Note: 7️⃣ Mark all non-INPUT parameters as OUTPUT if any OUTPUT is not set
|
|
8815
8874
|
if ($pipelineJson.parameters.every(function (parameter) { return !parameter.isOutput; })) {
|
|
8816
8875
|
try {
|
|
8817
|
-
for (var
|
|
8818
|
-
var parameter =
|
|
8876
|
+
for (var _k = __values($pipelineJson.parameters), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
8877
|
+
var parameter = _l.value;
|
|
8819
8878
|
if (!parameter.isInput) {
|
|
8820
8879
|
parameter.isOutput = true;
|
|
8821
8880
|
}
|
|
8822
8881
|
}
|
|
8823
8882
|
}
|
|
8824
|
-
catch (
|
|
8883
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
8825
8884
|
finally {
|
|
8826
8885
|
try {
|
|
8827
|
-
if (
|
|
8886
|
+
if (_l && !_l.done && (_e = _k.return)) _e.call(_k);
|
|
8828
8887
|
}
|
|
8829
|
-
finally { if (
|
|
8888
|
+
finally { if (e_5) throw e_5.error; }
|
|
8830
8889
|
}
|
|
8831
8890
|
}
|
|
8832
8891
|
// =============================================================
|
|
8833
|
-
// Note:
|
|
8892
|
+
// Note: 8️⃣ Cleanup of undefined values
|
|
8834
8893
|
$pipelineJson.tasks.forEach(function (tasks) {
|
|
8835
|
-
var
|
|
8894
|
+
var e_8, _a;
|
|
8836
8895
|
try {
|
|
8837
8896
|
for (var _b = __values(Object.entries(tasks)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
8838
8897
|
var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
|
|
@@ -8841,16 +8900,16 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
8841
8900
|
}
|
|
8842
8901
|
}
|
|
8843
8902
|
}
|
|
8844
|
-
catch (
|
|
8903
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
8845
8904
|
finally {
|
|
8846
8905
|
try {
|
|
8847
8906
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
8848
8907
|
}
|
|
8849
|
-
finally { if (
|
|
8908
|
+
finally { if (e_8) throw e_8.error; }
|
|
8850
8909
|
}
|
|
8851
8910
|
});
|
|
8852
8911
|
$pipelineJson.parameters.forEach(function (parameter) {
|
|
8853
|
-
var
|
|
8912
|
+
var e_9, _a;
|
|
8854
8913
|
try {
|
|
8855
8914
|
for (var _b = __values(Object.entries(parameter)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
8856
8915
|
var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
|
|
@@ -8859,12 +8918,12 @@ function pipelineStringToJsonSync(pipelineString) {
|
|
|
8859
8918
|
}
|
|
8860
8919
|
}
|
|
8861
8920
|
}
|
|
8862
|
-
catch (
|
|
8921
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
8863
8922
|
finally {
|
|
8864
8923
|
try {
|
|
8865
8924
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
8866
8925
|
}
|
|
8867
|
-
finally { if (
|
|
8926
|
+
finally { if (e_9) throw e_9.error; }
|
|
8868
8927
|
}
|
|
8869
8928
|
});
|
|
8870
8929
|
// =============================================================
|
|
@@ -8937,18 +8996,19 @@ function addAutoGeneratedSection(content, options) {
|
|
|
8937
8996
|
var warningLine = "<!-- ".concat(GENERATOR_WARNING, " -->");
|
|
8938
8997
|
var sectionRegex = new RegExp("<!--".concat(sectionName, "-->([\\s\\S]*?)<!--/").concat(sectionName, "-->"), 'g');
|
|
8939
8998
|
var sectionMatch = content.match(sectionRegex);
|
|
8999
|
+
var contentToInsert = spaceTrim$1(function (block) { return "\n <!--".concat(sectionName, "-->\n ").concat(block(warningLine), "\n ").concat(block(sectionContent), "\n <!--/").concat(sectionName, "-->\n "); });
|
|
8940
9000
|
if (sectionMatch) {
|
|
8941
|
-
return content.replace(sectionRegex,
|
|
9001
|
+
return content.replace(sectionRegex, contentToInsert);
|
|
8942
9002
|
}
|
|
9003
|
+
// Note: Following is the case when the section is not found in the file so we add it there
|
|
8943
9004
|
var placeForSection = removeContentComments(content).match(/^##.*$/im);
|
|
8944
|
-
if (
|
|
8945
|
-
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
return content.replace(heading, "<!--".concat(sectionName, "-->\n").concat(warningLine, "\n").concat(sectionContent, "\n<!--/").concat(sectionName, "-->\n\n").concat(heading));
|
|
9005
|
+
if (placeForSection !== null) {
|
|
9006
|
+
var _a = __read(placeForSection, 1), heading_1 = _a[0];
|
|
9007
|
+
return content.replace(heading_1, spaceTrim$1(function (block) { return "\n ".concat(block(contentToInsert), "\n \n ").concat(block(heading_1), "\n "); }));
|
|
9008
|
+
}
|
|
9009
|
+
console.warn("No place where to put the section <!--".concat(sectionName, "-->, using the end of the file"));
|
|
9010
|
+
// <- TODO: [🚎] Some better way how to get warnings from pipeline parsing / logic
|
|
9011
|
+
return spaceTrim$1(function (block) { return "\n ".concat(block(content), "\n \n ").concat(block(contentToInsert), "\n "); });
|
|
8952
9012
|
}
|
|
8953
9013
|
/**
|
|
8954
9014
|
* TODO: [🏛] This can be part of markdown builder
|
|
@@ -8976,7 +9036,7 @@ function renderPromptbookMermaid(pipelineJson, options) {
|
|
|
8976
9036
|
if (!task) {
|
|
8977
9037
|
throw new Error("Could not find task for {".concat(parameterName, "}"));
|
|
8978
9038
|
}
|
|
8979
|
-
return normalizeTo_camelCase('task-' + titleToName(task.title));
|
|
9039
|
+
return task.name || normalizeTo_camelCase('task-' + titleToName(task.title));
|
|
8980
9040
|
};
|
|
8981
9041
|
var promptbookMermaid = spaceTrim$1(function (block) { return "\n\n %% \uD83D\uDD2E Tip: Open this on GitHub or in the VSCode website to see the Mermaid graph visually\n\n flowchart LR\n subgraph \"".concat(pipelineJson.title, "\"\n\n direction TB\n\n input((Input)):::input\n ").concat(block(pipelineJson.tasks
|
|
8982
9042
|
.flatMap(function (_a) {
|
|
@@ -9039,7 +9099,7 @@ function prettifyPipelineString(pipelineString, options) {
|
|
|
9039
9099
|
return { href: "#".concat(task.name), title: task.title };
|
|
9040
9100
|
},
|
|
9041
9101
|
});
|
|
9042
|
-
promptbookMermaidBlock = spaceTrim$1(function (block) { return "\n
|
|
9102
|
+
promptbookMermaidBlock = spaceTrim$1(function (block) { return "\n ```mermaid\n ".concat(block(promptbookMermaid_1), "\n ```\n "); });
|
|
9043
9103
|
pipelineString = addAutoGeneratedSection(pipelineString, {
|
|
9044
9104
|
sectionName: 'Graph',
|
|
9045
9105
|
sectionContent: promptbookMermaidBlock,
|
|
@@ -9625,7 +9685,14 @@ var $isRunningInNode = new Function("\n try {\n return this === global
|
|
|
9625
9685
|
*/
|
|
9626
9686
|
function $registeredLlmToolsMessage() {
|
|
9627
9687
|
var e_1, _a, e_2, _b;
|
|
9628
|
-
var env
|
|
9688
|
+
var env;
|
|
9689
|
+
if ($isRunningInNode()) {
|
|
9690
|
+
env = process.env;
|
|
9691
|
+
// <- TODO: [⚛] Some DRY way how to get to `process.env` and pass it into functions - ACRY search for `env`
|
|
9692
|
+
}
|
|
9693
|
+
else {
|
|
9694
|
+
env = {};
|
|
9695
|
+
}
|
|
9629
9696
|
/**
|
|
9630
9697
|
* Mixes registered LLM tools from $llmToolsMetadataRegister and $llmToolsRegister
|
|
9631
9698
|
*/
|
|
@@ -10156,10 +10223,7 @@ var _GoogleMetadataRegistration = $llmToolsMetadataRegister.register({
|
|
|
10156
10223
|
packageName: '@promptbook/google',
|
|
10157
10224
|
className: 'GoogleExecutionTools',
|
|
10158
10225
|
options: {
|
|
10159
|
-
apiKey: '
|
|
10160
|
-
isProxied: true,
|
|
10161
|
-
remoteUrl: DEFAULT_REMOTE_URL,
|
|
10162
|
-
path: DEFAULT_REMOTE_URL_PATH,
|
|
10226
|
+
apiKey: 'AI',
|
|
10163
10227
|
},
|
|
10164
10228
|
};
|
|
10165
10229
|
},
|
|
@@ -10621,5 +10685,5 @@ var PrefixStorage = /** @class */ (function () {
|
|
|
10621
10685
|
return PrefixStorage;
|
|
10622
10686
|
}());
|
|
10623
10687
|
|
|
10624
|
-
export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, AbstractFormatError, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateError, BoilerplateFormfactorDefinition, CLAIM, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CsvFormatDefinition, CsvFormatError, DEFAULT_BOOKS_DIRNAME, DEFAULT_CSV_SETTINGS, DEFAULT_EXECUTIONS_CACHE_DIRNAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_REMOTE_URL, DEFAULT_REMOTE_URL_PATH, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TITLE,
|
|
10688
|
+
export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, AbstractFormatError, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateError, BoilerplateFormfactorDefinition, CLAIM, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CsvFormatDefinition, CsvFormatError, DEFAULT_BOOKS_DIRNAME, DEFAULT_CSV_SETTINGS, DEFAULT_EXECUTIONS_CACHE_DIRNAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_REMOTE_URL, DEFAULT_REMOTE_URL_PATH, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TITLE, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FORMFACTOR_DEFINITIONS, GENERIC_PIPELINE_INTERFACE, GeneratorFormfactorDefinition, GenericFormfactorDefinition, KnowledgeScrapeError, LOGO_DARK_SRC, LOGO_LIGHT_SRC, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_VARIANTS, MatcherFormfactorDefinition, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NAME, NonTaskSectionTypes, NotFoundError, NotYetImplementedError, PROMPTBOOK_ENGINE_VERSION, PROMPTBOOK_ERRORS, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, RESERVED_PARAMETER_NAMES, SET_IS_VERBOSE, SectionTypes, SheetsFormfactorDefinition, TaskTypes, TextFormatDefinition, TranslatorFormfactorDefinition, UNCERTAIN_USAGE, UnexpectedError, ZERO_USAGE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _DocumentScraperMetadataRegistration, _GoogleMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, addUsage, assertsExecutionSuccessful, cacheLlmTools, collectionToJson, countTotalUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, getPipelineInterface, isPassingExpectations, isPipelineImplementingInterface, isPipelineInterfacesEqual, isPipelinePrepared, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, pipelineJsonToString, pipelineStringToJson, pipelineStringToJsonSync, prepareKnowledgePieces, preparePersona, preparePipeline, prepareTasks, prettifyPipelineString, stringifyPipelineJson, unpreparePipeline, usageToHuman, usageToWorktime, validatePipeline };
|
|
10625
10689
|
//# sourceMappingURL=index.es.js.map
|