Spaces:
Sleeping
Sleeping
Download evaluator_agent.py from lemosryan007/deep_research: direct link, hf CLI and curl.
- Browser
- Download file 1.67 kB
-
https://huggingface.co/spaces/lemosryan007/deep_research/resolve/main/evaluator_agent.py
- Command line
-
hf download hf://spaces/lemosryan007/deep_research/evaluator_agent.py
-
curl -L -o evaluator_agent.py https://huggingface.co/spaces/lemosryan007/deep_research/resolve/main/evaluator_agent.py
1.67 kB
| # evaluator_agent.py | |
| from pydantic import BaseModel, Field | |
| from typing import List, Literal, Optional | |
| from agents import Agent | |
| class EvalFeedback(BaseModel): | |
| coverage_score: int = Field( | |
| description="0-100 score for how well current summaries answer the refined query." | |
| ) | |
| missing_questions: List[str] = Field( | |
| default_factory=list, | |
| description="Specific questions/topics still missing or weakly covered." | |
| ) | |
| action: Literal["finalize", "continue", "refine_plan"] = Field( | |
| description="Controller decision recommendation." | |
| ) | |
| additional_queries: List[str] = Field( | |
| default_factory=list, | |
| description="Concrete search queries to run next if action=continue." | |
| ) | |
| INSTRUCTIONS = ( | |
| "You are a research evaluator. You receive a refined query and a set of summaries. " | |
| "Assess coverage breadth, depth, recency, and authoritativeness. " | |
| "Respond in JSON strictly matching the EvalFeedback schema:\n" | |
| "{\n" | |
| ' "coverage_score": <int 0-100>,\n' | |
| ' "missing_questions": [<string>...],\n' | |
| ' "action": "finalize" | "continue" | "refine_plan",\n' | |
| ' "additional_queries": [<string>...]\n' | |
| "}\n\n" | |
| "Heuristics:\n" | |
| "- If coverage_score >= 85 and critical gaps are minimal -> finalize.\n" | |
| "- If gaps are specific and can be filled by a few targeted searches -> continue and provide 3-5 queries.\n" | |
| "- If the plan itself seems mis-scoped (wrong regions, timeframe, entities) -> refine_plan and say what to fix." | |
| ) | |
| evaluator_agent = Agent( | |
| name="EvaluatorAgent", | |
| instructions=INSTRUCTIONS, | |
| model="gpt-4o-mini", | |
| output_type=EvalFeedback, | |
| ) | |