Skip to content

Commit 217e633

Browse files
authored
rename and re-classification for reasoning operators (#112)
* rename reasoning doc ops
1 parent c1b0fc6 commit 217e633

File tree

14 files changed

+232
-228
lines changed

14 files changed

+232
-228
lines changed

docs/en/notes/dev_guide/test.md

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,18 @@ The test code’s implementation can refer to `DataFlow/test/test_reasoning.py`.
1212

1313
```python
1414
import pytest
15-
from dataflow.operators.generate import (
16-
QuestionCategoryClassifier,
17-
QuestionDifficultyClassifier,
18-
QuestionGenerator,
19-
AnswerGenerator,
15+
from dataflow.operators.reasoning import (
16+
ReasoningQuestionCategorySampleEvaluator,
17+
ReasoningQuestionDifficultySampleEvaluator,
18+
ReasoningQuestionGenerator,
19+
ReasoningAnswerGenerator,
20+
ReasoningAnswerFormatterFilter,
21+
ReasoningAnswerTokenLengthFilter,
22+
ReasoningAnswerNgramFilter,
23+
ReasoningAnswerGroundTruthFilter,
24+
ReasoningAnswerPipelineRootFilter,
2025
)
2126

22-
from dataflow.operators.filter import *
2327
from dataflow.utils.storage import FileStorage
2428
from dataflow.serving import APILLMServing_request, LocalModelLLMServing
2529
from dataflow.core import LLMServingABC
@@ -43,41 +47,41 @@ class ReasoningPipeline():
4347
model_source="local"
4448
)
4549

46-
self.question_filter_step1 = QuestionFilter(
50+
self.question_filter_step1 = ReasoningQuestionFilter(
4751
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.",
4852
llm_serving=llm_serving
4953
)
50-
self.question_gen_step2 = QuestionGenerator(
54+
self.question_gen_step2 = ReasoningQuestionGenerator(
5155
num_prompts=3,
5256
llm_serving=llm_serving
5357
)
54-
self.question_filter_step3 = QuestionFilter(
58+
self.question_filter_step3 = ReasoningQuestionFilter(
5559
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.",
5660
llm_serving=llm_serving
5761
)
58-
self.question_difficulty_classifier_step4 = QuestionDifficultyClassifier(
62+
self.question_difficulty_classifier_step4 = ReasoningQuestionDifficultySampleEvaluator(
5963
llm_serving=llm_serving
6064
)
61-
self.question_category_classifier_step5 = QuestionCategoryClassifier(
65+
self.question_category_classifier_step5 = ReasoningQuestionCategorySampleEvaluator(
6266
llm_serving=llm_serving
6367
)
6468
########################## branch ############################
65-
self.answer_pipeline_root_step6 = AnswerPipelineRoot()
69+
self.answer_pipeline_root_step6 = ReasoningAnswerPipelineRootFilter()
6670
########################## answer ############################
67-
self.answer_generator_step7 = AnswerGenerator(
71+
self.answer_generator_step7 = ReasoningAnswerGenerator(
6872
llm_serving=llm_serving
6973
)
7074

71-
self.answer_format_filter_step8 = AnswerFormatterFilter()
75+
self.answer_format_filter_step8 = ReasoningAnswerFormatterFilter()
7276

73-
self.answer_token_length_filter_step9 = AnswerTokenLengthFilter(
77+
self.answer_token_length_filter_step9 = ReasoningAnswerTokenLengthFilter(
7478
max_answer_token_length = 8192,
7579
tokenizer_dir = "Qwen/Qwen2.5-0.5B-Instruct"
7680
)
7781

78-
self.answer_groundtruth_filter_step10 = AnswerGroundTruthFilter()
82+
self.answer_groundtruth_filter_step10 = ReasoningAnswerGroundTruthFilter()
7983

80-
self.answer_ngram_filter_step11 = AnswerNgramFilter(
84+
self.answer_ngram_filter_step11 = ReasoningAnswerNgramFilter(
8185
min_score = 0.1,
8286
max_score = 1.0,
8387
ngrams = 5

docs/en/notes/guide/agent/DataFlow-AgentPipelineOrchestration.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ python test/test_dataflow_agent.py recommend
5858
The generated pipeline code (results may vary depending on the chosen model type and version) looks roughly like this:
5959
```python
6060
import pytest
61-
from dataflow.operators.generate.Reasoning.QuestionGenerator import QuestionGenerator
62-
from dataflow.operators.process.Reasoning.QuestionFilter import QuestionFilter
63-
from dataflow.operators.generate.Reasoning.QuestionDifficultyClassifier import QuestionDifficultyClassifier
64-
from dataflow.operators.generate.Reasoning.QuestionCategoryClassifier import QuestionCategoryClassifier
61+
from dataflow.operators.generate.Reasoning.ReasoningQuestionGenerator import ReasoningQuestionGenerator
62+
from dataflow.operators.process.Reasoning.ReasoningQuestionFilter import ReasoningQuestionFilter
63+
from dataflow.operators.generate.Reasoning.ReasoningQuestionDifficultySampleEvaluator import ReasoningQuestionDifficultySampleEvaluator
64+
from dataflow.operators.generate.Reasoning.ReasoningQuestionCategorySampleEvaluator import ReasoningQuestionCategorySampleEvaluator
6565
from dataflow.utils.storage import FileStorage
6666
from dataflow.serving import APILLMServing_request, LocalModelLLMServing_vllm, LocalModelLLMServing_sglang
6767

@@ -86,10 +86,10 @@ class RecommendPipeline():
8686
hf_local_dir="local",
8787
)
8888

