"""Non-secret configuration for the GAIA agent. WHAT LIVES WHERE - Secrets (Space → Settings → Variables and secrets): * HF_TOKEN — required, for HF Inference Providers * SERPER_API_KEY — required, for web search - Everything else (model IDs, providers, step limits, tool knobs) lives in this file. Edit values here and push — no secret changes needed. OVERRIDE RULES Any env var with the same name as a constant below will override the value at import time. This lets you A/B test from Space secrets without editing code. """ from __future__ import annotations import os def _env(name: str, default: str) -> str: return os.getenv(name, default) # --------------------------------------------------------------------------- # LLM that powers the CodeAgent (the "brain") # --------------------------------------------------------------------------- # Strong open-source options ranked by GAIA performance (as of 2026): # - "deepseek-ai/DeepSeek-V3-0324" (provider="together") ← default # - "Qwen/Qwen2.5-72B-Instruct" (provider="auto") # - "meta-llama/Llama-3.3-70B-Instruct" (provider="auto") # - "deepseek-ai/DeepSeek-R1-Distill-Llama-70B" (reasoning-tuned) AGENT_MODEL_ID = _env("AGENT_MODEL_ID", "Qwen/Qwen2.5-72B-Instruct") AGENT_PROVIDER = _env("AGENT_PROVIDER", "auto") AGENT_MAX_TOKENS = int(_env("AGENT_MAX_TOKENS", "4096")) # --------------------------------------------------------------------------- # Vision-language model (used by `analyze_image`) # --------------------------------------------------------------------------- VLM_MODEL_ID = _env("VLM_MODEL_ID", "Qwen/Qwen2.5-VL-72B-Instruct") VLM_PROVIDER = _env("VLM_PROVIDER", "auto") # --------------------------------------------------------------------------- # Speech-to-text model (used by `transcribe_audio`) # --------------------------------------------------------------------------- ASR_MODEL_ID = _env("ASR_MODEL_ID", "openai/whisper-large-v3") # --------------------------------------------------------------------------- # Agent loop knobs # --------------------------------------------------------------------------- # Max reasoning steps before the agent must commit to a final answer. MAX_STEPS = int(_env("AGENT_MAX_STEPS", "15")) # How often to interleave a planning step (0 = disabled). PLANNING_INTERVAL = int(_env("AGENT_PLANNING_INTERVAL", "4")) # Self-consistency: independent attempts per question. 3 = balanced, 5 = max. SELF_CONSISTENCY_N = int(_env("GAIA_SELF_CONSISTENCY_N", "3")) # --------------------------------------------------------------------------- # Tool defaults # --------------------------------------------------------------------------- SEARCH_RESULTS = int(_env("WEB_SEARCH_RESULTS", "10")) PAGE_MAX_CHARS = int(_env("READ_WEBPAGE_MAX_CHARS", "15000")) WIKI_SENTENCES = int(_env("WIKI_SENTENCES", "8")) # --------------------------------------------------------------------------- # GAIA scoring API # --------------------------------------------------------------------------- GAIA_API_URL = _env("GAIA_API_URL", "https://agents-course-unit4-scoring.hf.space")