temp / shared /models.py
CheeksTheGeek's picture
Initial commit: LLM Code Deployment System
c5292d8 unverified
"""Shared data models for LLM Code Deployment system."""
from datetime import datetime
from typing import Any
from pydantic import BaseModel, Field, HttpUrl
class Attachment(BaseModel):
"""File attachment with data URI."""
name: str = Field(..., description="Attachment filename")
url: str = Field(..., description="Data URI or URL of the attachment")
class TaskRequest(BaseModel):
"""Task request sent to student endpoint."""
email: str = Field(..., description="Student email ID")
secret: str = Field(..., description="Student-provided secret")
task: str = Field(..., description="Unique task ID")
round: int = Field(..., description="Round index", ge=1)
nonce: str = Field(..., description="Nonce to pass back to evaluation URL")
brief: str = Field(..., description="App brief description")
checks: list[str] = Field(..., description="Evaluation checks")
evaluation_url: str = Field(..., description="URL to send repo details")
attachments: list[Attachment] = Field(default_factory=list, description="File attachments")
class RepoSubmission(BaseModel):
"""Repository submission sent to evaluation endpoint."""
email: str = Field(..., description="Student email ID")
task: str = Field(..., description="Task ID")
round: int = Field(..., description="Round index", ge=1)
nonce: str = Field(..., description="Nonce from request")
repo_url: str = Field(..., description="GitHub repository URL")
commit_sha: str = Field(..., description="Git commit SHA")
pages_url: str = Field(..., description="GitHub Pages URL")
class TaskRecord(BaseModel):
"""Task record in database."""
timestamp: datetime
email: str
task: str
round: int
nonce: str
brief: str
attachments: str # JSON serialized
checks: str # JSON serialized
evaluation_url: str
endpoint: str
statuscode: int | None = None
secret: str
class RepoRecord(BaseModel):
"""Repository record in database."""
timestamp: datetime
email: str
task: str
round: int
nonce: str
repo_url: str
commit_sha: str
pages_url: str
class EvaluationResult(BaseModel):
"""Evaluation result record."""
timestamp: datetime
email: str
task: str
round: int
repo_url: str
commit_sha: str
pages_url: str
check: str
score: float
reason: str
logs: str
class Submission(BaseModel):
"""Student submission from CSV."""
timestamp: datetime
email: str
endpoint: str
secret: str