File size: 1,848 Bytes
7485602
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""Typed Pydantic models for the Financial Task Environment."""

from typing import Any, Dict

from pydantic import Field

from openenv.core.env_server.types import Action, Observation, State


class FinancialAction(Action):
    """Action model for the Financial Task Environment.

    Agents interact by executing Python code to read/modify xlsx files,
    or by submitting a text answer / file path.
    """

    action_type: str = Field(
        description="Action type: 'code' to execute Python, 'submit' for text answer, 'submit_file' for xlsx"
    )
    content: str = Field(
        description="Python code when action_type='code', text answer for 'submit', file path for 'submit_file'"
    )


class FinancialObservation(Observation):
    """Observation model for the Financial Task Environment.

    Contains the task description, financial data, and feedback from
    the environment after each action.
    """

    task_id: str = Field(default="", description="Current task identifier")
    task_description: str = Field(default="", description="Task instructions")
    financial_data: str = Field(default="", description="Financial data / xlsx summary")
    difficulty: str = Field(default="", description="Task difficulty: easy, medium, or hard")
    feedback: str = Field(default="", description="Feedback on the last action taken")
    current_step: int = Field(default=0, description="Current step number in the episode")
    max_steps: int = Field(default=15, description="Maximum steps allowed per episode")
    task_type: str = Field(default="", description="Type of financial task: QA or MODIFY")
    source_file: str = Field(default="", description="Path to the working xlsx file")
    available_tasks: str = Field(
        default="",
        description="Comma-separated list of available task IDs (shown on reset)",
    )