Spaces:
Sleeping
Sleeping
| 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() | |
| } |