Skip to content

Commit dcf35e0

Browse files
committed
Fix index overwrite condition to only be true when index is not a property
1 parent 7a66ae6 commit dcf35e0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/vertexai/src/requests/response-helpers.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function createEnhancedContentResponse(
3737
* This causes the `index` property to be omitted from the first candidate in the
3838
* response, since it has index 0, and 0 is a default value.
3939
*/
40-
if (response.candidates && !response.candidates[0].index) {
40+
if (response.candidates && !response.candidates[0].hasOwnProperty('index')) {
4141
response.candidates[0].index = 0;
4242
}
4343

0 commit comments

Comments
 (0)