Skip to content

Fixed name of a step for step reasoning #1896

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class IncorrectStepReasoningVariant:
name: str
regenerate_steps: Optional[bool] = True
generate_and_rate_alternative_steps: Optional[bool] = True
rewrite_steps: Optional[bool] = True
rewrite_step: Optional[bool] = True
justification: Optional[bool] = True

def asdict(self) -> Dict[str, Any]:
Expand All @@ -30,8 +30,8 @@ def asdict(self) -> Dict[str, Any]:
actions.append("regenerateSteps")
if self.generate_and_rate_alternative_steps:
actions.append("generateAndRateAlternativeSteps")
if self.rewrite_steps:
actions.append("rewriteSteps")
if self.rewrite_step:
actions.append("rewriteStep")
if self.justification:
actions.append("justification")
return {"id": self.id, "name": self.name, "actions": actions}
Expand All @@ -46,7 +46,7 @@ def from_dict(
regenerate_steps="regenerateSteps" in dictionary.get("actions", []),
generate_and_rate_alternative_steps="generateAndRateAlternativeSteps"
in dictionary.get("actions", []),
rewrite_steps="rewriteSteps" in dictionary.get("actions", []),
rewrite_step="rewriteStep" in dictionary.get("actions", []),
justification="justification" in dictionary.get("actions", []),
)

Expand Down Expand Up @@ -183,11 +183,11 @@ def reset_generate_and_rate_alternative_steps(self):
"""
self.definition.variants.incorrect_step.generate_and_rate_alternative_steps = False

def reset_rewrite_steps(self):
def reset_rewrite_step(self):
"""
For live models, will require labelers to rewrite the conversation
"""
self.definition.variants.incorrect_step.rewrite_steps = False
self.definition.variants.incorrect_step.rewrite_step = False

def reset_justification(self):
"""
Expand Down
20 changes: 16 additions & 4 deletions libs/labelbox/tests/integration/test_ontology.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,17 @@ def test_step_reasoning_ontology(chat_evaluation_ontology):
break
assert step_reasoning_tool is not None
assert step_reasoning_tool["definition"]["variants"] == [
{"id": 0, "name": "Correct"},
{"id": 1, "name": "Neutral"},
{"id": 0, "name": "Correct", "actions": []},
{"id": 1, "name": "Neutral", "actions": []},
{
"id": 2,
"name": "Incorrect",
"actions": ["regenerateSteps", "generateAndRateAlternativeSteps"],
"actions": [
"regenerateSteps",
"generateAndRateAlternativeSteps",
"rewriteStep",
"justification",
],
},
]
assert step_reasoning_tool["definition"]["version"] == 1
Expand All @@ -356,14 +361,21 @@ def test_step_reasoning_ontology(chat_evaluation_ontology):
{
"id": 0,
"name": "Correct",
"actions": [],
},
{
"id": 1,
"name": "Neutral",
"actions": [],
},
{
"id": 2,
"name": "Incorrect",
"actions": ["regenerateSteps", "generateAndRateAlternativeSteps"],
"actions": [
"regenerateSteps",
"generateAndRateAlternativeSteps",
"rewriteStep",
"justification",
],
},
]
4 changes: 2 additions & 2 deletions libs/labelbox/tests/unit/test_unit_step_reasoning_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_step_reasoning_as_dict_default():
"actions": [
"regenerateSteps",
"generateAndRateAlternativeSteps",
"rewriteSteps",
"rewriteStep",
"justification",
],
},
Expand All @@ -33,7 +33,7 @@ def test_step_reasoning_as_dict_with_actions():
tool = StepReasoningTool(name="step reasoning")
tool.reset_generate_and_rate_alternative_steps()
tool.reset_regenerate_steps()
tool.reset_rewrite_steps()
tool.reset_rewrite_step()
tool.reset_justification()
assert tool.asdict() == {
"tool": "step-reasoning",
Expand Down
Loading