compass.extraction.wind.ordinance.WindOrdinanceTextCollector#

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

Bases: StructuredLLMCaller

Check text chunks for ordinances and collect them if they do

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 at a given ind to see if it contains ordinance

Attributes

CONTAINS_ORD_PROMPT

Prompt to check if chunk contains WES ordinance info

IS_UTILITY_SCALE_PROMPT

Prompt to check if chunk is for utility-scale WES

contains_ord_info

Flag indicating whether text contains ordinance info

ordinance_text

Combined ordinance text from the individual chunks

CONTAINS_ORD_PROMPT = "You extract structured data from text. Return your answer in JSON format (not markdown). Your JSON file must include exactly two keys. The first key is 'wind_reqs', which is a string that summarizes all zoning, siting, setback, system design, and operational requirements/restrictions that are explicitly enacted in the text for a wind energy system (or wind turbine/tower) for a given jurisdiction. Note that wind energy bans are an important restriction to track. Include any **closely related provisions** if they clearly pertain to the **development, operation, modification, or removal** of wind energy systems (or wind turbines/towers). All restrictions should be enforceable - ignore any text that only provides a legal definition of the regulation. If the text does not specify any concrete zoning, siting, setback, system design, or operational requirements/restrictions for a wind energy system, set this key to `null`. The last key is '{key}', which is a boolean that is set to True if the text excerpt explicitly details zoning, siting, setback, system design, or operational requirements/restrictions for a wind energy system (or wind turbine/tower) and False otherwise. "#

Prompt to check if chunk contains WES ordinance info

IS_UTILITY_SCALE_PROMPT = "You are a legal scholar that reads ordinance text and determines whether any of it applies to zoning, siting, setback, system design, or operational requirements/restrictions for **large wind energy systems**. 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. Your client is a commercial wind developer that does not care about ordinances related to private, residential, micro, small, or medium sized wind energy systems. Ignore any text related to such systems. Return your answer as a dictionary in JSON format (not markdown). Your JSON file must include exactly two keys. The first key is 'summary' which contains a string that lists all of the types of wind energy systems the text applies to (if any). The second key is '{key}', which is a boolean that is set to True if any part of the text excerpt details zoning, siting, setback, system design, or operational requirements/restrictions for the **large wind energy conversion systems** (or similar) that the client is interested in and False otherwise."#

Prompt to check if chunk is for utility-scale WES

async check_chunk(chunk_parser, ind)[source]#

Check a chunk at a given ind to see if it contains ordinance

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 ordinance text.

property contains_ord_info#

Flag indicating whether text contains ordinance info

Type:

bool

property ordinance_text#

Combined ordinance text from the individual 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.