File size: 1,063 Bytes
1f15797
 
 
 
 
 
3e5ec4a
1f15797
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# agents/groq_compound.py
from groq import Groq
import os

class GroqCompoundAgent:
    """Wrapper around Groq’s compound-beta model for GAIA scoring."""
    def __init__(self, model: str = "compound-beta-mini", temperature: float = 0.2):
        self.client = Groq(api_key=os.getenv("GROQ_API_KEY"))
        self.model = model
        self.temperature = temperature

    def __call__(self, question: str) -> str:
        resp = self.client.chat.completions.create(
            model=self.model,
            messages=[
                {
                    "role": "system",
                    "content": (
                        "You are a careful GAIA solver. "
                        "Think step-by-step, use tools when helpful, "
                        "and then return ONLY the final answer on one line."
                    ),
                },
                {"role": "user", "content": question},
            ],
            temperature=self.temperature,
            max_tokens=512,
        )
        return resp.choices[0].message.content.strip()