@firebase/ai 2.1.0-canary.84b8bed35 → 2.1.0-canary.c5f08a9bc

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.
@@ -59,6 +59,14 @@ export interface ImagenResponseInternal {
59
59
  * The reason why the image was filtered.
60
60
  */
61
61
  raiFilteredReason?: string;
62
+ /**
63
+ * The safety attributes.
64
+ *
65
+ * This type is currently unused in the SDK. It is sent back because our requests set
66
+ * `includeSafetyAttributes`. This property is currently only used to avoid throwing an error
67
+ * when encountering this unsupported prediction type.
68
+ */
69
+ safetyAttributes?: unknown;
62
70
  }>;
63
71
  }
64
72
  /**
@@ -81,6 +89,7 @@ export interface ImagenResponseInternal {
81
89
  * "personGeneration": "allow_all",
82
90
  * "sampleCount": 2,
83
91
  * "includeRaiReason": true,
92
+ * "includeSafetyAttributes": true,
84
93
  * "aspectRatio": "9:16"
85
94
  * }
86
95
  * }
@@ -108,6 +117,7 @@ export interface PredictRequestBody {
108
117
  safetyFilterLevel?: string;
109
118
  personGeneration?: string;
110
119
  includeRaiReason: boolean;
120
+ includeSafetyAttributes: boolean;
111
121
  };
112
122
  }
113
123
  /**
package/dist/index.cjs.js CHANGED
@@ -8,7 +8,7 @@ var util = require('@firebase/util');
8
8
  var logger$1 = require('@firebase/logger');
9
9
 
10
10
  var name = "@firebase/ai";
11
- var version = "2.1.0-canary.84b8bed35";
11
+ var version = "2.1.0-canary.c5f08a9bc";
12
12
 
13
13
  /**
14
14
  * @license
@@ -1328,6 +1328,7 @@ async function handlePredictResponse(response) {
1328
1328
  gcsURI: prediction.gcsUri
1329
1329
  });
1330
1330
  }
1331
+ else if (prediction.safetyAttributes) ;
1331
1332
  else {
1332
1333
  throw new AIError(AIErrorCode.RESPONSE_ERROR, `Unexpected element in 'predictions' array in response: '${JSON.stringify(prediction)}'`);
1333
1334
  }
@@ -1870,7 +1871,8 @@ function createPredictRequestBody(prompt, { gcsURI, imageFormat, addWatermark, n
1870
1871
  addWatermark,
1871
1872
  safetyFilterLevel,
1872
1873
  personGeneration: personFilterLevel,
1873
- includeRaiReason: true
1874
+ includeRaiReason: true,
1875
+ includeSafetyAttributes: true
1874
1876
  }
1875
1877
  };
1876
1878
  return body;