Skip to content

Commit 9ea5b89

Browse files
authored
chore(vertex): add migration TODOs, suppress warning (#1196)
1 parent 068fe53 commit 9ea5b89

File tree

15 files changed

+62
-46
lines changed

15 files changed

+62
-46
lines changed

libs/vertexai/langchain_google_vertexai/_base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
cast,
1616
)
1717

18-
import vertexai # type: ignore[import-untyped]
18+
import vertexai
1919
from google.api_core.client_options import ClientOptions
2020
from google.cloud.aiplatform import initializer
2121
from google.cloud.aiplatform.constants import base as constants
@@ -42,8 +42,8 @@
4242
from langchain_core.outputs import Generation, LLMResult
4343
from pydantic import BaseModel, ConfigDict, Field, model_validator
4444
from typing_extensions import Literal, Self
45-
from vertexai.generative_models._generative_models import ( # type: ignore
46-
SafetySettingsType,
45+
from vertexai.generative_models._generative_models import (
46+
SafetySettingsType, # TODO: migrate to google-genai since this is deprecated
4747
)
4848

4949
from langchain_google_vertexai._client_utils import (

libs/vertexai/langchain_google_vertexai/_enums.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from google.cloud.aiplatform_v1beta1.types.content import Modality
2-
from vertexai.generative_models import ( # type: ignore
3-
HarmBlockThreshold,
2+
from vertexai.generative_models import (
3+
HarmBlockThreshold, # TODO: migrate to google-genai since this is deprecated
44
HarmCategory,
55
SafetySetting,
66
)

libs/vertexai/langchain_google_vertexai/_image_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
import requests
1212
from google.cloud import storage
1313
from google.cloud.aiplatform_v1beta1.types.content import Part as GapicPart
14-
from vertexai.generative_models import Image, Part # type: ignore
14+
from vertexai.generative_models import Image, Part
15+
16+
# TODO: migrate to google-genai since vertexai.generative_models is deprecated
1517

1618

1719
class Route(Enum):

libs/vertexai/langchain_google_vertexai/_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
AsyncCallbackManagerForLLMRun,
1515
CallbackManagerForLLMRun,
1616
)
17-
from vertexai.generative_models import ( # type: ignore[import-untyped]
18-
Candidate,
17+
from vertexai.generative_models import (
18+
Candidate, # TODO: migrate to google-genai since this is deprecated
1919
Image,
2020
)
21-
from vertexai.language_models import ( # type: ignore[import-untyped]
22-
TextGenerationResponse,
21+
from vertexai.language_models import (
22+
TextGenerationResponse, # TODO: migrate to google-genai since this is deprecated
2323
)
2424

2525
from langchain_google_vertexai._retry import create_base_retry_decorator

libs/vertexai/langchain_google_vertexai/chat_models.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,18 @@
7474
)
7575
from langchain_core.utils.pydantic import is_basemodel_subclass
7676
from langchain_core.utils.utils import _build_model_kwargs
77-
from vertexai.generative_models import ( # type: ignore
78-
Tool as VertexTool,
77+
from vertexai.generative_models import (
78+
Tool as VertexTool, # TODO: migrate to google-genai since this is deprecated
7979
)
80-
from vertexai.generative_models._generative_models import ( # type: ignore
81-
ToolConfig,
80+
from vertexai.generative_models._generative_models import (
81+
ToolConfig, # TODO: migrate to google-genai since this is deprecated
8282
SafetySettingsType,
8383
GenerationConfigType,
8484
GenerationResponse,
8585
_convert_schema_dict_to_gapic,
8686
)
87-
from vertexai.language_models import ( # type: ignore
88-
ChatMessage,
87+
from vertexai.language_models import (
88+
ChatMessage, # TODO: migrate to google-genai since this is deprecated
8989
InputOutputTextPair,
9090
)
9191
from google.cloud.aiplatform_v1.types import (

libs/vertexai/langchain_google_vertexai/embeddings.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
from langchain_core.language_models.llms import create_base_retry_decorator
2323
from pydantic import ConfigDict, model_validator
2424
from typing_extensions import Self
25-
from vertexai.language_models import ( # type: ignore
26-
TextEmbeddingInput,
25+
from vertexai.language_models import (
26+
TextEmbeddingInput, # TODO: migrate to google-genai since this is deprecated
2727
TextEmbeddingModel,
2828
)
29-
from vertexai.vision_models import ( # type: ignore
30-
Image,
29+
from vertexai.vision_models import (
30+
Image, # TODO: migrate to google-genai since this is deprecated
3131
MultiModalEmbeddingModel,
3232
MultiModalEmbeddingResponse,
3333
)

libs/vertexai/langchain_google_vertexai/functions_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
)
1818

1919
import google.cloud.aiplatform_v1beta1.types as gapic
20-
import vertexai.generative_models as vertexai # type: ignore
20+
import vertexai.generative_models as vertexai # TODO: migrate to google-genai
2121
from google.cloud.aiplatform_v1beta1.types import (
2222
ToolConfig as GapicToolConfig,
2323
)

libs/vertexai/langchain_google_vertexai/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from typing import List, Optional
33

44
from langchain_core.messages import BaseMessage
5-
from vertexai.preview import caching # type: ignore
5+
from vertexai.preview import caching
66

77
from langchain_google_vertexai._image_utils import ImageBytesLoader
88
from langchain_google_vertexai.chat_models import (

libs/vertexai/langchain_google_vertexai/vision_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from langchain_core.outputs.chat_generation import ChatGeneration
1212
from langchain_core.outputs.generation import Generation
1313
from pydantic import BaseModel, ConfigDict, Field
14-
from vertexai.vision_models import ( # type: ignore[import-untyped]
14+
from vertexai.vision_models import ( # TODO: migrate to google-genai
1515
GeneratedImage,
1616
Image,
1717
ImageGenerationModel,

libs/vertexai/pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ warn_unused_ignores = true
146146
# strict = true
147147
# disallow_untyped_defs = true
148148

149+
[[tool.mypy.overrides]]
150+
# TODO: remove after migrating to google-genai
151+
module = "vertexai.*"
152+
ignore_missing_imports = true
153+
149154
[tool.coverage.run]
150155
omit = ["tests/*"]
151156

0 commit comments

Comments
 (0)