Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from dataflow.core import OperatorABC
from dataflow.utils.storage import DataFlowStorage
from dataflow.core import LLMServingABC
from dataflow.prompts.model_evaluation.general import AnswerJudgePrompt
from dataflow.prompts.model_evaluation.general import AnswerJudgePromptQuestion, AnswerJudgePrompt
from dataflow.core.prompt import prompt_restrict, DIYPromptABC

import re
Expand All @@ -12,15 +12,16 @@
from typing import Union

@prompt_restrict(
AnswerJudgePrompt
AnswerJudgePromptQuestion,
AnswerJudgePrompt,
)

@OPERATOR_REGISTRY.register()
class ReasoningAnswerModelJudgeFilter(OperatorABC):
def __init__(self,
system_prompt: str = "You are a helpful assistant specialized in evaluating answer correctness.",
llm_serving: LLMServingABC = None,
prompt_template: Union[AnswerJudgePrompt, DIYPromptABC] = AnswerJudgePrompt,
prompt_template: Union[AnswerJudgePromptQuestion,AnswerJudgePrompt, DIYPromptABC] = AnswerJudgePromptQuestion,
keep_all_samples: bool = False, # 新增参数,控制是否保留所有样本
):

Expand Down
2 changes: 1 addition & 1 deletion dataflow/prompts/model_evaluation/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class AnswerJudgePrompt(PromptABC):
def __init__(self):
pass

def build_prompt(self, answer, reference_answer):
def build_prompt(self, answer, reference_answer, question=None):
prompt = f"""
As an answer evaluation expert, please assess whether the following answer is correct.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __init__(self, llm_serving: LLMServingABC = None):
)

self.question_filter_step1 = ReasoningQuestionFilter(
system_prompt="You are an expert in evaluating mathematical problems. Follow the user's instructions strictly and output your final judgment in the required JSON format.",
system_prompt="You are an expert in evaluating problems. Follow the user's instructions strictly and output your final judgment in the required JSON format.",
llm_serving=self.llm_serving,
prompt_template=DiyQuestionFilterPrompt(DIY_PROMPT_QUESTION)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(self, llm_serving: LLMServingABC = None):
)

self.question_filter_step1 = ReasoningQuestionFilter(
system_prompt="You are an expert in evaluating mathematical problems. Follow the user's instructions strictly and output your final judgment in the required JSON format.",
system_prompt="You are an expert in evaluating problems. Follow the user's instructions strictly and output your final judgment in the required JSON format.",
llm_serving=self.llm_serving,
prompt_template=GeneralQuestionFilterPrompt()
)
Expand Down