Skip to content

Commit

Permalink
IMPROVEMENT: Added title metadata to GoogleDriveLoader for optional F…
Browse files Browse the repository at this point in the history
…ile 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 <[email protected]>
  • Loading branch information
raelix and baskaryan authored Nov 25, 2023
1 parent 19c68c7 commit c172605
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libs/langchain/langchain/document_loaders/googledrive.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ def _load_file_from_id(self, id: str) -> List[Document]:
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:
Expand Down

0 comments on commit c172605

Please sign in to comment.