Agent SkillsOpenDCAI/DataFlow-WebUI › bench-dataset-evaluator-question

bench-dataset-evaluator-question

GitHub

用于评估答案正确性的算子,支持基于关键词匹配或LLM语义对比,并兼容多问题及子问题的上下文场景。

skills/canonical/core_text/eval/bench-dataset-evaluator-question/SKILL.md OpenDCAI/DataFlow-WebUI

Trigger Scenarios

需要评估生成答案与标准答案的一致性 涉及多问题或子问题的复杂评估任务

Install

npx skills add OpenDCAI/DataFlow-WebUI --skill bench-dataset-evaluator-question -g -y
More Options

Non-standard path

npx skills add https://github.com/OpenDCAI/DataFlow-WebUI/tree/main/skills/canonical/core_text/eval/bench-dataset-evaluator-question -g -y

Use without installing

npx skills use OpenDCAI/DataFlow-WebUI@bench-dataset-evaluator-question

指定 Agent (Claude Code)

npx skills add OpenDCAI/DataFlow-WebUI --skill bench-dataset-evaluator-question -a claude-code -g -y

安装 repo 全部 skill

npx skills add OpenDCAI/DataFlow-WebUI --all -g -y

预览 repo 内 skill

npx skills add OpenDCAI/DataFlow-WebUI --list

SKILL.md

Frontmatter
{
    "name": "bench-dataset-evaluator-question",
    "description": "Reference documentation for the BenchDatasetEvaluatorQuestion operator. Extended version of BenchDatasetEvaluator with question and subquestion support.\nUse when: evaluating answers with question context or multiple subquestions."
}

BenchDatasetEvaluatorQuestion Operator Reference

BenchDatasetEvaluatorQuestion extends BenchDatasetEvaluator with support for question context and subquestions.

1. Import

from dataflow.operators.core_text import BenchDatasetEvaluatorQuestion

2. Match Mode

Constructor

BenchDatasetEvaluatorQuestion(
    eval_result_path=None,
    compare_method="match",
)
Parameter Required Default Description
eval_result_path No Auto-generated Path to save evaluation statistics
compare_method No "match" Must be "match"
system_prompt No "You are a helpful assistant..." Not used in match mode
llm_serving No None Not used in match mode
prompt_template No AnswerJudgePromptQuestion Not used in match mode

run() Signature

op.run(
    storage=self.storage.step(),
    input_question_key="question",
    input_test_answer_key="generated_cot",
    input_gt_answer_key="golden_answer",
)
# returns: list of column names
Parameter Required Default Description
storage Yes None Storage step object
input_question_key No "question" Question column
input_test_answer_key No "generated_cot" Predicted answer column
input_gt_answer_key No "golden_answer" Ground truth column

Usage Example

from dataflow.operators.core_text import BenchDatasetEvaluatorQuestion
from dataflow.utils.storage import FileStorage

class MyPipeline:
    def __init__(self):
        self.storage = FileStorage(
            first_entry_file_name="./data/bench.jsonl",
            cache_path="./cache",
            file_name_prefix="step",
            cache_type="jsonl"
        )

        self.evaluator = BenchDatasetEvaluatorQuestion(
            compare_method="match",
            eval_result_path="./results/match_eval.json"
        )

    def forward(self):
        self.evaluator.run(
            storage=self.storage.step(),
            input_question_key="question",
            input_test_answer_key="predicted_answer",
            input_gt_answer_key="ground_truth"
        )

if __name__ == "__main__":
    pipeline = MyPipeline()
    pipeline.forward()

3. Semantic Mode

Constructor

BenchDatasetEvaluatorQuestion(
    eval_result_path=None,
    compare_method="semantic",
    system_prompt="You are a helpful assistant specialized in evaluating answer correctness.",
    llm_serving=llm_serving,
    prompt_template=None,
    support_subquestions=False,
)
Parameter Required Default Description
eval_result_path No Auto-generated Path to save evaluation statistics
compare_method Yes None Must be "semantic"
system_prompt No "You are..." System prompt for LLM
llm_serving Yes None LLM service object
prompt_template No AnswerJudgePromptQuestion Pass None to use built-in fallback
support_subquestions No False Enable subquestion evaluation

run() Signature

op.run(
    storage=self.storage.step(),
    input_question_key="question",
    input_test_answer_key="generated_cot",
    input_gt_answer_key="golden_answer",
)
# returns: list of column names
Parameter Required Default Description
storage Yes None Storage step object
input_question_key No "question" Question column
input_test_answer_key No "generated_cot" Predicted answer column
input_gt_answer_key No "golden_answer" Ground truth column

