From c172605ea6c5d52d41e7344d15d1fcb9cd039024 Mon Sep 17 00:00:00 2001 From: raelix Date: Sat, 25 Nov 2023 03:53:55 +0100 Subject: [PATCH] IMPROVEMENT: Added title metadata to GoogleDriveLoader for optional File Loaders (#13832) - **Description:** Simple change, I just added title metadata to GoogleDriveLoader for optional File Loaders - **Dependencies:** no dependencies - **Tag maintainer:** @hwchase17 --------- Co-authored-by: Bagatur --- libs/langchain/langchain/document_loaders/googledrive.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/langchain/langchain/document_loaders/googledrive.py b/libs/langchain/langchain/document_loaders/googledrive.py index 12b352a6541..fe88882e8ea 100644 --- a/libs/langchain/langchain/document_loaders/googledrive.py +++ b/libs/langchain/langchain/document_loaders/googledrive.py @@ -317,6 +317,8 @@ class GoogleDriveLoader(BaseLoader, BaseModel): docs = loader.load() for doc in docs: doc.metadata["source"] = f"https://drive.google.com/file/d/{id}/view" + if "title" not in doc.metadata: + doc.metadata["title"] = f"{file.get('name')}" return docs else: