From 676c68d318a03e4312384c623606edf6729f56a7 Mon Sep 17 00:00:00 2001 From: Leonid Kuligin Date: Mon, 15 Apr 2024 15:57:12 +0200 Subject: [PATCH] community[patch]: deprecating remaining google_community integrations (#20471) Deprecating remaining google community integrations --- .../retrievers/google_cloud_documentai_warehouse.py | 3 ++- .../retrievers/google_vertex_ai_search.py | 11 +++++++++++ .../tools/google_cloud/texttospeech.py | 6 ++++++ .../langchain_community/tools/google_places/tool.py | 6 ++++++ .../langchain_community/tools/google_search/tool.py | 11 +++++++++++ .../utilities/google_places_api.py | 9 +++++++-- .../langchain_community/utilities/google_search.py | 7 +++++++ .../vectorstores/bigquery_vector_search.py | 7 +++++++ 8 files changed, 57 insertions(+), 3 deletions(-) diff --git a/libs/community/langchain_community/retrievers/google_cloud_documentai_warehouse.py b/libs/community/langchain_community/retrievers/google_cloud_documentai_warehouse.py index 50913a65dc..0068da96c0 100644 --- a/libs/community/langchain_community/retrievers/google_cloud_documentai_warehouse.py +++ b/libs/community/langchain_community/retrievers/google_cloud_documentai_warehouse.py @@ -1,4 +1,5 @@ """Retriever wrapper for Google Cloud Document AI Warehouse.""" + from typing import TYPE_CHECKING, Any, Dict, List, Optional from langchain_core._api.deprecation import deprecated @@ -24,7 +25,7 @@ if TYPE_CHECKING: @deprecated( since="0.0.32", removal="0.2.0", - alternative_import="langchain_google_community.GoogleDriveLoader", + alternative_import="langchain_google_community.DocumentAIWarehouseRetriever", ) class GoogleDocumentAIWarehouseRetriever(BaseRetriever): """A retriever based on Document AI Warehouse. diff --git a/libs/community/langchain_community/retrievers/google_vertex_ai_search.py b/libs/community/langchain_community/retrievers/google_vertex_ai_search.py index 9544cc5817..fc7b396dfd 100644 --- a/libs/community/langchain_community/retrievers/google_vertex_ai_search.py +++ b/libs/community/langchain_community/retrievers/google_vertex_ai_search.py @@ -4,6 +4,7 @@ from __future__ import annotations from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence, Tuple +from langchain_core._api.deprecation import deprecated from langchain_core.callbacks import CallbackManagerForRetrieverRun from langchain_core.documents import Document from langchain_core.pydantic_v1 import BaseModel, Extra, Field, root_validator @@ -195,6 +196,11 @@ class _BaseGoogleVertexAISearchRetriever(BaseModel): return documents +@deprecated( + since="0.0.33", + removal="0.2.0", + alternative_import="langchain_google_community.VertexAISearchRetriever", +) class GoogleVertexAISearchRetriever(BaseRetriever, _BaseGoogleVertexAISearchRetriever): """`Google Vertex AI Search` retriever. @@ -390,6 +396,11 @@ class GoogleVertexAISearchRetriever(BaseRetriever, _BaseGoogleVertexAISearchRetr return documents, response +@deprecated( + since="0.0.33", + removal="0.2.0", + alternative_import="langchain_google_community.VertexAIMultiTurnSearchRetriever", +) class GoogleVertexAIMultiTurnSearchRetriever( BaseRetriever, _BaseGoogleVertexAISearchRetriever ): diff --git a/libs/community/langchain_community/tools/google_cloud/texttospeech.py b/libs/community/langchain_community/tools/google_cloud/texttospeech.py index fc1e5852ef..cccc3f5cc4 100644 --- a/libs/community/langchain_community/tools/google_cloud/texttospeech.py +++ b/libs/community/langchain_community/tools/google_cloud/texttospeech.py @@ -3,6 +3,7 @@ from __future__ import annotations import tempfile from typing import TYPE_CHECKING, Any, Optional +from langchain_core._api.deprecation import deprecated from langchain_core.callbacks import CallbackManagerForToolRun from langchain_core.tools import BaseTool @@ -36,6 +37,11 @@ def _encoding_file_extension_map(encoding: texttospeech.AudioEncoding) -> Option return ENCODING_FILE_EXTENSION_MAP.get(encoding) +@deprecated( + since="0.0.33", + removal="0.2.0", + alternative_import="langchain_google_community.TextToSpeechTool", +) class GoogleCloudTextToSpeechTool(BaseTool): """Tool that queries the Google Cloud Text to Speech API. diff --git a/libs/community/langchain_community/tools/google_places/tool.py b/libs/community/langchain_community/tools/google_places/tool.py index d198350126..9e09744ab0 100644 --- a/libs/community/langchain_community/tools/google_places/tool.py +++ b/libs/community/langchain_community/tools/google_places/tool.py @@ -2,6 +2,7 @@ from typing import Optional, Type +from langchain_core._api.deprecation import deprecated from langchain_core.callbacks import CallbackManagerForToolRun from langchain_core.pydantic_v1 import BaseModel, Field from langchain_core.tools import BaseTool @@ -15,6 +16,11 @@ class GooglePlacesSchema(BaseModel): query: str = Field(..., description="Query for google maps") +@deprecated( + since="0.0.33", + removal="0.2.0", + alternative_import="langchain_google_community.GooglePlacesTool", +) class GooglePlacesTool(BaseTool): """Tool that queries the Google places API.""" diff --git a/libs/community/langchain_community/tools/google_search/tool.py b/libs/community/langchain_community/tools/google_search/tool.py index abc9d3916e..5be24c0b0c 100644 --- a/libs/community/langchain_community/tools/google_search/tool.py +++ b/libs/community/langchain_community/tools/google_search/tool.py @@ -2,12 +2,18 @@ from typing import Optional +from langchain_core._api.deprecation import deprecated from langchain_core.callbacks import CallbackManagerForToolRun from langchain_core.tools import BaseTool from langchain_community.utilities.google_search import GoogleSearchAPIWrapper +@deprecated( + since="0.0.33", + removal="0.2.0", + alternative_import="langchain_google_community.GoogleSearchRun", +) class GoogleSearchRun(BaseTool): """Tool that queries the Google search API.""" @@ -28,6 +34,11 @@ class GoogleSearchRun(BaseTool): return self.api_wrapper.run(query) +@deprecated( + since="0.0.33", + removal="0.2.0", + alternative_import="langchain_google_community.GoogleSearchResults", +) class GoogleSearchResults(BaseTool): """Tool that queries the Google Search API and gets back json.""" diff --git a/libs/community/langchain_community/utilities/google_places_api.py b/libs/community/langchain_community/utilities/google_places_api.py index eb7ff148b6..330486497d 100644 --- a/libs/community/langchain_community/utilities/google_places_api.py +++ b/libs/community/langchain_community/utilities/google_places_api.py @@ -1,13 +1,18 @@ -"""Chain that calls Google Places API. -""" +"""Chain that calls Google Places API.""" import logging from typing import Any, Dict, Optional +from langchain_core._api.deprecation import deprecated from langchain_core.pydantic_v1 import BaseModel, Extra, root_validator from langchain_core.utils import get_from_dict_or_env +@deprecated( + since="0.0.33", + removal="0.2.0", + alternative_import="langchain_google_community.GooglePlacesAPIWrapper", +) class GooglePlacesAPIWrapper(BaseModel): """Wrapper around Google Places API. diff --git a/libs/community/langchain_community/utilities/google_search.py b/libs/community/langchain_community/utilities/google_search.py index 5229f59cb3..7a6747060d 100644 --- a/libs/community/langchain_community/utilities/google_search.py +++ b/libs/community/langchain_community/utilities/google_search.py @@ -1,10 +1,17 @@ """Util that calls Google Search.""" + from typing import Any, Dict, List, Optional +from langchain_core._api.deprecation import deprecated from langchain_core.pydantic_v1 import BaseModel, Extra, root_validator from langchain_core.utils import get_from_dict_or_env +@deprecated( + since="0.0.33", + removal="0.2.0", + alternative_import="langchain_google_community.GoogleSearchAPIWrapper", +) class GoogleSearchAPIWrapper(BaseModel): """Wrapper for Google Search API. diff --git a/libs/community/langchain_community/vectorstores/bigquery_vector_search.py b/libs/community/langchain_community/vectorstores/bigquery_vector_search.py index da89dc34c2..2da8cc8dd2 100644 --- a/libs/community/langchain_community/vectorstores/bigquery_vector_search.py +++ b/libs/community/langchain_community/vectorstores/bigquery_vector_search.py @@ -1,4 +1,5 @@ """Vector Store in Google Cloud BigQuery.""" + from __future__ import annotations import asyncio @@ -12,6 +13,7 @@ from threading import Lock, Thread from typing import Any, Callable, Dict, List, Optional, Tuple, Type import numpy as np +from langchain_core._api.deprecation import deprecated from langchain_core.documents import Document from langchain_core.embeddings import Embeddings from langchain_core.vectorstores import VectorStore @@ -34,6 +36,11 @@ _INDEX_CHECK_PERIOD_SECONDS = 60 # Do not check for index more often that this. _vector_table_lock = Lock() # process-wide BigQueryVectorSearch table lock +@deprecated( + since="0.0.33", + removal="0.2.0", + alternative_import="langchain_google_community.BigQueryVectorSearch", +) class BigQueryVectorSearch(VectorStore): """Google Cloud BigQuery vector store.