Skip to content

fix: preserve metadata on batch inlined responses#607

Open
volkan wants to merge 5 commits intogoogleapis:mainfrom
volkan:fix-missing-metadata
Open

fix: preserve metadata on batch inlined responses#607
volkan wants to merge 5 commits intogoogleapis:mainfrom
volkan:fix-missing-metadata

Conversation

@volkan
Copy link

@volkan volkan commented Nov 14, 2025

The SDK’s InlinedResponse type in types.go does not define a Metadata field, even though the REST InlinedResponse message has metadata alongside the response/error union. With this fix we will be able to batch

  • Add Metadata field to InlinedResponse to match Batch API schema.
  • Update inlinedResponseFromMldev to copy metadata, and still convert response / error, so per-request metadata is retained when reading batch jobs.
// Create InlinedRequest with metadata for result matching
		inlinedRequest := &genai.InlinedRequest{
			Model:    req.Model,
			Contents: []*genai.Content{content},
			Metadata: map[string]string{
				"product_id": fmt.Sprintf("%d", req.ProductID), // Store product ID for result matching
			},
		}

Response contained metadata:
Screenshot 2025-11-14 at 09 56 08

Screenshot 2025-11-14 at 11 19 38

With this change we will be able to get metadata to match jobs easily.

@Sivasankaran25 Sivasankaran25 self-assigned this Nov 15, 2025
@volkan
Copy link
Author

volkan commented Dec 1, 2025

Hello @Sivasankaran25 any update on this?

@Sivasankaran25
Copy link
Collaborator

Hello @Sivasankaran25 any update on this?
Thank you for your contributions. The PR is currently under review.

@volkan
Copy link
Author

volkan commented Jan 12, 2026

Hello @Sivasankaran25
Any update about this PR?

@Sivasankaran25 Sivasankaran25 added the api:gemini-api Issues related to Gemini API label Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api:gemini-api Issues related to Gemini API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants