Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

Document comparison operations of dspy.Prediction (#8437)

TomuHiratafc9c0dd75d72
diff --git a/dspy/primitives/prediction.py b/dspy/primitives/prediction.py
index 670b816b2..4f32fe9fc 100644
--- a/dspy/primitives/prediction.py
+++ b/dspy/primitives/prediction.py
@@ -2,6 +2,19 @@ from dspy.primitives.example import Example
class Prediction(Example):
+ """A prediction object that contains the output of a DSPy module.
+
+ Prediction inherits from Example.
+
+ To allow feedback-augmented scores, Prediction supports comparison operations
+ (<, >, <=, >=) for Predictions with a `score` field. The comparison operations
+ compare the 'score' values as floats. For equality comparison, Predictions are equal
+ if their underlying data stores are equal (inherited from Example).
+
+ Arithmetic operations (+, /, etc.) are also supported for Predictions with a 'score'
+ field, operating on the score value.
+ """
+
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)