File size: 1,706 Bytes
7af055a
3aeb699
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7af055a
3aeb699
 
 
 
 
 
7af055a
3aeb699
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7af055a
 
 
 
 
 
 
3aeb699
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from typing import Any, Dict, Optional
from openenv.core.env_server.types import Action, Observation
from pydantic import Field

class DataCleaningAction(Action):
    """Actions the agent can take to clean a dirty dataset."""

    operation: str = Field(
        ...,
        description=(
            "Cleaning operation to apply. One of: "
            "'impute_mean', 'impute_mode', 'drop_missing_rows', "
            "'remove_duplicates', 'fix_type_errors', "
            "'remove_outliers', 'normalize_text', 'fill_quantity_mean'"
        ),
    )
    column: Optional[str] = Field(
        default=None,
        description="Target column (optional). If omitted the op applies to all relevant columns.",
    )

class DataCleaningObservation(Observation):
    """The dataset state observed after each cleaning step."""

    current_text: str = Field(
        default="",
        description="Human-readable table of the current dataset rows.",
    )
    is_normalized: bool = Field(
        default=False,
        description="True when there are no missing values, duplicates, or outliers.",
    )
    html_found: bool = Field(
        default=False,
        description="Unused field kept for API compatibility (always False).",
    )
    remaining_typos: int = Field(
        default=0,
        description=(
            "Composite count of remaining issues: "
            "missing values + duplicate rows + outlier rows."
        ),
    )
    metadata: Dict[str, Any] = Field(
        default_factory=dict,
        description=(
            "Runtime metadata: quality_score, missing_count, has_duplicates, "
            "has_outliers, ops_already_applied, recommended_next, error."
        ),
    )