MCPcopy Create free account
hub / github.com/Sphere-AI-Lab/FormalMATH-Bench / process_batch

Function process_batch

verify_answers.py:151–175  ·  view source on GitHub ↗
(batch_id, item, batch_answers, context, autoformalization, 
                  repl_path, lean_env_path, session_timeout, expect_timeout)

Source from the content-addressed store, hash-verified

149
150# Process a proof batch
151def process_batch(batch_id, item, batch_answers, context, autoformalization,
152 repl_path, lean_env_path, session_timeout, expect_timeout):
153 # Initialize interactive thread
154 thread = InteractiveThread(
155 batch_id,
156 repl_path=repl_path,
157 lean_env_path=lean_env_path,
158 initial_context=context,
159 timeout=session_timeout,
160 expect_timeout=expect_timeout
161 )
162 thread.start()
163 thread.init_complete.wait() # Wait for initialization to complete
164
165 results = []
166 try:
167 for answer in batch_answers:
168 # Verify each answer in the batch
169 verified_answer, answer_bool = process_answer(item, answer, autoformalization, thread)
170 results.append({"answer": verified_answer, "answer_bool": answer_bool}) # Collect results
171 finally:
172 thread.stop()
173 thread.join()
174
175 return results
176
177def process_answer(item, answer, autoformalization, thread):
178 answer = answer.split("```")[0]

Callers

nothing calls this directly

Calls 3

stopMethod · 0.95
InteractiveThreadClass · 0.85
process_answerFunction · 0.85

Tested by

no test coverage detected