diff --git a/.changeset/calm-guests-pump.md b/.changeset/calm-guests-pump.md new file mode 100644 index 00000000000..da46e234f77 --- /dev/null +++ b/.changeset/calm-guests-pump.md @@ -0,0 +1,5 @@ +--- +'@firebase/ai': patch +--- + +Fixed an issue where `AIError` messages were too long after including an entire response body. diff --git a/packages/ai/src/requests/response-helpers.ts b/packages/ai/src/requests/response-helpers.ts index 2505b5c9276..fec9b371512 100644 --- a/packages/ai/src/requests/response-helpers.ts +++ b/packages/ai/src/requests/response-helpers.ts @@ -299,9 +299,9 @@ export async function handlePredictResponse< } else { throw new AIError( AIErrorCode.RESPONSE_ERROR, - `Predictions array in response has missing properties. Response: ${JSON.stringify( - responseJson - )}` + `Unexpected element in 'predictions' array in response: '${JSON.stringify( + prediction + )}'` ); } }