Skip to content

Commit dcbf927

Browse files
authored
Add YES_NO_PROMPT to template (#357)
1 parent 0e5795c commit dcbf927

5 files changed

Lines changed: 101 additions & 172 deletions

File tree

compass/common/base.py

Lines changed: 36 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
"If you had to make a selection when reporting the ordinance, be sure to "
3030
"list out all the other options and their conditions in the summary."
3131
)
32+
_YES_NO_PROMPT = (
33+
"Please start your response with either 'Yes' or 'No' and briefly "
34+
"explain your answer."
35+
)
3236
_UNITS_IN_SUMMARY_PROMPT = (
3337
"Also include any clarifications about the units in the summary."
3438
)
@@ -71,6 +75,7 @@ def setup_graph_no_nodes(d_tree_name="Unknown Decision Tree", **kwargs):
7175
return nx.DiGraph(
7276
SECTION_PROMPT=_SECTION_PROMPT,
7377
SUMMARY_PROMPT=_SUMMARY_PROMPT,
78+
YES_NO_PROMPT=_YES_NO_PROMPT,
7479
UNITS_IN_SUMMARY_PROMPT=_UNITS_IN_SUMMARY_PROMPT,
7580
_d_tree_name=d_tree_name,
7681
**kwargs,
@@ -194,8 +199,7 @@ def setup_base_setback_graph(**kwargs):
194199
"{system_size_reminder}" # expected to end in space
195200
"Don't forget to pay extra attention to clarifying text found "
196201
"in parentheses and footnotes. "
197-
"Please start your response with either 'Yes' or 'No' and briefly "
198-
"explain your answer."
202+
"{YES_NO_PROMPT}"
199203
'\n\n"""\n{text}\n"""'
200204
),
201205
)
@@ -208,8 +212,7 @@ def setup_base_setback_graph(**kwargs):
208212
prompt=(
209213
"Did you infer your answer based on setback requirements from "
210214
"something other than {feature}, such as {ignore_features}? "
211-
"Please start your response with either 'Yes' or 'No' and briefly "
212-
"explain your answer."
215+
"{YES_NO_PROMPT}"
213216
),
214217
)
215218
if "roads" in kwargs.get("feature", ""):
@@ -222,8 +225,8 @@ def setup_base_setback_graph(**kwargs):
222225
"check_if_property_line",
223226
prompt=(
224227
"Is this requirement better classified as a setback from "
225-
"property lines? Please start your response with "
226-
"either 'Yes' or 'No' and briefly explain your answer."
228+
"property lines? "
229+
"{YES_NO_PROMPT}"
227230
),
228231
)
229232
G.add_edge(
@@ -272,8 +275,7 @@ def setup_participating_owner(**kwargs):
272275
"related to {ignore_features}. "
273276
"Please only consider setbacks that would apply for "
274277
"{system_size_reminder}"
275-
"Please start your response with either 'Yes' or 'No' "
276-
"and briefly explain your answer."
278+
"{YES_NO_PROMPT}"
277279
),
278280
)
279281
G.add_edge("init", "waiver", condition=llm_response_starts_with_yes)
@@ -283,8 +285,7 @@ def setup_participating_owner(**kwargs):
283285
"Does the ordinance allow **participating** {owned_type} owners "
284286
"to completely waive or reduce by an unspecified amount the "
285287
"{feature} setbacks requirements? "
286-
"Please start your response with either 'Yes' or 'No' and "
287-
"briefly explain your answer."
288+
"{YES_NO_PROMPT}"
288289
),
289290
)
290291

@@ -295,8 +296,7 @@ def setup_participating_owner(**kwargs):
295296
"Does the ordinance for {feature} setbacks explicitly specify "
296297
"that **participating** {owned_type} owners must abide to the "
297298
"same setbacks as **non-participating** {owned_type} owners? "
298-
"Please start your response with either 'Yes' or 'No' and "
299-
"briefly explain your answer."
299+
"{YES_NO_PROMPT}"
300300
),
301301
)
302302

