Spaces:
Sleeping
Sleeping
Download agentgraph/shared/models/reference_based/optimization_recommendation.py from holistic-ai/AgentGraph: direct link, hf CLI and curl.
- Browser
- Download file 1.62 kB
-
https://huggingface.co/spaces/holistic-ai/AgentGraph/resolve/5d5103b4e4e5e7ed5e46be7c31e4cbbbbfe952b2/agentgraph/shared/models/reference_based/optimization_recommendation.py
- Command line
-
hf download hf://spaces/holistic-ai/AgentGraph@5d5103b4e4e5e7ed5e46be7c31e4cbbbbfe952b2/agentgraph/shared/models/reference_based/optimization_recommendation.py
-
curl -L -o optimization_recommendation.py https://huggingface.co/spaces/holistic-ai/AgentGraph/resolve/5d5103b4e4e5e7ed5e46be7c31e4cbbbbfe952b2/agentgraph/shared/models/reference_based/optimization_recommendation.py
1.62 kB
| from pydantic import BaseModel, Field | |
| from typing import List, Optional, Literal | |
| import uuid | |
| from .content_reference import ContentReference | |
| # Predefined recommendation types for common optimization scenarios | |
| RecommendationType = Literal[ | |
| "PROMPT_REFINEMENT", # Suggests improving an entity's prompt for clarity or efficiency | |
| "AGENT_MERGING", # Recommends merging two or more agents with overlapping roles | |
| "TASK_CONSOLIDATION", # Suggests combining multiple simple tasks into one | |
| "TOOL_ENHANCEMENT", # Recommends improving a tool (e.g., adding parameters, better error handling) | |
| "WORKFLOW_SIMPLIFICATION", # Suggests changes to the relationship flow (e.g., parallelizing tasks) | |
| ] | |
| class OptimizationRecommendation(BaseModel): | |
| """Represents a suggestion for improving the structure, efficiency, or clarity of the agent system.""" | |
| id: str = Field(default_factory=lambda: f"opt_{uuid.uuid4()}", description="Unique identifier for the optimization recommendation") | |
| recommendation_type: RecommendationType = Field(..., description="The category of optimization being suggested") | |
| description: str = Field(..., description="A detailed, human-readable explanation of the recommendation, including the observed pattern and the justification for the change.") | |
| affected_ids: List[str] = Field(default_factory=list, description="A list of Entity or Relation IDs that are the focus of this recommendation") | |
| raw_text_ref: List[ContentReference] = Field(default_factory=list, description="List of references to the exact trace locations related to this recommendation") | |