@@ -1059,7 +1059,7 @@ def compute(self, responses: list[ModelResponse], docs: list[Doc], **kwargs) ->
10591059 questions = [formatted_doc .query for formatted_doc in docs ]
10601060 options = [formatted_doc .choices for formatted_doc in docs ]
10611061 golds = [formatted_doc .get_golds ()[0 ] for formatted_doc in docs ]
1062- predictions = [response .text [0 ] for response in responses ]
1062+ predictions = [response .final_text [0 ] for response in responses ]
10631063
10641064 scores , messages , judgements = self .judge .evaluate_answer_batch (questions , predictions , options , golds )
10651065
@@ -1077,18 +1077,21 @@ def compute(self, responses: list[ModelResponse], docs: list[Doc], **kwargs) ->
10771077
10781078
10791079class JudgeLLMMTBench (JudgeLLM ):
1080- def compute (self , model_response : list [ModelResponse ], docs : list [Doc ], ** kwargs ):
1080+ def compute (self , model_response : list [ModelResponse ], doc : list [Doc ], ** kwargs ):
10811081 """Compute the score of a generative task using a llm as a judge.
10821082 The generative task can be multiturn with 2 turns max, in that case, we
10831083 return scores for turn 1 and 2. Also returns user_prompt and judgement
10841084 which are ignored later by the aggregator.
10851085 """
10861086 import json
10871087
1088+ model_responses = as_list (model_response )
1089+ docs = as_list (doc )
1090+
10881091 # If we are evaluating a multiturn task, we need to have specific field in the formatted doc
10891092 questions = [doc .specific ["multi_turn_queries" ] for doc in docs ]
10901093 golds = [doc .specific .get ("reference" , None ) for doc in docs ]
1091- predictions = [response .text [0 ] for response in model_response ]
1094+ predictions = [response .final_text [0 ] for response in model_responses ]
10921095
10931096 query_context_1 = {"query" : questions [0 ], "context" : "" }
10941097 query_context_2 = {"query" : questions [1 ], "context" : predictions [0 ]}
@@ -1109,7 +1112,7 @@ def compute(self, model_response: list[ModelResponse], docs: list[Doc], **kwargs
11091112
11101113
11111114class JudgeLLMMixEval (JudgeLLM ):
1112- def compute (self , model_responses : list [ModelResponse ], docs : list [Doc ], ** kwargs ):
1115+ def compute (self , responses : list [ModelResponse ], docs : list [Doc ], ** kwargs ):
11131116 """Compute the score of a generative task using a llm as a judge.
11141117 The generative task can be multiturn with 2 turns max, in that case, we
11151118 return scores for turn 1 and 2. Also returns user_prompt and judgement
@@ -1118,7 +1121,7 @@ def compute(self, model_responses: list[ModelResponse], docs: list[Doc], **kwarg
11181121 questions = [doc .specific ["question" ] for doc in docs ]
11191122 options = [doc .choices for doc in docs ]
11201123 golds = [doc .get_golds ()[0 ] for doc in docs ]
1121- predictions = [response .text [0 ] for response in model_responses ]
1124+ predictions = [response .final_text [0 ] for response in responses ]
11221125
11231126 scores , messages , judgements = self .judge .evaluate_answer_batch (questions , predictions , options , golds )
11241127
@@ -1127,8 +1130,8 @@ def compute(self, model_responses: list[ModelResponse], docs: list[Doc], **kwarg
11271130 metrics .append (
11281131 {
11291132 f"judge_score_{ self .short_judge_name } " : scores [i ],
1130- f"user_prompt_{ self .short_judge_name } " : messages [i ],
1131- f"judgement_{ self .short_judge_name } " : judgements [i ],
1133+ # f"user_prompt_{self.short_judge_name}": messages[i],
1134+ # f"judgement_{self.short_judge_name}": judgements[i],
11321135 }
11331136 )
11341137
0 commit comments