@promptbook/core 0.52.0-11 → 0.52.0-13
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 +37 -22
- package/esm/index.es.js.map +1 -1
- package/esm/typings/_packages/core.index.d.ts +2 -1
- package/esm/typings/library/constructors/createPromptbookLibraryFromPromise.d.ts +1 -2
- package/package.json +1 -1
- package/umd/index.umd.js +37 -21
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/_packages/core.index.d.ts +2 -1
- package/umd/typings/library/constructors/createPromptbookLibraryFromPromise.d.ts +1 -2
|
@@ -11,6 +11,7 @@ import { SimplePromptInterfaceTools } from '../execution/plugins/user-interface-
|
|
|
11
11
|
import { checkExpectations, isPassingExpectations } from '../execution/utils/checkExpectations';
|
|
12
12
|
import { createPromptbookLibraryFromDirectory } from '../library/constructors/createPromptbookLibraryFromDirectory';
|
|
13
13
|
import { createPromptbookLibraryFromPromise } from '../library/constructors/createPromptbookLibraryFromPromise';
|
|
14
|
+
import { createPromptbookLibraryFromUrl } from '../library/constructors/createPromptbookLibraryFromUrl';
|
|
14
15
|
import { createPromptbookLibraryFromSources } from '../library/constructors/createPromptbookLibraryFromSources';
|
|
15
16
|
import { createPromptbookSublibrary } from '../library/constructors/createPromptbookSublibrary';
|
|
16
17
|
import { SimplePromptbookLibrary } from '../library/SimplePromptbookLibrary';
|
|
@@ -20,7 +21,7 @@ import { ExecutionTypes } from '../types/ExecutionTypes';
|
|
|
20
21
|
import { PROMPTBOOK_VERSION } from '../version';
|
|
21
22
|
export { ExecutionTypes, PROMPTBOOK_VERSION };
|
|
22
23
|
export { assertsExecutionSuccessful, checkExpectations, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, isPassingExpectations, prettifyPromptbookString, };
|
|
23
|
-
export { createPromptbookLibraryFromDirectory, createPromptbookLibraryFromPromise, createPromptbookLibraryFromSources, createPromptbookSublibrary, SimplePromptbookLibrary, };
|
|
24
|
+
export { createPromptbookLibraryFromDirectory, createPromptbookLibraryFromUrl, createPromptbookLibraryFromPromise, createPromptbookLibraryFromSources, createPromptbookSublibrary, SimplePromptbookLibrary, };
|
|
24
25
|
export { SimplePromptInterfaceTools };
|
|
25
26
|
export { promptbookJsonToString, promptbookStringToJson, validatePromptbookJson };
|
|
26
27
|
export { createPromptbookExecutor, MultipleLlmExecutionTools };
|
|
@@ -14,11 +14,10 @@ import { PromptbookLibrary } from '../PromptbookLibrary';
|
|
|
14
14
|
* Note: The function does NOT return promise it returns the library directly which waits for the sources to be resolved
|
|
15
15
|
* when error occurs in given promise or factory function, it is thrown during `listPromptbooks` or `getPromptbookByUrl` call
|
|
16
16
|
*
|
|
17
|
+
* Note: Consider using `createPromptbookLibraryFromUrl` or `createPromptbookLibraryFromDirectory`
|
|
17
18
|
*
|
|
18
19
|
* @param promptbookSourcesPromiseOrFactory
|
|
19
20
|
* @returns PromptbookLibrary
|
|
20
|
-
*
|
|
21
|
-
* @deprecated Consider using `createPromptbookLibraryFromUrl` or `createPromptbookLibraryFromDirectory`
|
|
22
21
|
*/
|
|
23
22
|
export declare function createPromptbookLibraryFromPromise(promptbookSourcesPromiseOrFactory: Promise<Array<PromptbookJson | PromptbookString>> | (() => Promise<Array<PromptbookJson | PromptbookString>>)): PromptbookLibrary;
|
|
24
23
|
/***
|
package/package.json
CHANGED
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.52.0-
|
|
457
|
+
var PROMPTBOOK_VERSION = '0.52.0-12';
|
|
458
458
|
|
|
459
459
|
/**
|
|
460
460
|
* Parses the template and returns the list of all parameter names
|
|
@@ -3175,6 +3175,23 @@
|
|
|
3175
3175
|
*/
|
|
3176
3176
|
new Function("\n try {\n if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {\n return true;\n } else {\n return false;\n }\n } catch (e) {\n return false;\n }\n");
|
|
3177
3177
|
|
|
3178
|
+
/**
|
|
3179
|
+
* Returns the same value that is passed as argument.
|
|
3180
|
+
* No side effects.
|
|
3181
|
+
*
|
|
3182
|
+
* Note: It can be usefull for leveling indentation
|
|
3183
|
+
*
|
|
3184
|
+
* @param value any values
|
|
3185
|
+
* @returns the same values
|
|
3186
|
+
*/
|
|
3187
|
+
function just(value) {
|
|
3188
|
+
if (value === undefined) {
|
|
3189
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3190
|
+
return undefined;
|
|
3191
|
+
}
|
|
3192
|
+
return value;
|
|
3193
|
+
}
|
|
3194
|
+
|
|
3178
3195
|
/**
|
|
3179
3196
|
* This error indicates that promptbook not found in the library
|
|
3180
3197
|
*/
|
|
@@ -3330,11 +3347,10 @@
|
|
|
3330
3347
|
* Note: The function does NOT return promise it returns the library directly which waits for the sources to be resolved
|
|
3331
3348
|
* when error occurs in given promise or factory function, it is thrown during `listPromptbooks` or `getPromptbookByUrl` call
|
|
3332
3349
|
*
|
|
3350
|
+
* Note: Consider using `createPromptbookLibraryFromUrl` or `createPromptbookLibraryFromDirectory`
|
|
3333
3351
|
*
|
|
3334
3352
|
* @param promptbookSourcesPromiseOrFactory
|
|
3335
3353
|
* @returns PromptbookLibrary
|
|
3336
|
-
*
|
|
3337
|
-
* @deprecated Consider using `createPromptbookLibraryFromUrl` or `createPromptbookLibraryFromDirectory`
|
|
3338
3354
|
*/
|
|
3339
3355
|
function createPromptbookLibraryFromPromise(promptbookSourcesPromiseOrFactory) {
|
|
3340
3356
|
var library;
|
|
@@ -3425,7 +3441,7 @@
|
|
|
3425
3441
|
return __generator(this, function (_a) {
|
|
3426
3442
|
switch (_a.label) {
|
|
3427
3443
|
case 0:
|
|
3428
|
-
readdir = require('fs/promises').readdir;
|
|
3444
|
+
readdir = require(just('fs/promises') /* <- Note: Using require just !!!!! */).readdir;
|
|
3429
3445
|
return [4 /*yield*/, readdir(path)];
|
|
3430
3446
|
case 1:
|
|
3431
3447
|
readdirResult = _a.sent();
|
|
@@ -3440,6 +3456,22 @@
|
|
|
3440
3456
|
* TODO: [🍓][🚯] !!! Add to README and samples + maybe make `@promptbook/library` package
|
|
3441
3457
|
*/
|
|
3442
3458
|
|
|
3459
|
+
/**
|
|
3460
|
+
* Constructs Promptbook from remote Promptbase URL
|
|
3461
|
+
*
|
|
3462
|
+
* Note: The function does NOT return promise it returns the library directly which dynamically loads promptbooks when needed
|
|
3463
|
+
* SO during the construction syntax and logic sources IS NOT validated
|
|
3464
|
+
*
|
|
3465
|
+
* @returns PromptbookLibrary
|
|
3466
|
+
*/
|
|
3467
|
+
function createPromptbookLibraryFromUrl() {
|
|
3468
|
+
throw new Error('Not implemented yet');
|
|
3469
|
+
// TODO: !! Load dynamically DO NOT use createPromptbookLibraryFromPromise
|
|
3470
|
+
}
|
|
3471
|
+
/***
|
|
3472
|
+
* TODO: [🍓][🚯] !!! Add to README and samples + maybe make `@promptbook/library` package
|
|
3473
|
+
*/
|
|
3474
|
+
|
|
3443
3475
|
/**
|
|
3444
3476
|
* Creates PromptbookLibrary as a subset of another PromptbookLibrary
|
|
3445
3477
|
*
|
|
@@ -3542,23 +3574,6 @@
|
|
|
3542
3574
|
return value.toString();
|
|
3543
3575
|
}
|
|
3544
3576
|
|
|
3545
|
-
/**
|
|
3546
|
-
* Returns the same value that is passed as argument.
|
|
3547
|
-
* No side effects.
|
|
3548
|
-
*
|
|
3549
|
-
* Note: It can be usefull for leveling indentation
|
|
3550
|
-
*
|
|
3551
|
-
* @param value any values
|
|
3552
|
-
* @returns the same values
|
|
3553
|
-
*/
|
|
3554
|
-
function just(value) {
|
|
3555
|
-
if (value === undefined) {
|
|
3556
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3557
|
-
return undefined;
|
|
3558
|
-
}
|
|
3559
|
-
return value;
|
|
3560
|
-
}
|
|
3561
|
-
|
|
3562
3577
|
/**
|
|
3563
3578
|
* Create a markdown table from a 2D array of strings
|
|
3564
3579
|
*
|
|
@@ -3852,6 +3867,7 @@
|
|
|
3852
3867
|
exports.createPromptbookLibraryFromDirectory = createPromptbookLibraryFromDirectory;
|
|
3853
3868
|
exports.createPromptbookLibraryFromPromise = createPromptbookLibraryFromPromise;
|
|
3854
3869
|
exports.createPromptbookLibraryFromSources = createPromptbookLibraryFromSources;
|
|
3870
|
+
exports.createPromptbookLibraryFromUrl = createPromptbookLibraryFromUrl;
|
|
3855
3871
|
exports.createPromptbookSublibrary = createPromptbookSublibrary;
|
|
3856
3872
|
exports.executionReportJsonToString = executionReportJsonToString;
|
|
3857
3873
|
exports.isPassingExpectations = isPassingExpectations;
|