Team Ai
Apppublic

Shumaque/code-review-agent

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
models.py67 linesDownload Raw Back to server
1"""Pydantic models for Code Review Agent environment."""2 3from __future__ import annotations4 5from enum import Enum6from typing import Any7 8from pydantic import BaseModel, Field9 10from openenv.core.env_server.types import Action, Observation, State11 12 13class Severity(str, Enum):14    CRITICAL = "critical"15    HIGH = "high"16    MEDIUM = "medium"17    LOW = "low"18    INFO = "info"19 20 21class Category(str, Enum):22    BUG = "bug"23    SECURITY = "security"24    STYLE = "style"25    PERFORMANCE = "performance"26 27 28class Finding(BaseModel):29    """A single finding in a code review."""30 31    line_number: int = Field(32        ..., ge=1, description="1-indexed line in the diff where issue lives"33    )34    severity: Severity35    category: Category36    description: str = Field(..., min_length=5)37 38 39class CodeReviewAction(Action):40    """Action for code review environment - list of findings."""41 42    findings: list[Finding] = Field(43        default_factory=list, description="List of issues found in the diff"44    )45 46 47class CodeReviewObservation(Observation):48    """Observation for code review environment - diff and context."""49 50    diff: str51    file_path: str52    task_name: str53    step_number: int54    pr_context: str55 56 57class CodeReviewState(State):58    """State for code review environment."""59 60    task_name: str61    step_count: int62    done: bool63    last_reward: float64    cumulative_reward: float65    last_action: dict[str, Any] | None66    last_error: str | None67