@promptbook/core 0.59.0-15 → 0.59.0-16
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 +133 -133
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +5 -5
- package/esm/typings/src/_packages/node.index.d.ts +1 -1
- package/esm/typings/src/_packages/types.index.d.ts +1 -1
- package/esm/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +133 -133
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/src/_packages/core.index.d.ts +5 -5
- package/umd/typings/src/_packages/node.index.d.ts +1 -1
- package/umd/typings/src/_packages/types.index.d.ts +1 -1
- package/umd/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +1 -1
- /package/esm/typings/src/{promptbook-library → library}/PromptbookLibrary.d.ts +0 -0
- /package/esm/typings/src/{promptbook-library → library}/SimplePromptbookLibrary.d.ts +0 -0
- /package/esm/typings/src/{promptbook-library → library}/constructors/createPromptbookLibraryFromDirectory.d.ts +0 -0
- /package/esm/typings/src/{promptbook-library → library}/constructors/createPromptbookLibraryFromDirectory.test.d.ts +0 -0
- /package/esm/typings/src/{promptbook-library → library}/constructors/createPromptbookLibraryFromPromise.d.ts +0 -0
- /package/esm/typings/src/{promptbook-library → library}/constructors/createPromptbookLibraryFromPromise.test.d.ts +0 -0
- /package/esm/typings/src/{promptbook-library → library}/constructors/createPromptbookLibraryFromSources.d.ts +0 -0
- /package/esm/typings/src/{promptbook-library → library}/constructors/createPromptbookLibraryFromSources.test.d.ts +0 -0
- /package/esm/typings/src/{promptbook-library → library}/constructors/createPromptbookLibraryFromUrl.d.ts +0 -0
- /package/esm/typings/src/{promptbook-library → library}/constructors/createPromptbookSublibrary.d.ts +0 -0
- /package/esm/typings/src/{promptbook-library → library}/constructors/justTestFsImport.d.ts +0 -0
- /package/umd/typings/src/{promptbook-library → library}/PromptbookLibrary.d.ts +0 -0
- /package/umd/typings/src/{promptbook-library → library}/SimplePromptbookLibrary.d.ts +0 -0
- /package/umd/typings/src/{promptbook-library → library}/constructors/createPromptbookLibraryFromDirectory.d.ts +0 -0
- /package/umd/typings/src/{promptbook-library → library}/constructors/createPromptbookLibraryFromDirectory.test.d.ts +0 -0
- /package/umd/typings/src/{promptbook-library → library}/constructors/createPromptbookLibraryFromPromise.d.ts +0 -0
- /package/umd/typings/src/{promptbook-library → library}/constructors/createPromptbookLibraryFromPromise.test.d.ts +0 -0
- /package/umd/typings/src/{promptbook-library → library}/constructors/createPromptbookLibraryFromSources.d.ts +0 -0
- /package/umd/typings/src/{promptbook-library → library}/constructors/createPromptbookLibraryFromSources.test.d.ts +0 -0
- /package/umd/typings/src/{promptbook-library → library}/constructors/createPromptbookLibraryFromUrl.d.ts +0 -0
- /package/umd/typings/src/{promptbook-library → library}/constructors/createPromptbookSublibrary.d.ts +0 -0
- /package/umd/typings/src/{promptbook-library → library}/constructors/justTestFsImport.d.ts +0 -0
package/esm/index.es.js
CHANGED
|
@@ -199,7 +199,7 @@ var PromptbookSyntaxError = /** @class */ (function (_super) {
|
|
|
199
199
|
return PromptbookSyntaxError;
|
|
200
200
|
}(Error));
|
|
201
201
|
|
|
202
|
-
var promptbookLibrary = [{ "title": "Prepare Knowledge from Markdown", "promptbookUrl": "https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md", "promptbookVersion": "0.59.0-
|
|
202
|
+
var promptbookLibrary = [{ "title": "Prepare Knowledge from Markdown", "promptbookUrl": "https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md", "promptbookVersion": "0.59.0-15", "parameters": [{ "name": "content", "description": "Markdown document content", "isInput": true, "isOutput": false }, { "name": "knowledge", "description": "The knowledge JSON object", "isInput": false, "isOutput": true }], "promptTemplates": [{ "name": "knowledge", "title": "Knowledge", "dependentParameterNames": ["content"], "executionType": "PROMPT_TEMPLATE", "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> {content}", "resultingParameterName": "knowledge" }], "knowledge": [] }];
|
|
203
203
|
|
|
204
204
|
/**
|
|
205
205
|
* This error indicates errors during the execution of the promptbook
|
|
@@ -524,7 +524,7 @@ function isValidJsonString(value /* <-[👨⚖️] */) {
|
|
|
524
524
|
/**
|
|
525
525
|
* The version of the Promptbook library
|
|
526
526
|
*/
|
|
527
|
-
var PROMPTBOOK_VERSION = '0.59.0-
|
|
527
|
+
var PROMPTBOOK_VERSION = '0.59.0-15';
|
|
528
528
|
|
|
529
529
|
/**
|
|
530
530
|
* Function `addUsage` will add multiple usages into one
|
|
@@ -3475,137 +3475,6 @@ var SimplePromptInterfaceTools = /** @class */ (function () {
|
|
|
3475
3475
|
return SimplePromptInterfaceTools;
|
|
3476
3476
|
}());
|
|
3477
3477
|
|
|
3478
|
-
/**
|
|
3479
|
-
* Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
|
|
3480
|
-
*
|
|
3481
|
-
* @see https://github.com/webgptorg/promptbook#multiple-server
|
|
3482
|
-
*/
|
|
3483
|
-
var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
3484
|
-
/**
|
|
3485
|
-
* Gets array of execution tools in order of priority
|
|
3486
|
-
*/
|
|
3487
|
-
function MultipleLlmExecutionTools() {
|
|
3488
|
-
var llmExecutionTools = [];
|
|
3489
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3490
|
-
llmExecutionTools[_i] = arguments[_i];
|
|
3491
|
-
}
|
|
3492
|
-
this.llmExecutionTools = llmExecutionTools;
|
|
3493
|
-
}
|
|
3494
|
-
/**
|
|
3495
|
-
* Calls the best available chat model
|
|
3496
|
-
*/
|
|
3497
|
-
MultipleLlmExecutionTools.prototype.gptChat = function (prompt) {
|
|
3498
|
-
return this.gptCommon(prompt);
|
|
3499
|
-
};
|
|
3500
|
-
/**
|
|
3501
|
-
* Calls the best available completion model
|
|
3502
|
-
*/
|
|
3503
|
-
MultipleLlmExecutionTools.prototype.gptComplete = function (prompt) {
|
|
3504
|
-
return this.gptCommon(prompt);
|
|
3505
|
-
};
|
|
3506
|
-
/**
|
|
3507
|
-
* Calls the best available model
|
|
3508
|
-
*/
|
|
3509
|
-
MultipleLlmExecutionTools.prototype.gptCommon = function (prompt) {
|
|
3510
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3511
|
-
var errors, _a, _b, llmExecutionTools, error_1, e_1_1;
|
|
3512
|
-
var e_1, _c;
|
|
3513
|
-
return __generator(this, function (_d) {
|
|
3514
|
-
switch (_d.label) {
|
|
3515
|
-
case 0:
|
|
3516
|
-
errors = [];
|
|
3517
|
-
_d.label = 1;
|
|
3518
|
-
case 1:
|
|
3519
|
-
_d.trys.push([1, 11, 12, 13]);
|
|
3520
|
-
_a = __values(this.llmExecutionTools), _b = _a.next();
|
|
3521
|
-
_d.label = 2;
|
|
3522
|
-
case 2:
|
|
3523
|
-
if (!!_b.done) return [3 /*break*/, 10];
|
|
3524
|
-
llmExecutionTools = _b.value;
|
|
3525
|
-
_d.label = 3;
|
|
3526
|
-
case 3:
|
|
3527
|
-
_d.trys.push([3, 8, , 9]);
|
|
3528
|
-
if (!(prompt.modelRequirements.modelVariant === 'CHAT')) return [3 /*break*/, 5];
|
|
3529
|
-
return [4 /*yield*/, llmExecutionTools.gptChat(prompt)];
|
|
3530
|
-
case 4: return [2 /*return*/, _d.sent()];
|
|
3531
|
-
case 5:
|
|
3532
|
-
if (!(prompt.modelRequirements.modelVariant === 'COMPLETION')) return [3 /*break*/, 7];
|
|
3533
|
-
return [4 /*yield*/, llmExecutionTools.gptComplete(prompt)];
|
|
3534
|
-
case 6: return [2 /*return*/, _d.sent()];
|
|
3535
|
-
case 7: return [3 /*break*/, 9];
|
|
3536
|
-
case 8:
|
|
3537
|
-
error_1 = _d.sent();
|
|
3538
|
-
if (!(error_1 instanceof Error)) {
|
|
3539
|
-
throw error_1;
|
|
3540
|
-
}
|
|
3541
|
-
errors.push(error_1);
|
|
3542
|
-
return [3 /*break*/, 9];
|
|
3543
|
-
case 9:
|
|
3544
|
-
_b = _a.next();
|
|
3545
|
-
return [3 /*break*/, 2];
|
|
3546
|
-
case 10: return [3 /*break*/, 13];
|
|
3547
|
-
case 11:
|
|
3548
|
-
e_1_1 = _d.sent();
|
|
3549
|
-
e_1 = { error: e_1_1 };
|
|
3550
|
-
return [3 /*break*/, 13];
|
|
3551
|
-
case 12:
|
|
3552
|
-
try {
|
|
3553
|
-
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
3554
|
-
}
|
|
3555
|
-
finally { if (e_1) throw e_1.error; }
|
|
3556
|
-
return [7 /*endfinally*/];
|
|
3557
|
-
case 13: throw new Error(spaceTrim$1(function (block) { return "\n All execution tools failed:\n \n ".concat(block(errors.map(function (error) { return "- ".concat(error.name || 'Error', ": ").concat(error.message); }).join('\n')), "\n \n "); }));
|
|
3558
|
-
}
|
|
3559
|
-
});
|
|
3560
|
-
});
|
|
3561
|
-
};
|
|
3562
|
-
/**
|
|
3563
|
-
* List all available models that can be used
|
|
3564
|
-
* This liost is a combination of all available models from all execution tools
|
|
3565
|
-
*/
|
|
3566
|
-
MultipleLlmExecutionTools.prototype.listModels = function () {
|
|
3567
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3568
|
-
var availableModels, _a, _b, llmExecutionTools, models, e_2_1;
|
|
3569
|
-
var e_2, _c;
|
|
3570
|
-
return __generator(this, function (_d) {
|
|
3571
|
-
switch (_d.label) {
|
|
3572
|
-
case 0:
|
|
3573
|
-
availableModels = [];
|
|
3574
|
-
_d.label = 1;
|
|
3575
|
-
case 1:
|
|
3576
|
-
_d.trys.push([1, 6, 7, 8]);
|
|
3577
|
-
_a = __values(this.llmExecutionTools), _b = _a.next();
|
|
3578
|
-
_d.label = 2;
|
|
3579
|
-
case 2:
|
|
3580
|
-
if (!!_b.done) return [3 /*break*/, 5];
|
|
3581
|
-
llmExecutionTools = _b.value;
|
|
3582
|
-
return [4 /*yield*/, llmExecutionTools.listModels()];
|
|
3583
|
-
case 3:
|
|
3584
|
-
models = _d.sent();
|
|
3585
|
-
availableModels.push.apply(availableModels, __spreadArray([], __read(models), false));
|
|
3586
|
-
_d.label = 4;
|
|
3587
|
-
case 4:
|
|
3588
|
-
_b = _a.next();
|
|
3589
|
-
return [3 /*break*/, 2];
|
|
3590
|
-
case 5: return [3 /*break*/, 8];
|
|
3591
|
-
case 6:
|
|
3592
|
-
e_2_1 = _d.sent();
|
|
3593
|
-
e_2 = { error: e_2_1 };
|
|
3594
|
-
return [3 /*break*/, 8];
|
|
3595
|
-
case 7:
|
|
3596
|
-
try {
|
|
3597
|
-
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
3598
|
-
}
|
|
3599
|
-
finally { if (e_2) throw e_2.error; }
|
|
3600
|
-
return [7 /*endfinally*/];
|
|
3601
|
-
case 8: return [2 /*return*/, availableModels];
|
|
3602
|
-
}
|
|
3603
|
-
});
|
|
3604
|
-
});
|
|
3605
|
-
};
|
|
3606
|
-
return MultipleLlmExecutionTools;
|
|
3607
|
-
}());
|
|
3608
|
-
|
|
3609
3478
|
/**
|
|
3610
3479
|
* Constructs Promptbook from async sources
|
|
3611
3480
|
* It can be one of the following:
|
|
@@ -3808,6 +3677,137 @@ function createPromptbookSublibrary(library, predicate) {
|
|
|
3808
3677
|
};
|
|
3809
3678
|
}
|
|
3810
3679
|
|
|
3680
|
+
/**
|
|
3681
|
+
* Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
|
|
3682
|
+
*
|
|
3683
|
+
* @see https://github.com/webgptorg/promptbook#multiple-server
|
|
3684
|
+
*/
|
|
3685
|
+
var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
3686
|
+
/**
|
|
3687
|
+
* Gets array of execution tools in order of priority
|
|
3688
|
+
*/
|
|
3689
|
+
function MultipleLlmExecutionTools() {
|
|
3690
|
+
var llmExecutionTools = [];
|
|
3691
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3692
|
+
llmExecutionTools[_i] = arguments[_i];
|
|
3693
|
+
}
|
|
3694
|
+
this.llmExecutionTools = llmExecutionTools;
|
|
3695
|
+
}
|
|
3696
|
+
/**
|
|
3697
|
+
* Calls the best available chat model
|
|
3698
|
+
*/
|
|
3699
|
+
MultipleLlmExecutionTools.prototype.gptChat = function (prompt) {
|
|
3700
|
+
return this.gptCommon(prompt);
|
|
3701
|
+
};
|
|
3702
|
+
/**
|
|
3703
|
+
* Calls the best available completion model
|
|
3704
|
+
*/
|
|
3705
|
+
MultipleLlmExecutionTools.prototype.gptComplete = function (prompt) {
|
|
3706
|
+
return this.gptCommon(prompt);
|
|
3707
|
+
};
|
|
3708
|
+
/**
|
|
3709
|
+
* Calls the best available model
|
|
3710
|
+
*/
|
|
3711
|
+
MultipleLlmExecutionTools.prototype.gptCommon = function (prompt) {
|
|
3712
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3713
|
+
var errors, _a, _b, llmExecutionTools, error_1, e_1_1;
|
|
3714
|
+
var e_1, _c;
|
|
3715
|
+
return __generator(this, function (_d) {
|
|
3716
|
+
switch (_d.label) {
|
|
3717
|
+
case 0:
|
|
3718
|
+
errors = [];
|
|
3719
|
+
_d.label = 1;
|
|
3720
|
+
case 1:
|
|
3721
|
+
_d.trys.push([1, 11, 12, 13]);
|
|
3722
|
+
_a = __values(this.llmExecutionTools), _b = _a.next();
|
|
3723
|
+
_d.label = 2;
|
|
3724
|
+
case 2:
|
|
3725
|
+
if (!!_b.done) return [3 /*break*/, 10];
|
|
3726
|
+
llmExecutionTools = _b.value;
|
|
3727
|
+
_d.label = 3;
|
|
3728
|
+
case 3:
|
|
3729
|
+
_d.trys.push([3, 8, , 9]);
|
|
3730
|
+
if (!(prompt.modelRequirements.modelVariant === 'CHAT')) return [3 /*break*/, 5];
|
|
3731
|
+
return [4 /*yield*/, llmExecutionTools.gptChat(prompt)];
|
|
3732
|
+
case 4: return [2 /*return*/, _d.sent()];
|
|
3733
|
+
case 5:
|
|
3734
|
+
if (!(prompt.modelRequirements.modelVariant === 'COMPLETION')) return [3 /*break*/, 7];
|
|
3735
|
+
return [4 /*yield*/, llmExecutionTools.gptComplete(prompt)];
|
|
3736
|
+
case 6: return [2 /*return*/, _d.sent()];
|
|
3737
|
+
case 7: return [3 /*break*/, 9];
|
|
3738
|
+
case 8:
|
|
3739
|
+
error_1 = _d.sent();
|
|
3740
|
+
if (!(error_1 instanceof Error)) {
|
|
3741
|
+
throw error_1;
|
|
3742
|
+
}
|
|
3743
|
+
errors.push(error_1);
|
|
3744
|
+
return [3 /*break*/, 9];
|
|
3745
|
+
case 9:
|
|
3746
|
+
_b = _a.next();
|
|
3747
|
+
return [3 /*break*/, 2];
|
|
3748
|
+
case 10: return [3 /*break*/, 13];
|
|
3749
|
+
case 11:
|
|
3750
|
+
e_1_1 = _d.sent();
|
|
3751
|
+
e_1 = { error: e_1_1 };
|
|
3752
|
+
return [3 /*break*/, 13];
|
|
3753
|
+
case 12:
|
|
3754
|
+
try {
|
|
3755
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
3756
|
+
}
|
|
3757
|
+
finally { if (e_1) throw e_1.error; }
|
|
3758
|
+
return [7 /*endfinally*/];
|
|
3759
|
+
case 13: throw new Error(spaceTrim$1(function (block) { return "\n All execution tools failed:\n \n ".concat(block(errors.map(function (error) { return "- ".concat(error.name || 'Error', ": ").concat(error.message); }).join('\n')), "\n \n "); }));
|
|
3760
|
+
}
|
|
3761
|
+
});
|
|
3762
|
+
});
|
|
3763
|
+
};
|
|
3764
|
+
/**
|
|
3765
|
+
* List all available models that can be used
|
|
3766
|
+
* This liost is a combination of all available models from all execution tools
|
|
3767
|
+
*/
|
|
3768
|
+
MultipleLlmExecutionTools.prototype.listModels = function () {
|
|
3769
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3770
|
+
var availableModels, _a, _b, llmExecutionTools, models, e_2_1;
|
|
3771
|
+
var e_2, _c;
|
|
3772
|
+
return __generator(this, function (_d) {
|
|
3773
|
+
switch (_d.label) {
|
|
3774
|
+
case 0:
|
|
3775
|
+
availableModels = [];
|
|
3776
|
+
_d.label = 1;
|
|
3777
|
+
case 1:
|
|
3778
|
+
_d.trys.push([1, 6, 7, 8]);
|
|
3779
|
+
_a = __values(this.llmExecutionTools), _b = _a.next();
|
|
3780
|
+
_d.label = 2;
|
|
3781
|
+
case 2:
|
|
3782
|
+
if (!!_b.done) return [3 /*break*/, 5];
|
|
3783
|
+
llmExecutionTools = _b.value;
|
|
3784
|
+
return [4 /*yield*/, llmExecutionTools.listModels()];
|
|
3785
|
+
case 3:
|
|
3786
|
+
models = _d.sent();
|
|
3787
|
+
availableModels.push.apply(availableModels, __spreadArray([], __read(models), false));
|
|
3788
|
+
_d.label = 4;
|
|
3789
|
+
case 4:
|
|
3790
|
+
_b = _a.next();
|
|
3791
|
+
return [3 /*break*/, 2];
|
|
3792
|
+
case 5: return [3 /*break*/, 8];
|
|
3793
|
+
case 6:
|
|
3794
|
+
e_2_1 = _d.sent();
|
|
3795
|
+
e_2 = { error: e_2_1 };
|
|
3796
|
+
return [3 /*break*/, 8];
|
|
3797
|
+
case 7:
|
|
3798
|
+
try {
|
|
3799
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
3800
|
+
}
|
|
3801
|
+
finally { if (e_2) throw e_2.error; }
|
|
3802
|
+
return [7 /*endfinally*/];
|
|
3803
|
+
case 8: return [2 /*return*/, availableModels];
|
|
3804
|
+
}
|
|
3805
|
+
});
|
|
3806
|
+
});
|
|
3807
|
+
};
|
|
3808
|
+
return MultipleLlmExecutionTools;
|
|
3809
|
+
}());
|
|
3810
|
+
|
|
3811
3811
|
/**
|
|
3812
3812
|
* Format either small or big number
|
|
3813
3813
|
*
|