From eb0521064eb3443a270971b479fbc52a7f71efcc Mon Sep 17 00:00:00 2001 From: Leonid Kuligin Date: Tue, 2 Apr 2024 23:06:07 +0200 Subject: [PATCH] deprecating integrations moved to langchain_google_community (#19841) Thank you for contributing to LangChain! - [ ] **PR title**: "community: deprecating integrations moved to langchain_google_community" - [ ] **PR message**: deprecating integrations moved to langchain_google_community --------- Co-authored-by: ccurme --- libs/community/langchain_community/chat_loaders/gmail.py | 6 ++++++ .../langchain_community/document_loaders/bigquery.py | 6 ++++++ .../langchain_community/document_loaders/gcs_directory.py | 6 ++++++ .../langchain_community/document_loaders/gcs_file.py | 6 ++++++ .../document_loaders/google_speech_to_text.py | 6 ++++++ .../langchain_community/document_loaders/googledrive.py | 6 ++++++ .../langchain_community/document_loaders/parsers/docai.py | 6 ++++++ .../document_transformers/google_translate.py | 6 ++++++ .../retrievers/google_cloud_documentai_warehouse.py | 6 ++++++ 9 files changed, 54 insertions(+) diff --git a/libs/community/langchain_community/chat_loaders/gmail.py b/libs/community/langchain_community/chat_loaders/gmail.py index 7f120347f5b..27dd0ff9065 100644 --- a/libs/community/langchain_community/chat_loaders/gmail.py +++ b/libs/community/langchain_community/chat_loaders/gmail.py @@ -2,6 +2,7 @@ import base64 import re from typing import Any, Iterator +from langchain_core._api.deprecation import deprecated from langchain_core.chat_sessions import ChatSession from langchain_core.messages import HumanMessage @@ -63,6 +64,11 @@ def _get_message_data(service: Any, message: Any) -> ChatSession: return ChatSession(messages=[starter_content, message_content]) +@deprecated( + since="0.0.32", + removal="0.2.0", + alternative_import="langchain_google_community.GMailLoader", +) class GMailLoader(BaseChatLoader): """Load data from `GMail`. diff --git a/libs/community/langchain_community/document_loaders/bigquery.py b/libs/community/langchain_community/document_loaders/bigquery.py index e007b1f4954..0d809ce53f2 100644 --- a/libs/community/langchain_community/document_loaders/bigquery.py +++ b/libs/community/langchain_community/document_loaders/bigquery.py @@ -2,6 +2,7 @@ from __future__ import annotations from typing import TYPE_CHECKING, List, Optional +from langchain_core._api.deprecation import deprecated from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader @@ -11,6 +12,11 @@ if TYPE_CHECKING: from google.auth.credentials import Credentials +@deprecated( + since="0.0.32", + removal="0.2.0", + alternative_import="langchain_google_community.BigQueryLoader", +) class BigQueryLoader(BaseLoader): """Load from the Google Cloud Platform `BigQuery`. diff --git a/libs/community/langchain_community/document_loaders/gcs_directory.py b/libs/community/langchain_community/document_loaders/gcs_directory.py index 3414ec3b670..3bb0cd0738d 100644 --- a/libs/community/langchain_community/document_loaders/gcs_directory.py +++ b/libs/community/langchain_community/document_loaders/gcs_directory.py @@ -1,6 +1,7 @@ import logging from typing import Callable, List, Optional +from langchain_core._api.deprecation import deprecated from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader @@ -10,6 +11,11 @@ from langchain_community.utilities.vertexai import get_client_info logger = logging.getLogger(__name__) +@deprecated( + since="0.0.32", + removal="0.2.0", + alternative_import="langchain_google_community.GCSDirectoryLoader", +) class GCSDirectoryLoader(BaseLoader): """Load from GCS directory.""" diff --git a/libs/community/langchain_community/document_loaders/gcs_file.py b/libs/community/langchain_community/document_loaders/gcs_file.py index a527d2f5b08..26993f61258 100644 --- a/libs/community/langchain_community/document_loaders/gcs_file.py +++ b/libs/community/langchain_community/document_loaders/gcs_file.py @@ -2,6 +2,7 @@ import os import tempfile from typing import Callable, List, Optional +from langchain_core._api.deprecation import deprecated from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader @@ -9,6 +10,11 @@ from langchain_community.document_loaders.unstructured import UnstructuredFileLo from langchain_community.utilities.vertexai import get_client_info +@deprecated( + since="0.0.32", + removal="0.2.0", + alternative_import="langchain_google_community.GCSFileLoader", +) class GCSFileLoader(BaseLoader): """Load from GCS file.""" diff --git a/libs/community/langchain_community/document_loaders/google_speech_to_text.py b/libs/community/langchain_community/document_loaders/google_speech_to_text.py index da3c743dea3..c90e1e7a02b 100644 --- a/libs/community/langchain_community/document_loaders/google_speech_to_text.py +++ b/libs/community/langchain_community/document_loaders/google_speech_to_text.py @@ -2,6 +2,7 @@ from __future__ import annotations from typing import TYPE_CHECKING, List, Optional +from langchain_core._api.deprecation import deprecated from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader @@ -12,6 +13,11 @@ if TYPE_CHECKING: from google.protobuf.field_mask_pb2 import FieldMask +@deprecated( + since="0.0.32", + removal="0.2.0", + alternative_import="langchain_google_community.SpeechToTextLoader", +) class GoogleSpeechToTextLoader(BaseLoader): """ Loader for Google Cloud Speech-to-Text audio transcripts. diff --git a/libs/community/langchain_community/document_loaders/googledrive.py b/libs/community/langchain_community/document_loaders/googledrive.py index 9e28b4dedf2..581c4285b29 100644 --- a/libs/community/langchain_community/document_loaders/googledrive.py +++ b/libs/community/langchain_community/document_loaders/googledrive.py @@ -11,6 +11,7 @@ import os from pathlib import Path from typing import Any, Dict, List, Optional, Sequence, Union +from langchain_core._api.deprecation import deprecated from langchain_core.documents import Document from langchain_core.pydantic_v1 import BaseModel, root_validator, validator @@ -19,6 +20,11 @@ from langchain_community.document_loaders.base import BaseLoader SCOPES = ["https://www.googleapis.com/auth/drive.readonly"] +@deprecated( + since="0.0.32", + removal="0.2.0", + alternative_import="langchain_google_community.GoogleDriveLoader", +) class GoogleDriveLoader(BaseLoader, BaseModel): """Load Google Docs from `Google Drive`.""" diff --git a/libs/community/langchain_community/document_loaders/parsers/docai.py b/libs/community/langchain_community/document_loaders/parsers/docai.py index ca2bc8e5350..bb7a502db28 100644 --- a/libs/community/langchain_community/document_loaders/parsers/docai.py +++ b/libs/community/langchain_community/document_loaders/parsers/docai.py @@ -10,6 +10,7 @@ import time from dataclasses import dataclass from typing import TYPE_CHECKING, Iterator, List, Optional, Sequence +from langchain_core._api.deprecation import deprecated from langchain_core.documents import Document from langchain_core.utils.iter import batch_iterate @@ -33,6 +34,11 @@ class DocAIParsingResults: parsed_path: str +@deprecated( + since="0.0.32", + removal="0.2.0", + alternative_import="langchain_google_community.DocAIParser", +) class DocAIParser(BaseBlobParser): """`Google Cloud Document AI` parser. diff --git a/libs/community/langchain_community/document_transformers/google_translate.py b/libs/community/langchain_community/document_transformers/google_translate.py index b2653c48919..d21cfd47de8 100644 --- a/libs/community/langchain_community/document_transformers/google_translate.py +++ b/libs/community/langchain_community/document_transformers/google_translate.py @@ -1,10 +1,16 @@ from typing import Any, Optional, Sequence +from langchain_core._api.deprecation import deprecated from langchain_core.documents import BaseDocumentTransformer, Document from langchain_community.utilities.vertexai import get_client_info +@deprecated( + since="0.0.32", + removal="0.2.0", + alternative_import="langchain_google_community.DocAIParser", +) class GoogleTranslateTransformer(BaseDocumentTransformer): """Translate text documents using Google Cloud Translation.""" 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 ce71a2db1d4..50913a65dc0 100644 --- a/libs/community/langchain_community/retrievers/google_cloud_documentai_warehouse.py +++ b/libs/community/langchain_community/retrievers/google_cloud_documentai_warehouse.py @@ -1,6 +1,7 @@ """Retriever wrapper for Google Cloud Document AI Warehouse.""" from typing import TYPE_CHECKING, Any, Dict, List, Optional +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 root_validator @@ -20,6 +21,11 @@ if TYPE_CHECKING: ) +@deprecated( + since="0.0.32", + removal="0.2.0", + alternative_import="langchain_google_community.GoogleDriveLoader", +) class GoogleDocumentAIWarehouseRetriever(BaseRetriever): """A retriever based on Document AI Warehouse.