compass.extraction.wind.ordinance.WindPermittedUseDistrictsTextCollector#

class WindPermittedUseDistrictsTextCollector(*args, **kwargs)[source]#

Bases: StructuredLLMCaller

Check text chunks for permitted wind districts; collect them

Parameters:
  • llm_service (Service) – LLM service used for queries.

  • usage_tracker (UsageTracker, optional) – Optional tracker instance to monitor token usage during LLM calls. By default, None.

  • **kwargs

    Keyword arguments to be passed to the underlying service processing function (i.e. llm_service.call(**kwargs)). Should not contain the following keys:

    • usage_sub_label

    • messages

    These arguments are provided by this caller object.

Methods

call(sys_msg, content[, usage_sub_label])

Call LLM for structured data retrieval

check_chunk(chunk_parser, ind)

Check a chunk to see if it contains permitted uses

Attributes

DISTRICT_PROMPT

Prompt to check if chunk contains info on permitted districts

contains_district_info

Flag indicating whether text contains district info

permitted_use_district_text

Combined permitted use districts text from the chunks

DISTRICT_PROMPT = "You are a legal scholar that reads ordinance text and determines whether the text explicitly contains relevant information to determine the districts (and especially the district names) where large wind energy systems are a permitted use (primary, special, accessory, or otherwise), as well as the districts where large wind energy systems are prohibited entirely. Large wind energy systems (WES) may also be referred to as wind turbines, wind energy conversion systems (WECS), wind energy facilities (WEF), wind energy turbines (WET), large wind energy turbines (LWET), utility-scale wind energy turbines (UWET), commercial wind energy conversion systems (CWECS), alternate energy systems (AES), commercial energy production systems (CEPCS), or similar. Do not make any inferences; only answer based on information that is explicitly stated in the text. Note that relevant information may sometimes be found in tables. Return your answer as a dictionary in JSON format (not markdown). Your JSON file must include exactly two keys. The first key is 'districts' which contains a string that lists all of the district names for which the text explicitly permits **large wind energy systems** (if any). The last key is '{key}', which is a boolean that is set to True if any part of the text excerpt provides information on districts where **large wind energy systems** (or similar) are a permitted use in and False otherwise."#

Prompt to check if chunk contains info on permitted districts

async check_chunk(chunk_parser, ind)[source]#

Check a chunk to see if it contains permitted uses

Parameters:
  • chunk_parser (ParseChunksWithMemory) – Instance that contains a parse_from_ind method.

  • ind (int) – Index of the chunk to check.

Returns:

bool – Boolean flag indicating whether or not the text in the chunk contains large wind energy conversion system permitted use text.

property contains_district_info#

Flag indicating whether text contains district info

Type:

bool

property permitted_use_district_text#

Combined permitted use districts text from the chunks

Type:

str

async call(sys_msg, content, usage_sub_label=LLMUsageCategory.DEFAULT)#

Call LLM for structured data retrieval

Parameters:
  • sys_msg (str) – The LLM system message. If this text does not contain the instruction text “Return your answer as a dictionary in JSON format”, it will be added.

  • content (str) – LLM call content (typically some text to extract info from).

  • usage_sub_label (str, optional) – Label to store token usage under. By default, "default".

Returns:

dict – Dictionary containing the LLM-extracted features. Dictionary may be empty if there was an error during the LLM call.