Skip to content

Commit 41861bb

Browse files
committed
refactor: check private null for llamacloud datasource files
1 parent dfecff9 commit 41861bb

File tree

2 files changed

+3
-7
lines changed
  • templates

2 files changed

+3
-7
lines changed

templates/components/vectordbs/python/llamacloud/generate.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@ def generate_datasource():
3030

3131
documents = get_documents()
3232

33-
# Set is_local_file=true to distinguish locally ingested files from LlamaCloud files
3433
# Set private=false to mark the document as public (required for filtering)
3534
for doc in documents:
36-
doc.metadata["is_local_file"] = "true"
3735
doc.metadata["private"] = "false"
3836

3937
LlamaCloudIndex.from_documents(

templates/types/streaming/fastapi/app/api/routers/models.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,7 @@ def get_url_from_metadata(cls, metadata: Dict[str, Any]) -> str:
192192
if file_name and url_prefix:
193193
# file_name exists and file server is configured
194194
pipeline_id = metadata.get("pipeline_id")
195-
is_local_file = metadata.get("is_local_file")
196-
if pipeline_id and not is_local_file:
195+
if pipeline_id and metadata.get("private") is None:
197196
# file is from LlamaCloud and was not ingested locally
198197
file_name = f"{pipeline_id}${file_name}"
199198
return f"{url_prefix}/output/llamacloud/{file_name}"
@@ -219,9 +218,8 @@ def get_download_files(nodes: List[NodeWithScore]) -> Set[LlamaCloudFile]:
219218
)
220219
for node in source_nodes
221220
if (
222-
not node.metadata.get(
223-
"is_local_file"
224-
) # Download the file of the node flagged as not local
221+
node.metadata.get("private")
222+
is None # Only download files are from LlamaCloud and were not ingested locally
225223
and node.metadata.get("pipeline_id") is not None
226224
and node.metadata.get("file_name") is not None
227225
)

0 commit comments

Comments
 (0)