Skip to content

feat(generative-ai): migrate batch 3 samples to @google/genai and remove old vertexai package#4334

Open
angelcaamal wants to merge 2 commits into
mainfrom
feat/genai-migration-batch3
Open

feat(generative-ai): migrate batch 3 samples to @google/genai and remove old vertexai package#4334
angelcaamal wants to merge 2 commits into
mainfrom
feat/genai-migration-batch3

Conversation

@angelcaamal
Copy link
Copy Markdown
Contributor

@angelcaamal angelcaamal commented Jun 5, 2026

Description

Fixes Internal: b/519978610

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

Checklist

  • I have followed guidelines from CONTRIBUTING.MD and Samples Style Guide
  • Tests pass: npm test (see Testing)
  • Lint pass: npm run lint (see Style)
  • Required CI tests pass (see CI testing)
  • 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 pull request is from a branch created directly off of GoogleCloudPlatform/nodejs-docs-samples. Not a fork.
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new sample directory, and I created GitHub Actions workflow 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

Note: Any check with (dev), (experimental), or (legacy) can be ignored and should not block your PR from merging (see CI testing).

@angelcaamal angelcaamal added samples Issues that are directly related to samples. generated: genai Contains Generative AI based code, requesting an additional reviewer. labels Jun 5, 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 migrates the generative AI snippets from the @google-cloud/vertexai SDK to the new @google/genai SDK, updating the default model to gemini-2.5-flash and simplifying client initialization and content generation. Additionally, previously skipped tests are now enabled. A review comment suggests updating an outdated test comment in nonStreamingContent.test.js to accurately describe the new assertion logic.

Comment thread generative-ai/snippets/test/nonStreamingContent.test.js Outdated
@angelcaamal angelcaamal marked this pull request as ready for review June 5, 2026 16:57
@angelcaamal angelcaamal requested review from a team as code owners June 5, 2026 16:57
@holtskinner
Copy link
Copy Markdown
Contributor

There's currently a directory of samples for the updated SDK Here https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/main/genai

Most of the samples updated in this PR seem to be duplicated in this other directory, can they be consolidated?

@angelcaamal
Copy link
Copy Markdown
Contributor Author

Hi @holtskinner thanks for the feedback! You're completely right. However, this PR is primarily a fix to unblock the CI/tests that were failing due to the old vertex library. Consolidating the samples and migrating the region tags to the genai folder is the very next task planned. Does it work for you if we merge this to fix the tests first, and handle the consolidation in the next PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: genai generated: genai Contains Generative AI based code, requesting an additional reviewer. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants