Skip to content

fix(vertexai): use correct MIME type for multimodal stream sample#5572

Merged
iennae merged 2 commits into
GoogleCloudPlatform:mainfrom
amcolin:fix-vertexai-stream-multimodality
May 20, 2026
Merged

fix(vertexai): use correct MIME type for multimodal stream sample#5572
iennae merged 2 commits into
GoogleCloudPlatform:mainfrom
amcolin:fix-vertexai-stream-multimodality

Conversation

@amcolin
Copy link
Copy Markdown
Contributor

@amcolin amcolin commented May 15, 2026

Description

This PR addresses two issues in the generativeaionvertexai_stream_multimodality_basic sample:

  1. Corrected MIME Type: Updated it to the supported format to ensure successful multimodal streaming.
  2. Error Handling: Added explicit nil-pointer checks and robust error handling. This prevents the sample from panicking if the API response or specific fields are unexpected, improving the overall stability of the snippet.

Fixes Internal b/506216658

Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

Checklist

  • I have followed Contributing Guidelines from CONTRIBUTING.MD
  • Tests pass: go test -v ./.. (see Testing)
  • Code formatted: gofmt (see Formatting)
  • Vetting pass: go vet (see Formatting)
  • These samples need a new API enabled in testing projects to pass (let us know which ones)
  • These samples need a new/updated env vars in testing projects set to pass (let us know which ones)
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample
  • Please merge this PR for me once it is approved

@product-auto-label product-auto-label Bot added the samples Issues that are directly related to samples. label May 15, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request corrects a MIME type for an image file and enhances the robustness of the streaming response loop by adding a nil check for the response and providing more descriptive error messages. A review comment suggests further improving the safety of the response handling by checking for a nil Content field within the first candidate to prevent potential panics.

Comment thread vertexai/stream-multimodality-basic/streammultimodalitybasic.go Outdated
@amcolin amcolin force-pushed the fix-vertexai-stream-multimodality branch from f314a11 to 1be2938 Compare May 15, 2026 17:18
@amcolin amcolin marked this pull request as ready for review May 15, 2026 17:28
@amcolin amcolin requested review from a team as code owners May 15, 2026 17:28
@iennae iennae merged commit 8f431e4 into GoogleCloudPlatform:main May 20, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants