Spaces:
Sleeping
Sleeping
File size: 1,774 Bytes
0d7c387 | 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 | """
Data models for the CSV Cleaner Environment.
The CSV Cleaner environment simulates real-world data cleaning tasks
where an AI agent must clean messy CSV datasets using structured commands.
"""
from typing import Any, Dict, List, Optional
from pydantic import Field
try:
from openenv.core.env_server.types import Action, Observation
except ImportError:
from openenv.core.env_server.types import Action, Observation
class CsvCleanerAction(Action):
"""Action for the CSV Cleaner environment — a cleaning command with parameters."""
command: str = Field(
...,
description=(
"Cleaning command to execute. One of: rename_column, cast_column, "
"fill_missing, drop_missing, drop_duplicates, filter_rows, "
"strip_whitespace, replace_values"
),
)
params: Dict[str, Any] = Field(
default_factory=dict,
description="Command-specific parameters (see README for each command's params)",
)
class CsvCleanerObservation(Observation):
"""Observation from the CSV Cleaner environment — current dataset state."""
columns: List[Dict[str, Any]] = Field(
default_factory=list,
description="Column metadata: name, dtype, null_count, unique_count, sample_values",
)
row_count: int = Field(default=0, ge=0, description="Current number of rows")
duplicate_count: int = Field(default=0, ge=0, description="Number of duplicate rows")
task_description: str = Field(default="", description="Description of the cleaning objective")
last_action_result: str = Field(default="", description="Result of the last action (success/error)")
progress: float = Field(default=0.0, ge=0.0, le=1.0, description="Progress toward target (0.0-1.0)")
|