fix: refine subproblem handling and aggregation logic in agent

This commit is contained in:
Han Xiao 2025-06-12 19:57:50 -07:00
parent e8b99a5889
commit a664e4d851

View File

@ -796,6 +796,8 @@ But then you realized you have asked them before. You decided to to think out of
if (teamSize > 1) {
const subproblems = await researchPlan(question, teamSize, soundBites, context, SchemaGen);
if (subproblems.length > 1) {
// parallel call getResponse for each subproblem with exact same parameters from the current step, but their teamSize is 1
const subproblemResponses = await Promise.all(subproblems.map(subproblem => getResponse(subproblem,
tokenBudget,
@ -829,6 +831,10 @@ But then you realized you have asked them before. You decided to to think out of
// break the loop, jump directly final boxing
break;
} else {
// if there is only one subproblem, then we skip the recurrsion
gaps.push(subproblems[0]);
}
}
// rewrite queries with initial soundbites