INNER CODE UNIT · Python
search
yifanfeng97/Hyper-Extract · hyperextract/cli/cli.py:1024
def search(
ka_path: str = typer.Argument(..., help="Knowledge Abstract directory"),
query: str = typer.Argument(..., help="Search query"),
top_k: int = typer.Option(3, "--top-k", "-n", help="Number of results"),
source: list[str] | None = typer.Option(
None, "--source", help="Scope: only knowledge from these source documents"
),
tag: list[str] | None = typer.Option(
None, "--tag", help="Scope: only knowledge from sources carrying these tags"
),
):
"""Semantic search in Knowledge Abstract."""
from hyperextract.utils.search_results import coerce_search_results
logger.info("command=search ka_path=%s query=%s top_k=%d", ka_path, query, top_k)
validate_config()