Skip to content

The agent engineering platform.

IMPROVEMENT: Added title metadata to GoogleDriveLoader for optional File Loaders (#13832)

raelixc172605ea6c5
diff --git a/libs/langchain/langchain/document_loaders/googledrive.py b/libs/langchain/langchain/document_loaders/googledrive.py
index 12b352a654..fe88882e8e 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: