DriptoBhattacharyya Claude Opus 4.8 commited on
Commit
abd9bdb
·
1 Parent(s): 86a7fd1

Default to Gemini 2.5-flash (thinking disabled) for text/judge nodes

Browse files

Key fixed on a non-billing project; 2.5-flash with thinking_budget=0 is fast and accurate (Mercedes Sosa -> correct '3'). Pace lowered to 0.15 rps for the ~10 RPM free tier.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Files changed (3) hide show
  1. .env.example +7 -8
  2. gaia_agent/config.py +5 -7
  3. gaia_agent/llm.py +3 -0
.env.example CHANGED
@@ -4,15 +4,14 @@ TAVILY_API_KEY=
4
  # Required when LLM_PROVIDER=gemini (default). Free key: aistudio.google.com
5
  GOOGLE_API_KEY=
6
 
7
- # --- LLM provider for text/reasoning + judge nodes: "groq" or "gemini" ---
8
- # Default "groq" + llama-3.1-8b-instant works with the existing key (high TPM).
9
- # Switch to "gemini" for better quality once you have a free-tier GOOGLE_API_KEY
10
- # (created in a Google project WITHOUT billing enabled, else free tier = 0).
11
- LLM_PROVIDER=groq
12
  GROQ_TEXT_MODEL=llama-3.1-8b-instant
13
- GEMINI_TEXT_MODEL=gemini-2.0-flash
14
- # Global pace across all text-LLM calls (req/sec). 0.2 = ~12/min.
15
- RATE_LIMIT_RPS=0.2
16
 
17
  # --- Optional: LangSmith tracing (nice for debugging the graph) ---
18
  # Set TRACING=true and provide the API key to stream runs to smith.langchain.com.
 
4
  # Required when LLM_PROVIDER=gemini (default). Free key: aistudio.google.com
5
  GOOGLE_API_KEY=
6
 
7
+ # --- LLM provider for text/reasoning + judge nodes: "gemini" or "groq" ---
8
+ # Default "gemini" + gemini-2.5-flash (best quality, high free-tier TPM).
9
+ # GOOGLE_API_KEY must come from a project WITHOUT billing (else free tier = 0).
10
+ LLM_PROVIDER=gemini
11
+ GEMINI_TEXT_MODEL=gemini-2.5-flash
12
  GROQ_TEXT_MODEL=llama-3.1-8b-instant
13
+ # Global pace across all text-LLM calls (req/sec). 0.15 = ~9/min (<10 RPM free).
14
+ RATE_LIMIT_RPS=0.15
 
15
 
16
  # --- Optional: LangSmith tracing (nice for debugging the graph) ---
17
  # Set TRACING=true and provide the API key to stream runs to smith.langchain.com.
gaia_agent/config.py CHANGED
@@ -24,21 +24,19 @@ class Settings(BaseSettings):
24
  google_api_key: str = ""
25
 
26
  # --- LLM provider for the text/reasoning + judge nodes ---
27
- # "groq" (default, works with the existing key) or "gemini" (better quality,
28
- # needs a free-tier GOOGLE_API_KEY from a project WITHOUT billing enabled).
29
  # Vision + Whisper always use Groq.
30
- llm_provider: str = "groq"
31
 
32
  # --- Models (override via env) ---
33
- gemini_text_model: str = "gemini-2.0-flash"
34
- # 8b-instant has ~30k TPM free (vs 70B's ~12k) so it survives the batch.
35
  groq_text_model: str = "llama-3.1-8b-instant"
36
  groq_vision_model: str = "meta-llama/llama-4-scout-17b-16e-instruct"
37
  groq_whisper_model: str = "whisper-large-v3"
38
 
39
  # --- Rate limiting (requests/sec across all text-LLM calls) ---
40
- # Gemini 2.0-flash free tier ~15 RPM; 0.2 rps = ~12/min keeps headroom.
41
- rate_limit_rps: float = 0.2
42
 
43
  # --- API + control knobs ---
44
  gaia_api_url: str = "https://agents-course-unit4-scoring.hf.space"
 
24
  google_api_key: str = ""
25
 
26
  # --- LLM provider for the text/reasoning + judge nodes ---
27
+ # "gemini" (default, best quality + high free-tier TPM) or "groq".
 
28
  # Vision + Whisper always use Groq.
29
+ llm_provider: str = "gemini"
30
 
31
  # --- Models (override via env) ---
32
+ gemini_text_model: str = "gemini-2.5-flash"
 
33
  groq_text_model: str = "llama-3.1-8b-instant"
34
  groq_vision_model: str = "meta-llama/llama-4-scout-17b-16e-instruct"
35
  groq_whisper_model: str = "whisper-large-v3"
36
 
37
  # --- Rate limiting (requests/sec across all text-LLM calls) ---
38
+ # Gemini 2.5-flash free tier ~10 RPM; 0.15 rps = ~9/min keeps headroom.
39
+ rate_limit_rps: float = 0.15
40
 
41
  # --- API + control knobs ---
42
  gaia_api_url: str = "https://agents-course-unit4-scoring.hf.space"
gaia_agent/llm.py CHANGED
@@ -45,12 +45,15 @@ def get_text_llm(temperature: float = 0.0):
45
  # Default: Gemini (high free-tier TPM).
46
  from langchain_google_genai import ChatGoogleGenerativeAI
47
 
 
 
48
  return ChatGoogleGenerativeAI(
49
  model=s.gemini_text_model,
50
  google_api_key=s.google_api_key,
51
  temperature=temperature,
52
  max_retries=3,
53
  rate_limiter=limiter,
 
54
  )
55
 
56
 
 
45
  # Default: Gemini (high free-tier TPM).
46
  from langchain_google_genai import ChatGoogleGenerativeAI
47
 
48
+ # thinking_budget=0 disables 2.5-flash's reasoning tokens -> much faster and
49
+ # cheaper, which matters under the slow free-tier RPM pacing.
50
  return ChatGoogleGenerativeAI(
51
  model=s.gemini_text_model,
52
  google_api_key=s.google_api_key,
53
  temperature=temperature,
54
  max_retries=3,
55
  rate_limiter=limiter,
56
+ thinking_budget=0,
57
  )
58
 
59