From 20ad65e81db534097096f85156974e8e7f34654e Mon Sep 17 00:00:00 2001 From: Mohit Kumar Date: Fri, 19 Dec 2025 16:39:06 +0100 Subject: [PATCH] fix: Add missing metadata field to InlinedResponse The InlinedResponse class was missing the metadata field that is documented in the REST API and present in InlinedRequest. This prevented users from tracking custom identifiers through batch processing. Fixes #1886 --- google/genai/batches.py | 3 +++ google/genai/types.py | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/google/genai/batches.py b/google/genai/batches.py index 57ae78c49..ebb3626f3 100644 --- a/google/genai/batches.py +++ b/google/genai/batches.py @@ -1206,6 +1206,9 @@ def _InlinedResponse_from_mldev( if getv(from_object, ['error']) is not None: setv(to_object, ['error'], getv(from_object, ['error'])) + if getv(from_object, ['metadata']) is not None: + setv(to_object, ['metadata'], getv(from_object, ['metadata'])) + return to_object diff --git a/google/genai/types.py b/google/genai/types.py index d421a36bf..409c23de1 100644 --- a/google/genai/types.py +++ b/google/genai/types.py @@ -14078,6 +14078,10 @@ class InlinedResponse(_common.BaseModel): description="""The error encountered while processing the request. """, ) + metadata: Optional[dict[str, str]] = Field( + default=None, + description="""The metadata associated with the request.""", + ) class InlinedResponseDict(TypedDict, total=False): @@ -14091,6 +14095,9 @@ class InlinedResponseDict(TypedDict, total=False): """The error encountered while processing the request. """ + metadata: Optional[dict[str, str]] + """The metadata associated with the request.""" + InlinedResponseOrDict = Union[InlinedResponse, InlinedResponseDict]