compass.validation.location.DTreeURLJurisdictionValidator#
- class DTreeURLJurisdictionValidator(jurisdiction, **kwargs)[source]#
Bases:
BaseLLMCallerValidate whether a URL appears to target a jurisdiction
- Parameters:
jurisdiction (
compass.utilities.location.Jurisdiction) – Jurisdiction descriptor with the target location attributes.**kwargs – Additional keyword arguments forwarded to
BaseLLMCallerfor model selection, temperature, or tracing control.
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 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 toFalse.- Returns:
bool–Truewhen the decision-tree evaluation finds all jurisdiction criteria satisfied,Falseotherwise.- Raises:
compass.exceptions.COMPASSError – Propagated if underlying LLM interactions fail while the caller has configured
BaseLLMCallerto 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.