Skip to content
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
2 changes: 1 addition & 1 deletion examples/classify_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def new_classify_order(rapi: RapidataClient):
.workflow(
ClassifyWorkflow(
question="What is shown in the image?",
options=["Fish", "Cat", "Wallabe", "Airplane"],
options=["Fish", "Cat", "Wallaby", "Airplane"],
)
)
.media(["examples/data/wallaby.jpg"])
Expand Down
19 changes: 11 additions & 8 deletions rapidata/rapidata_client/feature_flags/feature_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@ def __init__(self):

def to_list(self) -> list[FeatureFlagModel]:
return [FeatureFlagModel(key=name, value=value) for name, value in self._flags.items()]

def alert_on_fast_response(self, value: int):
self._flags["alertOnFastResponse"] = str(value)
self._flags["aler_on_fast_response"] = str(value)
return self
def disable_translation(self, value: bool):
self._flags["disableTranslation"] = str(value)

def disable_translation(self, value: bool = True):
self._flags["disable_translation"] = str(value)
return self

def free_text_minimum_characters(self, value: int):
self._flags["freeTextMinimumCharacters"] = str(value)
self._flags["free_text_minimum_characters"] = str(value)
return self

def no_shuffle(self, value: bool = True):
self._flags["no_shuffle"] = str(value)
return self

Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ def add_compare_rapid(self, media_paths: list[str], question: str, truth: str):
for media_path in media_paths:
if not os.path.exists(media_path):
raise FileNotFoundError(f"File not found: {media_path}")

# take only last part of truth path
truth = os.path.basename(truth)

self._rapid_parts.append(
ValidatioRapidParts(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from typing import Any
from rapidata.rapidata_client.referee.base_referee import Referee
from rapidata.api_client.models.probabilistic_attach_category_referee_config import ProbabilisticAttachCategoryRefereeConfig


class ClassifyEarlyStoppingReferee(Referee):
Expand All @@ -18,3 +20,10 @@ def to_dict(self):
"threshold": self.threshold,
"maxVotes": self.max_vote_count,
}

def to_model(self) -> Any:
return ProbabilisticAttachCategoryRefereeConfig(
_t="ProbabilisticAttachCategoryRefereeConfig",
threshold=self.threshold,
maxVotes=self.max_vote_count,
)