@@ -327,8 +327,7 @@ def setup_participating_owner(**kwargs):
327327
"Does the ordinance for {feature} setbacks explicitly specify "
328328
"a **numerical** value that applies to **participating** "
329329
"{owned_type} owners? "
330-
"Please start your response with either 'Yes' or 'No' and "
331-
"briefly explain your answer."
330+
"{YES_NO_PROMPT}"
332331
),
333332
)
334333
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):
402401
"{system_size_reminder}\n"
403402
"4) Pay close attention to clarifying details in parentheses, "
404403
"footnotes, or additional explanatory text.\n"
405-
"5) Please start your response with either 'Yes' or 'No' and "
406-
"briefly explain your answer."
404+
"5) {YES_NO_PROMPT}"
407405
'\n\n"""\n{text}\n"""'
408406
),
409407
)
@@ -475,8 +473,7 @@ def setup_graph_extra_restriction(is_numerical=True, **kwargs):
475473
"{restriction} for {tech}? "
476474
"As before, focus only on {restriction} specifically for "
477475
"{system_size_reminder}"
478-
"Please start your response with either 'Yes' or 'No' and "
479-
"briefly explain your answer."
476+
"{YES_NO_PROMPT}"
480477
),
481478
)
482479
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):
494491
"Based on your response, are you still confident that the text "
495492
"**directly** states that there are no regulations around "
496493
"{restriction} for {tech}? "
497-
"Please start your response with either 'Yes' or 'No' and "
498-
"briefly explain your answer."
494+
"{YES_NO_PROMPT}"
499495
),
500496
)
501497
G.add_edge(
@@ -544,11 +540,7 @@ def _add_coverage_clarification_nodes(G): # noqa: N803
544540
G.add_edge("init", "is_area", condition=llm_response_starts_with_yes)
545541
G.add_node(
546542
"is_area",
547-
prompt=(
548-
"Is the coverage reported as an area value? "
549-
"Please start your response with either 'Yes' or 'No' and "
550-
"briefly explain your answer."
551-
),
543+
prompt="Is the coverage reported as an area value? {YES_NO_PROMPT}",
552544
)
553545
G.add_edge("is_area", "value", condition=llm_response_starts_with_no)
554546
return G
@@ -562,10 +554,8 @@ def _add_land_density_clarification_nodes(G): # noqa: N803
562554
G.add_node(
563555
"correct_density_units",
564556
prompt=(
565-
"Is the density reported as a system size **per area** "
566-
"value? "
567-
"Please start your response with either 'Yes' or 'No' and "
568-
"briefly explain your answer."
557+
"Is the density reported as a system size **per area** value? "
558+
"{YES_NO_PROMPT}"
569559
),
570560
)
571561
G.add_edge(
@@ -585,8 +575,7 @@ def _add_minimum_lot_size_clarification_nodes(G): # noqa: N803
585575
"correct_min_ls_units",
586576
prompt=(
587577
"Is the minimum lot size reported as an **area** value? "
588-
"Please start your response with either 'Yes' or 'No' and "
589-
"briefly explain your answer."
578+
"{YES_NO_PROMPT}"
590579
),
591580
)
592581
G.add_edge(
@@ -604,8 +593,7 @@ def _add_maximum_lot_size_clarification_nodes(G): # noqa: N803
604593
"correct_max_ls_units",
605594
prompt=(
606595
"Is the maximum lot size reported as an **area** value? "
607-
"Please start your response with either 'Yes' or 'No' and "
608-
"briefly explain your answer."
596+
"{YES_NO_PROMPT}"
609597
),
610598
)
611599
G.add_edge(
@@ -620,12 +608,10 @@ def _add_maximum_project_size_clarification_nodes(G): # noqa: N803
620608
G.add_node(
621609
"is_mps_area",
622610
prompt=(
623-
"Does the project size requirement specifically provide "
624-
"a system size in MW or an installation size (e.g. "
625-
"maximum number of systems or maximum number of solar "
626-
"panels)? "
627-
"Please start your response with either 'Yes' or 'No' and "
628-
"briefly explain your answer."
611+
"Does the project size requirement specifically provide a system "
612+
"size in MW or an installation size (e.g. maximum number of "
613+
"systems or maximum number of solar panels)? "
614+
"{YES_NO_PROMPT}"
629615
),
630616
)
631617
G.add_edge(
@@ -638,8 +624,7 @@ def _add_maximum_project_size_clarification_nodes(G): # noqa: N803
638624
prompt=(
639625
"Can the project size requirement be bypassed by applying "
640626
"for a permit? "
641-
"Please start your response with either 'Yes' or 'No' and "
642-
"briefly explain your answer."
627+
"{YES_NO_PROMPT}"
643628
),
644629
)
645630

@@ -658,8 +643,7 @@ def _add_maximum_turbine_height_clarification_nodes(G): # noqa: N803
658643
"Are any of the turbine height restrictions measured from a point "
659644
"other than the ground (e.g. a building height or an airspace "
660645
"level, etc.)? "
661-
"Please start your response with either 'Yes' or 'No' and "
662-
"briefly explain your answer."
646+
"{YES_NO_PROMPT}"
663647
),
664648
)
665649
G.add_edge(
@@ -675,8 +659,7 @@ def _add_maximum_turbine_height_clarification_nodes(G): # noqa: N803
675659
"We are not interested in restrictions that are relative to some "
676660
"level. Does the legal text enact any turbine height restrictions "
677661
"measured from the ground? "
678-
"Please start your response with either 'Yes' or 'No' and "
679-
"briefly explain your answer."
662+
"{YES_NO_PROMPT}"
680663
),
681664
)
682665

