elm.ords.validation.location.CountyNameValidator

class CountyNameValidator(structured_llm_caller)[source]

Bases: FixedMessageValidator

Validator that checks wether text applies to a particular county.

Parameters:

structured_llm_caller (elm.ords.llm.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 legal text. Return your answer in JSON format. Your JSON file must include exactly three keys. The first key is 'wrong_county', which is a boolean that is set to `True` if the legal text is not for {county} County. Do not infer based on any information about any US state, city, township, or otherwise. `False` if the text applies to {county} County or if there is not enough information to determine the answer. The second key is 'wrong_state', which is a boolean that is set to `True` if the legal text is not for a county in {state} State. Do not infer based on any information about any US county, city, township, or otherwise. `False` if the text applies to a county in {state} State or if there is not enough information to determine the answer. The third key is 'explanation', which is a string that contains a short explanation if you chose `True` for any answers above."

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.