Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions treesearch/minimal_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import random
from pathlib import Path
from typing import Any, Optional
import asyncio

import humanize

Expand Down Expand Up @@ -513,8 +514,10 @@ async def score_code(self, node: Node, exec_result: ExecutionResult) -> Node:
# Proceed with detailed scoring regardless of bug status
logger.info("Proceeding with detailed scoring")

# Use the scoring system
for req in node.requirements:
# Score each requirement with an independent LLM call.
# Requirements are independent of each other, so we evaluate them
# concurrently with asyncio.gather to reduce wall-clock time.
async def _score_requirement(req: Requirement) -> None:
logger.debug("Scoring requirement: %s", req.description)
scoring_prompt: Prompt = {
"Instructions": (
Expand Down Expand Up @@ -555,6 +558,8 @@ async def score_code(self, node: Node, exec_result: ExecutionResult) -> Node:
req.is_fulfilled = False
req.feedback = "No specific feedback provided."

await asyncio.gather(*(_score_requirement(req) for req in node.requirements))

all_fulfilled = all(r.is_fulfilled for r in node.requirements)
logger.debug("All requirements fulfilled=%s", all_fulfilled)
if not node.is_buggy and all_fulfilled:
Expand Down