fix(ai): Add 'includeSafetyAttributes' to Predict request payloads#9216
fix(ai): Add 'includeSafetyAttributes' to Predict request payloads#9216
'includeSafetyAttributes' to Predict request payloads#9216Conversation
🦋 Changeset detectedLatest commit: 06a42a6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Size Report 1Affected Products
Test Logs |
Size Analysis Report 1Affected Products
Test Logs |
If the `responseJson` from the Predict request has an image, the entire image base64 will be included in the error message. This can make the error message >400kB (!!), which could cause performance issues in apps. I ran into this when testing #9216, since the `safetyAttributes` would be included in a response and trigger this error, but the `predictions` array in `responseJson` would have images. I noticed that when the sample app rendered the `error.message`, it began running into serious performance issues.
#9222) * fix(ai): Only include unexpected prediction element in error message. If the `responseJson` from the Predict request has an image, the entire image base64 will be included in the error message. This can make the error message >400kB (!!), which could cause performance issues in apps. I ran into this when testing #9216, since the `safetyAttributes` would be included in a response and trigger this error, but the `predictions` array in `responseJson` would have images. I noticed that when the sample app rendered the `error.message`, it began running into serious performance issues.
Add
'includeSafetyAttributes'to Predict request payloads, and set it totrue.This is identical to how we send
'includeRaiReason'.Fixes b/438467377 (internal)