mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-19 01:21:50 +00:00
[Community][Minor]: Fetch loader_source of GoogleDriveLoader in PebbloSafeLoader. (#21314)
Description: This PR includes fix for loader_source to be fetched from metadata in case of GdriveLoaders. Documentation: NA Unit Test: NA Signed-off-by: Rahul Tripathi <rauhl.psit.ec@gmail.com> Co-authored-by: Rahul Tripathi <rauhl.psit.ec@gmail.com>
This commit is contained in:
parent
7cbf1c31aa
commit
7994cba18d
@ -236,6 +236,27 @@ def get_loader_full_path(loader: BaseLoader) -> str:
|
||||
location = "in-memory"
|
||||
elif isinstance(loader, NotionDBLoader):
|
||||
location = f"notiondb://{loader.database_id}"
|
||||
elif loader.__class__.__name__ == "GoogleDriveLoader":
|
||||
if loader_dict.get("folder_id"):
|
||||
folder_id = loader_dict.get("folder_id")
|
||||
location = f"https://drive.google.com/drive/u/2/folders/{folder_id}"
|
||||
elif loader_dict.get("file_ids"):
|
||||
file_ids = loader_dict.get("file_ids", [])
|
||||
location = ", ".join(
|
||||
[
|
||||
f"https://drive.google.com/file/d/{file_id}/view"
|
||||
for file_id in file_ids
|
||||
]
|
||||
)
|
||||
elif loader_dict.get("document_ids"):
|
||||
document_ids = loader_dict.get("document_ids", [])
|
||||
location = ", ".join(
|
||||
[
|
||||
f"https://docs.google.com/document/d/{doc_id}/edit"
|
||||
for doc_id in document_ids
|
||||
]
|
||||
)
|
||||
|
||||
except Exception:
|
||||
pass
|
||||
return get_full_path(str(location))
|
||||
|
Loading…
Reference in New Issue
Block a user