Skip to content

Commit 88bf7ab

Browse files
TomeHirataokhat
authored andcommitted
Document comparison operations of dspy.Prediction (#8437)
* update the docstring of dspy.Prediction * lint * Update prediction.py --------- Co-authored-by: Omar Khattab <okhat@users.noreply.github.com>
1 parent 7a92065 commit 88bf7ab

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

dspy/primitives/prediction.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22

33

44
class Prediction(Example):
5+
"""A prediction object that contains the output of a DSPy module.
6+
7+
Prediction inherits from Example.
8+
9+
To allow feedback-augmented scores, Prediction supports comparison operations
10+
(<, >, <=, >=) for Predictions with a `score` field. The comparison operations
11+
compare the 'score' values as floats. For equality comparison, Predictions are equal
12+
if their underlying data stores are equal (inherited from Example).
13+
14+
Arithmetic operations (+, /, etc.) are also supported for Predictions with a 'score'
15+
field, operating on the score value.
16+
"""
17+
518
def __init__(self, *args, **kwargs):
619
super().__init__(*args, **kwargs)
720

0 commit comments

Comments
 (0)