Skip to content

feat(leann): Add metadata filtering support #25

@hummat

Description

@hummat

Problem or Motivation

LEANN supports rich post-search filtering (==, !=, <, >, in, contains, starts_with, etc.) via its Python API (metadata_filters=...), but neither LEANN's CLI nor paperpipe surfaces this capability.

Users cannot scope queries to specific papers or tags when using LEANN backend, reducing precision for large paper collections.

Proposed Solution

Expose LEANN's metadata filtering in papi ask --backend leann:

papi ask --backend leann --leann-filter "paper_name in ['lora', 'attention']" "query"

This would allow filtering by any metadata field stored during indexing.

Alternatives Considered

  • Pre-filter papers before indexing — loses flexibility, requires multiple indexes
  • Use PaperQA2 instead — doesn't have the same metadata filtering capabilities

Area

RAG backends (PaperQA2/LEANN)

Blockers

Blocked on upstream: LEANN's leann ask CLI does not expose --filter yet. Needs PR to LEANN first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions