Skip to content

Commit bf98fb1

Browse files
committed
Refactored to include_text_prompt_template to be clear
1 parent 0519905 commit bf98fb1

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/paperqa/prompts.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
from datetime import datetime
22

3+
include_text_prompt_template = (
4+
"Excerpt from {citation}\n\n------------\n\n{text}\n\n------------"
5+
"\n\nQuestion: {question}"
6+
)
7+
38
summary_prompt = (
4-
"Summarize the excerpt below to help answer a question.\n\nExcerpt from"
5-
" {citation}\n\n------------\n\n{text}\n\n------------"
6-
"\n\nQuestion: {question}\n\nDo not directly"
7-
" answer the question, instead summarize to give evidence to help answer the"
9+
"Summarize the excerpt below to help answer a question."
10+
f"\n\n{include_text_prompt_template}"
11+
"\n\nDo not directly answer the question,"
12+
" instead summarize to give evidence to help answer the"
813
" question. Stay detailed; report specific numbers, equations, or direct quotes"
914
' (marked with quotation marks). Reply "Not applicable" if the excerpt is'
1015
" irrelevant. At the end of your response, provide an integer score from 1-10 on a"
@@ -18,11 +23,6 @@
1823
"\n\n------------\n\n{tables}"
1924
)
2025

21-
summary_json_prompt = (
22-
"Excerpt from {citation}\n\n------------\n\n{text}\n\n------------"
23-
"\n\nQuestion: {question}\n\n"
24-
)
25-
2626
# The below "cannot answer" sentinel phrase should:
2727
# 1. Lead to complete tool being called with has_successful_answer=False
2828
# 2. Can be used for unit testing

src/paperqa/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@
5858
default_system_prompt,
5959
env_reset_prompt,
6060
env_system_prompt,
61+
include_text_prompt_template,
6162
qa_prompt,
6263
select_paper_prompt,
6364
structured_citation_prompt,
64-
summary_json_prompt,
6565
summary_json_system_prompt,
6666
summary_prompt,
6767
)
@@ -397,7 +397,7 @@ class PromptSettings(BaseModel):
397397
# Not thrilled about this model,
398398
# but need to split out the system/summary
399399
# to get JSON
400-
summary_json: str = summary_json_prompt
400+
summary_json: str = include_text_prompt_template
401401
summary_json_system: str = summary_json_system_prompt
402402
context_outer: str = Field(
403403
default=CONTEXT_OUTER_PROMPT,

0 commit comments

Comments
 (0)