Commit 9edd56b 1 parent e56f9d7 commit 9edd56b Copy full SHA for 9edd56b
File tree 2 files changed +13
-17
lines changed
2 files changed +13
-17
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,11 @@ def validate_batch(
84
84
"context is required for this scoring method. Please provide a "
85
85
"dataframe column or a list of your context strings in the Test Suite."
86
86
)
87
+
88
+ if reference_batch is not None :
89
+ raise UserValueError (
90
+ "using reference is not currently supported for qa correctness"
91
+ )
87
92
return input_text_batch , context_batch
88
93
89
94
async def arun_batch (
Original file line number Diff line number Diff line change @@ -187,24 +187,15 @@ def run(
187
187
)
188
188
189
189
def _parse_response (self , response : Dict [str , Any ]) -> ScoreResult :
190
- score = None
191
- if "text" in response :
192
- llmchoice = response ["text" ][:3 ]
193
- score = LLM_CHOICE_TO_FLOAT .get (llmchoice )
194
- if score is not None :
195
- result = ScoreResult (
196
- score = score ,
197
- category = LLM_CHOICE_TO_CATEGORIES .get (
198
- llmchoice , LLM_CHOICE_TO_CATEGORIES ["default" ]
199
- ),
200
- )
201
-
202
- # return -1.0 if the LLMChain returns an invalid result
203
- if score is None :
204
- result = ScoreResult (
205
- score = - 1.0 , category = LLM_CHOICE_TO_CATEGORIES ["default" ]
190
+ llmchoice = response ["text" ][:3 ] if "text" in response else None
191
+
192
+ if llmchoice in LLM_CHOICE_TO_FLOAT :
193
+ return ScoreResult (
194
+ score = LLM_CHOICE_TO_FLOAT [llmchoice ],
195
+ category = LLM_CHOICE_TO_CATEGORIES [llmchoice ],
206
196
)
207
- return result
197
+ else :
198
+ return ScoreResult (score = - 1.0 , category = LLM_CHOICE_TO_CATEGORIES ["default" ])
208
199
209
200
@staticmethod
210
201
def validate_batch (
You can’t perform that action at this time.
0 commit comments