diff --git a/libs/vertexai/langchain_google_vertexai/vectorstores/vectorstores.py b/libs/vertexai/langchain_google_vertexai/vectorstores/vectorstores.py index ea0be4422..de3b782d5 100644 --- a/libs/vertexai/langchain_google_vertexai/vectorstores/vectorstores.py +++ b/libs/vertexai/langchain_google_vertexai/vectorstores/vectorstores.py @@ -1,6 +1,6 @@ import uuid import warnings -from typing import TYPE_CHECKING, Any, Iterable, List, Optional, Tuple, Type, Union +from typing import Any, Iterable, List, Optional, Tuple, Type, Union from google.cloud.aiplatform.matching_engine.matching_engine_index_endpoint import ( Namespace, @@ -19,9 +19,6 @@ Searcher, ) -if TYPE_CHECKING: - from langchain_community.embeddings import TensorflowHubEmbeddings - class _BaseVertexAIVectorStore(VectorStore): """Represents a base vector store based on VertexAI.""" @@ -189,7 +186,7 @@ def from_texts( ) @classmethod - def _get_default_embeddings(cls) -> "TensorflowHubEmbeddings": + def _get_default_embeddings(cls) -> Embeddings: """This function returns the default embedding. Returns: Default TensorflowHubEmbeddings to use. @@ -205,12 +202,10 @@ def _get_default_embeddings(cls) -> "TensorflowHubEmbeddings": ) # TODO: Change to vertexai embbedingss - - from langchain_community.embeddings import ( - TensorflowHubEmbeddings, # type: ignore - ) - - return TensorflowHubEmbeddings() + # type: ignore[import-not-found] + from langchain_community import embeddings +g + return embeddings.TensorflowHubEmbeddings() def _generate_unique_ids(self, number: int) -> List[str]: """Generates a list of unique ids of length `number`