endomorphosis's picture
Add files using upload-large-folder tool
a8a1e51 verified
|
Raw History Blame Contribute Delete
1.94 kB
metadata
name: query-hf-graphrag
description: >-
  Query the CID-keyed ipfs_kenya_laws_ir GraphRAG release on Hugging Face with
  bounded BM25, centroid-routed vectors, adjacency neighbors, and graph walks.
  Use when an agent must retrieve lexical, semantic, or graph context without
  downloading the full corpus.

Query ipfs_kenya_laws_ir on Hugging Face

Use the bundled search script. It fetches only the manifest, compact locators, matching posting/vector/adjacency shards, and corpus rows for final hits.

Repository: justicedao/ipfs_kenya_laws_ir. Primary key is entry_cid. Integer document_index is a compact pointer, not an identity.

Research snapshot. Similarity edges cannot establish legal authority.

Choose retrieval

  • bm25 for citations, docket numbers, quoted terms, and exact names.
  • vector for paraphrases and topical similarity.
  • neighbors / walk after you have a node_cid.
  • Merge BM25 and vector hits on entry_cid. Similarity edges (BM25_NEIGHBOR_OF, EMBEDDING_NEIGHBOR_OF, contains_term) are retrieval proposals only.

BM25

python scripts/query_hf_graphrag.py \
  --repo-id justicedao/ipfs_kenya_laws_ir \
  --revision <pinned-commit> \
  bm25 "clean air act section 111" --top-k 10

Local checkout:

python scripts/query_hf_graphrag.py --local-root . bm25 "clean air act section 111"

Install pyarrow and huggingface_hub. Set HF_TOKEN for private datasets. Always pin --revision for remote queries; never use main.

Neighbors and walks

python scripts/query_hf_graphrag.py --local-root . neighbors <node-cid> --direction both --limit 25
python scripts/query_hf_graphrag.py --local-root . walk <node-cid> --max-depth 2 --max-nodes 100

Inspect fetch_trace. A budget stop is a partial walk, not proof that no further path exists. Treat hits as context_only.

Read references/schema.md for locator and posting contracts.