{"id":"citation-passage-check","version":"1.0.0","description":"Check that a cited start/end span of a supplied source version reads exactly as the quoted passage.","supported_operations":["verify quoted passage at character offsets","check citation span matches source text","does this quote really appear at position start end","validate text position selector against document","check rag citation offsets against retrieved chunk","verify quotation from a specific document version","בדיקת ציטוט מול טקסט המקור לפי מיקום"],"unsupported_operations":["fetching the source or proving the supplied text is authentic","fuzzy, case-insensitive or whitespace-normalized quote matching","UTF-16 or byte offsets (positions are Unicode code points)","grapheme-cluster boundary checks"],"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 the caller-supplied text: authenticity_checked is always false and a valid result never claims the text is the real content of the named source or version.","Sources are (source_id, version, text) entries; the pair must be unique. version is an immutable label compared exactly. The cited source_id must exist (else unknown_source) and the cited version must be one supplied for it (else version_mismatch with available_versions sorted by code point).","TextPositionSelector start and end count Unicode code points from 0; start is included and end excluded (W3C 4.2.5). Comparison order: span_reversed (start > end), span_out_of_range (end > text length), then quote_mismatch.","The quote is compared code point by code point with no normalization; quote_mismatch reports quote_offset (index in the quote), source_offset, expected_char (source code point, null past the span) and claimed_char (null past the quote).","Strings with lone surrogates are invalid_input; text may be empty, quote may not."],"limits":{"max_input_bytes":1048576,"max_sources":16,"max_text_bytes":524288,"max_quote_bytes":16384,"max_label_bytes":256},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["sources","citation"],"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"}}}},"citation":{"type":"object","additionalProperties":false,"required":["source_id","version","selector","quote"],"properties":{"source_id":{"type":"string","minLength":1},"version":{"type":"string","minLength":1},"selector":{"type":"object","additionalProperties":false,"required":["type","start","end"],"properties":{"type":{"type":"string","const":"TextPositionSelector"},"start":{"type":"integer","minimum":0},"end":{"type":"integer","minimum":0}}},"quote":{"type":"string","minLength":1}}}}},"output_schema":{"type":"object","additionalProperties":false,"required":["valid","reason","first_discrepancy","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"]},"first_discrepancy":{"type":["object","null"],"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"]}}},"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"}],"citation":{"source_id":"alphabet","version":"v1","selector":{"type":"TextPositionSelector","start":4,"end":7},"quote":"efg"}},"output":{"valid":true,"reason":null,"first_discrepancy":null,"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"}],"citation":{"source_id":"alphabet","version":"v1","selector":{"type":"TextPositionSelector","start":4,"end":7},"quote":"efh"}},"output":{"valid":false,"reason":"quote_mismatch","first_discrepancy":{"field":"quote","available_versions":null,"start":4,"end":7,"text_length":26,"quote_offset":2,"source_offset":6,"expected_char":"g","claimed_char":"h"},"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-passage-check/versions/1.0.0/execute"}