Skip to content

Commit

Permalink
Also fix prompt for bullet count.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sid-Data-Universe committed Dec 19, 2024
1 parent 4083cef commit 867ad4b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions finetune/eval/if_eval/bullet_count.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ def __init__(self, count: int):

if count < 1:
raise ValueError(
f"BulletFrequencyRule must expect at least 1 bullet point."
f"BulletFrequencyRule must expect at least 1 '*' bullet point."
)
self.count = count

def get_prompt(self, index: int = -1) -> str:
bullet = "bullet point" if self.count == 1 else "bullet points"
return f"The response must contain exactly {self.count} {bullet} in markdown format."
return f"The response must contain exactly {self.count} '*' {bullet} in markdown format."

def matches(self, text: str, index: int = -1) -> bool:
return (
Expand Down
4 changes: 2 additions & 2 deletions tests/finetune/eval/if_eval/test_bullet_count.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ def test_get_prompt_frequency_one(self):
rule = BulletFrequencyRule(count=1)
self.assertEqual(
rule.get_prompt(),
"The response must contain exactly 1 bullet point in markdown format.",
"The response must contain exactly 1 '*' bullet point in markdown format.",
)

def test_get_prompt_frequency_two(self):
rule = BulletFrequencyRule(count=2)
self.assertEqual(
rule.get_prompt(),
"The response must contain exactly 2 bullet points in markdown format.",
"The response must contain exactly 2 '*' bullet points in markdown format.",
)


Expand Down

0 comments on commit 867ad4b

Please sign in to comment.