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
+1 -1
View File
@@ -777,7 +777,7 @@ class ResearchHandler:
llm_model=llm_model,
llm_headers=llm_headers,
max_rounds=max_rounds,
min_rounds=min(3, max_rounds),
min_rounds=max(2, max_rounds - 2),
max_time=max_time,
max_report_tokens=_max_report_tokens,
extraction_timeout=_extraction_timeout,