Skip to content

Commit

Permalink
improve chatGPT system prompt for numeric answers
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreFCruz committed Dec 3, 2024
1 parent 04975ad commit 63c4ac7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions folktexts/classifier/web_api_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def _query_webapi_batch(
# > Therefore: for multi-token answers, extra forward passes may be required
else:
# Add extra tokens for textual prefix, e.g., "The probability is: ..."
num_forward_passes = question.num_forward_passes + 8
num_forward_passes = question.num_forward_passes + 2

api_call_params = dict(
temperature=1,
Expand All @@ -176,8 +176,12 @@ def _query_webapi_batch(

# Get system prompt depending on Q&A type
if isinstance(question, DirectNumericQA):
# system_prompt = "Please respond with number."
system_prompt = "Please respond with number representing the estimated probability."
system_prompt = "Your response must start with a number representing the estimated probability."
# system_prompt = (
# "You are a highly specialized assistant that always responds with a single number. "
# "For every input, you must analyze the request and respond with only the relevant single number, "
# "without any additional text, explanation, or symbols."
# )
elif isinstance(question, MultipleChoiceQA):
system_prompt = "Please respond with a single letter."
else:
Expand Down

0 comments on commit 63c4ac7

Please sign in to comment.