SimranShaikh commited on
Commit
6ffeef4
·
verified ·
1 Parent(s): 0ef4206
Files changed (1) hide show
  1. environment/models.py +49 -0
environment/models.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pydantic import BaseModel
2
+ from typing import Optional, Dict, Any, List
3
+
4
+
5
+ class Issue(BaseModel):
6
+ line_number: Optional[int] = None
7
+ issue_type: str # "syntax_error", "logic_bug", "security_vulnerability"
8
+ description: str
9
+ severity: str = "medium" # "low", "medium", "high", "critical"
10
+
11
+
12
+ class CodeReviewAction(BaseModel):
13
+ identified_issues: List[Issue] = []
14
+ suggested_fix: Optional[str] = None # corrected code as a string
15
+ explanation: str = ""
16
+ done: bool = False
17
+
18
+
19
+ class CodeReviewObservation(BaseModel):
20
+ task_id: str
21
+ task_name: str
22
+ difficulty: str
23
+ language: str
24
+ code_snippet: str
25
+ context: str
26
+ step_number: int
27
+ max_steps: int
28
+ previous_feedback: Optional[str] = None
29
+
30
+
31
+ class StepResult(BaseModel):
32
+ observation: CodeReviewObservation
33
+ reward: float
34
+ done: bool
35
+ info: Dict[str, Any] = {}
36
+
37
+
38
+ class ResetResult(BaseModel):
39
+ observation: CodeReviewObservation
40
+ info: Dict[str, Any] = {}
41
+
42
+
43
+ class StateResult(BaseModel):
44
+ task_id: str
45
+ step_number: int
46
+ total_reward: float
47
+ actions_history: List[Dict] = []
48
+ done: bool
49
+ initialized: bool