compass.validation.location.JurisdictionValidator#

class JurisdictionValidator(score_thresh=0.8, text_splitter=None, **kwargs)[source]#

Bases: object

Coordinate URL and text jurisdiction validation for documents

Notes

The validator stores the score threshold, optional text splitter, and keyword arguments so they can be reused across many documents without reconfiguration.

Parameters:
  • score_thresh (float, optional) – Threshold applied to the weighted page vote. Documents at or above the threshold are considered jurisdiction matches. Default is 0.8.

  • text_splitter (TextSplitter, optional) – Optional splitter attached to documents lacking a text_splitter attribute so validators can iterate page content consistently. Default is None.

  • **kwargs – Additional keyword arguments forwarded to BaseLLMCaller and reused when instantiating subordinate validators.

Methods

check(doc, jurisdiction)

Assess whether a document applies to the jurisdiction

async check(doc, jurisdiction)[source]#

Assess whether a document applies to the jurisdiction

Parameters:
Returns:

boolTrue when either the URL or document text validation confirms jurisdiction alignment, False otherwise.

Raises:

compass.exceptions.COMPASSError – Propagated if subordinate validators encounter LLM caller errors.

Notes

The method temporarily overrides doc.text_splitter when a custom splitter is provided, ensuring the original splitter is restored after validation completes.

Examples

>>> validator = JurisdictionValidator()
>>> await validator.check(document, jurisdiction)
True