Skip to content

chore(multiple samples): update langchain and google-genai dependencies#14258

Draft
XrossFox wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
XrossFox:python-langchain-dependency-update-1
Draft

chore(multiple samples): update langchain and google-genai dependencies#14258
XrossFox wants to merge 2 commits into
GoogleCloudPlatform:mainfrom
XrossFox:python-langchain-dependency-update-1

Conversation

@XrossFox
Copy link
Copy Markdown
Contributor

@XrossFox XrossFox commented Jun 1, 2026

Description

This PR fixes

  • Replaced langchain-google-vertexai with langchain-google-genai==4.2.4; python_version >= "3.10".
  • Replaced google-vertexai, google-cloud-aiplatform, and older google-genai versions with google-genai==2.7.0; python_version >= "3.10".
  • Updated langchain-core to version 1.4.0 and pinned to python_version >= "3.10".

Fixes b/518888434, b/518889022 and b/518889824

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

Checklist

XrossFox added 2 commits June 1, 2026 20:56
 This PR fixes

 - Replaced `langchain-google-vertexai` with `langchain-google-genai==4.2.4; python_version >= "3.10"`.
 - Replaced `google-vertexai` and older `google-genai` versions with `google-genai==2.7.0; python_version >= "3.10"`.
 - Updated `langchain-core` to version `1.4.0` and pinned to `python_version >= "3.10"`.
@product-auto-label product-auto-label Bot added the samples Issues that are directly related to samples. label Jun 1, 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 replaces the google-cloud-aiplatform and langchain-google-vertexai dependencies with google-genai and langchain-google-genai across multiple requirements files. However, the review feedback correctly identifies that these changes will break several samples—including gemma2, generative_ai/evaluation, generative_ai/rag, model_garden/gemma, and people-and-planet-ai/image-classification—because the underlying code still imports and relies on the legacy packages. You should retain the original dependencies in the affected directories to prevent import and runtime errors.

Comment thread gemma2/requirements.txt
@@ -1,2 +1,2 @@
google-cloud-aiplatform[all]==1.64.0
google-genai==2.7.0; python_version >= "3.10"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

Replacing google-cloud-aiplatform with google-genai will break this sample. The code in gemma2/gemma2_predict_gpu.py imports google.cloud.aiplatform (line 27) and uses aiplatform.gapic.PredictionServiceClient (line 51). The new google-genai SDK is a completely different package and does not provide the google.cloud.aiplatform namespace. Please keep google-cloud-aiplatform as a dependency.

google-cloud-aiplatform[all]==1.64.0

pillow==10.4.0; python_version < '3.8'
pillow==10.4.0; python_version >= '3.8'
google-cloud-aiplatform[all]==1.69.0
google-genai==2.7.0; python_version >= "3.10"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

Replacing google-cloud-aiplatform with google-genai will break this sample. The code in generative_ai/evaluation/pairwise_summarization_quality.py imports vertexai (line 25) and uses vertexai.init and GenerativeModel from vertexai.generative_models. These are part of the google-cloud-aiplatform package, not google-genai. Please keep google-cloud-aiplatform as a dependency.

google-cloud-aiplatform[all]==1.69.0

langchain-core==0.2.33
langchain-google-vertexai==1.0.10
langchain-core==1.4.0; python_version >= "3.10"
langchain-google-genai==4.2.4; python_version >= "3.10"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

Replacing langchain-google-vertexai with langchain-google-genai will break this sample if any code imports or uses Vertex AI-specific LangChain classes. Since this sample relies on Vertex AI, please keep langchain-google-vertexai as a dependency.

langchain-google-vertexai==1.0.10

@@ -1 +1 @@
google-cloud-aiplatform==1.87.0
google-genai==2.7.0; python_version >= "3.10"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

Replacing google-cloud-aiplatform with google-genai will break this sample. The code in generative_ai/rag/generate_content_example.py imports vertexai (line 29) and vertexai.rag (line 27). These modules are part of the google-cloud-aiplatform package and are not available in google-genai. Please keep google-cloud-aiplatform as a dependency.

google-cloud-aiplatform==1.87.0

@@ -1 +1 @@
google-cloud-aiplatform[all]==1.103.0
google-genai==2.7.0; python_version >= "3.10"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

Replacing google-cloud-aiplatform with google-genai will break this sample. The code in model_garden/gemma/gemma3_deploy.py imports google.cloud.aiplatform (line 19) and vertexai (line 28). These are part of the google-cloud-aiplatform package and are not available in google-genai. Please keep google-cloud-aiplatform as a dependency.

google-cloud-aiplatform[all]==1.103.0

pillow==10.3.0
apache-beam[gcp]==2.55.1
google-cloud-aiplatform==1.47.0
google-genai==2.7.0; python_version >= "3.10"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

Replacing google-cloud-aiplatform with google-genai will break this sample. The code in people-and-planet-ai/image-classification/predict.py imports google.cloud.aiplatform (line 21) and google.cloud.aiplatform.gapic.schema (line 22). These are part of the google-cloud-aiplatform package and are not available in google-genai. Please keep google-cloud-aiplatform as a dependency.

google-cloud-aiplatform==1.47.0

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.

1 participant