fix: respect user round count in deep research (#2896)

The STOP_PROMPT did not include the target round count, so the LLM
could decide to stop after 2-3 rounds even when the user requested 8.
Additionally, min_rounds was capped at 3 regardless of max_rounds.

- Add max_rounds to STOP_PROMPT so the LLM knows the target
- Change min_rounds from min(3, max_rounds) to max(2, max_rounds - 2)

Fixes #2863

Co-authored-by: michaelxer <michaelxer@users.noreply.github.com>
This commit is contained in:
michaelxer
2026-06-06 01:49:42 +07:00
committed by GitHub
parent ad82ee1c83
commit 71dda5b106
2 changed files with 6 additions and 2 deletions
+5 -1
View File
@@ -107,7 +107,7 @@ You are deciding whether a research report is comprehensive enough.
**Current report:**
{report}
**Rounds completed:** {round_num}
**Rounds completed:** {round_num} of {max_rounds}
Based on the report so far, do we have enough information to answer the question \
comprehensively? Consider:
@@ -115,6 +115,9 @@ comprehensively? Consider:
- Are there obvious gaps or unanswered sub-questions?
- Is the evidence sufficient and from multiple sources?
If rounds completed is well below the target, prefer continuing unless the \
report is already exhaustive.
Reply with ONLY "YES" or "NO" followed by a brief one-sentence reason.
Example: "YES — The report covers all major aspects with evidence from multiple sources."
Example: "NO — We still lack information about the economic impact."
@@ -698,6 +701,7 @@ class DeepResearcher:
question=question,
report=report,
round_num=round_num,
max_rounds=self.max_rounds,
)
try: