@promptbook/cli 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 +1 -5
- package/esm/index.es.js +129 -69
- 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 +129 -69
- package/umd/index.umd.js.map +1 -1
|
@@ -35,7 +35,7 @@ import { validatePipeline } from '../conversion/validation/validatePipeline';
|
|
|
35
35
|
import { CallbackInterfaceTools } from '../dialogs/callback/CallbackInterfaceTools';
|
|
36
36
|
import type { CallbackInterfaceToolsOptions } from '../dialogs/callback/CallbackInterfaceToolsOptions';
|
|
37
37
|
import { BoilerplateError } from '../errors/0-BoilerplateError';
|
|
38
|
-
import {
|
|
38
|
+
import { PROMPTBOOK_ERRORS } from '../errors/0-index';
|
|
39
39
|
import { AbstractFormatError } from '../errors/AbstractFormatError';
|
|
40
40
|
import { CollectionError } from '../errors/CollectionError';
|
|
41
41
|
import { EnvironmentMismatchError } from '../errors/EnvironmentMismatchError';
|
|
@@ -150,7 +150,7 @@ export { validatePipeline };
|
|
|
150
150
|
export { CallbackInterfaceTools };
|
|
151
151
|
export type { CallbackInterfaceToolsOptions };
|
|
152
152
|
export { BoilerplateError };
|
|
153
|
-
export {
|
|
153
|
+
export { PROMPTBOOK_ERRORS };
|
|
154
154
|
export { AbstractFormatError };
|
|
155
155
|
export { CollectionError };
|
|
156
156
|
export { EnvironmentMismatchError };
|
|
@@ -18,7 +18,52 @@ import { UnexpectedError } from './UnexpectedError';
|
|
|
18
18
|
*
|
|
19
19
|
* @public exported from `@promptbook/core`
|
|
20
20
|
*/
|
|
21
|
-
export declare const
|
|
21
|
+
export declare const PROMPTBOOK_ERRORS: {
|
|
22
|
+
readonly AbstractFormatError: typeof AbstractFormatError;
|
|
23
|
+
readonly CsvFormatError: typeof CsvFormatError;
|
|
24
|
+
readonly CollectionError: typeof CollectionError;
|
|
25
|
+
readonly EnvironmentMismatchError: typeof EnvironmentMismatchError;
|
|
26
|
+
readonly ExpectError: typeof ExpectError;
|
|
27
|
+
readonly KnowledgeScrapeError: typeof KnowledgeScrapeError;
|
|
28
|
+
readonly LimitReachedError: typeof LimitReachedError;
|
|
29
|
+
readonly MissingToolsError: typeof MissingToolsError;
|
|
30
|
+
readonly NotFoundError: typeof NotFoundError;
|
|
31
|
+
readonly NotYetImplementedError: typeof NotYetImplementedError;
|
|
32
|
+
readonly ParseError: typeof ParseError;
|
|
33
|
+
readonly PipelineExecutionError: typeof PipelineExecutionError;
|
|
34
|
+
readonly PipelineLogicError: typeof PipelineLogicError;
|
|
35
|
+
readonly PipelineUrlError: typeof PipelineUrlError;
|
|
36
|
+
readonly UnexpectedError: typeof UnexpectedError;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Index of all javascript errors
|
|
40
|
+
*
|
|
41
|
+
* @private for internal usage
|
|
42
|
+
*/
|
|
43
|
+
export declare const COMMON_JAVASCRIPT_ERRORS: {
|
|
44
|
+
readonly Error: ErrorConstructor;
|
|
45
|
+
readonly EvalError: EvalErrorConstructor;
|
|
46
|
+
readonly RangeError: RangeErrorConstructor;
|
|
47
|
+
readonly ReferenceError: ReferenceErrorConstructor;
|
|
48
|
+
readonly SyntaxError: SyntaxErrorConstructor;
|
|
49
|
+
readonly TypeError: TypeErrorConstructor;
|
|
50
|
+
readonly URIError: URIErrorConstructor;
|
|
51
|
+
readonly AggregateError: AggregateErrorConstructor;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Index of all errors
|
|
55
|
+
*
|
|
56
|
+
* @private for internal usage
|
|
57
|
+
*/
|
|
58
|
+
export declare const ALL_ERRORS: {
|
|
59
|
+
readonly Error: ErrorConstructor;
|
|
60
|
+
readonly EvalError: EvalErrorConstructor;
|
|
61
|
+
readonly RangeError: RangeErrorConstructor;
|
|
62
|
+
readonly ReferenceError: ReferenceErrorConstructor;
|
|
63
|
+
readonly SyntaxError: SyntaxErrorConstructor;
|
|
64
|
+
readonly TypeError: TypeErrorConstructor;
|
|
65
|
+
readonly URIError: URIErrorConstructor;
|
|
66
|
+
readonly AggregateError: AggregateErrorConstructor;
|
|
22
67
|
readonly AbstractFormatError: typeof AbstractFormatError;
|
|
23
68
|
readonly CsvFormatError: typeof CsvFormatError;
|
|
24
69
|
readonly CollectionError: typeof CollectionError;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ALL_ERRORS } from '../0-index';
|
|
2
2
|
/**
|
|
3
3
|
* Represents a serialized error or custom Promptbook error
|
|
4
4
|
*
|
|
@@ -8,7 +8,7 @@ export type ErrorJson = {
|
|
|
8
8
|
/**
|
|
9
9
|
* The type of the error
|
|
10
10
|
*/
|
|
11
|
-
readonly name: keyof typeof
|
|
11
|
+
readonly name: keyof typeof ALL_ERRORS;
|
|
12
12
|
/**
|
|
13
13
|
* The message of the error
|
|
14
14
|
*/
|
package/esm/typings/src/llm-providers/_common/register/createLlmToolsFromConfiguration.test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -10,9 +10,5 @@ export declare const createGoogleExecutionTools: ((options: GoogleExecutionTools
|
|
|
10
10
|
className: string;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
|
-
* TODO: [🧠][main] !!!! Make anonymous this with all LLM providers
|
|
14
|
-
* TODO: [🧠][🧱][main] !!!! Maybe change all `new GoogleExecutionTools` -> `createGoogleExecutionTools` in manual
|
|
15
|
-
* TODO: [🧠] Maybe auto-detect usage in browser and determine default value of `isProxied`
|
|
16
|
-
* TODO: [🦺] Is there some way how to put `packageName` and `className` on top and function definition on bottom?
|
|
17
13
|
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
18
14
|
*/
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
*
|
|
50
50
|
* @see https://github.com/webgptorg/promptbook
|
|
51
51
|
*/
|
|
52
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.77.0
|
|
52
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.77.0';
|
|
53
53
|
/**
|
|
54
54
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
55
55
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1990,7 +1990,14 @@
|
|
|
1990
1990
|
*/
|
|
1991
1991
|
function $registeredLlmToolsMessage() {
|
|
1992
1992
|
var e_1, _a, e_2, _b;
|
|
1993
|
-
var env
|
|
1993
|
+
var env;
|
|
1994
|
+
if ($isRunningInNode()) {
|
|
1995
|
+
env = process.env;
|
|
1996
|
+
// <- TODO: [⚛] Some DRY way how to get to `process.env` and pass it into functions - ACRY search for `env`
|
|
1997
|
+
}
|
|
1998
|
+
else {
|
|
1999
|
+
env = {};
|
|
2000
|
+
}
|
|
1994
2001
|
/**
|
|
1995
2002
|
* Mixes registered LLM tools from $llmToolsMetadataRegister and $llmToolsRegister
|
|
1996
2003
|
*/
|
|
@@ -3628,7 +3635,7 @@
|
|
|
3628
3635
|
*
|
|
3629
3636
|
* @public exported from `@promptbook/core`
|
|
3630
3637
|
*/
|
|
3631
|
-
var
|
|
3638
|
+
var PROMPTBOOK_ERRORS = {
|
|
3632
3639
|
AbstractFormatError: AbstractFormatError,
|
|
3633
3640
|
CsvFormatError: CsvFormatError,
|
|
3634
3641
|
CollectionError: CollectionError,
|
|
@@ -3646,6 +3653,35 @@
|
|
|
3646
3653
|
UnexpectedError: UnexpectedError,
|
|
3647
3654
|
// TODO: [🪑]> VersionMismatchError,
|
|
3648
3655
|
};
|
|
3656
|
+
/**
|
|
3657
|
+
* Index of all javascript errors
|
|
3658
|
+
*
|
|
3659
|
+
* @private for internal usage
|
|
3660
|
+
*/
|
|
3661
|
+
var COMMON_JAVASCRIPT_ERRORS = {
|
|
3662
|
+
Error: Error,
|
|
3663
|
+
EvalError: EvalError,
|
|
3664
|
+
RangeError: RangeError,
|
|
3665
|
+
ReferenceError: ReferenceError,
|
|
3666
|
+
SyntaxError: SyntaxError,
|
|
3667
|
+
TypeError: TypeError,
|
|
3668
|
+
URIError: URIError,
|
|
3669
|
+
AggregateError: AggregateError,
|
|
3670
|
+
/*
|
|
3671
|
+
Note: Not widely supported
|
|
3672
|
+
> InternalError,
|
|
3673
|
+
> ModuleError,
|
|
3674
|
+
> HeapError,
|
|
3675
|
+
> WebAssemblyCompileError,
|
|
3676
|
+
> WebAssemblyRuntimeError,
|
|
3677
|
+
*/
|
|
3678
|
+
};
|
|
3679
|
+
/**
|
|
3680
|
+
* Index of all errors
|
|
3681
|
+
*
|
|
3682
|
+
* @private for internal usage
|
|
3683
|
+
*/
|
|
3684
|
+
var ALL_ERRORS = __assign(__assign({}, PROMPTBOOK_ERRORS), COMMON_JAVASCRIPT_ERRORS);
|
|
3649
3685
|
/**
|
|
3650
3686
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
3651
3687
|
*/
|
|
@@ -3656,11 +3692,11 @@
|
|
|
3656
3692
|
* @public exported from `@promptbook/utils`
|
|
3657
3693
|
*/
|
|
3658
3694
|
function deserializeError(error) {
|
|
3659
|
-
|
|
3660
|
-
|
|
3695
|
+
var ErrorClass = ALL_ERRORS[error.name];
|
|
3696
|
+
if (ErrorClass === undefined) {
|
|
3697
|
+
return new Error("".concat(error.name, ": ").concat(error.message));
|
|
3661
3698
|
}
|
|
3662
|
-
|
|
3663
|
-
return new CustomError(error.message);
|
|
3699
|
+
return new ErrorClass(error.message);
|
|
3664
3700
|
}
|
|
3665
3701
|
|
|
3666
3702
|
/**
|
|
@@ -3734,8 +3770,8 @@
|
|
|
3734
3770
|
*/
|
|
3735
3771
|
function serializeError(error) {
|
|
3736
3772
|
var name = error.name, message = error.message, stack = error.stack;
|
|
3737
|
-
if (!
|
|
3738
|
-
|
|
3773
|
+
if (!Object.keys(ALL_ERRORS).includes(name)) {
|
|
3774
|
+
console.error(spaceTrim__default["default"](function (block) { return "\n \n Cannot serialize error with name \"".concat(name, "\"\n\n ").concat(block(stack || message), "\n \n "); }));
|
|
3739
3775
|
}
|
|
3740
3776
|
return {
|
|
3741
3777
|
name: name,
|
|
@@ -9048,7 +9084,7 @@
|
|
|
9048
9084
|
* @public exported from `@promptbook/core`
|
|
9049
9085
|
*/
|
|
9050
9086
|
function pipelineStringToJsonSync(pipelineString) {
|
|
9051
|
-
var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
|
|
9087
|
+
var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e;
|
|
9052
9088
|
var $pipelineJson = {
|
|
9053
9089
|
title: undefined /* <- Note: [🍙] Putting here placeholder to keep `title` on top at final JSON */,
|
|
9054
9090
|
pipelineUrl: undefined /* <- Note: Putting here placeholder to keep `pipelineUrl` on top at final JSON */,
|
|
@@ -9077,7 +9113,7 @@
|
|
|
9077
9113
|
// =============================================================
|
|
9078
9114
|
// Note: 1️⃣ Parsing of the markdown into object
|
|
9079
9115
|
if (pipelineString.startsWith('#!')) {
|
|
9080
|
-
var
|
|
9116
|
+
var _f = __read(pipelineString.split('\n')), shebangLine_1 = _f[0], restLines = _f.slice(1);
|
|
9081
9117
|
if (!(shebangLine_1 || '').includes('ptbk')) {
|
|
9082
9118
|
throw new ParseError(spaceTrim.spaceTrim(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 "); }));
|
|
9083
9119
|
}
|
|
@@ -9087,7 +9123,7 @@
|
|
|
9087
9123
|
pipelineString = flattenMarkdown(pipelineString) /* <- Note: [🥞] */;
|
|
9088
9124
|
pipelineString = pipelineString.replaceAll(/`\{(?<parameterName>[a-z0-9_]+)\}`/gi, '{$<parameterName>}');
|
|
9089
9125
|
pipelineString = pipelineString.replaceAll(/`->\s+\{(?<parameterName>[a-z0-9_]+)\}`/gi, '-> {$<parameterName>}');
|
|
9090
|
-
var
|
|
9126
|
+
var _g = __read(splitMarkdownIntoSections(pipelineString).map(parseMarkdownSection)), pipelineHead = _g[0], pipelineSections = _g.slice(1); /* <- Note: [🥞] */
|
|
9091
9127
|
if (pipelineHead === undefined) {
|
|
9092
9128
|
throw new UnexpectedError(spaceTrim.spaceTrim(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 "); }));
|
|
9093
9129
|
}
|
|
@@ -9178,11 +9214,41 @@
|
|
|
9178
9214
|
}
|
|
9179
9215
|
finally { if (e_1) throw e_1.error; }
|
|
9180
9216
|
}
|
|
9217
|
+
// =============================================================
|
|
9218
|
+
// Note: 4️⃣ Prepare unique section names with indexes when needed
|
|
9219
|
+
var sectionCounts = {};
|
|
9220
|
+
try {
|
|
9221
|
+
for (var pipelineSections_1 = __values(pipelineSections), pipelineSections_1_1 = pipelineSections_1.next(); !pipelineSections_1_1.done; pipelineSections_1_1 = pipelineSections_1.next()) {
|
|
9222
|
+
var section = pipelineSections_1_1.value;
|
|
9223
|
+
var name_1 = titleToName(section.title);
|
|
9224
|
+
if (sectionCounts[name_1] === undefined) {
|
|
9225
|
+
sectionCounts[name_1] = { count: 0, currentIndex: 0 };
|
|
9226
|
+
}
|
|
9227
|
+
sectionCounts[name_1].count++;
|
|
9228
|
+
}
|
|
9229
|
+
}
|
|
9230
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
9231
|
+
finally {
|
|
9232
|
+
try {
|
|
9233
|
+
if (pipelineSections_1_1 && !pipelineSections_1_1.done && (_b = pipelineSections_1.return)) _b.call(pipelineSections_1);
|
|
9234
|
+
}
|
|
9235
|
+
finally { if (e_2) throw e_2.error; }
|
|
9236
|
+
}
|
|
9237
|
+
var getUniqueSectionName = function (title) {
|
|
9238
|
+
var name = titleToName(title);
|
|
9239
|
+
var count = sectionCounts[name];
|
|
9240
|
+
if (count.count === 1) {
|
|
9241
|
+
return name;
|
|
9242
|
+
}
|
|
9243
|
+
var nameWithSuffix = "".concat(name, "-").concat(count.currentIndex);
|
|
9244
|
+
count.currentIndex++;
|
|
9245
|
+
return nameWithSuffix;
|
|
9246
|
+
};
|
|
9181
9247
|
var _loop_2 = function (section) {
|
|
9182
|
-
var
|
|
9248
|
+
var e_6, _m, e_7, _o;
|
|
9183
9249
|
// TODO: Parse section's description (the content out of the codeblock and lists)
|
|
9184
9250
|
var listItems_2 = extractAllListItemsFromMarkdown(section.content);
|
|
9185
|
-
var
|
|
9251
|
+
var _p = extractOneBlockFromMarkdown(section.content), language = _p.language, content = _p.content;
|
|
9186
9252
|
// TODO: [🎾][1] DRY description
|
|
9187
9253
|
var description_1 = section.content;
|
|
9188
9254
|
// Note: Remove codeblocks - TODO: [🎾]
|
|
@@ -9198,7 +9264,7 @@
|
|
|
9198
9264
|
isSectionTypeSet: false,
|
|
9199
9265
|
isTask: true,
|
|
9200
9266
|
taskType: undefined /* <- Note: [🍙] Putting here placeholder to keep `taskType` on top at final JSON */,
|
|
9201
|
-
name:
|
|
9267
|
+
name: getUniqueSectionName(section.title),
|
|
9202
9268
|
title: section.title,
|
|
9203
9269
|
description: description_1,
|
|
9204
9270
|
content: content,
|
|
@@ -9246,17 +9312,17 @@
|
|
|
9246
9312
|
};
|
|
9247
9313
|
try {
|
|
9248
9314
|
// TODO [♓️] List commands and before apply order them to achieve order-agnostic commands
|
|
9249
|
-
for (var commands_1 = (
|
|
9250
|
-
var
|
|
9315
|
+
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()) {
|
|
9316
|
+
var _q = commands_1_1.value, listItem = _q.listItem, command = _q.command;
|
|
9251
9317
|
_loop_4(listItem, command);
|
|
9252
9318
|
}
|
|
9253
9319
|
}
|
|
9254
|
-
catch (
|
|
9320
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
9255
9321
|
finally {
|
|
9256
9322
|
try {
|
|
9257
|
-
if (commands_1_1 && !commands_1_1.done && (
|
|
9323
|
+
if (commands_1_1 && !commands_1_1.done && (_m = commands_1.return)) _m.call(commands_1);
|
|
9258
9324
|
}
|
|
9259
|
-
finally { if (
|
|
9325
|
+
finally { if (e_6) throw e_6.error; }
|
|
9260
9326
|
}
|
|
9261
9327
|
// TODO: [🍧] Should be done in SECTION command
|
|
9262
9328
|
if ($taskJson.taskType === 'SCRIPT_TASK') {
|
|
@@ -9270,8 +9336,8 @@
|
|
|
9270
9336
|
}
|
|
9271
9337
|
$taskJson.dependentParameterNames = Array.from(extractParameterNamesFromTask($taskJson));
|
|
9272
9338
|
try {
|
|
9273
|
-
for (var
|
|
9274
|
-
var parameterName =
|
|
9339
|
+
for (var _r = (e_7 = void 0, __values($taskJson.dependentParameterNames)), _s = _r.next(); !_s.done; _s = _r.next()) {
|
|
9340
|
+
var parameterName = _s.value;
|
|
9275
9341
|
// TODO: [🧠] This definition should be made first in the task
|
|
9276
9342
|
defineParam({
|
|
9277
9343
|
parameterName: parameterName,
|
|
@@ -9282,12 +9348,12 @@
|
|
|
9282
9348
|
});
|
|
9283
9349
|
}
|
|
9284
9350
|
}
|
|
9285
|
-
catch (
|
|
9351
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
9286
9352
|
finally {
|
|
9287
9353
|
try {
|
|
9288
|
-
if (
|
|
9354
|
+
if (_s && !_s.done && (_o = _r.return)) _o.call(_r);
|
|
9289
9355
|
}
|
|
9290
|
-
finally { if (
|
|
9356
|
+
finally { if (e_7) throw e_7.error; }
|
|
9291
9357
|
}
|
|
9292
9358
|
/*
|
|
9293
9359
|
// TODO: [🍧] This should be checked in `MODEL` command + better error message
|
|
@@ -9316,21 +9382,21 @@
|
|
|
9316
9382
|
};
|
|
9317
9383
|
try {
|
|
9318
9384
|
// =============================================================
|
|
9319
|
-
// Note:
|
|
9320
|
-
for (var
|
|
9321
|
-
var section =
|
|
9385
|
+
// Note: 5️⃣ Process each section of the pipeline
|
|
9386
|
+
for (var pipelineSections_2 = __values(pipelineSections), pipelineSections_2_1 = pipelineSections_2.next(); !pipelineSections_2_1.done; pipelineSections_2_1 = pipelineSections_2.next()) {
|
|
9387
|
+
var section = pipelineSections_2_1.value;
|
|
9322
9388
|
_loop_2(section);
|
|
9323
9389
|
}
|
|
9324
9390
|
}
|
|
9325
|
-
catch (
|
|
9391
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
9326
9392
|
finally {
|
|
9327
9393
|
try {
|
|
9328
|
-
if (
|
|
9394
|
+
if (pipelineSections_2_1 && !pipelineSections_2_1.done && (_c = pipelineSections_2.return)) _c.call(pipelineSections_2);
|
|
9329
9395
|
}
|
|
9330
|
-
finally { if (
|
|
9396
|
+
finally { if (e_3) throw e_3.error; }
|
|
9331
9397
|
}
|
|
9332
9398
|
// =============================================================
|
|
9333
|
-
// Note:
|
|
9399
|
+
// Note: 6️⃣ Mark parameters as INPUT if not explicitly set
|
|
9334
9400
|
if ($pipelineJson.parameters.every(function (parameter) { return !parameter.isInput; })) {
|
|
9335
9401
|
var _loop_3 = function (parameter) {
|
|
9336
9402
|
var isThisParameterResulting = $pipelineJson.tasks.some(function (task) { return task.resultingParameterName === parameter.name; });
|
|
@@ -9339,42 +9405,42 @@
|
|
|
9339
9405
|
}
|
|
9340
9406
|
};
|
|
9341
9407
|
try {
|
|
9342
|
-
for (var
|
|
9343
|
-
var parameter =
|
|
9408
|
+
for (var _h = __values($pipelineJson.parameters), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
9409
|
+
var parameter = _j.value;
|
|
9344
9410
|
_loop_3(parameter);
|
|
9345
9411
|
}
|
|
9346
9412
|
}
|
|
9347
|
-
catch (
|
|
9413
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
9348
9414
|
finally {
|
|
9349
9415
|
try {
|
|
9350
|
-
if (
|
|
9416
|
+
if (_j && !_j.done && (_d = _h.return)) _d.call(_h);
|
|
9351
9417
|
}
|
|
9352
|
-
finally { if (
|
|
9418
|
+
finally { if (e_4) throw e_4.error; }
|
|
9353
9419
|
}
|
|
9354
9420
|
}
|
|
9355
9421
|
// =============================================================
|
|
9356
|
-
// Note:
|
|
9422
|
+
// Note: 7️⃣ Mark all non-INPUT parameters as OUTPUT if any OUTPUT is not set
|
|
9357
9423
|
if ($pipelineJson.parameters.every(function (parameter) { return !parameter.isOutput; })) {
|
|
9358
9424
|
try {
|
|
9359
|
-
for (var
|
|
9360
|
-
var parameter =
|
|
9425
|
+
for (var _k = __values($pipelineJson.parameters), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
9426
|
+
var parameter = _l.value;
|
|
9361
9427
|
if (!parameter.isInput) {
|
|
9362
9428
|
parameter.isOutput = true;
|
|
9363
9429
|
}
|
|
9364
9430
|
}
|
|
9365
9431
|
}
|
|
9366
|
-
catch (
|
|
9432
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
9367
9433
|
finally {
|
|
9368
9434
|
try {
|
|
9369
|
-
if (
|
|
9435
|
+
if (_l && !_l.done && (_e = _k.return)) _e.call(_k);
|
|
9370
9436
|
}
|
|
9371
|
-
finally { if (
|
|
9437
|
+
finally { if (e_5) throw e_5.error; }
|
|
9372
9438
|
}
|
|
9373
9439
|
}
|
|
9374
9440
|
// =============================================================
|
|
9375
|
-
// Note:
|
|
9441
|
+
// Note: 8️⃣ Cleanup of undefined values
|
|
9376
9442
|
$pipelineJson.tasks.forEach(function (tasks) {
|
|
9377
|
-
var
|
|
9443
|
+
var e_8, _a;
|
|
9378
9444
|
try {
|
|
9379
9445
|
for (var _b = __values(Object.entries(tasks)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
9380
9446
|
var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
|
|
@@ -9383,16 +9449,16 @@
|
|
|
9383
9449
|
}
|
|
9384
9450
|
}
|
|
9385
9451
|
}
|
|
9386
|
-
catch (
|
|
9452
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
9387
9453
|
finally {
|
|
9388
9454
|
try {
|
|
9389
9455
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
9390
9456
|
}
|
|
9391
|
-
finally { if (
|
|
9457
|
+
finally { if (e_8) throw e_8.error; }
|
|
9392
9458
|
}
|
|
9393
9459
|
});
|
|
9394
9460
|
$pipelineJson.parameters.forEach(function (parameter) {
|
|
9395
|
-
var
|
|
9461
|
+
var e_9, _a;
|
|
9396
9462
|
try {
|
|
9397
9463
|
for (var _b = __values(Object.entries(parameter)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
9398
9464
|
var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
|
|
@@ -9401,12 +9467,12 @@
|
|
|
9401
9467
|
}
|
|
9402
9468
|
}
|
|
9403
9469
|
}
|
|
9404
|
-
catch (
|
|
9470
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
9405
9471
|
finally {
|
|
9406
9472
|
try {
|
|
9407
9473
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
9408
9474
|
}
|
|
9409
|
-
finally { if (
|
|
9475
|
+
finally { if (e_9) throw e_9.error; }
|
|
9410
9476
|
}
|
|
9411
9477
|
});
|
|
9412
9478
|
// =============================================================
|
|
@@ -10986,18 +11052,19 @@
|
|
|
10986
11052
|
var warningLine = "<!-- ".concat(GENERATOR_WARNING, " -->");
|
|
10987
11053
|
var sectionRegex = new RegExp("<!--".concat(sectionName, "-->([\\s\\S]*?)<!--/").concat(sectionName, "-->"), 'g');
|
|
10988
11054
|
var sectionMatch = content.match(sectionRegex);
|
|
11055
|
+
var contentToInsert = spaceTrim.spaceTrim(function (block) { return "\n <!--".concat(sectionName, "-->\n ").concat(block(warningLine), "\n ").concat(block(sectionContent), "\n <!--/").concat(sectionName, "-->\n "); });
|
|
10989
11056
|
if (sectionMatch) {
|
|
10990
|
-
return content.replace(sectionRegex,
|
|
11057
|
+
return content.replace(sectionRegex, contentToInsert);
|
|
10991
11058
|
}
|
|
11059
|
+
// Note: Following is the case when the section is not found in the file so we add it there
|
|
10992
11060
|
var placeForSection = removeContentComments(content).match(/^##.*$/im);
|
|
10993
|
-
if (
|
|
10994
|
-
|
|
10995
|
-
|
|
10996
|
-
"No place where to put the section <!--".concat(sectionName, "-->"));
|
|
10997
|
-
// <- [🚞]
|
|
11061
|
+
if (placeForSection !== null) {
|
|
11062
|
+
var _a = __read(placeForSection, 1), heading_1 = _a[0];
|
|
11063
|
+
return content.replace(heading_1, spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(contentToInsert), "\n \n ").concat(block(heading_1), "\n "); }));
|
|
10998
11064
|
}
|
|
10999
|
-
|
|
11000
|
-
|
|
11065
|
+
console.warn("No place where to put the section <!--".concat(sectionName, "-->, using the end of the file"));
|
|
11066
|
+
// <- TODO: [🚎] Some better way how to get warnings from pipeline parsing / logic
|
|
11067
|
+
return spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(content), "\n \n ").concat(block(contentToInsert), "\n "); });
|
|
11001
11068
|
}
|
|
11002
11069
|
/**
|
|
11003
11070
|
* TODO: [🏛] This can be part of markdown builder
|
|
@@ -11025,7 +11092,7 @@
|
|
|
11025
11092
|
if (!task) {
|
|
11026
11093
|
throw new Error("Could not find task for {".concat(parameterName, "}"));
|
|
11027
11094
|
}
|
|
11028
|
-
return normalizeTo_camelCase('task-' + titleToName(task.title));
|
|
11095
|
+
return task.name || normalizeTo_camelCase('task-' + titleToName(task.title));
|
|
11029
11096
|
};
|
|
11030
11097
|
var promptbookMermaid = spaceTrim.spaceTrim(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
|
|
11031
11098
|
.flatMap(function (_a) {
|
|
@@ -11088,7 +11155,7 @@
|
|
|
11088
11155
|
return { href: "#".concat(task.name), title: task.title };
|
|
11089
11156
|
},
|
|
11090
11157
|
});
|
|
11091
|
-
promptbookMermaidBlock = spaceTrim.spaceTrim(function (block) { return "\n
|
|
11158
|
+
promptbookMermaidBlock = spaceTrim.spaceTrim(function (block) { return "\n ```mermaid\n ".concat(block(promptbookMermaid_1), "\n ```\n "); });
|
|
11092
11159
|
pipelineString = addAutoGeneratedSection(pipelineString, {
|
|
11093
11160
|
sectionName: 'Graph',
|
|
11094
11161
|
sectionContent: promptbookMermaidBlock,
|
|
@@ -13594,10 +13661,7 @@
|
|
|
13594
13661
|
packageName: '@promptbook/google',
|
|
13595
13662
|
className: 'GoogleExecutionTools',
|
|
13596
13663
|
options: {
|
|
13597
|
-
apiKey: '
|
|
13598
|
-
isProxied: true,
|
|
13599
|
-
remoteUrl: DEFAULT_REMOTE_URL,
|
|
13600
|
-
path: DEFAULT_REMOTE_URL_PATH,
|
|
13664
|
+
apiKey: 'AI',
|
|
13601
13665
|
},
|
|
13602
13666
|
};
|
|
13603
13667
|
},
|
|
@@ -13803,7 +13867,7 @@
|
|
|
13803
13867
|
var createGoogleGenerativeAI = require('@ai-sdk/google').createGoogleGenerativeAI;
|
|
13804
13868
|
var googleGeminiVercelProvider = createGoogleGenerativeAI(__assign({}, options));
|
|
13805
13869
|
return createExecutionToolsFromVercelProvider(__assign({ title: 'Google', description: 'Implementation of Google models', vercelProvider: googleGeminiVercelProvider, availableModels: [
|
|
13806
|
-
// TODO:
|
|
13870
|
+
// TODO: [🕘] Maybe list models in same way as in other providers - in separate file with metadata
|
|
13807
13871
|
'gemini-1.5-flash',
|
|
13808
13872
|
'gemini-1.5-flash-latest',
|
|
13809
13873
|
'gemini-1.5-flash-001',
|
|
@@ -13825,10 +13889,6 @@
|
|
|
13825
13889
|
className: 'GoogleExecutionTools',
|
|
13826
13890
|
});
|
|
13827
13891
|
/**
|
|
13828
|
-
* TODO: [🧠][main] !!!! Make anonymous this with all LLM providers
|
|
13829
|
-
* TODO: [🧠][🧱][main] !!!! Maybe change all `new GoogleExecutionTools` -> `createGoogleExecutionTools` in manual
|
|
13830
|
-
* TODO: [🧠] Maybe auto-detect usage in browser and determine default value of `isProxied`
|
|
13831
|
-
* TODO: [🦺] Is there some way how to put `packageName` and `className` on top and function definition on bottom?
|
|
13832
13892
|
* TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
|
|
13833
13893
|
*/
|
|
13834
13894
|
|