Spaces:
Sleeping
Sleeping
File size: 2,557 Bytes
c5292d8 |
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
"""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
|