@promptbook/core 0.95.0 → 0.98.0-2
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 +12 -0
- package/esm/index.es.js +34 -16
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +34 -16
- package/umd/index.umd.js.map +1 -1
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.
|
|
18
|
+
* It follows semantic versioning (e.g., `0.98.0-1`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* @generated
|
|
28
28
|
* @see https://github.com/webgptorg/promptbook
|
|
29
29
|
*/
|
|
30
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.
|
|
30
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.98.0-2';
|
|
31
31
|
/**
|
|
32
32
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
33
33
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -10809,21 +10809,39 @@
|
|
|
10809
10809
|
}
|
|
10810
10810
|
// TODO: [🧠] !!5 How to do timing in mixed cache / non-cache situation
|
|
10811
10811
|
// promptResult.timing: FromtoItems
|
|
10812
|
-
|
|
10813
|
-
|
|
10814
|
-
|
|
10815
|
-
|
|
10816
|
-
|
|
10817
|
-
|
|
10818
|
-
|
|
10819
|
-
|
|
10820
|
-
|
|
10821
|
-
|
|
10822
|
-
|
|
10823
|
-
|
|
10824
|
-
|
|
10825
|
-
|
|
10826
|
-
|
|
10812
|
+
// Check if the result is valid and should be cached
|
|
10813
|
+
// A result is considered failed if:
|
|
10814
|
+
// 1. It has a content property that is null or undefined
|
|
10815
|
+
// 2. It has an error property that is truthy
|
|
10816
|
+
// 3. It has a success property that is explicitly false
|
|
10817
|
+
const isFailedResult = promptResult.content === null ||
|
|
10818
|
+
promptResult.content === undefined ||
|
|
10819
|
+
promptResult.error ||
|
|
10820
|
+
promptResult.success === false;
|
|
10821
|
+
if (!isFailedResult) {
|
|
10822
|
+
await storage.setItem(key, {
|
|
10823
|
+
date: $getCurrentDate(),
|
|
10824
|
+
promptbookVersion: PROMPTBOOK_ENGINE_VERSION,
|
|
10825
|
+
bookVersion: BOOK_LANGUAGE_VERSION,
|
|
10826
|
+
prompt: {
|
|
10827
|
+
...prompt,
|
|
10828
|
+
parameters: Object.entries(parameters).length === Object.entries(relevantParameters).length
|
|
10829
|
+
? parameters
|
|
10830
|
+
: {
|
|
10831
|
+
...relevantParameters,
|
|
10832
|
+
note: `<- Note: Only relevant parameters are stored in the cache`,
|
|
10833
|
+
},
|
|
10834
|
+
},
|
|
10835
|
+
promptResult,
|
|
10836
|
+
});
|
|
10837
|
+
}
|
|
10838
|
+
else if (isVerbose) {
|
|
10839
|
+
console.info('Not caching failed result for key:', key, {
|
|
10840
|
+
content: promptResult.content,
|
|
10841
|
+
error: promptResult.error,
|
|
10842
|
+
success: promptResult.success,
|
|
10843
|
+
});
|
|
10844
|
+
}
|
|
10827
10845
|
return promptResult;
|
|
10828
10846
|
};
|
|
10829
10847
|
if (llmTools.callChatModel !== undefined) {
|