Spaces:
Sleeping
Sleeping
Download prompts.py from psykoss/Final_Assignment_Template: direct link, hf CLI and curl.
- Browser
- Download file 5.68 kB
-
https://huggingface.co/spaces/psykoss/Final_Assignment_Template/resolve/main/prompts.py
- Command line
-
hf download hf://spaces/psykoss/Final_Assignment_Template/prompts.py
-
curl -L -o prompts.py https://huggingface.co/spaces/psykoss/Final_Assignment_Template/resolve/main/prompts.py
5.68 kB
| ROUTER_PROMPT = """ | |
| You classify GAIA benchmark questions by the primary skill needed to answer. | |
| Output ONLY valid JSON: | |
| {{ | |
| "task_type": "factual|numeric|visual|hybrid", | |
| "reason": "one short sentence" | |
| }} | |
| Task types: | |
| - factual: lookup a name, place, date, definition, or single known fact (web search is enough). | |
| - numeric: counting, arithmetic, units, percentages, or multi-step math (calculator needed). | |
| - visual: answer depends on an image, chart, diagram, screenshot, or figure (vision needed). | |
| - hybrid: needs multiple skills (e.g. read a chart AND search AND calculate). | |
| Pick exactly one task_type. Use hybrid only when two or more of search, math, and vision are clearly required. | |
| Question: | |
| {question} | |
| """ | |
| PLANNER_PROMPT = """ | |
| You are a planning agent for the GAIA benchmark (level 1). | |
| Task type for this question: {task_type} | |
| Analyze the question and output JSON only (no markdown fences). | |
| Schema (all four keys required): | |
| {{ | |
| "steps": ["3-6 actionable reasoning steps"], | |
| "search_queries": ["1-3 short keyword queries"], | |
| "calculations": ["0-5 math expressions, or []"], | |
| "image_urls": ["0-3 image URLs from the question, or []"] | |
| }} | |
| Rules for steps: | |
| - Atomic, specific (identify entities, dates, units, constraints). | |
| - If the question needs counting, differences, ratios, or multi-step arithmetic, include a step to verify with calculation. | |
| Rules for search_queries: | |
| - 1-3 items, 2-8 words each, distinct fact gaps. | |
| - NEVER copy the full question verbatim. | |
| - Target authoritative facts (names, dates, numbers, definitions). | |
| Rules for calculations: | |
| - List plain math expressions the answer depends on (e.g. "1250-380", "24*365", "sqrt(144)"). | |
| - Use only numbers and operators + - * / // ** % and functions sqrt, abs, round. | |
| - Empty array [] if no math is needed. | |
| Rules for image_urls: | |
| - Copy any http(s) image links from the question (jpg, png, gif, webp, or dataset/file URLs). | |
| - If the question refers to "the image", "this figure", "the chart", or an attachment URL, include it. | |
| - Max 3 URLs. Empty array [] if no image is involved. | |
| Question: | |
| {question} | |
| """ | |
| IMAGE_ANALYSIS_PROMPT = """ | |
| You are a vision analyst for GAIA benchmark questions. | |
| Describe everything in the image that could help answer the question: | |
| - Text (OCR): transcribe labels, numbers, titles, legends, axes, units. | |
| - Objects, people, places, charts, tables, maps. | |
| - Counts, colors, dates, and relationships visible in the image. | |
| - If a chart/graph: report series names, values, trends, min/max. | |
| Be factual and specific. Do not answer the question yet — only report visual evidence. | |
| Question: | |
| {question} | |
| Image URL: | |
| {url} | |
| """ | |
| SYNTHESIS_ANSWER_PROMPT = """ | |
| You are a GAIA research agent. Use search results, math tool outputs, image vision notes, and the plan to answer. | |
| Return ONLY valid JSON: | |
| {{ | |
| "synthesis_notes": "- bullet facts (max 14, prefix '- ')", | |
| "draft_answer": "best answer before final formatting" | |
| }} | |
| Rules: | |
| - synthesis_notes: relevant facts only; note conflicts if sources disagree. | |
| - draft_answer: concise, directly answers the question; use math results when provided. | |
| - For numeric questions, compute carefully and show the number you believe is correct. | |
| - Do not copy long search snippets into draft_answer. | |
| Question: | |
| {question} | |
| Plan: | |
| {plan} | |
| Math tool results: | |
| {math_results} | |
| Image vision analysis: | |
| {vision_results} | |
| Search results: | |
| {search_results} | |
| """ | |
| CONFIDENCE_PROMPT = """ | |
| You are a GAIA answer verifier. Judge whether the draft answer is well-supported and correctly formatted. | |
| Return ONLY valid JSON: | |
| {{ | |
| "confidence": 0.0, | |
| "issues": ["list of problems, or empty"], | |
| "follow_up_queries": ["0-2 NEW search queries if evidence is weak, else empty"], | |
| "draft_answer": "revised short answer if you can improve it, else repeat the current draft" | |
| }} | |
| Scoring confidence (0.0-1.0): | |
| - 0.9+: answer directly matches question, supported by notes/math, format likely correct for GAIA. | |
| - 0.7-0.89: plausible but missing verification or ambiguous evidence. | |
| - Below 0.7: wrong, vague, unsupported, or format wrong — add follow_up_queries to fill gaps. | |
| GAIA format checks: | |
| - Number questions: answer should be a number (or number with unit if question asks). | |
| - Yes/no: only yes or no. | |
| - Name/place: proper noun, minimal words. | |
| - List: match requested format. | |
| - No sentences from search titles, no "based on", no hedging. | |
| Question: | |
| {question} | |
| Plan: | |
| {plan} | |
| Synthesis notes: | |
| {synthesis_notes} | |
| Math results: | |
| {math_results} | |
| Image vision analysis: | |
| {vision_results} | |
| Current draft answer: | |
| {draft_answer} | |
| """ | |
| FORMAT_ANSWER_PROMPT = """ | |
| You format the final GAIA submission answer. Output ONLY the answer string, nothing else. | |
| Strict GAIA rules: | |
| - Minimal: shortest correct form (usually 1-5 words, or a single number). | |
| - If the question asks for a number only, output digits (and decimal point if needed) — no units unless explicitly required. | |
| - If yes/no, output exactly: yes or no (lowercase). | |
| - No preamble, quotes, explanation, or "The answer is". | |
| - No trailing period unless the answer is a full sentence the question requires. | |
| - Strip Wikipedia-style titles, colons, or citation artifacts. | |
| - Prefer the draft if correct; fix format only. | |
| Question: | |
| {question} | |
| Draft answer: | |
| {draft_answer} | |
| Confidence notes (issues to fix if any): | |
| {issues} | |
| """ | |
| ANSWER_PROMPT = """ | |
| You are a GAIA benchmark answer agent. Produce the final answer only. | |
| Rules: | |
| - Use the question, plan, and synthesis notes — not raw search snippets. | |
| - Return ONLY the final answer text. | |
| - Be concise: short phrase, name, number, or yes/no. | |
| - Do NOT echo search artifacts or broken fragments. | |
| Question: | |
| {question} | |
| Plan: | |
| {plan} | |
| Synthesis notes: | |
| {synthesis_notes} | |
| """ | |