Version: latest
agrag.evidence.citation.check_citations
check_citations(cited_ids:Sequence[str], fetched_ids:Iterable[str], *, scope:frozenset[str]) -> list[CitationCheck]
Return one verdict for each cited evidence id, in the order given.
A citation is valid when its document is in scope and it was fetched. A
span citation is also valid when its range lies inside a fetched span of the
same document and content hash. A wider range is not_fetched. A chunk
citation must equal a fetched id. A citation of a document outside the scope
is unavailable, even when the caller fetched it earlier. A string that
does not decode is malformed.
Pass only the ids whose fetch returned ok. An id from a truncated or
partial outcome names more text than the caller received.
Parameters:
- cited_ids (
Sequence[str]) – Evidence ids the answer cites. - fetched_ids (
Iterable[str]) – Evidence ids the caller fetched. A malformed entry is ignored. - scope (
frozenset[str]) – Keys of the documents the caller may read.
Returns:
list[CitationCheck]– One check for each cited id, in the same order.