Skip to content
Snippets Groups Projects
Unverified Commit bedde2bf authored by Huu Le's avatar Huu Le Committed by GitHub
Browse files

Use is_empty filter (#263)

parent 5cd12fa9
No related branches found
No related tags found
No related merge requests found
---
"create-llama": patch
---
Use is_empty filter for private files in LlamaCloud Index
......@@ -5,11 +5,11 @@ def generate_filters(doc_ids):
"""
Generate public/private document filters based on the doc_ids and the vector store.
"""
# Using "nin" filter to include the documents don't have the "private" key because they're uploaded in LlamaCloud UI
# Using "is_empty" filter to include the documents don't have the "private" key because they're uploaded in LlamaCloud UI
public_doc_filter = MetadataFilter(
key="private",
value=["true"],
operator="nin", # type: ignore
value=None,
operator="is_empty", # type: ignore
)
selected_doc_filter = MetadataFilter(
key="file_id", # Note: LLamaCloud uses "file_id" to reference private document ids as "doc_id" is a restricted field in LlamaCloud
......
......@@ -4,8 +4,8 @@ export function generateFilters(documentIds: string[]): MetadataFilters {
// public documents don't have the "private" field or it's set to "false"
const publicDocumentsFilter: MetadataFilter = {
key: "private",
value: ["true"],
operator: "nin",
value: null,
operator: "is_empty",
};
// if no documentIds are provided, only retrieve information from public documents
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment