MCPcopy Index your code
hub / github.com/SkyworkAI/DeepResearchAgent / test_math_benchmark

Function test_math_benchmark

tests/test_benchmark.py:42–159  ·  view source on GitHub ↗

Test the benchmark manager specifically for Math/AIME using a REAL model. Uses response_format for structured output.

(benchmark_name: str = "aime25")

Source from the content-addressed store, hash-verified

40 return re.sub(r'[\\/*?:"<>|]', '', name).strip()
41
42async def test_math_benchmark(benchmark_name: str = "aime25"):
43 """
44 Test the benchmark manager specifically for Math/AIME using a REAL model.
45 Uses response_format for structured output.
46 """
47 print(f"🧪 Testing benchmark manager with benchmark: {benchmark_name}")
48 print(f"🤖 Using Model: {TARGET_MODEL}")
49
50 # Define save directory
51 save_dir = os.path.join(config.workdir, "benchmark", benchmark_name)
52 if not os.path.exists(save_dir):
53 os.makedirs(save_dir, exist_ok=True)
54 print(f"📁 Created output directory: {save_dir}")
55
56 # 1. Reset and get first task
57 print(f"🔄 Resetting progress for {benchmark_name}...")
58 task = await benchmark_manager.reset(benchmark_name)
59
60 if not task:
61 logger.warning("⚠️ No tasks available to run (Dataset empty or all finished).")
62 return
63
64 # ==========================================
65 # Loop Logic
66 # ==========================================
67 while task is not None:
68 task_id = task.task_id
69 start_time = time.time()
70
71 try:
72 print(f"\n" + "="*50)
73 print(f"🚀 Processing Task ID: {task_id}")
74 print("="*50)
75
76 # --- 1. Prepare Prompt ---
77 question_text = task.input
78
79 # Get system_prompt directly from task
80 system_prompt_text = task.system_prompt
81
82 logger.info(f"| 📋 [Task {task_id}] Input length: {len(question_text)}")
83
84 messages = [
85 SystemMessage(content=system_prompt_text),
86 HumanMessage(content=question_text)
87 ]
88
89 # --- 2. Model Inference (Structured Output) ---
90 print(f"⏳ [Task {task_id}] Model inferencing (Structured)...")
91
92 try:
93 # Call model_manager and pass response_format
94 response = await model_manager(
95 model=TARGET_MODEL,
96 messages=messages,
97 response_format=Response,
98 )
99

Callers 1

mainFunction · 0.70

Calls 14

SystemMessageClass · 0.90
HumanMessageClass · 0.90
printFunction · 0.85
joinMethod · 0.80
warningMethod · 0.80
sanitize_filenameFunction · 0.70
existsMethod · 0.45
resetMethod · 0.45
infoMethod · 0.45
writeMethod · 0.45
errorMethod · 0.45
evalMethod · 0.45

Tested by

no test coverage detected