89-
self.questiongenerator = QuestionGenerator(num_prompts=1, llm_serving=llm_serving)
90-
self.questionfilter = QuestionFilter(system_prompt="You are a helpful assistant.", llm_serving=llm_serving)
91-
self.questiondifficultyclassifier = QuestionDifficultyClassifier(llm_serving=llm_serving)
92-
self.questioncategoryclassifier = QuestionCategoryClassifier(llm_serving=llm_serving)
89+
self.questiongenerator = ReasoningQuestionGenerator(num_prompts=1, llm_serving=llm_serving)
90+
self.questionfilter = ReasoningQuestionFilter(system_prompt="You are a helpful assistant.", llm_serving=llm_serving)
91+
self.questiondifficultyclassifier = ReasoningQuestionDifficultySampleEvaluator(llm_serving=llm_serving)
92+
self.questioncategoryclassifier = ReasoningQuestionCategorySampleEvaluator(llm_serving=llm_serving)
9393

9494
def forward(self):
9595
self.questiongenerator.run(

docs/en/notes/guide/basicinfo/framework.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ For the augmentation, filtering, and scoring of large volumes of data with compl
2727

2828
DataFlow operators are the basic processing units that execute on raw data, typically implemented based on rules, deep learning models, or large language models (LLMs). Taking the `Reasoning Pipeline` schematic diagram above as an example, each rectangular unit can be considered an independent DataFlow operator, used to complete specific data processing tasks (such as cleaning, transformation, validation, etc.).
2929

30-
The code style of each operator in DataFlow is very concise. Below is an example of calling the `QuestionDifficultyClassifier` operator, which uses the large model backend to evaluate the difficulty level of questions:
30+
The code style of each operator in DataFlow is very concise. Below is an example of calling the `ReasoningQuestionDifficultySampleEvaluator` operator, which uses the large model backend to evaluate the difficulty level of questions:
3131

3232
```python
33-
from dataflow.operators.generate.Reasoning import QuestionDifficultyClassifier,
34-
question_difficulty_classifier = QuestionDifficultyClassifier(
33+
from dataflow.operators.generate.Reasoning import ReasoningQuestionDifficultySampleEvaluator,
34+
question_difficulty_classifier = ReasoningQuestionDifficultySampleEvaluator(
3535
llm_serving=llm_serving # Pass in a large model LLMServing class as the backend
3636
)
3737
question_difficulty_classifier.run(

0 commit comments

Comments
 (0)