CodeAutoGeneratedFilter
About 243 wordsLess than 1 minute
2025-10-09
📘 Overview
CodeAutoGeneratedFilter is a filter operator that filters auto-generated code files using scores from CodeAutoGeneratedSampleEvaluator to ensure only human-written code is retained.
__init__
def __init__(self, min_score: float = 1.0, max_score: float = 1.0, is_generated_func: Optional[Callable[[], bool]] = None)init Parameter Descriptions
| Parameter | Type | Default Value | Description |
|---|---|---|---|
| min_score | float | 1.0 | Minimum auto-generation score threshold. |
| max_score | float | 1.0 | Maximum auto-generation score threshold. |
| is_generated_func | Optional[Callable[[], bool]] | None | Optional external detection function for additional validation. |
Prompt Template Descriptions
| Prompt Template Name | Primary Use | Applicable Scenarios | Feature Description |
|---|---|---|---|
run
def run(self, storage: DataFlowStorage, input_key: str, output_key: str = "auto_generated_filter_label")Parameters
| Name | Type | Default Value | Description |
|---|---|---|---|
| storage | DataFlowStorage | Required | Data storage object responsible for reading and writing data. |
| input_key | str | Required | Input column name, corresponding to the code field. |
| output_key | str | "auto_generated_filter_label" | Output column name, corresponding to the generated filter label. |
🧠 Example Usage
🧾 Default Output Format
| Field | Type | Description |
|---|---|---|
| [input_key] | str | The input code text. |
| CodeAutoGeneratedScore | float | A comprehensive auto-generation score from 0-1, where 1 means not auto-generated. |
| auto_generated_filter_label | int | The filter label, where 1 indicates the sample passed the filter and 0 indicates it failed. |
Example Input:
{
"code": "def add(a, b):\n # A simple function to add two numbers.\n return a + b"
}Example Output:
{
"code": "def add(a, b):\n # A simple function to add two numbers.\n return a + b",
"CodeAutoGeneratedScore": 1.0,
"auto_generated_filter_label": 1
}