Usage Example

from dataflow.operators.core_text import BenchDatasetEvaluatorQuestion
from dataflow.serving import APILLMServing_request
from dataflow.utils.storage import FileStorage

class MyPipeline:
    def __init__(self):
        self.storage = FileStorage(
            first_entry_file_name="./data/bench.jsonl",
            cache_path="./cache",
            file_name_prefix="step",
            cache_type="jsonl"
        )

        self.llm_serving = APILLMServing_request(
            api_url="https://api.openai.com/v1/chat/completions",
            key_name_of_api_key="DF_API_KEY",
            model_name="gpt-4o",
            max_workers=10
        )

        self.evaluator = BenchDatasetEvaluatorQuestion(
            compare_method="semantic",
            llm_serving=self.llm_serving,
            prompt_template=None,
            support_subquestions=False
        )

    def forward(self):
        self.evaluator.run(
            storage=self.storage.step(),
            input_question_key="question",
            input_test_answer_key="predicted_answer",
            input_gt_answer_key="ground_truth"
        )

if __name__ == "__main__":
    pipeline = MyPipeline()
    pipeline.forward()

4. Key Differences from BenchDatasetEvaluator

  1. Question context: Semantic mode includes question field in the prompt alongside answer and reference_answer.
  2. Subquestions support: When support_subquestions=True, evaluates multiple subquestions per row.
  3. Prompt templates: Uses AnswerJudgePromptQuestion (single question) or AnswerJudgeMultipleQuestionsPrompt (subquestions).

5. AnswerJudgePromptQuestion

AnswerJudgePromptQuestion is the default prompt template class for semantic mode.

Important Notes on prompt_template

Although the source code sets the default value to AnswerJudgePromptQuestion, this default is a class object, not an instance.

In normal usage, it's recommended to use one of these two approaches:

Option 1: Pass None (recommended)

prompt_template=None

This uses the built-in fallback logic.

Option 2: Pass an instance

from dataflow.prompts.core_text import AnswerJudgePromptQuestion

prompt_template=AnswerJudgePromptQuestion()

Fields Passed to build_prompt(...)

When prompt_template is an AnswerJudgePromptQuestion instance, the source code passes these fields:

  • question: The question being evaluated
  • answer: The predicted answer to evaluate
  • reference_answer: The ground truth answer

Expected LLM Response Format

LLM response must contain:

{
  "judgement_result": true  // or false
}

Version History

  • 2e95d40 Current 2026-08-27 09:03

Same Skill Collection

skills/canonical/core_text/eval/bench-dataset-evaluator/SKILL.md
skills/canonical/core_text/eval/prompted-evaluator/SKILL.md
skills/canonical/core_text/eval/text2qa-sample-evaluator/SKILL.md
skills/canonical/core_text/eval/unified-bench-dataset-evaluator/SKILL.md
skills/canonical/core_text/filter/general-filter/SKILL.md
skills/canonical/core_text/filter/kcentergreedy-filter/SKILL.md
skills/canonical/core_text/filter/prompted-filter/SKILL.md
skills/canonical/core_text/generate/bench-answer-generator/SKILL.md
skills/canonical/core_text/generate/chunked-prompted-generator/SKILL.md
skills/canonical/core_text/generate/embedding-generator/SKILL.md
skills/canonical/core_text/generate/format-str-prompted-generator/SKILL.md
skills/canonical/core_text/generate/prompted-generator/SKILL.md
skills/canonical/core_text/generate/retrieval-generator/SKILL.md
skills/canonical/core_text/generate/text2multihopqa-generator/SKILL.md
skills/canonical/core_text/refine/pandas-operator/SKILL.md
skills/canonical/core_text/refine/prompted-refiner/SKILL.md
skills/canonical/core_text/SKILL.md
skills/canonical/dataflow-dev/SKILL.md
skills/canonical/dataflow-operator-builder/SKILL.md
skills/canonical/generating-dataflow-pipeline/SKILL.md
skills/canonical/prompt-template-builder/SKILL.md
skills/canonical/core_text/generate/random-domain-knowledge-row-generator/SKILL.md

Metadata

Files
0
Version
2e95d40
Hash
ad510977
Indexed
2026-08-27 09:03

Accueil - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-27 18:12
浙ICP备14020137号-1 $Carte des visiteurs$