@@ -765,8 +748,7 @@ def _add_prohibitions_extraction_nodes(G): # noqa: N803
765748
prompt=(
766749
"Is there reason to believe that this prohibition is only "
767750
"being proposed and not yet in effect? "
768-
"Please start your response with either 'Yes' or 'No' "
769-
"and briefly explain your answer."
751+
"{YES_NO_PROMPT}"
770752
),
771753
)
772754
G.add_edge(
@@ -787,8 +769,7 @@ def _add_prohibitions_extraction_nodes(G): # noqa: N803
787769
"been previously approved?\n"
788770
" - Does it only apply if some other condition is met?\n"
789771
" - etc.\n"
790-
"Please start your response with either 'Yes' or 'No' "
791-
"and briefly explain your answer."
772+
"{YES_NO_PROMPT}"
792773
),
793774
)
794775
G.add_edge(
@@ -799,8 +780,7 @@ def _add_prohibitions_extraction_nodes(G): # noqa: N803
799780
prompt=(
800781
"Does the legal text given an expiration date for the "
801782
"prohibition, moratorium, or ban? "
802-
"Please start your response with either 'Yes' or 'No' "
803-
"and briefly explain your answer."
783+
"{YES_NO_PROMPT}"
804784
),
805785
)
806786
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
815795
prompt=(
816796
f"Today is {todays_date}. Has the prohibition, "
817797
"moratorium, or ban expired? "
818-
"Please start your response with either 'Yes' or 'No' "
819-
"and briefly explain your answer."
798+
"{YES_NO_PROMPT}"
820799
),
821800
)
822801
G.add_edge(
@@ -862,8 +841,8 @@ def setup_graph_permitted_use_districts(**kwargs):
862841
"Does the following legal text explicitly define districts where "
863842
"{tech} (or similar) are {use_type}? {clarifications}"
864843
"Pay extra attention to titles and clarifying text found in "
865-
"parentheses and footnotes. Please start your response with "
866-
"either 'Yes' or 'No' and briefly explain your answer."
844+
"parentheses and footnotes. "
845+
"{YES_NO_PROMPT}"
867846
'\n\n"""\n{text}\n"""'
868847
),
869848
)
@@ -888,8 +867,7 @@ def setup_graph_permitted_use_districts(**kwargs):
888867
"developers can site {tech} (or similar) as the primary "
889868
"use of the land/parcel/lot? Remember that this is true "
890869
"by assumption for all overlay districts. "
891-
"Please start your response with either 'Yes' or 'No' and "
892-
"briefly explain your answer."
870+
"{YES_NO_PROMPT}"
893871
),
894872
)
895873
G.add_edge(
@@ -903,8 +881,7 @@ def setup_graph_permitted_use_districts(**kwargs):
903881
"Are these districts representative of locations where "
904882
"developers can site {tech} (or similar) as an accessory "
905883
"structure and/or as a secondary use of the land/parcel/lot? "
906-
"Please start your response with either 'Yes' or 'No' and "
907-
"briefly explain your answer."
884+
"{YES_NO_PROMPT}"
908885
),
909886
)
910887
G.add_edge(

compass/extraction/small_wind/graphs.py

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ def setup_graph_wes_types(**kwargs):
3232
"system sizes? Distinctions are often made as 'small', "
3333
"'personal', or 'private' vs 'large', 'commercial', or 'utility'. "
3434
"Sometimes the distinction uses actual MW values. "
35-
"Please start your response with either 'Yes' or 'No' and briefly "
36-
"explain your answer."
35+
"{YES_NO_PROMPT}"
3736
'\n\n"""\n{text}\n"""'
3837
),
3938
)
@@ -68,8 +67,7 @@ def setup_graph_wes_types(**kwargs):
6867
"medium, non-commercial, or something akin to that (i.e. "
6968
"**not** private, micro, building-mounted and **not** large, "
7069
"commercial, or utility-scale)? "
71-
"Please start your response with either 'Yes' or 'No' and briefly "
72-
"explain your answer."
70+
"{YES_NO_PROMPT}"
7371
),
7472
)
7573

