-
Notifications
You must be signed in to change notification settings - Fork 68
[MODEL-1448] Upsert label feedback method #1684
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
Changes from 1 commit
8d5b97c
1fd1d57
2b9c0b6
3dd32d4
2c2d070
55c710b
1d49d35
a859280
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2216,3 +2216,27 @@ def get_embedding_by_name(self, name: str) -> Embedding: | |
return e | ||
raise labelbox.exceptions.ResourceNotFoundError(Embedding, | ||
dict(name=name)) | ||
|
||
def upsert_label_feedback(self, label_id: str, feedback: str, | ||
scores: Dict[str, float]) -> Entity.Label: | ||
""" | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extra whitespace |
||
Args: | ||
label_id: Target label ID | ||
feedback: Free text comment regarding the label | ||
scores: A dict of scores, the key is a score name and the value is the score value | ||
Returns: A list of LabelScore instances | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. white space between to keep style consistent with other methods |
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extra whitespace |
||
""" | ||
mutation_str = """mutation UpsertAutoQaLabelFeedbackPyApi($labelId: ID!, $feedback: String!, $scores: Json!){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would be nice to keep mutation string formatted to keep style consistency across the file |
||
upsertAutoQaLabelFeedback(input: {labelId: $labelId, feedback: $feedback, scores: $scores}) { id scores {id name score} } | ||
} | ||
""" | ||
res = self.execute(mutation_str, { | ||
"labelId": label_id, | ||
"feedback": feedback, | ||
"scores": scores | ||
}) | ||
scores_raw = res["upsertAutoQaLabelFeedback"]["scores"] | ||
|
||
return [Entity.LabelScore(self, x) for x in scores_raw] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from labelbox.orm.db_object import DbObject | ||
from labelbox.orm.model import Field | ||
|
||
|
||
class LabelScore(DbObject): | ||
""" | ||
a label score | ||
|
||
Attributes | ||
name | ||
score | ||
|
||
""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would be nice to preserve the same docs style format as with the rest of schema objects. Look There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I understand this class correctly, this is just a |
||
|
||
name = Field.String("name") | ||
data_row_count = Field.Float("score") | ||
|
||
def __init__(self, client, *args, **kwargs): | ||
super().__init__(client, *args, **kwargs) |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return type is
Entity.Label
, but actual type isList[Entity.Label]
. Probably its better to match the actual returned type