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.
ClassificationPrediction
#
Bases: _Prediction
Labeled prediction result from a ClassificationModel
Attributes:
-
prediction_id
–Unique identifier of this prediction used for feedback
-
label
(int
) –Label predicted by the model
-
label_name
(str
) –Human-readable name of the label
-
confidence
(str
) –Confidence of the prediction
-
anomaly_score
(str
) –Anomaly score of the input
-
input_value
(str
) –The input value used for the prediction
-
expected_label
(int | None
) –Expected label for the prediction, useful when evaluating the model
-
expected_label_name
(str | None
) –Human-readable name of the expected label
-
memory_lookups
(list[LabeledMemoryLookup]
) –Memories used by the model to make the prediction
-
explanation
(list[LabeledMemoryLookup]
) –Natural language explanation of the prediction, only available if the model has the Explain API enabled
-
tags
(list[LabeledMemoryLookup]
) –Tags for the prediction, useful for filtering and grouping predictions
-
model
(ClassificationModel
) –Model used to make the prediction
-
memoryset
(LabeledMemoryset
) –Memoryset that was used to lookup memories to ground the prediction
explain
#
Print an explanation of the prediction as a stream of text.
Parameters:
-
refresh
(bool
, default:False
) –Force the explanation agent to re-run even if an explanation already exists.
get
classmethod
#
Fetch a prediction or predictions
Parameters:
Returns:
Raises:
-
LookupError
–If no prediction with the given id is found
Examples:
Fetch a single prediction:
Fetch multiple predictions:
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.
inspect
#
Display an interactive UI with the details about this prediction
Parameters:
-
**kwargs
–Additional keyword arguments to pass to the display function
Note
This method is only available in Jupyter notebooks.
RegressionPrediction
#
Bases: _Prediction
Score-based prediction result from a RegressionModel
Attributes:
-
prediction_id
–Unique identifier of this prediction used for feedback
-
score
(float
) –Score predicted by the model
-
confidence
(float
) –Confidence of the prediction
-
anomaly_score
(float
) –Anomaly score of the input
-
input_value
(float
) –The input value used for the prediction
-
expected_score
(float | None
) –Expected score for the prediction, useful when evaluating the model
-
memory_lookups
(list[ScoredMemoryLookup]
) –Memories used by the model to make the prediction
-
explanation
(str
) –Natural language explanation of the prediction, only available if the model has the Explain API enabled
-
tags
(str
) –Tags for the prediction, useful for filtering and grouping predictions
-
model
(RegressionModel
) –Model used to make the prediction
-
memoryset
(ScoredMemoryset
) –Memoryset that was used to lookup memories to ground the prediction
explanation
property
#
The explanation for this prediction. Requires lighthouse_client_api_key
to be set.
explain
#
Print an explanation of the prediction as a stream of text.
Parameters:
-
refresh
(bool
, default:False
) –Force the explanation agent to re-run even if an explanation already exists.
get
classmethod
#
Fetch a prediction or predictions
Parameters:
Returns:
Raises:
-
LookupError
–If no prediction with the given id is found
Examples:
Fetch a single prediction:
Fetch multiple predictions:
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.
inspect
#
Display an interactive UI with the details about this prediction
Parameters:
-
**kwargs
–Additional keyword arguments to pass to the display function
Note
This method is only available in Jupyter notebooks.