Skip to content

Commit

Permalink
update prompts and templates
Browse files Browse the repository at this point in the history
  • Loading branch information
crvernon committed Oct 9, 2024
1 parent 5869e17 commit 16df0de
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 16 deletions.
14 changes: 9 additions & 5 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@
if "search_phrase" not in st.session_state:
st.session_state.search_phrase = None

if "point_of_contact" not in st.session_state:
st.session_state.point_of_contact = "Jennie Rice\nIM3 Principal Investigator\n[email protected]"

# Force responsive layout for columns also on mobile
st.write(
"""<style>
Expand Down Expand Up @@ -634,7 +637,8 @@
'summary': st.session_state.summary_response,
'funding': st.session_state.funding,
'citation': st.session_state.citation,
'related_links': st.session_state.related_links
'related_links': st.session_state.related_links,
'point_of_contact': st.session_state.point_of_contact,
}

# template word document
Expand Down Expand Up @@ -898,7 +902,7 @@
# Ensure font size and bold settings are maintained for each paragraph
for paragraph in shape.text_frame.paragraphs:
for run in paragraph.runs:
run.font.size = Pt(12) # Example size for citation, adjust as needed
run.font.size = Pt(11) # Example size for citation, adjust as needed
run.font.bold = False # Citation typically isn't bold
run.alignment = PP_ALIGN.LEFT # Align citation

Expand All @@ -908,7 +912,7 @@

# Optional: Adjust font size and alignment for the objective
for paragraph in shape.text_frame.paragraphs:
paragraph.font.size = Pt(14) # Set font size
paragraph.font.size = Pt(13) # Set font size
paragraph.alignment = PP_ALIGN.LEFT # Set alignment

# Handle approach bullet points
Expand All @@ -921,7 +925,7 @@
p = shape.text_frame.add_paragraph()
p.text = approach_point
p.level = 0 # This sets it as a bullet point
p.font.size = Pt(14) # Adjust bullet point font size
p.font.size = Pt(13) # Adjust bullet point font size
p.alignment = PP_ALIGN.LEFT # Align bullet points

# Handle the impact bullet points in the same text box
Expand All @@ -934,7 +938,7 @@
p = shape.text_frame.add_paragraph()
p.text = impact_point
p.level = 0 # This sets it as a bullet point
p.font.size = Pt(14) # Adjust bullet point font size
p.font.size = Pt(13) # Adjust bullet point font size
p.alignment = PP_ALIGN.LEFT # Align bullet points

# Save the modified presentation to a BytesIO object
Expand Down
Binary file modified highlight/data/highlight_template.docx
Binary file not shown.
Binary file modified highlight/data/highlight_template.pptx
Binary file not shown.
27 changes: 19 additions & 8 deletions highlight/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
with two pound signs and ends with four pound signs:
##
TEXT: {0}
RESPONSE: Defines key terms and concepts for the field of MultiSector Dynamics and identifies important science questions driving the field forward.
RESPONSE: Define key terms and concepts for the field of MultiSector Dynamics and identifies important science questions driving the field forward.
###
TEXT: {1}
RESPONSE: Understand the effects of temperature and drought extremes on the Western U.S. power grid, while taking into account the increasing penetration of variable renewable energy sources, using a high-resolution operational power system model.
Expand All @@ -157,18 +157,20 @@
"approach": """Clearly and concisely state in 2-3 short points how this work accomplished the stated objective from a methodolgocial perspecive.
- Do not restate the objective or include results.
- Only include methodology including but not limited to: statistical, technological, and theory based approaches.
- Here is the objective statement: {2}
- Here is the objective statement: {1}
- Use a different action verb to start sentences than what is used to begin the objective statement.
- Use active verbs for the start of each point.
- Use present tense.
- Format the results as a hyphen-separated list.
TEXT: {0}
- The response must be in a hyphen-separated list.
# Example response for the purposes of formatting
RESPONSE:
- Evaluate contemporary and hypothesized Western U.S. infrastructures with variable renewable generation shares for sensitivity to drought and Southern California heat wave scenarios on generation and load.
- Use a stochastic temperature simulation combined with spatially resolved historical drought as a toolset to incorporate other grid stressors in high-resolution power system models, leading to improved sensitivity analyses not limited by the current ability of climate models to capture extreme conditions.
###
TEXT: {1}
# Input to process
TEXT: {0}
RESPONSE:
""",

Expand All @@ -178,7 +180,16 @@
- Each point should be 1 concise sentence.
- Use present tense.
- Format the results as a hyphen-separated list.
- The response must be in a hyphen-separated list.
- Do not start sentences with 'The'.
# Example response for the purposes of formatting
RESPONSE:
- Incorporation of adaptive farmer agents in a large-scale hydrological model reduces US-wide annual water shortages by up to 42%.
- Farmer adaptation primarily occurs through the contraction of irrigated crop areas, with crop switching playing a secondary role.
- Sensitivity analysis shows that the impact of farmer adaptation on water shortage outcomes is robust across different assumptions of agent memory.
# Input to process
TEXT: {0}
RESPONSE:
""",
Expand All @@ -196,12 +207,12 @@
RESPONSE:
""",

"figure_choice": """What figure best represents the high impact content that can be easily understood by a non-technical, non-scientifc audience.
"figure_choice": """What figure from the results of the paper best represents the high impact content that can be easily understood by a non-technical, non-scientifc audience.
Limit the response to:
1. The figure name as it is written in the text,
2. An explanation of why it was chosen,
3. What the figure is about as a figure caption in less than 50 words. Use the figure name in the caption. Start this point with the phrase "CAPTION: "
TEXT: {0}
RESPONSE:
""",
Expand Down
4 changes: 1 addition & 3 deletions highlight/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,6 @@ def generate_prompt(
if additional_content is None:
additional_content = content
prompt = prompts.prompt_queue[prompt_name].format(
prompts.EXAMPLE_TEXT_TWO,
content,
additional_content
)
Expand All @@ -327,15 +326,14 @@ def generate_prompt(
additional_content
)


elif prompt_name in (
"figure",
"caption",
"impact",
"summary",
"ppt_impact",
"title",
"science",
"ppt_impact",
"figure_caption",
"figure_choice",
"citation",
Expand Down

0 comments on commit 16df0de

Please sign in to comment.