Spaces:
Running
Running
File size: 2,434 Bytes
bc5aa4d 7e16649 bc5aa4d 7e16649 bc5aa4d 7e16649 bc5aa4d 7e16649 | 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 | from dataclasses import dataclass, field
from typing import Dict, List, Optional
@dataclass
class GeoAuditAction:
"""One decision the agent can take during an audit episode."""
action_type: str
target: Optional[str] = None
issue_type: Optional[str] = None
positive_type: Optional[str] = None
severity: Optional[str] = None
details: Optional[str] = None
@dataclass
class PageData:
"""The visible page features the agent can inspect."""
url: str = ""
target_query: str = ""
title_tag: str = ""
meta_description: str = ""
h1: str = ""
first_paragraph: str = ""
word_count: int = 0
headers: List[str] = field(default_factory=list)
schema_types: List[str] = field(default_factory=list)
has_author: bool = False
has_date: bool = False
has_sources: bool = False
source_count: int = 0
@dataclass
class CheckResults:
"""Stores what the agent has already inspected."""
title_tag: Optional[Dict] = None
meta_description: Optional[Dict] = None
headers: Optional[Dict] = None
schema: Optional[Dict] = None
direct_answer: Optional[Dict] = None
content_structure: Optional[Dict] = None
word_count: Optional[Dict] = None
trust_signals: Optional[Dict] = None
sources: Optional[Dict] = None
@dataclass
class GeoAuditObservation:
"""The observation returned after each reset/step."""
page: PageData = field(default_factory=PageData)
checked: CheckResults = field(default_factory=CheckResults)
flagged_issues: List[Dict] = field(default_factory=list)
marked_positives: List[Dict] = field(default_factory=list)
step_count: int = 0
max_steps: int = 10
available_actions: List[str] = field(default_factory=list)
message: str = ""
done: bool = False
reward: float = 0.0
@dataclass
class GeoAuditState:
"""Internal episode state the environment uses to grade the agent."""
episode_id: str = ""
task_id: str = ""
task_difficulty: str = ""
step_count: int = 0
max_steps: int = 10
ground_truth_issues: List[Dict] = field(default_factory=list)
ground_truth_positives: List[Dict] = field(default_factory=list)
current_page: Dict = field(default_factory=dict)
checks_performed: List[str] = field(default_factory=list)
flagged_issues: List[Dict] = field(default_factory=list)
marked_positives: List[Dict] = field(default_factory=list)
|