Skip to content

Commit 9edd56b

Browse files
committed
pr comments
1 parent e56f9d7 commit 9edd56b

File tree

2 files changed

+13
-17
lines changed

2 files changed

+13
-17
lines changed

arthur_bench/scoring/qa_quality.py

+5
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ def validate_batch(
8484
"context is required for this scoring method. Please provide a "
8585
"dataframe column or a list of your context strings in the Test Suite."
8686
)
87+
88+
if reference_batch is not None:
89+
raise UserValueError(
90+
"using reference is not currently supported for qa correctness"
91+
)
8792
return input_text_batch, context_batch
8893

8994
async def arun_batch(

arthur_bench/scoring/summary_quality.py

+8-17
Original file line numberDiff line numberDiff line change
@@ -187,24 +187,15 @@ def run(
187187
)
188188

189189
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],
206196
)
207-
return result
197+
else:
198+
return ScoreResult(score=-1.0, category=LLM_CHOICE_TO_CATEGORIES["default"])
208199

209200
@staticmethod
210201
def validate_batch(

0 commit comments

Comments
 (0)