orca_sdk.telemetry#
FeedbackCategory
#
A category of feedback for predictions.
Categories are created automatically, the first time feedback with a new name is recorded. The value type of the category is inferred from the first recorded value. Subsequent feedback for the same category must be of the same type. Categories are not model specific.
Attributes:
-
id
(str
) –Unique identifier for the category.
-
name
(str
) –Name of the category.
-
value_type
(type[bool] | type[float]
) –Type that values for this category must have.
-
created_at
(datetime
) –When the category was created.
all
classmethod
#
Get a list of all existing feedback categories.
Returns:
-
list[FeedbackCategory]
–List with information about all existing feedback categories.
drop
classmethod
#
Drop all feedback for this category and drop the category itself, allowing it to be recreated with a different value type.
Warning
This will delete all feedback in this category across all models.
Parameters:
-
name
(str
) –Name of the category to drop.
Raises:
-
LookupError
–If the category is not found.
LabelPrediction
#
A prediction made by a model
Attributes:
-
prediction_id
(str
) –Unique identifier for the prediction
-
label
(int
) –Predicted label for the input value
-
label_name
(str | None
) –Name of the predicted label
-
confidence
(float
) –Confidence of the prediction
-
memory_lookups
(list[LabeledMemoryLookup]
) –List of memories used to ground the prediction
-
input_value
(str | None
) –Input value that this prediction was for
-
model
(ClassificationModel
) –Model that was used to make the prediction
-
memoryset
(LabeledMemoryset
) –Memoryset that was used to lookup memories to ground the prediction
-
expected_label
(int | None
) –Optional expected label that was set for the prediction
-
tags
(set[str]
) –tags that were set for the prediction
-
feedback
(dict[str, bool | float]
) –Feedback recorded, mapping from category name to value
get
classmethod
#
Fetch a prediction or predictions
Parameters:
Returns:
-
LabelPrediction | list[LabelPrediction]
–Prediction or list of predictions
Raises:
-
LookupError
–If no prediction with the given id is found
Examples:
Fetch a single prediction:
Fetch multiple predictions:
update
#
Update editable prediction properties.
Parameters:
-
expected_label
(int | None
, default:UNSET
) –Value to set for the expected label, defaults to
[UNSET]
if not provided. -
tags
(set[str] | None
, default:UNSET
) –Value to replace existing tags with, defaults to
[UNSET]
if not provided.
Examples:
Update the expected label:
Add a new tag:
Remove expected label and tags:
add_tag
#
remove_tag
#
record_feedback
#
Record feedback for the prediction.
We support recording feedback in several categories for each prediction. A
FeedbackCategory
is created automatically,
the first time feedback with a new name is recorded. Categories are global across models.
The value type of the category is inferred from the first recorded value. Subsequent
feedback for the same category must be of the same type.
Parameters:
-
category
(str
) –Name of the category under which to record the feedback.
-
value
(bool | float
) –Feedback value to record, should be
True
for positive feedback andFalse
for negative feedback or afloat
between-1.0
and+1.0
where negative values indicate negative feedback and positive values indicate positive feedback. -
comment
(str | None
, default:None
) –Optional comment to record with the feedback.
Examples:
Record whether a suggestion was accepted or rejected:
Record star rating as normalized continuous score between -1.0
and +1.0
:
Raises:
-
ValueError
–If the value does not match previous value types for the category, or is a
float
that is not between-1.0
and+1.0
.
delete_feedback
#
Delete prediction feedback for a specific category.
Parameters:
-
category
(str
) –Name of the category of the feedback to delete.
Raises:
-
ValueError
–If the category is not found.