Spaces:
Runtime error
Runtime error
File size: 1,866 Bytes
0683cf4 | 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 51 52 53 54 | from typing import Optional, List
from pydantic import Field
from openenv.core.env_server.types import Action, Observation, State
class SQLAction(Action):
action_type: str = Field(
...,
description="Either 'submit_fix' to submit a corrected SQL query, or 'request_hint' to get a hint.",
)
sql_query: Optional[str] = Field(
default=None,
description="The corrected SQL query. Required when action_type is 'submit_fix'.",
)
class SQLObservation(Observation):
# The broken query the agent needs to fix
broken_query: str = Field(..., description="The SQL query that contains a bug.")
schema_description: str = Field(..., description="Description of the database schema.")
task_description: str = Field(..., description="What the correct query should return.")
# Feedback from the last action
execution_result: str = Field(
default="", description="Output or error from executing the submitted query."
)
is_correct: bool = Field(
default=False, description="Whether the last submitted query was correct."
)
hint: Optional[str] = Field(
default=None, description="A hint, if one was requested."
)
# Progress info
steps_taken: int = Field(default=0, description="Number of actions taken so far.")
max_steps: int = Field(default=5, description="Maximum allowed actions.")
hints_used: int = Field(default=0, description="Number of hints used so far.")
class SQLState(State):
challenge_id: str = ""
broken_query: str = ""
correct_query: str = ""
schema_sql: str = ""
schema_description: str = ""
task_description: str = ""
hints: List[str] = Field(default_factory=list)
steps_taken: int = 0
max_steps: int = 5
hints_used: int = 0
is_resolved: bool = False
cumulative_reward: float = 0.0
|