dspy.Evaluate
dspy.Evaluate(*, devset: List[dspy.Example], metric: Optional[Callable] = None, num_threads: int = 1, display_progress: bool = False, display_table: bool = False, max_errors: int = 5, return_all_scores: bool = False, return_outputs: bool = False, provide_traceback: bool = False, failure_score: float = 0.0, **kwargs)
DSPy Evaluate class.
This class is used to evaluate the performance of a DSPy program. Users need to provide a evaluation dataset and a metric function in order to use this class. This class supports parallel evaluation on the provided dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
devset
|
List[Example]
|
the evaluation dataset. |
required |
metric
|
Callable
|
The metric function to use for evaluation. |
None
|
num_threads
|
int
|
The number of threads to use for parallel evaluation. |
1
|
display_progress
|
bool
|
Whether to display progress during evaluation. |
False
|
display_table
|
bool
|
Whether to display the evaluation results in a table. |
False
|
max_errors
|
int
|
The maximum number of errors to allow before stopping evaluation. |
5
|
return_all_scores
|
bool
|
Whether to return scores for every data record in |
False
|
return_outputs
|
bool
|
Whether to return the dspy program's outputs for every data in |
False
|
provide_traceback
|
bool
|
Whether to provide traceback information during evaluation. |
False
|
failure_score
|
float
|
The default score to use if evaluation fails due to an exception. |
0.0
|
Source code in dspy/evaluate/evaluate.py
Functions
__call__(program: dspy.Module, metric: Optional[Callable] = None, devset: Optional[List[dspy.Example]] = None, num_threads: Optional[int] = None, display_progress: Optional[bool] = None, display_table: Optional[bool] = None, return_all_scores: Optional[bool] = None, return_outputs: Optional[bool] = None)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
program
|
Module
|
The DSPy program to evaluate. |
required |
metric
|
Callable
|
The metric function to use for evaluation. if not provided, use |
None
|
devset
|
List[Example]
|
the evaluation dataset. if not provided, use |
None
|
num_threads
|
int
|
The number of threads to use for parallel evaluation. if not provided, use
|
None
|
display_progress
|
bool
|
Whether to display progress during evaluation. if not provided, use
|
None
|
display_table
|
bool
|
Whether to display the evaluation results in a table. if not provided, use
|
None
|
return_all_scores
|
bool
|
Whether to return scores for every data record in |
None
|
return_outputs
|
bool
|
Whether to return the dspy program's outputs for every data in |
None
|
Returns:
Type | Description |
---|---|
The evaluation results are returned in different formats based on the flags: |
|
|
|
|
|
|
|
|
Source code in dspy/evaluate/evaluate.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|