@promptbook/wizard 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/wizard",
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,
@@ -74,7 +74,7 @@
74
74
  "module": "./esm/index.es.js",
75
75
  "typings": "./esm/typings/src/_packages/wizard.index.d.ts",
76
76
  "peerDependencies": {
77
- "@promptbook/core": "0.95.0"
77
+ "@promptbook/core": "0.98.0-2"
78
78
  },
79
79
  "dependencies": {
80
80
  "@ai-sdk/deepseek": "0.1.6",
package/umd/index.umd.js CHANGED
@@ -49,7 +49,7 @@
49
49
  * @generated
50
50
  * @see https://github.com/webgptorg/promptbook
51
51
  */
52
- const PROMPTBOOK_ENGINE_VERSION = '0.95.0';
52
+ const PROMPTBOOK_ENGINE_VERSION = '0.98.0-2';
53
53
  /**
54
54
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
55
55
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -11774,21 +11774,39 @@
11774
11774
  }
11775
11775
  // TODO: [🧠] !!5 How to do timing in mixed cache / non-cache situation
11776
11776
  // promptResult.timing: FromtoItems
11777
- await storage.setItem(key, {
11778
- date: $getCurrentDate(),
11779
- promptbookVersion: PROMPTBOOK_ENGINE_VERSION,
11780
- bookVersion: BOOK_LANGUAGE_VERSION,
11781
- prompt: {
11782
- ...prompt,
11783
- parameters: Object.entries(parameters).length === Object.entries(relevantParameters).length
11784
- ? parameters
11785
- : {
11786
- ...relevantParameters,
11787
- note: `<- Note: Only relevant parameters are stored in the cache`,
11788
- },
11789
- },
11790
- promptResult,
11791
- });
11777
+ // Check if the result is valid and should be cached
11778
+ // A result is considered failed if:
11779
+ // 1. It has a content property that is null or undefined
11780
+ // 2. It has an error property that is truthy
11781
+ // 3. It has a success property that is explicitly false
11782
+ const isFailedResult = promptResult.content === null ||
11783
+ promptResult.content === undefined ||
11784
+ promptResult.error ||
11785
+ promptResult.success === false;
11786
+ if (!isFailedResult) {
11787
+ await storage.setItem(key, {
11788
+ date: $getCurrentDate(),
11789
+ promptbookVersion: PROMPTBOOK_ENGINE_VERSION,
11790
+ bookVersion: BOOK_LANGUAGE_VERSION,
11791
+ prompt: {
11792
+ ...prompt,
11793
+ parameters: Object.entries(parameters).length === Object.entries(relevantParameters).length
11794
+ ? parameters
11795
+ : {
11796
+ ...relevantParameters,
11797
+ note: `<- Note: Only relevant parameters are stored in the cache`,
11798
+ },
11799
+ },
11800
+ promptResult,
11801
+ });
11802
+ }
11803
+ else if (isVerbose) {
11804
+ console.info('Not caching failed result for key:', key, {
11805
+ content: promptResult.content,
11806
+ error: promptResult.error,
11807
+ success: promptResult.success,
11808
+ });
11809
+ }
11792
11810
  return promptResult;
11793
11811
  };
11794
11812
  if (llmTools.callChatModel !== undefined) {