Spaces:
Runtime error
Runtime error
Download models.py from adrija93/TDS-Project-2: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/spaces/adrija93/TDS-Project-2/resolve/main/models.py
- Command line
-
hf download hf://spaces/adrija93/TDS-Project-2/models.py
-
curl -L -o models.py https://huggingface.co/spaces/adrija93/TDS-Project-2/resolve/main/models.py
1.16 kB
| """Pydantic models for the agent system.""" | |
| from typing import List, Optional, Dict, Any, Literal | |
| from pydantic import BaseModel, Field | |
| class Message(BaseModel): | |
| """A message in the conversation.""" | |
| role: Literal["system", "user", "assistant"] | |
| content: str | |
| metadata: Dict[str, Any] = Field(default_factory=dict) | |
| class ToolCall(BaseModel): | |
| """Represents a tool invocation requested by the LLM.""" | |
| tool_name: str | |
| arguments: Dict[str, Any] | |
| class TaskResult(BaseModel): | |
| """Result from an LLM task analysis.""" | |
| question_type: Literal["code", "direct"] | |
| python_code: Optional[str] = None | |
| dependencies: List[str] = Field(default_factory=list) | |
| answer: Optional[str] = None | |
| submit_url: Optional[str] = None | |
| payload_key: str = "answer" | |
| reasoning: Optional[str] = None | |
| class QuizState(BaseModel): | |
| """State tracking for quiz solving.""" | |
| current_url: str | |
| email: str | |
| secret: Optional[str] = None | |
| messages: List[Message] = Field(default_factory=list) | |
| attempts: int = 0 | |
| max_attempts: int = 3 | |
| last_error: Optional[str] = None | |
| score: int = 0 | |
| total_questions: int = 0 | |