Skip to content

Commit 73219cf

Browse files
author
Val Brodsky
committed
Make variants internal
1 parent e1a8c08 commit 73219cf

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

libs/labelbox/src/labelbox/schema/tool_building/step_reasoning_tool.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class StepReasoningVariants:
1717
"""
1818
This class is used to define the possible options for evaluating a step
1919
Currently the options are correct, neutral, and incorrect
20+
NOTE: do not change the variant values
2021
"""
2122

2223
correct_step: Variant = field(

libs/labelbox/src/labelbox/schema/tool_building/variant.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ def asdict(self) -> Dict[str, Any]:
1616

1717

1818
@dataclass
19-
class VariantWithActions:
20-
id: int
21-
name: str
19+
class VariantWithActions(Variant):
2220
actions: List[str] = field(default_factory=list)
2321
_available_actions: Set[str] = field(default_factory=set)
2422

@@ -32,10 +30,7 @@ def reset_actions(self) -> None:
3230
self.actions = []
3331

3432
def asdict(self) -> Dict[str, Any]:
35-
data = {
36-
"id": self.id,
37-
"name": self.name,
38-
}
33+
data = super().asdict()
3934
if len(self.actions) > 0:
4035
data["actions"] = self.actions
4136

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from labelbox.schema.tool_building.variant import VariantWithActions
2+
3+
4+
def test_variant_with_actions_as_dict():
5+
variant = VariantWithActions(
6+
id=0, name="Correct", _available_actions={"regenerateSteps"}
7+
)
8+
variant.set_actions(["regenerateSteps"])
9+
assert variant.asdict() == {
10+
"id": 0,
11+
"name": "Correct",
12+
"actions": ["regenerateSteps"],
13+
}
14+
variant.reset_actions()
15+
assert variant.asdict() == {
16+
"id": 0,
17+
"name": "Correct",
18+
}

0 commit comments

Comments
 (0)