Spaces:
Sleeping
Sleeping
File size: 986 Bytes
5716a3a 95707b2 5716a3a 95707b2 5716a3a 154f3d9 5716a3a 154f3d9 5716a3a 95707b2 | 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 | from pydantic import BaseModel, Field
from typing import Optional, Any, Dict, Callable
class SQLObservation(BaseModel):
task_id: str
broken_query: str
schema_context: Optional[str] = None
error_hint: Optional[str] = None
step_number: int
previous_attempt: Optional[str] = None
feedback: Optional[str] = None
class SQLAction(BaseModel):
corrected_query: str
class SQLReward(BaseModel):
value: float = Field(gt=0.0, lt=1.0) # strictly between, not ge/le
reason: str
class SQLTask(BaseModel):
task_id: str
difficulty: str
broken_query: str
canonical_answer: str
schema_context: Optional[str] = None
error_hint: Optional[str] = None
max_steps: int = 5
grader: Optional[Any] = Field(default=None, exclude=True)
model_config = {"arbitrary_types_allowed": True}
class StepResult(BaseModel):
observation: SQLObservation
reward: float
done: bool
info: Dict[str, Any] = Field(default_factory=dict) |