diff --git a/backend/oasst_backend/api/v1/text_labels.py b/backend/oasst_backend/api/v1/text_labels.py index 5b18e4ea..03fd2cb4 100644 --- a/backend/oasst_backend/api/v1/text_labels.py +++ b/backend/oasst_backend/api/v1/text_labels.py @@ -38,5 +38,8 @@ def label_text( @router.get("/valid_labels") def get_valid_lables() -> ValidLabelsResponse: return ValidLabelsResponse( - valid_labels=[LabelOption(name=l.value, description=l.description) for l in protocol_schema.TextLabel] + valid_labels=[ + LabelOption(name=l.value, display_text=l.display_text, help_text=l.help_text) + for l in protocol_schema.TextLabel + ] ) diff --git a/backend/oasst_backend/schemas/text_labels.py b/backend/oasst_backend/schemas/text_labels.py index e7160236..9135c558 100644 --- a/backend/oasst_backend/schemas/text_labels.py +++ b/backend/oasst_backend/schemas/text_labels.py @@ -1,9 +1,12 @@ +from typing import Optional + from pydantic import BaseModel class LabelOption(BaseModel): name: str - description: str + display_text: str + help_text: Optional[str] class ValidLabelsResponse(BaseModel): diff --git a/oasst-shared/oasst_shared/schemas/protocol.py b/oasst-shared/oasst_shared/schemas/protocol.py index b87575a9..cbfbeca5 100644 --- a/oasst-shared/oasst_shared/schemas/protocol.py +++ b/oasst-shared/oasst_shared/schemas/protocol.py @@ -265,10 +265,11 @@ class MessageRanking(Interaction): class TextLabel(str, enum.Enum): """A label for a piece of text.""" - def __new__(cls, label, description=""): + def __new__(cls, label: str, display_text: str = "", help_text: str = None): obj = str.__new__(cls, label) obj._value_ = label - obj.description = description + obj.display_text = display_text + obj.help_text = help_text return obj spam = "spam" @@ -277,6 +278,7 @@ class TextLabel(str, enum.Enum): violence = "violence", "Encourages or fails to discourage violence/abuse/terrorism/self-harm" harmful = ( "harmful", + "Harmful content", "The advice given in the output is harmful or counter-productive. This may be in addition to, but is distinct from the question about encouraging violence/abuse/terrorism/self-harm.", ) sexual_content = "sexual_content", "Contains sexual content"