compass.validation.location.URLValidator#

class URLValidator(structured_llm_caller)[source]#

Bases: LocationValidator

Validator that checks whether a URL matches a county

Parameters:

structured_llm_caller (StructuredLLMCaller) – StructuredLLMCaller instance. Used for structured validation queries.

Methods

check(content, **fmt_kwargs)

Check if the content passes the validation

Attributes

SYSTEM_MESSAGE

LLM system message describing validation task

SYSTEM_MESSAGE = "You extract structured data from a URL. Return your answer in JSON format. Your JSON file must include exactly two keys. The first key is 'correct_county', which is a boolean that is set to `True` if the URL mentions {county} County in some way. DO NOT infer based on information in the URL about any US state, city, township, or otherwise. `False` if not sure. The second key is 'correct_state', which is a boolean that is set to `True` if the URL mentions {state} State in some way. DO NOT infer based on information in the URL about any US county, city, township, or otherwise. `False` if not sure."#

LLM system message describing validation task

async check(content, **fmt_kwargs)#

Check if the content passes the validation

The exact validation is outlined in the class SYSTEM_MESSAGE.

Parameters:
  • content (str) – Document content to validate.

  • **fmt_kwargs – Keyword arguments to be passed to SYSTEM_MESSAGE.format().

Returns:

boolTrue if the content passes the validation check, False otherwise.