CoolFace
Apppublic

vasiuuu/DGX_AI

sourceHugging Faceupdated 5mo agoView on Hugging Face
0likes
models.py74 linesDownload Raw Back to codeforge
1from __future__ import annotations2 3from dataclasses import dataclass4from enum import StrEnum5 6from openenv.core.env_server.types import Action, Observation7from pydantic import Field8 9 10class CodeForgeActionType(StrEnum):11    QUERY_KB = "query_kb"12    QUERY_CLUSTER = "query_cluster"13    INTERROGATE = "interrogate"14    RUN_RALPH = "run_ralph"15    SUBMIT = "submit"16    GET_AUDIT = "get_audit"17 18 19class CodeForgeAction(Action):20    action_type: CodeForgeActionType21    # query_kb fields22    claim: str | None = None23    top_k: int = 524    required_tags: tuple[str, ...] = ()25    # submit fields26    files: dict[str, str] | None = None27    confidence: float | None = Field(default=None, ge=0.0, le=1.0)28    # query_cluster fields29    cluster_label: str | None = None30    # run_ralph fields31    max_iters: int = Field(default=3, ge=1, le=10)32    # get_audit fields33    target_run_id: str | None = None34 35 36class CodeForgeObservation(Observation):37    episode_id: str38    task_id: str39    task_level: str40    task_brief: str41    initial_files: dict[str, str]42    current_files: dict[str, str]43    budget_remaining: int44    previous_score: float45    last_reward: float46    is_done: bool47    # KB results48    last_citations: tuple[dict[str, object], ...] = ()49    last_grounding: dict[str, object] | None = None50    # Cluster results51    last_cluster_hits: tuple[str, ...] = ()52    # Interrogation results53    last_interrogation_questions: tuple[str, ...] = ()54    # Ralph results55    last_ralph_run_id: str | None = None56    last_ralph_iterations: tuple[dict[str, object], ...] = ()57    # Audit summary58    cumulative_audit_summary: dict[str, object] = Field(default_factory=dict)59    # Error field60    error: str | None = None61 62 63@dataclass(frozen=True)64class AuditEntry:65    step_index: int66    action_type: str67    cited_skill_ids: tuple[str, ...]68    cited_clusters: tuple[str, ...]69    grounding_report: dict[str, object] | None70    reward: float71    brier_penalty: float | None72    confidence_declared: float | None73    quality: float74