@@ -93,8 +91,7 @@ def setup_graph_wes_types(**kwargs):
9391
"energy generation system (e.g. with the primary purpose of "
9492
"generating electricity for use on-site, as opposed to large, "
9593
"commercial, utility-scale, or other kinds of 'large' systems)? "
96-
"Please start your response with either 'Yes' or 'No' and briefly "
97-
"explain your answer."
94+
"{YES_NO_PROMPT}"
9895
),
9996
)
10097

@@ -173,8 +170,7 @@ def setup_multiplier(**kwargs):
173170
"{system_size_reminder}"
174171
"Remember that 1 is a valid multiplier, and treat any "
175172
"mention of 'fall zone' as a system height multiplier of 1. "
176-
"Please start your response with either 'Yes' or 'No' and "
177-
"briefly explain your answer."
173+
"{YES_NO_PROMPT}"
178174
),
179175
)
180176
G.add_edge("init", "no_multiplier", condition=llm_response_starts_with_no)
@@ -187,8 +183,7 @@ def setup_multiplier(**kwargs):
187183
"related to {ignore_features}. "
188184
"Please also only consider setbacks specifically for "
189185
"{system_size_reminder}"
190-
"Please start your response with either 'Yes' or "
191-
"'No' and briefly explain your answer."
186+
"{YES_NO_PROMPT}"
192187
),
193188
)
194189
G.add_edge(
@@ -277,9 +272,9 @@ def setup_multiplier(**kwargs):
277272
"Do not confuse this value with static setback requirements. "
278273
"Ignore text with clauses such as "
279274
"'no lesser than', 'no greater than', 'the lesser of', or 'the "
280-
"greater of'. Please start your response with either 'Yes' or "
281-
"'No' and briefly explain your answer, stating the adder value "
282-
"if it exists."
275+
"greater of'. "
276+
"{YES_NO_PROMPT} "
277+
"State the adder value if it exists."
283278
),
284279
)
285280
G.add_edge("adder", "out_no_adder", condition=llm_response_starts_with_no)
@@ -289,9 +284,8 @@ def setup_multiplier(**kwargs):
289284
"adder_eq",
290285
prompt=(
291286
"Does the adder value you identified satisfy the following "
292-
"equation: `multiplier * height + <adder>`? Please begin your "
293-
"response with either 'Yes' or 'No' and briefly explain your "
294-
"answer."
287+
"equation: `multiplier * height + <adder>`? "
288+
"{YES_NO_PROMPT}"
295289
),
296290
)
297291
G.add_edge(
@@ -384,8 +378,7 @@ def setup_conditional_min(**kwargs):
384378
"when a multiplier is used for the calculation? This value acts "
385379
"like a threshold and is often found within phrases like 'the "
386380
"greater of'. "
387-
"Please begin your response with either 'Yes' or 'No' and "
388-
"briefly explain your answer."
381+
"{YES_NO_PROMPT}"
389382
),
390383
)
391384

@@ -396,8 +389,7 @@ def setup_conditional_min(**kwargs):
396389
"Does the threshold value you identified satisfy the following "
397390
"equation: "
398391
"`setback_distance = max(<threshold>, multiplier_setback)`? "
399-
"Please begin your response with either 'Yes' or 'No' and "
400-
"briefly explain your answer."
392+
"{YES_NO_PROMPT}"
401393
),
402394
)
403395

@@ -463,8 +455,7 @@ def setup_conditional_max(**kwargs):
463455
"setback distance that must be observed in all cases, even when "
464456
"a multiplier is used for the calculation? This value acts like "
465457
"a limit and is often found within phrases like 'the lesser of'. "
466-
"Please begin your response with either 'Yes' or 'No' and "
467-
"briefly explain your answer."
458+
"{YES_NO_PROMPT}"
468459
),
469460
)
470461

@@ -475,8 +466,7 @@ def setup_conditional_max(**kwargs):
475466
"Does the limit value you identified satisfy the following "
476467
"equation: "
477468
"`setback_distance = min(multiplier_setback, <limit>)`? "
478-
"Please begin your response with either 'Yes' or 'No' and "
479-
"briefly explain your answer."
469+
"{YES_NO_PROMPT}"
480470
),
481471
)
482472

0 commit comments

Comments
 (0)