diff --git a/compass/common/base.py b/compass/common/base.py index 75954004..469ea65b 100644 --- a/compass/common/base.py +++ b/compass/common/base.py @@ -29,6 +29,10 @@ "If you had to make a selection when reporting the ordinance, be sure to " "list out all the other options and their conditions in the summary." ) +_YES_NO_PROMPT = ( + "Please start your response with either 'Yes' or 'No' and briefly " + "explain your answer." +) _UNITS_IN_SUMMARY_PROMPT = ( "Also include any clarifications about the units in the summary." ) @@ -71,6 +75,7 @@ def setup_graph_no_nodes(d_tree_name="Unknown Decision Tree", **kwargs): return nx.DiGraph( SECTION_PROMPT=_SECTION_PROMPT, SUMMARY_PROMPT=_SUMMARY_PROMPT, + YES_NO_PROMPT=_YES_NO_PROMPT, UNITS_IN_SUMMARY_PROMPT=_UNITS_IN_SUMMARY_PROMPT, _d_tree_name=d_tree_name, **kwargs, @@ -194,8 +199,7 @@ def setup_base_setback_graph(**kwargs): "{system_size_reminder}" # expected to end in space "Don't forget to pay extra attention to clarifying text found " "in parentheses and footnotes. " - "Please start your response with either 'Yes' or 'No' and briefly " - "explain your answer." + "{YES_NO_PROMPT}" '\n\n"""\n{text}\n"""' ), ) @@ -208,8 +212,7 @@ def setup_base_setback_graph(**kwargs): prompt=( "Did you infer your answer based on setback requirements from " "something other than {feature}, such as {ignore_features}? " - "Please start your response with either 'Yes' or 'No' and briefly " - "explain your answer." + "{YES_NO_PROMPT}" ), ) if "roads" in kwargs.get("feature", ""): @@ -222,8 +225,8 @@ def setup_base_setback_graph(**kwargs): "check_if_property_line", prompt=( "Is this requirement better classified as a setback from " - "property lines? Please start your response with " - "either 'Yes' or 'No' and briefly explain your answer." + "property lines? " + "{YES_NO_PROMPT}" ), ) G.add_edge( @@ -272,8 +275,7 @@ def setup_participating_owner(**kwargs): "related to {ignore_features}. " "Please only consider setbacks that would apply for " "{system_size_reminder}" - "Please start your response with either 'Yes' or 'No' " - "and briefly explain your answer." + "{YES_NO_PROMPT}" ), ) G.add_edge("init", "waiver", condition=llm_response_starts_with_yes) @@ -283,8 +285,7 @@ def setup_participating_owner(**kwargs): "Does the ordinance allow **participating** {owned_type} owners " "to completely waive or reduce by an unspecified amount the " "{feature} setbacks requirements? " - "Please start your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" ), ) @@ -295,8 +296,7 @@ def setup_participating_owner(**kwargs): "Does the ordinance for {feature} setbacks explicitly specify " "that **participating** {owned_type} owners must abide to the " "same setbacks as **non-participating** {owned_type} owners? " - "Please start your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" ), ) @@ -327,8 +327,7 @@ def setup_participating_owner(**kwargs): "Does the ordinance for {feature} setbacks explicitly specify " "a **numerical** value that applies to **participating** " "{owned_type} owners? " - "Please start your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" ), ) G.add_edge("part", "non_part", condition=llm_response_starts_with_yes) @@ -402,8 +401,7 @@ def setup_graph_extra_restriction(is_numerical=True, **kwargs): "{system_size_reminder}\n" "4) Pay close attention to clarifying details in parentheses, " "footnotes, or additional explanatory text.\n" - "5) Please start your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "5) {YES_NO_PROMPT}" '\n\n"""\n{text}\n"""' ), ) @@ -475,8 +473,7 @@ def setup_graph_extra_restriction(is_numerical=True, **kwargs): "{restriction} for {tech}? " "As before, focus only on {restriction} specifically for " "{system_size_reminder}" - "Please start your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" ), ) G.add_edge("enr", "enr_text", condition=llm_response_starts_with_yes) @@ -494,8 +491,7 @@ def setup_graph_extra_restriction(is_numerical=True, **kwargs): "Based on your response, are you still confident that the text " "**directly** states that there are no regulations around " "{restriction} for {tech}? " - "Please start your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" ), ) G.add_edge( @@ -544,11 +540,7 @@ def _add_coverage_clarification_nodes(G): # noqa: N803 G.add_edge("init", "is_area", condition=llm_response_starts_with_yes) G.add_node( "is_area", - prompt=( - "Is the coverage reported as an area value? " - "Please start your response with either 'Yes' or 'No' and " - "briefly explain your answer." - ), + prompt="Is the coverage reported as an area value? {YES_NO_PROMPT}", ) G.add_edge("is_area", "value", condition=llm_response_starts_with_no) return G @@ -562,10 +554,8 @@ def _add_land_density_clarification_nodes(G): # noqa: N803 G.add_node( "correct_density_units", prompt=( - "Is the density reported as a system size **per area** " - "value? " - "Please start your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "Is the density reported as a system size **per area** value? " + "{YES_NO_PROMPT}" ), ) G.add_edge( @@ -585,8 +575,7 @@ def _add_minimum_lot_size_clarification_nodes(G): # noqa: N803 "correct_min_ls_units", prompt=( "Is the minimum lot size reported as an **area** value? " - "Please start your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" ), ) G.add_edge( @@ -604,8 +593,7 @@ def _add_maximum_lot_size_clarification_nodes(G): # noqa: N803 "correct_max_ls_units", prompt=( "Is the maximum lot size reported as an **area** value? " - "Please start your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" ), ) G.add_edge( @@ -620,12 +608,10 @@ def _add_maximum_project_size_clarification_nodes(G): # noqa: N803 G.add_node( "is_mps_area", prompt=( - "Does the project size requirement specifically provide " - "a system size in MW or an installation size (e.g. " - "maximum number of systems or maximum number of solar " - "panels)? " - "Please start your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "Does the project size requirement specifically provide a system " + "size in MW or an installation size (e.g. maximum number of " + "systems or maximum number of solar panels)? " + "{YES_NO_PROMPT}" ), ) G.add_edge( @@ -638,8 +624,7 @@ def _add_maximum_project_size_clarification_nodes(G): # noqa: N803 prompt=( "Can the project size requirement be bypassed by applying " "for a permit? " - "Please start your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" ), ) @@ -658,8 +643,7 @@ def _add_maximum_turbine_height_clarification_nodes(G): # noqa: N803 "Are any of the turbine height restrictions measured from a point " "other than the ground (e.g. a building height or an airspace " "level, etc.)? " - "Please start your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" ), ) G.add_edge( @@ -675,8 +659,7 @@ def _add_maximum_turbine_height_clarification_nodes(G): # noqa: N803 "We are not interested in restrictions that are relative to some " "level. Does the legal text enact any turbine height restrictions " "measured from the ground? " - "Please start your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" ), ) @@ -765,8 +748,7 @@ def _add_prohibitions_extraction_nodes(G): # noqa: N803 prompt=( "Is there reason to believe that this prohibition is only " "being proposed and not yet in effect? " - "Please start your response with either 'Yes' or 'No' " - "and briefly explain your answer." + "{YES_NO_PROMPT}" ), ) G.add_edge( @@ -787,8 +769,7 @@ def _add_prohibitions_extraction_nodes(G): # noqa: N803 "been previously approved?\n" " - Does it only apply if some other condition is met?\n" " - etc.\n" - "Please start your response with either 'Yes' or 'No' " - "and briefly explain your answer." + "{YES_NO_PROMPT}" ), ) G.add_edge( @@ -799,8 +780,7 @@ def _add_prohibitions_extraction_nodes(G): # noqa: N803 prompt=( "Does the legal text given an expiration date for the " "prohibition, moratorium, or ban? " - "Please start your response with either 'Yes' or 'No' " - "and briefly explain your answer." + "{YES_NO_PROMPT}" ), ) G.add_edge("has_end_date", "final", condition=llm_response_starts_with_no) @@ -815,8 +795,7 @@ def _add_prohibitions_extraction_nodes(G): # noqa: N803 prompt=( f"Today is {todays_date}. Has the prohibition, " "moratorium, or ban expired? " - "Please start your response with either 'Yes' or 'No' " - "and briefly explain your answer." + "{YES_NO_PROMPT}" ), ) G.add_edge( @@ -862,8 +841,8 @@ def setup_graph_permitted_use_districts(**kwargs): "Does the following legal text explicitly define districts where " "{tech} (or similar) are {use_type}? {clarifications}" "Pay extra attention to titles and clarifying text found in " - "parentheses and footnotes. Please start your response with " - "either 'Yes' or 'No' and briefly explain your answer." + "parentheses and footnotes. " + "{YES_NO_PROMPT}" '\n\n"""\n{text}\n"""' ), ) @@ -888,8 +867,7 @@ def setup_graph_permitted_use_districts(**kwargs): "developers can site {tech} (or similar) as the primary " "use of the land/parcel/lot? Remember that this is true " "by assumption for all overlay districts. " - "Please start your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" ), ) G.add_edge( @@ -903,8 +881,7 @@ def setup_graph_permitted_use_districts(**kwargs): "Are these districts representative of locations where " "developers can site {tech} (or similar) as an accessory " "structure and/or as a secondary use of the land/parcel/lot? " - "Please start your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" ), ) G.add_edge( diff --git a/compass/extraction/small_wind/graphs.py b/compass/extraction/small_wind/graphs.py index 4091ffa2..533f45b5 100644 --- a/compass/extraction/small_wind/graphs.py +++ b/compass/extraction/small_wind/graphs.py @@ -32,8 +32,7 @@ def setup_graph_wes_types(**kwargs): "system sizes? Distinctions are often made as 'small', " "'personal', or 'private' vs 'large', 'commercial', or 'utility'. " "Sometimes the distinction uses actual MW values. " - "Please start your response with either 'Yes' or 'No' and briefly " - "explain your answer." + "{YES_NO_PROMPT}" '\n\n"""\n{text}\n"""' ), ) @@ -68,8 +67,7 @@ def setup_graph_wes_types(**kwargs): "medium, non-commercial, or something akin to that (i.e. " "**not** private, micro, building-mounted and **not** large, " "commercial, or utility-scale)? " - "Please start your response with either 'Yes' or 'No' and briefly " - "explain your answer." + "{YES_NO_PROMPT}" ), ) @@ -93,8 +91,7 @@ def setup_graph_wes_types(**kwargs): "energy generation system (e.g. with the primary purpose of " "generating electricity for use on-site, as opposed to large, " "commercial, utility-scale, or other kinds of 'large' systems)? " - "Please start your response with either 'Yes' or 'No' and briefly " - "explain your answer." + "{YES_NO_PROMPT}" ), ) @@ -173,8 +170,7 @@ def setup_multiplier(**kwargs): "{system_size_reminder}" "Remember that 1 is a valid multiplier, and treat any " "mention of 'fall zone' as a system height multiplier of 1. " - "Please start your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" ), ) G.add_edge("init", "no_multiplier", condition=llm_response_starts_with_no) @@ -187,8 +183,7 @@ def setup_multiplier(**kwargs): "related to {ignore_features}. " "Please also only consider setbacks specifically for " "{system_size_reminder}" - "Please start your response with either 'Yes' or " - "'No' and briefly explain your answer." + "{YES_NO_PROMPT}" ), ) G.add_edge( @@ -277,9 +272,9 @@ def setup_multiplier(**kwargs): "Do not confuse this value with static setback requirements. " "Ignore text with clauses such as " "'no lesser than', 'no greater than', 'the lesser of', or 'the " - "greater of'. Please start your response with either 'Yes' or " - "'No' and briefly explain your answer, stating the adder value " - "if it exists." + "greater of'. " + "{YES_NO_PROMPT} " + "State the adder value if it exists." ), ) G.add_edge("adder", "out_no_adder", condition=llm_response_starts_with_no) @@ -289,9 +284,8 @@ def setup_multiplier(**kwargs): "adder_eq", prompt=( "Does the adder value you identified satisfy the following " - "equation: `multiplier * height + `? Please begin your " - "response with either 'Yes' or 'No' and briefly explain your " - "answer." + "equation: `multiplier * height + `? " + "{YES_NO_PROMPT}" ), ) G.add_edge( @@ -384,8 +378,7 @@ def setup_conditional_min(**kwargs): "when a multiplier is used for the calculation? This value acts " "like a threshold and is often found within phrases like 'the " "greater of'. " - "Please begin your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" ), ) @@ -396,8 +389,7 @@ def setup_conditional_min(**kwargs): "Does the threshold value you identified satisfy the following " "equation: " "`setback_distance = max(, multiplier_setback)`? " - "Please begin your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" ), ) @@ -463,8 +455,7 @@ def setup_conditional_max(**kwargs): "setback distance that must be observed in all cases, even when " "a multiplier is used for the calculation? This value acts like " "a limit and is often found within phrases like 'the lesser of'. " - "Please begin your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" ), ) @@ -475,8 +466,7 @@ def setup_conditional_max(**kwargs): "Does the limit value you identified satisfy the following " "equation: " "`setback_distance = min(multiplier_setback, )`? " - "Please begin your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" ), ) diff --git a/compass/extraction/solar/graphs.py b/compass/extraction/solar/graphs.py index 0a977db0..3f0a3555 100644 --- a/compass/extraction/solar/graphs.py +++ b/compass/extraction/solar/graphs.py @@ -32,8 +32,7 @@ def setup_graph_sef_types(**kwargs): "energy farm sizes? Distinctions are often made as 'small', " "'personal', or 'private' vs 'large', 'commercial', or 'utility'. " "Sometimes the distinction uses actual MW values. " - "Please start your response with either 'Yes' or 'No' and briefly " - "explain your answer." + "{YES_NO_PROMPT}" '\n\n"""\n{text}\n"""' ), ) @@ -74,8 +73,7 @@ def setup_graph_sef_types(**kwargs): prompt=( "Does the ordinance explicitly define this system as large, " "commercial, utility-scale, or something akin to that? " - "Please start your response with either 'Yes' or 'No' and briefly " - "explain your answer." + "{YES_NO_PROMPT}" ), ) @@ -97,8 +95,7 @@ def setup_graph_sef_types(**kwargs): "(e.g. with the primary purpose of generating electricity for " "sale, as opposed to small, residential, roof-mounted, private, " "or other kinds of 'small' systems)? " - "Please start your response with either 'Yes' or 'No' and briefly " - "explain your answer." + "{YES_NO_PROMPT}" ), ) @@ -173,8 +170,7 @@ def setup_multiplier(**kwargs): "related to {ignore_features}. " "Please also only consider setbacks specifically for " "{system_size_reminder}" - "Please start your response with either 'Yes' or 'No' and briefly " - "explain your answer." + "{YES_NO_PROMPT}" ), ) G.add_edge("init", "no_multiplier", condition=llm_response_starts_with_no) @@ -187,8 +183,7 @@ def setup_multiplier(**kwargs): "text related to {ignore_features}. " "Please also only consider setbacks specifically for " "{system_size_reminder}" - "Please start your response with either 'Yes' or " - "'No' and briefly explain your answer." + "{YES_NO_PROMPT}" ), ) G.add_edge( @@ -258,9 +253,9 @@ def setup_multiplier(**kwargs): "{system_size_reminder}" "Do not confuse this value with static setback requirements. " "Ignore text with clauses such as 'no lesser than', 'no greater " - "than', 'the lesser of', or 'the greater of'. Please start your " - "response with either 'Yes' or 'No' and briefly explain your " - "answer, stating the adder value if it exists." + "than', 'the lesser of', or 'the greater of'. " + "{YES_NO_PROMPT} " + "State the adder value if it exists." ), ) G.add_edge("adder", "out_no_adder", condition=llm_response_starts_with_no) @@ -270,9 +265,8 @@ def setup_multiplier(**kwargs): "adder_eq", prompt=( "Does the adder value you identified satisfy the following " - "equation: `multiplier * height + `? Begin your " - "response with either 'Yes' or 'No' and briefly explain your " - "answer." + "equation: `multiplier * height + `? " + "{YES_NO_PROMPT}" ), ) G.add_edge( diff --git a/compass/extraction/wind/graphs.py b/compass/extraction/wind/graphs.py index e8927363..b30ddf52 100644 --- a/compass/extraction/wind/graphs.py +++ b/compass/extraction/wind/graphs.py @@ -32,8 +32,7 @@ def setup_graph_wes_types(**kwargs): "system sizes? Distinctions are often made as 'small', " "'personal', or 'private' vs 'large', 'commercial', or 'utility'. " "Sometimes the distinction uses actual MW values. " - "Please start your response with either 'Yes' or 'No' and briefly " - "explain your answer." + "{YES_NO_PROMPT}" '\n\n"""\n{text}\n"""' ), ) @@ -64,8 +63,7 @@ def setup_graph_wes_types(**kwargs): prompt=( "Does the ordinance explicitly define this system as large, " "commercial, utility-scale, or something akin to that? " - "Please start your response with either 'Yes' or 'No' and briefly " - "explain your answer." + "{YES_NO_PROMPT}" ), ) @@ -89,8 +87,7 @@ def setup_graph_wes_types(**kwargs): "(e.g. with the primary purpose of generating electricity for " "sale, as opposed to small, micro, private, onsite, or other " "kinds of 'small' systems)? " - "Please start your response with either 'Yes' or 'No' and briefly " - "explain your answer." + "{YES_NO_PROMPT}" ), ) @@ -167,8 +164,7 @@ def setup_multiplier(**kwargs): "{system_size_reminder}" "Remember that 1 is a valid multiplier, and treat any " "mention of 'fall zone' as a system height multiplier of 1. " - "Please start your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" ), ) G.add_edge("init", "no_multiplier", condition=llm_response_starts_with_no) @@ -181,8 +177,7 @@ def setup_multiplier(**kwargs): "related to {ignore_features}. " "Please also only consider setbacks specifically for " "{system_size_reminder}" - "Please start your response with either 'Yes' or " - "'No' and briefly explain your answer." + "{YES_NO_PROMPT}" ), ) G.add_edge( @@ -271,9 +266,9 @@ def setup_multiplier(**kwargs): "Do not confuse this value with static setback requirements. " "Ignore text with clauses such as " "'no lesser than', 'no greater than', 'the lesser of', or 'the " - "greater of'. Please start your response with either 'Yes' or " - "'No' and briefly explain your answer, stating the adder value " - "if it exists." + "greater of'. " + "{YES_NO_PROMPT} " + "State the adder value if it exists." ), ) G.add_edge("adder", "out_no_adder", condition=llm_response_starts_with_no) @@ -283,9 +278,8 @@ def setup_multiplier(**kwargs): "adder_eq", prompt=( "Does the adder value you identified satisfy the following " - "equation: `multiplier * height + `? Please begin your " - "response with either 'Yes' or 'No' and briefly explain your " - "answer." + "equation: `multiplier * height + `? " + "{YES_NO_PROMPT}" ), ) G.add_edge( @@ -378,8 +372,7 @@ def setup_conditional_min(**kwargs): "when a multiplier is used for the calculation? This value acts " "like a threshold and is often found within phrases like 'the " "greater of'. " - "Please begin your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" ), ) @@ -390,8 +383,7 @@ def setup_conditional_min(**kwargs): "Does the threshold value you identified satisfy the following " "equation: " "`setback_distance = max(, multiplier_setback)`? " - "Please begin your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" ), ) @@ -457,8 +449,7 @@ def setup_conditional_max(**kwargs): "setback distance that must be observed in all cases, even when " "a multiplier is used for the calculation? This value acts like " "a limit and is often found within phrases like 'the lesser of'. " - "Please begin your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" ), ) @@ -469,8 +460,7 @@ def setup_conditional_max(**kwargs): "Does the limit value you identified satisfy the following " "equation: " "`setback_distance = min(multiplier_setback, )`? " - "Please begin your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" ), ) diff --git a/compass/validation/graphs.py b/compass/validation/graphs.py index 31c2287d..b6fb8b2c 100644 --- a/compass/validation/graphs.py +++ b/compass/validation/graphs.py @@ -31,8 +31,7 @@ def setup_graph_correct_document_type(**kwargs): prompt=( "Does the following text resemble an excerpt from a legal " "statute, such as an ordinance or code? " - "Please start your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" '\n\n"""\n{text}\n"""' ), ) @@ -42,8 +41,7 @@ def setup_graph_correct_document_type(**kwargs): "check_for_laws", prompt=( "Does the text excerpt detail legal statutes/regulations? " - "Please start your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" ), ) @@ -56,8 +54,7 @@ def setup_graph_correct_document_type(**kwargs): prompt=( "Does this text appear to be from a model ordinance or other " "kind of model law? " - "Please start your response with either 'Yes' or 'No' and briefly " - "explain why you chose your answer." + "{YES_NO_PROMPT}" ), ) @@ -89,8 +86,7 @@ def setup_graph_correct_document_type(**kwargs): "adoption status, or there is not enough information to " "**confidently** conclude one way or another, default to " '"Yes".\n\n' - "Please start your response with either 'Yes' or 'No' and briefly " - "explain why you chose your answer." + "{YES_NO_PROMPT}" ), ) @@ -101,8 +97,7 @@ def setup_graph_correct_document_type(**kwargs): "is_meeting", prompt=( "Does this text appear to be from town or board meeting notes? " - "Please start your response with either 'Yes' or 'No' and briefly " - "explain why you chose your answer." + "{YES_NO_PROMPT}" ), ) @@ -113,8 +108,7 @@ def setup_graph_correct_document_type(**kwargs): "is_public_notice", prompt=( "Does this text appear to be from a public notice or letter? " - "Please start your response with either 'Yes' or 'No' and briefly " - "explain why you chose your answer." + "{YES_NO_PROMPT}" ), ) @@ -127,8 +121,7 @@ def setup_graph_correct_document_type(**kwargs): "is_single_project", prompt=( "Does this text appear to apply for a single specific project? " - "Please start your response with either 'Yes' or 'No' and briefly " - "explain why you chose your answer." + "{YES_NO_PROMPT}" ), ) @@ -141,8 +134,7 @@ def setup_graph_correct_document_type(**kwargs): "is_planning_doc", prompt=( "Does this text appear to be from a project planning document? " - "Please start your response with either 'Yes' or 'No' and briefly " - "explain why you chose your answer." + "{YES_NO_PROMPT}" ), ) @@ -152,9 +144,7 @@ def setup_graph_correct_document_type(**kwargs): G.add_node( "is_pres", prompt=( - "Does this text appear to be from a presentation? " - "Please start your response with either 'Yes' or 'No' and briefly " - "explain why you chose your answer." + "Does this text appear to be from a presentation? {YES_NO_PROMPT}" ), ) @@ -222,10 +212,8 @@ def setup_graph_correct_document_type(**kwargs): G.add_node( "is_report", prompt=( - "Does this text appear to be from a report or summary " - "document? " - "Please start your response with either 'Yes' or 'No' and briefly " - "explain why you chose your answer." + "Does this text appear to be from a report or summary document? " + "{YES_NO_PROMPT}" ), ) @@ -235,10 +223,8 @@ def setup_graph_correct_document_type(**kwargs): G.add_node( "is_article", prompt=( - "Does this text appear to be from a news article or " - "other media? " - "Please start your response with either 'Yes' or 'No' and briefly " - "explain why you chose your answer." + "Does this text appear to be from a news article or other media? " + "{YES_NO_PROMPT}" ), ) @@ -252,8 +238,7 @@ def setup_graph_correct_document_type(**kwargs): "application form, or other legal or court document that is not " "intended to detail specific laws, ordinances, and/or " "regulations? " - "Please start your response with either 'Yes' or 'No' and briefly " - "explain why you chose your answer." + "{YES_NO_PROMPT}" ), ) @@ -303,8 +288,7 @@ def setup_graph_correct_jurisdiction_type(jurisdiction, **kwargs): "information to reasonably conclude what type of " "jurisdiction it applies to? Common types of jurisdictions " "include 'state', 'county', 'city', 'township',' borough', etc. " - "Please start your response with either 'Yes' or 'No' and briefly " - "explain your answer." + "{YES_NO_PROMPT}" '\n\n"""\n{text}\n"""' ), ) @@ -318,8 +302,7 @@ def setup_graph_correct_jurisdiction_type(jurisdiction, **kwargs): "Does the legal text explicitly include enough information to " "reasonably determine the **full name** of the jurisdiction it " f"applies to? We want to know at least {names_we_want}. " - "Please start your response with either 'Yes' or 'No' and briefly " - "explain your answer." + "{YES_NO_PROMPT}" ), ) @@ -333,9 +316,9 @@ def setup_graph_correct_jurisdiction_type(jurisdiction, **kwargs): "to a statewide statute, agency, or regulatory authority? If the " "text only applies to a county, municipality, or other local " f"subdivision within {jurisdiction.state}, or if the text applies " - "to a different state entirely, or if there is no " - "reasonable basis to infer statewide application, respond with " - "'No'. Start your response with 'Yes' or 'No' and briefly explain." + "to a different state entirely, or if there is no reasonable " + "basis to infer statewide application, respond with 'No'. " + "{YES_NO_PROMPT}" ), ) @@ -360,7 +343,7 @@ def setup_graph_correct_jurisdiction_type(jurisdiction, **kwargs): "'State Zoning Administrator' are not sufficient on their own " "unless clearly linked to " f"{jurisdiction.full_name_the_prefixed}. " - "Start your response with 'Yes' or 'No' and explain briefly." + "{YES_NO_PROMPT}" ), ) G.add_edge("has_state_name", "final") @@ -388,7 +371,7 @@ def setup_graph_correct_jurisdiction_type(jurisdiction, **kwargs): "township), or the text applies to a different county or " "borough entirely, or if the scope is unclear, respond with " "'No'. " - "Start your answer with 'Yes' or 'No' and explain briefly." + "{YES_NO_PROMPT}" ), ) if not jurisdiction.subdivision_name: @@ -416,8 +399,7 @@ def setup_graph_correct_jurisdiction_type(jurisdiction, **kwargs): f"'{jurisdiction.type} Zoning Administrator' are not " "sufficient on their own unless clearly linked to " f"{jurisdiction.full_name_the_prefixed}. " - "Start your response with 'Yes' or 'No' and explain " - "briefly." + "{YES_NO_PROMPT}" ), ) G.add_edge("has_county_name", "final") @@ -446,7 +428,7 @@ def setup_graph_correct_jurisdiction_type(jurisdiction, **kwargs): f"a different {jurisdiction.type.casefold()}, or does not " "provide a reasonable basis to infer that it is limited to " "municipal governance, respond with 'No'. " - "Start your response with 'Yes' or 'No' and explain briefly." + "{YES_NO_PROMPT}" ), ) @@ -471,8 +453,7 @@ def setup_graph_correct_jurisdiction_type(jurisdiction, **kwargs): f"'{jurisdiction.type} Zoning Administrator' are not " "sufficient on their own unless clearly linked to " f"{jurisdiction.full_name_the_prefixed}. " - "Start your response with 'Yes' or 'No' and explain " - "briefly." + "{YES_NO_PROMPT}" ), ) G.add_edge("has_city_name", "final") @@ -523,8 +504,7 @@ def setup_graph_correct_jurisdiction_from_url(jurisdiction, **kwargs): "state in some way (e.g. either by full name or abbreviation)? " "**Do not** answer based on auxiliary information like county or " "city names. " - "Please start your response with either 'Yes' or 'No' and explain " - "your answer." + "{YES_NO_PROMPT}" "\n\nURL: '{url}\n'" ), ) @@ -545,8 +525,7 @@ def setup_graph_correct_jurisdiction_from_url(jurisdiction, **kwargs): f"{jurisdiction.full_county_phrase} in some way (e.g. either " "by full name or abbreviation)? **Do not** answer based on " "auxiliary information like state or city names. " - "Please start your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" "\n\nURL: '{url}\n'" ), ) @@ -569,8 +548,7 @@ def setup_graph_correct_jurisdiction_from_url(jurisdiction, **kwargs): "some way (e.g. either by full name or abbreviation)? **Do " "not** answer based on auxiliary information like state or " "county names. " - "Please start your response with either 'Yes' or 'No' and " - "briefly explain your answer." + "{YES_NO_PROMPT}" "\n\nURL: '{url}\n'" ), )