{"id":"citation-batch-check","version":"1.0.0","description":"Check an ordered batch of citations (span+quote or quote anchors) against supplied sources; returns the first failure.","supported_operations":["verify all citations in an answer against sources","check every quote in a report against supplied documents","batch citation verification for rag answer","find the first fabricated or misquoted citation","validate many web annotation selectors at once","check citations cite the right document version","בדיקת כל הציטוטים בתשובה מול המקורות"],"unsupported_operations":["fetching sources or proving the supplied text is authentic","judging whether a quote supports the claim it is cited for","fuzzy or normalized matching","reporting every failure (only the first, in batch order)"],"semantics":["Implements W3C Web Annotation Data Model (Recommendation 2017-02-23) 4.2.4 TextQuoteSelector, 4.2.5 TextPositionSelector; r68 supplied-text profile 1.0.0; every result carries reference_version.","Checks only caller-supplied text: authenticity_checked is always false. Sources are unique (source_id, version) pairs; citation_id values must be unique (duplicate is invalid_input).","Each citation has a TextPositionSelector {start, end} plus a required quote (checked as in citation-passage-check), or a TextQuoteSelector {exact, prefix?, suffix?} plus an optional claimed_start (checked as in citation-anchor-check). quote with a quote selector, or claimed_start with a position selector, is invalid_input.","All citations are validated structurally first; then, when the total text length (UTF-16 units) of the sources scanned by quote selectors exceeds max_scan_units, the call is limit_exceeded before any matching.","Citations are checked in array order and the first failure is returned with citation_index, citation_id, selector_type and the per-selector detail (same fields and reason order as the single-citation tools); citations_checked counts the citations compared.","Positions count Unicode code points from 0; no normalization of text, quotes or labels."],"limits":{"max_input_bytes":1048576,"max_sources":16,"max_text_bytes":524288,"max_quote_bytes":16384,"max_context_bytes":1024,"max_label_bytes":256,"max_citations":256,"max_scan_units":16777216},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["sources","citations"],"properties":{"sources":{"type":"array","minItems":1,"maxItems":16,"items":{"type":"object","additionalProperties":false,"required":["source_id","version","text"],"properties":{"source_id":{"type":"string","minLength":1},"version":{"type":"string","minLength":1},"text":{"type":"string"}}}},"citations":{"type":"array","minItems":1,"maxItems":256,"items":{"type":"object","additionalProperties":false,"required":["citation_id","source_id","version","selector"],"properties":{"citation_id":{"type":"string","minLength":1},"source_id":{"type":"string","minLength":1},"version":{"type":"string","minLength":1},"selector":{"anyOf":[{"type":"object","additionalProperties":false,"required":["type","start","end"],"properties":{"type":{"type":"string","const":"TextPositionSelector"},"start":{"type":"integer","minimum":0},"end":{"type":"integer","minimum":0}}},{"type":"object","additionalProperties":false,"required":["type","exact"],"properties":{"type":{"type":"string","const":"TextQuoteSelector"},"exact":{"type":"string","minLength":1},"prefix":{"type":"string"},"suffix":{"type":"string"}}}]},"quote":{"type":"string","minLength":1},"claimed_start":{"type":"integer","minimum":0}}}}}},"output_schema":{"type":"object","additionalProperties":false,"required":["valid","reason","first_discrepancy","citations_checked","authenticity_checked","reference_version"],"properties":{"valid":{"type":"boolean"},"reason":{"type":["string","null"],"enum":[null,"unknown_source","version_mismatch","span_reversed","span_out_of_range","quote_mismatch","exact_not_found","prefix_mismatch","suffix_mismatch","ambiguous_anchor","position_mismatch"]},"first_discrepancy":{"type":["object","null"],"additionalProperties":false,"required":["citation_index","citation_id","selector_type","detail"],"properties":{"citation_index":{"type":"integer","minimum":0},"citation_id":{"type":"string"},"selector_type":{"type":"string","enum":["TextPositionSelector","TextQuoteSelector"]},"detail":{"anyOf":[{"type":"object","additionalProperties":false,"required":["field","available_versions","start","end","text_length","quote_offset","source_offset","expected_char","claimed_char"],"properties":{"field":{"type":"string","enum":["source_id","version","start","end","quote"]},"available_versions":{"type":["array","null"],"items":{"type":"string"}},"start":{"type":["integer","null"],"minimum":0},"end":{"type":["integer","null"],"minimum":0},"text_length":{"type":["integer","null"],"minimum":0},"quote_offset":{"type":["integer","null"],"minimum":0},"source_offset":{"type":["integer","null"],"minimum":0},"expected_char":{"type":["string","null"]},"claimed_char":{"type":["string","null"]}}},{"type":"object","additionalProperties":false,"required":["field","available_versions","exact_matches","prefix_matches","full_matches","match_starts","claimed_start","resolved_start","observed"],"properties":{"field":{"type":"string","enum":["source_id","version","exact","prefix","suffix","claimed_start"]},"available_versions":{"type":["array","null"],"items":{"type":"string"}},"exact_matches":{"type":["integer","null"],"minimum":0},"prefix_matches":{"type":["integer","null"],"minimum":0},"full_matches":{"type":["integer","null"],"minimum":0},"match_starts":{"type":["array","null"],"maxItems":2,"items":{"type":"integer","minimum":0}},"claimed_start":{"type":["integer","null"],"minimum":0},"resolved_start":{"type":["integer","null"],"minimum":0},"observed":{"type":["string","null"]}}}]}}},"citations_checked":{"type":"integer","minimum":0},"authenticity_checked":{"type":"boolean","const":false},"reference_version":{"type":"string","const":"W3C Web Annotation Data Model (Recommendation 2017-02-23) 4.2.4 TextQuoteSelector, 4.2.5 TextPositionSelector; r68 supplied-text profile 1.0.0"}}},"examples":[{"input":{"sources":[{"source_id":"alphabet","version":"v1","text":"abcdefghijklmnopqrstuvwxyz"}],"citations":[{"citation_id":"c1","source_id":"alphabet","version":"v1","selector":{"type":"TextPositionSelector","start":4,"end":7},"quote":"efg"},{"citation_id":"c2","source_id":"alphabet","version":"v1","selector":{"type":"TextQuoteSelector","exact":"xyz","prefix":"w"},"claimed_start":23}]},"output":{"valid":true,"reason":null,"first_discrepancy":null,"citations_checked":2,"authenticity_checked":false,"reference_version":"W3C Web Annotation Data Model (Recommendation 2017-02-23) 4.2.4 TextQuoteSelector, 4.2.5 TextPositionSelector; r68 supplied-text profile 1.0.0"}},{"input":{"sources":[{"source_id":"alphabet","version":"v1","text":"abcdefghijklmnopqrstuvwxyz"}],"citations":[{"citation_id":"c1","source_id":"alphabet","version":"v1","selector":{"type":"TextPositionSelector","start":4,"end":7},"quote":"efg"},{"citation_id":"c2","source_id":"alphabet","version":"v2","selector":{"type":"TextQuoteSelector","exact":"xyz"}}]},"output":{"valid":false,"reason":"version_mismatch","first_discrepancy":{"citation_index":1,"citation_id":"c2","selector_type":"TextQuoteSelector","detail":{"field":"version","available_versions":["v1"],"exact_matches":null,"prefix_matches":null,"full_matches":null,"match_starts":null,"claimed_start":null,"resolved_start":null,"observed":null}},"citations_checked":2,"authenticity_checked":false,"reference_version":"W3C Web Annotation Data Model (Recommendation 2017-02-23) 4.2.4 TextQuoteSelector, 4.2.5 TextPositionSelector; r68 supplied-text profile 1.0.0"}}],"execute_url":"/v1/tools/citation-batch-check/versions/1.0.0/execute"}