Skip to content

Commit 84422f1

Browse files
committed
Provide additional context even if user submits prompt
1 parent dc4d87a commit 84422f1

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

compass/plugin/one_shot/components.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,13 @@
101101
"""
102102
_DATA_PARSER_SYSTEM_PROMPT = """\
103103
You are a legal scholar extracting structured data from {desc}documents. \
104-
Follow all instructions in the following schema carefully:
105-
106-
{schema}
107-
104+
Follow all instructions in the schema descriptions carefully.\
105+
"""
106+
_DATA_PARSER_ADDITIONAL_CONTEXT = """\
108107
# ADDITIONAL CONTEXT #
109-
Today's date is {todays_date}. If a moratorium or temporary restriction \
110-
includes an explicit end date that has already passed as of today, treat it \
111-
as expired and omit that prohibition feature.\
108+
- Today's date is {todays_date}. If you are extracting a moratorium or \
109+
temporary restriction that includes an explicit end date that has already \
110+
passed as of today, treat it as expired and omit that prohibition feature.\
112111
"""
113112

114113

@@ -348,7 +347,10 @@ async def parse(self, text):
348347
)
349348

350349
todays_date = datetime.now().strftime("%B %d, %Y")
351-
sys_prompt = self.SYSTEM_PROMPT.format(
350+
sys_prompt = (
351+
f"{self.SYSTEM_PROMPT}\n\n{_DATA_PARSER_ADDITIONAL_CONTEXT}"
352+
)
353+
sys_prompt = sys_prompt.format(
352354
desc=desc, schema=self.SCHEMA, todays_date=todays_date
353355
)
354356

0 commit comments

Comments
 (0)