Skip to content

Commit

Permalink
implemented family_relationships score ans
Browse files Browse the repository at this point in the history
  • Loading branch information
joesharratt1229 committed Mar 4, 2025
1 parent f29abea commit d20b008
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion reasoning_gym/graphs/family_relationships.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from dataclasses import dataclass, field
from enum import StrEnum
from itertools import count
from typing import Optional
from typing import Any, Optional

from ..factory import ProceduralDataset, register_dataset

Expand Down Expand Up @@ -356,5 +356,19 @@ def _generate_story(self, family: set[Person]) -> str:

return " ".join(story_parts)

def score_answer(self, answer: Optional[str], entry: dict[str, Any]) -> float:
reward = 0.0
if answer is not None:
try:
answer_formatted = answer.strip().lower()
solved = answer_formatted == entry["answer"].strip().lower()
if solved:
reward = 1.0
else:
reward = 0.01
except:
reward = 0.01
return reward


register_dataset("family_relationships", FamilyRelationshipsDataset, FamilyRelationshipsConfig)

0 comments on commit d20b008

Please sign in to comment.