Skip to content

Commit dcc8406

Browse files
committed
Adjust the LLM prompt for key factors generation
1 parent 5ca2693 commit dcc8406

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

utils/openai.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,21 @@ def generate_keyfactors(
148148
The comment is intended to describe what might influence the predictions on the question so the key factors should only be relate to that.
149149
The key factors should be the most important things that the user is trying to say in the comment and how it might influence the predictions on the question.
150150
The key factors should be single sentences, not longer than {MAX_LENGTH} characters and they should only contain the key factor, no other text (e.g.: do not reference the user).
151+
151152
The user comment is: \n\n{comment}\n\n
152153
The Metaculus question is: \n\n{question_data}\n\n
153154
The existing key factors are: \n\n{existing_keyfactors}\n\n
154-
Do not include any key factors that are already in the existing key factors list.
155+
156+
Do not include any key factors that are already in the existing key factors list. Read that carefully and make sure you don't have any duplicates.
157+
155158
If we are not sure the comment has meaningful key factors information, return the literal string "None". Better be conservative than creating meaningless key factors.
156-
Each key factor should be a single sentence, not longer than {MAX_LENGTH} characters, and they should be coma separated without quotes or other formatting. List only the key factors, nothing else.
159+
160+
Each key factor should be a single sentence, not longer than {MAX_LENGTH} characters, and they should follow this format:
161+
- separate each key factor with a new line
162+
- do not include any other text
163+
- do not include any formatting like quotes, numbering or other punctuation
164+
- do not include any other formatting like bold or italic
165+
- do not include anything else than the key factors
157166
"""
158167
)
159168

@@ -177,4 +186,5 @@ def generate_keyfactors(
177186
if keyfactors is None or keyfactors.lower() == "none":
178187
return []
179188

180-
return keyfactors.split(",")
189+
keyfactors = keyfactors.split("\n")
190+
return [keyfactor.strip().strip('"').strip("'") for keyfactor in keyfactors]

0 commit comments

Comments
 (0)