INNER CODE UNIT · Python
tag
yifanfeng97/Hyper-Extract · hyperextract/cli/cli.py:1156
def tag(
ka_path: str = typer.Argument(..., help="Knowledge Abstract directory"),
source: str = typer.Option(..., "--source", help="Source document id to tag"),
add: list[str] | None = typer.Option(
None, "--add", help="Tag(s) to add (repeatable)"
),
remove: list[str] | None = typer.Option(
None, "--remove", help="Tag(s) to remove (repeatable)"
),
list_sources: bool = typer.Option(
False, "--list", "-l", help="List all sources with their tags"
),
):
"""Manage tags on source documents (for scoped search and rollback)."""
logger.info("command=tag ka_path=%s source=%s", ka_path, source)
path = validate_ka_with_data(ka_path)
template, lang = get_template_from_ka(path)