Skip to content

Commit 91506ea

Browse files
wanlin31copybara-github
authored andcommitted
chore: internal change
PiperOrigin-RevId: 899110561
1 parent 772d2fc commit 91506ea

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

google/genai/_interactions/_utils/_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,9 @@ def _extract_items(
102102
index += 1
103103
if is_dict(obj):
104104
try:
105-
# We are at the last entry in the path so we must remove the field
106-
if (len(path)) == index:
105+
# Remove the field if there are no more dict keys in the path,
106+
# only "<array>" traversal markers or end.
107+
if all(p == "<array>" for p in path[index:]):
107108
item = obj.pop(key)
108109
else:
109110
item = obj[key]

0 commit comments

Comments
 (0)