chore(multiple samples): update langchain and google-genai dependencies#14258
chore(multiple samples): update langchain and google-genai dependencies#14258XrossFox wants to merge 2 commits into
Conversation
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"`.
There was a problem hiding this comment.
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.
| @@ -1,2 +1,2 @@ | |||
| google-cloud-aiplatform[all]==1.64.0 | |||
| google-genai==2.7.0; python_version >= "3.10" | |||
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
| @@ -1 +1 @@ | |||
| google-cloud-aiplatform==1.87.0 | |||
| google-genai==2.7.0; python_version >= "3.10" | |||
There was a problem hiding this comment.
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" | |||
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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
Description
This PR fixes
langchain-google-vertexaiwithlangchain-google-genai==4.2.4; python_version >= "3.10".google-vertexai,google-cloud-aiplatform, and oldergoogle-genaiversions withgoogle-genai==2.7.0; python_version >= "3.10".langchain-coreto version1.4.0and pinned topython_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
nox -s py-3.9(see Test Environment Setup)nox -s lint(see Test Environment Setup)