@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/umd/index.umd.js
CHANGED
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
return PromptbookSyntaxError;
|
|
207
207
|
}(Error));
|
|
208
208
|
|
|
209
|
-
var promptbookLibrary = [{ "title": "Prepare Knowledge from Markdown", "promptbookUrl": "https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md", "promptbookVersion": "0.59.0-
|
|
209
|
+
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": [] }];
|
|
210
210
|
|
|
211
211
|
/**
|
|
212
212
|
* This error indicates errors during the execution of the promptbook
|
|
@@ -531,7 +531,7 @@
|
|
|
531
531
|
/**
|
|
532
532
|
* The version of the Promptbook library
|
|
533
533
|
*/
|
|
534
|
-
var PROMPTBOOK_VERSION = '0.59.0-
|
|
534
|
+
var PROMPTBOOK_VERSION = '0.59.0-15';
|
|
535
535
|
|
|
536
536
|
/**
|
|
537
537
|
* Function `addUsage` will add multiple usages into one
|
|
@@ -3482,137 +3482,6 @@
|
|
|
3482
3482
|
return SimplePromptInterfaceTools;
|
|
3483
3483
|
}());
|
|
3484
3484
|
|
|
3485
|
-
/**
|
|
3486
|
-
* Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
|
|
3487
|
-
*
|
|
3488
|
-
* @see https://github.com/webgptorg/promptbook#multiple-server
|
|
3489
|
-
*/
|
|
3490
|
-
var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
3491
|
-
/**
|
|
3492
|
-
* Gets array of execution tools in order of priority
|
|
3493
|
-
*/
|
|
3494
|
-
function MultipleLlmExecutionTools() {
|
|
3495
|
-
var llmExecutionTools = [];
|
|
3496
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3497
|
-
llmExecutionTools[_i] = arguments[_i];
|
|
3498
|
-
}
|
|
3499
|
-
this.llmExecutionTools = llmExecutionTools;
|
|
3500
|
-
}
|
|
3501
|
-
/**
|
|
3502
|
-
* Calls the best available chat model
|
|
3503
|
-
*/
|
|
3504
|
-
MultipleLlmExecutionTools.prototype.gptChat = function (prompt) {
|
|
3505
|
-
return this.gptCommon(prompt);
|
|
3506
|
-
};
|
|
3507
|
-
/**
|
|
3508
|
-
* Calls the best available completion model
|
|
3509
|
-
*/
|
|
3510
|
-
MultipleLlmExecutionTools.prototype.gptComplete = function (prompt) {
|
|
3511
|
-
return this.gptCommon(prompt);
|
|
3512
|
-
};
|
|
3513
|
-
/**
|
|
3514
|
-
* Calls the best available model
|
|
3515
|
-
*/
|
|
3516
|
-
MultipleLlmExecutionTools.prototype.gptCommon = function (prompt) {
|
|
3517
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3518
|
-
var errors, _a, _b, llmExecutionTools, error_1, e_1_1;
|
|
3519
|
-
var e_1, _c;
|
|
3520
|
-
return __generator(this, function (_d) {
|
|
3521
|
-
switch (_d.label) {
|
|
3522
|
-
case 0:
|
|
3523
|
-
errors = [];
|
|
3524
|
-
_d.label = 1;
|
|
3525
|
-
case 1:
|
|
3526
|
-
_d.trys.push([1, 11, 12, 13]);
|
|
3527
|
-
_a = __values(this.llmExecutionTools), _b = _a.next();
|
|
3528
|
-
_d.label = 2;
|
|
3529
|
-
case 2:
|
|
3530
|
-
if (!!_b.done) return [3 /*break*/, 10];
|
|
3531
|
-
llmExecutionTools = _b.value;
|
|
3532
|
-
_d.label = 3;
|
|
3533
|
-
case 3:
|
|
3534
|
-
_d.trys.push([3, 8, , 9]);
|
|
3535
|
-
if (!(prompt.modelRequirements.modelVariant === 'CHAT')) return [3 /*break*/, 5];
|
|
3536
|
-
return [4 /*yield*/, llmExecutionTools.gptChat(prompt)];
|
|
3537
|
-
case 4: return [2 /*return*/, _d.sent()];
|
|
3538
|
-
case 5:
|
|
3539
|
-
if (!(prompt.modelRequirements.modelVariant === 'COMPLETION')) return [3 /*break*/, 7];
|
|
3540
|
-
return [4 /*yield*/, llmExecutionTools.gptComplete(prompt)];
|
|
3541
|
-
case 6: return [2 /*return*/, _d.sent()];
|
|
3542
|
-
case 7: return [3 /*break*/, 9];
|
|
3543
|
-
case 8:
|
|
3544
|
-
error_1 = _d.sent();
|
|
3545
|
-
if (!(error_1 instanceof Error)) {
|
|
3546
|
-
throw error_1;
|
|
3547
|
-
}
|
|
3548
|
-
errors.push(error_1);
|
|
3549
|
-
return [3 /*break*/, 9];
|
|
3550
|
-
case 9:
|
|
3551
|
-
_b = _a.next();
|
|
3552
|
-
return [3 /*break*/, 2];
|
|
3553
|
-
case 10: return [3 /*break*/, 13];
|
|
3554
|
-
case 11:
|
|
3555
|
-
e_1_1 = _d.sent();
|
|
3556
|
-
e_1 = { error: e_1_1 };
|
|
3557
|
-
return [3 /*break*/, 13];
|
|
3558
|
-
case 12:
|
|
3559
|
-
try {
|
|
3560
|
-
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
3561
|
-
}
|
|
3562
|
-
finally { if (e_1) throw e_1.error; }
|
|
3563
|
-
return [7 /*endfinally*/];
|
|
3564
|
-
case 13: throw new Error(spaceTrim__default["default"](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 "); }));
|
|
3565
|
-
}
|
|
3566
|
-
});
|
|
3567
|
-
});
|
|
3568
|
-
};
|
|
3569
|
-
/**
|
|
3570
|
-
* List all available models that can be used
|
|
3571
|
-
* This liost is a combination of all available models from all execution tools
|
|
3572
|
-
*/
|
|
3573
|
-
MultipleLlmExecutionTools.prototype.listModels = function () {
|
|
3574
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3575
|
-
var availableModels, _a, _b, llmExecutionTools, models, e_2_1;
|
|
3576
|
-
var e_2, _c;
|
|
3577
|
-
return __generator(this, function (_d) {
|
|
3578
|
-
switch (_d.label) {
|
|
3579
|
-
case 0:
|
|
3580
|
-
availableModels = [];
|
|
3581
|
-
_d.label = 1;
|
|
3582
|
-
case 1:
|
|
3583
|
-
_d.trys.push([1, 6, 7, 8]);
|
|
3584
|
-
_a = __values(this.llmExecutionTools), _b = _a.next();
|
|
3585
|
-
_d.label = 2;
|
|
3586
|
-
case 2:
|
|
3587
|
-
if (!!_b.done) return [3 /*break*/, 5];
|
|
3588
|
-
llmExecutionTools = _b.value;
|
|
3589
|
-
return [4 /*yield*/, llmExecutionTools.listModels()];
|
|
3590
|
-
case 3:
|
|
3591
|
-
models = _d.sent();
|
|
3592
|
-
availableModels.push.apply(availableModels, __spreadArray([], __read(models), false));
|
|
3593
|
-
_d.label = 4;
|
|
3594
|
-
case 4:
|
|
3595
|
-
_b = _a.next();
|
|
3596
|
-
return [3 /*break*/, 2];
|
|
3597
|
-
case 5: return [3 /*break*/, 8];
|
|
3598
|
-
case 6:
|
|
3599
|
-
e_2_1 = _d.sent();
|
|
3600
|
-
e_2 = { error: e_2_1 };
|
|
3601
|
-
return [3 /*break*/, 8];
|
|
3602
|
-
case 7:
|
|
3603
|
-
try {
|
|
3604
|
-
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
3605
|
-
}
|
|
3606
|
-
finally { if (e_2) throw e_2.error; }
|
|
3607
|
-
return [7 /*endfinally*/];
|
|
3608
|
-
case 8: return [2 /*return*/, availableModels];
|
|
3609
|
-
}
|
|
3610
|
-
});
|
|
3611
|
-
});
|
|
3612
|
-
};
|
|
3613
|
-
return MultipleLlmExecutionTools;
|
|
3614
|
-
}());
|
|
3615
|
-
|
|
3616
3485
|
/**
|
|
3617
3486
|
* Constructs Promptbook from async sources
|
|
3618
3487
|
* It can be one of the following:
|
|
@@ -3815,6 +3684,137 @@
|
|
|
3815
3684
|
};
|
|
3816
3685
|
}
|
|
3817
3686
|
|
|
3687
|
+
/**
|
|
3688
|
+
* Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
|
|
3689
|
+
*
|
|
3690
|
+
* @see https://github.com/webgptorg/promptbook#multiple-server
|
|
3691
|
+
*/
|
|
3692
|
+
var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
3693
|
+
/**
|
|
3694
|
+
* Gets array of execution tools in order of priority
|
|
3695
|
+
*/
|
|
3696
|
+
function MultipleLlmExecutionTools() {
|
|
3697
|
+
var llmExecutionTools = [];
|
|
3698
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3699
|
+
llmExecutionTools[_i] = arguments[_i];
|
|
3700
|
+
}
|
|
3701
|
+
this.llmExecutionTools = llmExecutionTools;
|
|
3702
|
+
}
|
|
3703
|
+
/**
|
|
3704
|
+
* Calls the best available chat model
|
|
3705
|
+
*/
|
|
3706
|
+
MultipleLlmExecutionTools.prototype.gptChat = function (prompt) {
|
|
3707
|
+
return this.gptCommon(prompt);
|
|
3708
|
+
};
|
|
3709
|
+
/**
|
|
3710
|
+
* Calls the best available completion model
|
|
3711
|
+
*/
|
|
3712
|
+
MultipleLlmExecutionTools.prototype.gptComplete = function (prompt) {
|
|
3713
|
+
return this.gptCommon(prompt);
|
|
3714
|
+
};
|
|
3715
|
+
/**
|
|
3716
|
+
* Calls the best available model
|
|
3717
|
+
*/
|
|
3718
|
+
MultipleLlmExecutionTools.prototype.gptCommon = function (prompt) {
|
|
3719
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3720
|
+
var errors, _a, _b, llmExecutionTools, error_1, e_1_1;
|
|
3721
|
+
var e_1, _c;
|
|
3722
|
+
return __generator(this, function (_d) {
|
|
3723
|
+
switch (_d.label) {
|
|
3724
|
+
case 0:
|
|
3725
|
+
errors = [];
|
|
3726
|
+
_d.label = 1;
|
|
3727
|
+
case 1:
|
|
3728
|
+
_d.trys.push([1, 11, 12, 13]);
|
|
3729
|
+
_a = __values(this.llmExecutionTools), _b = _a.next();
|
|
3730
|
+
_d.label = 2;
|
|
3731
|
+
case 2:
|
|
3732
|
+
if (!!_b.done) return [3 /*break*/, 10];
|
|
3733
|
+
llmExecutionTools = _b.value;
|
|
3734
|
+
_d.label = 3;
|
|
3735
|
+
case 3:
|
|
3736
|
+
_d.trys.push([3, 8, , 9]);
|
|
3737
|
+
if (!(prompt.modelRequirements.modelVariant === 'CHAT')) return [3 /*break*/, 5];
|
|
3738
|
+
return [4 /*yield*/, llmExecutionTools.gptChat(prompt)];
|
|
3739
|
+
case 4: return [2 /*return*/, _d.sent()];
|
|
3740
|
+
case 5:
|
|
3741
|
+
if (!(prompt.modelRequirements.modelVariant === 'COMPLETION')) return [3 /*break*/, 7];
|
|
3742
|
+
return [4 /*yield*/, llmExecutionTools.gptComplete(prompt)];
|
|
3743
|
+
case 6: return [2 /*return*/, _d.sent()];
|
|
3744
|
+
case 7: return [3 /*break*/, 9];
|
|
3745
|
+
case 8:
|
|
3746
|
+
error_1 = _d.sent();
|
|
3747
|
+
if (!(error_1 instanceof Error)) {
|
|
3748
|
+
throw error_1;
|
|
3749
|
+
}
|
|
3750
|
+
errors.push(error_1);
|
|
3751
|
+
return [3 /*break*/, 9];
|
|
3752
|
+
case 9:
|
|
3753
|
+
_b = _a.next();
|
|
3754
|
+
return [3 /*break*/, 2];
|
|
3755
|
+
case 10: return [3 /*break*/, 13];
|
|
3756
|
+
case 11:
|
|
3757
|
+
e_1_1 = _d.sent();
|
|
3758
|
+
e_1 = { error: e_1_1 };
|
|
3759
|
+
return [3 /*break*/, 13];
|
|
3760
|
+
case 12:
|
|
3761
|
+
try {
|
|
3762
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
3763
|
+
}
|
|
3764
|
+
finally { if (e_1) throw e_1.error; }
|
|
3765
|
+
return [7 /*endfinally*/];
|
|
3766
|
+
case 13: throw new Error(spaceTrim__default["default"](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 "); }));
|
|
3767
|
+
}
|
|
3768
|
+
});
|
|
3769
|
+
});
|
|
3770
|
+
};
|
|
3771
|
+
/**
|
|
3772
|
+
* List all available models that can be used
|
|
3773
|
+
* This liost is a combination of all available models from all execution tools
|
|
3774
|
+
*/
|
|
3775
|
+
MultipleLlmExecutionTools.prototype.listModels = function () {
|
|
3776
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3777
|
+
var availableModels, _a, _b, llmExecutionTools, models, e_2_1;
|
|
3778
|
+
var e_2, _c;
|
|
3779
|
+
return __generator(this, function (_d) {
|
|
3780
|
+
switch (_d.label) {
|
|
3781
|
+
case 0:
|
|
3782
|
+
availableModels = [];
|
|
3783
|
+
_d.label = 1;
|
|
3784
|
+
case 1:
|
|
3785
|
+
_d.trys.push([1, 6, 7, 8]);
|
|
3786
|
+
_a = __values(this.llmExecutionTools), _b = _a.next();
|
|
3787
|
+
_d.label = 2;
|
|
3788
|
+
case 2:
|
|
3789
|
+
if (!!_b.done) return [3 /*break*/, 5];
|
|
3790
|
+
llmExecutionTools = _b.value;
|
|
3791
|
+
return [4 /*yield*/, llmExecutionTools.listModels()];
|
|
3792
|
+
case 3:
|
|
3793
|
+
models = _d.sent();
|
|
3794
|
+
availableModels.push.apply(availableModels, __spreadArray([], __read(models), false));
|
|
3795
|
+
_d.label = 4;
|
|
3796
|
+
case 4:
|
|
3797
|
+
_b = _a.next();
|
|
3798
|
+
return [3 /*break*/, 2];
|
|
3799
|
+
case 5: return [3 /*break*/, 8];
|
|
3800
|
+
case 6:
|
|
3801
|
+
e_2_1 = _d.sent();
|
|
3802
|
+
e_2 = { error: e_2_1 };
|
|
3803
|
+
return [3 /*break*/, 8];
|
|
3804
|
+
case 7:
|
|
3805
|
+
try {
|
|
3806
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
3807
|
+
}
|
|
3808
|
+
finally { if (e_2) throw e_2.error; }
|
|
3809
|
+
return [7 /*endfinally*/];
|
|
3810
|
+
case 8: return [2 /*return*/, availableModels];
|
|
3811
|
+
}
|
|
3812
|
+
});
|
|
3813
|
+
});
|
|
3814
|
+
};
|
|
3815
|
+
return MultipleLlmExecutionTools;
|
|
3816
|
+
}());
|
|
3817
|
+
|
|
3818
3818
|
/**
|
|
3819
3819
|
* Format either small or big number
|
|
3820
3820
|
*
|