mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-03 11:47:49 +00:00
Fixed a source for documents uploaded from GCS (#8912)
Sets source for documents uploaded from GCS to source on gcs #8911 Co-authored-by: Leonid Kuligin <kuligin@google.com>
This commit is contained in:
parent
e74a605379
commit
52d6b91c18
@ -69,4 +69,8 @@ class GCSFileLoader(BaseLoader):
|
||||
# Download the file to a destination
|
||||
blob.download_to_filename(file_path)
|
||||
loader = self._loader_func(file_path)
|
||||
return loader.load()
|
||||
docs = loader.load()
|
||||
for doc in docs:
|
||||
if "source" in doc.metadata:
|
||||
doc.metadata["source"] = f"gs://{self.bucket}/{self.blob}"
|
||||
return docs
|
||||
|
Loading…
Reference in New Issue
Block a user