compass.validation.location.DTreeURLJurisdictionValidator#

class DTreeURLJurisdictionValidator(jurisdiction, **kwargs)[source]#

Bases: BaseLLMCaller

Validate whether a URL appears to target a jurisdiction

Parameters:

Notes

The validator stores the input jurisdiction for subsequent URL checks; it does not perform any validation work during instantiation.

Methods

check(url)

Determine whether the supplied URL targets the jurisdiction

Attributes

SYSTEM_MESSAGE

System message for URL jurisdiction validation LLM calls

SYSTEM_MESSAGE = 'You are an expert data analyst that examines URLs to determine if they contain information about jurisdictions. Only ever answer based on the information in the URL itself.'#

System message for URL jurisdiction validation LLM calls

async check(url)[source]#

Determine whether the supplied URL targets the jurisdiction

Parameters:

url (str) – URL string to evaluate. Empty values short-circuit to False.

Returns:

boolTrue when the decision-tree evaluation finds all jurisdiction criteria satisfied, False otherwise.

Raises:

compass.exceptions.COMPASSError – Propagated if underlying LLM interactions fail while the caller has configured BaseLLMCaller to raise.

Notes

The method delegates to an internal asynchronous decision tree backed by ChatLLMCaller. The validator aggregates structured responses and only approves when each required attribute matches the target jurisdiction.