Spaces:
Sleeping
Sleeping
Download agentgraph/shared/models/reference_based/failure.py from holistic-ai/AgentGraph: direct link, hf CLI and curl.
- Browser
- Download file 1.4 kB
-
https://huggingface.co/spaces/holistic-ai/AgentGraph/resolve/5d5103b4e4e5e7ed5e46be7c31e4cbbbbfe952b2/agentgraph/shared/models/reference_based/failure.py
- Command line
-
hf download hf://spaces/holistic-ai/AgentGraph@5d5103b4e4e5e7ed5e46be7c31e4cbbbbfe952b2/agentgraph/shared/models/reference_based/failure.py
-
curl -L -o failure.py https://huggingface.co/spaces/holistic-ai/AgentGraph/resolve/5d5103b4e4e5e7ed5e46be7c31e4cbbbbfe952b2/agentgraph/shared/models/reference_based/failure.py
1.4 kB
| from pydantic import BaseModel, Field | |
| from typing import List, Optional, Literal | |
| from .content_reference import ContentReference | |
| import uuid | |
| # Predefined risk types derived from "Who & When" taxonomy (simplified) | |
| RiskType = Literal[ | |
| "AGENT_ERROR", # incorrect reasoning or knowledge within an agent | |
| "PLANNING_ERROR", # wrong high-level plan or task breakdown | |
| "EXECUTION_ERROR", # tool call / code execution failure | |
| "RETRIEVAL_ERROR", # failed to fetch needed information | |
| "HALLUCINATION", # fabricated content or invalid assumption | |
| ] | |
| class Failure(BaseModel): | |
| """Represents a failure / risk event located via ContentReference.""" | |
| id: str = Field(default_factory=lambda: str(uuid.uuid4()), description="Unique identifier for the failure event") | |
| risk_type: RiskType = Field(..., description="Categorised failure type (predefined list)") | |
| description: str = Field(..., description="One-sentence explanation of the failure") | |
| raw_text: str = Field("", description="Exact snippet of trace text that evidences the failure (can be left blank and recovered via raw_text_ref)") | |
| raw_text_ref: List[ContentReference] = Field(..., description="List of references to every occurrence of the failure evidence in the trace") | |
| affected_id: str = Field(..., description="ID of related Entity or Relation responsible for or impacted by the failure") |