File size: 779 Bytes
1c4cf5d
a1b5009
368de35
1c4cf5d
 
 
a1b5009
1c4cf5d
 
a1b5009
1c4cf5d
 
 
 
a1b5009
1c4cf5d
 
 
a1b5009
1c4cf5d
 
 
 
a1b5009
1c4cf5d
 
 
 
 
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
import os
import json

from tools import TOOLS
from metadata import load_metadata  
from mistral_inference import query_mistral  

API_URL = os.getenv("HF_MISTRAL_URL")
API_TOKEN = os.getenv("HF_TOKEN")

HEADERS = {
    "Authorization": f"Bearer {API_TOKEN}",
    "Content-Type": "application/json"
}

# Load all tasks from metadata.jsonl
def load_tasks():
    return load_metadata("metadata.jsonl")

# Solve a single task
def solve_task(task, tools=TOOLS):
    system_prompt = "You are a helpful agent. Use reasoning, tools if needed, and return the answer only."
    user_prompt = task["question"]

    response = query_mistral(API_URL, HEADERS, system_prompt, user_prompt)
    return {
        "task_id": task["question_id"],
        "submitted_answer": response.strip()
    }