Skip to content

Commit

Permalink
fix(labelling): Fixed label prediction type
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-prosser committed Jan 31, 2024
1 parent b2f0651 commit 2a43afd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# unreleased
- Fix a bug where some label annotations cannot be applied

# v0.22.0
- Add integration commands

Expand Down
8 changes: 7 additions & 1 deletion api/src/resources/comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -624,9 +624,15 @@ pub struct Label {
pub metadata: Option<HashMap<String, JsonValue>>,
}

#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
pub enum PredictedLabelName {
Parts(Vec<String>),
String(LabelName),
}

#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
pub struct PredictedLabel {
pub name: Vec<String>,
pub name: PredictedLabelName,
#[serde(skip_serializing_if = "Option::is_none")]
pub sentiment: Option<NotNan<f64>>,
pub probability: NotNan<f64>,
Expand Down
8 changes: 5 additions & 3 deletions cli/src/commands/get/comments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use regex::Regex;
use reinfer_client::{
resources::{
comment::{
CommentTimestampFilter, MessagesFilter, PropertyFilterKind, ReviewedFilterEnum,
UserPropertiesFilter,
CommentTimestampFilter, MessagesFilter, PredictedLabelName, PropertyFilterKind,
ReviewedFilterEnum, UserPropertiesFilter,
},
dataset::{
Attribute, AttributeFilter, AttributeFilterEnum, OrderEnum, QueryRequestParams,
Expand Down Expand Up @@ -613,7 +613,9 @@ fn get_comments_from_uids(
auto_threshold_labels
.iter()
.map(|auto_threshold_label| PredictedLabel {
name: auto_threshold_label.name.to_owned(),
name: PredictedLabelName::String(LabelName(
auto_threshold_label.name.join(" > "),
)),
sentiment: None,
probability: auto_threshold_label.probability,
auto_thresholds: Some(
Expand Down

0 comments on commit 2a43afd

Please sign in to comment.