From 134e74121ab75dcd453a841007592a3a4803ca23 Mon Sep 17 00:00:00 2001 From: Volkan Altan Date: Fri, 14 Nov 2025 11:12:48 +0100 Subject: [PATCH] fix: preserve metadata on batch inlined responses --- batches.go | 5 +++++ types.go | 2 ++ 2 files changed, 7 insertions(+) diff --git a/batches.go b/batches.go index 7f978497..df3c1490 100644 --- a/batches.go +++ b/batches.go @@ -744,6 +744,11 @@ func inlinedRequestToMldev(ac *apiClient, fromObject map[string]any, parentObjec func inlinedResponseFromMldev(fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) { toObject = make(map[string]any) + fromMetadata := getValueByPath(fromObject, []string{"metadata"}) + if fromMetadata != nil { + setValueByPath(toObject, []string{"metadata"}, fromMetadata) + } + fromResponse := getValueByPath(fromObject, []string{"response"}) if fromResponse != nil { fromResponse, err = generateContentResponseFromMldev(fromResponse.(map[string]any), toObject) diff --git a/types.go b/types.go index 7c5c0af9..d73d7455 100644 --- a/types.go +++ b/types.go @@ -5171,6 +5171,8 @@ type JobError struct { // Config for `inlined_responses` parameter. type InlinedResponse struct { + // Optional. The metadata associated with the request. + Metadata map[string]any `json:"metadata,omitempty"` // The response to the request. Response *GenerateContentResponse `json:"response,omitempty"` // Optional. The error encountered while processing the request.