@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.
@@ -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.94.0`).
18
+ * It follows semantic versioning (e.g., `0.98.0-1`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/core",
3
- "version": "0.95.0",
3
+ "version": "0.98.0-2",
4
4
  "description": "Promptbook: Run AI apps in plain human language across multiple models and platforms",
5
5
  "private": false,
6
6
  "sideEffects": false,
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.95.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
- await storage.setItem(key, {
10813
- date: $getCurrentDate(),
10814
- promptbookVersion: PROMPTBOOK_ENGINE_VERSION,
10815
- bookVersion: BOOK_LANGUAGE_VERSION,
10816
- prompt: {
10817
- ...prompt,
10818
- parameters: Object.entries(parameters).length === Object.entries(relevantParameters).length
10819
- ? parameters
10820
- : {
10821
- ...relevantParameters,
10822
- note: `<- Note: Only relevant parameters are stored in the cache`,
10823
- },
10824
- },
10825
- promptResult,
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) {