Skip to content

feat: merge question_confirm and summary_task into single LLM call#1440

Open
Desel72 wants to merge 3 commits intoeigent-ai:mainfrom
Desel72:fix/issue-1427
Open

feat: merge question_confirm and summary_task into single LLM call#1440
Desel72 wants to merge 3 commits intoeigent-ai:mainfrom
Desel72:fix/issue-1427

Conversation

@Desel72
Copy link
Contributor

@Desel72 Desel72 commented Mar 4, 2026

Related Issue

Closes #1427

Description

Merges the two meta LLM calls made before task execution into a single request:

  1. question_confirm – classifies the task as complex or simple
  2. summary_task – generates task name and summary

Both were analyzing the same user intent, so they are combined into one analyze_task call that returns structured output (is_complex, task_name, summary). This reduces cost and latency for complex tasks.

Changes:

  • Add TaskAnalysisResult model in backend/app/model/chat.py
  • Add analyze_task() in backend/app/service/chat_service.py with fallback to question_confirm when parsing fails
  • Update step_solve to use analyze_task and reuse prefetched summary in decomposition
  • Add unit tests for analyze_task (structured output, JSON parsing, fallback)

Scope:

  • Only the initial task flow (no attachments) is merged
  • Attachments path still uses summary_task
  • Multi-turn flow still uses summary_task for new follow-up tasks

Testing Evidence (REQUIRED)

  • I have included human-verified testing evidence in this PR.
  • This PR includes frontend/UI changes, and I attached screenshot(s) or screen recording(s).
  • No frontend/UI changes in this PR.

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Contribution Guidelines Acknowledgement

@Desel72
Copy link
Contributor Author

Desel72 commented Mar 4, 2026

@Wendong-Fan @bytecii Could you please review this PR and share any feedback?

summary: str | None = Field(
default=None,
description="Concise task summary. Only when is_complex=True.",
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can add some post validation or postprocess that when is_complex=True task_name and summary need to be None.
Also cc @Wendong-Fan IMO we should still have a task_name when it's a non complex chat?

and analysis.summary
):
task_lock._prefetched_summary = (
f"{analysis.task_name}|{analysis.summary}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems that different from the original one?
f"Task|{summary_task_content}" though I am not sure why we used the fixed Task before cc @Wendong-Fan

) -> TaskAnalysisResult:
"""Analyze user query in one LLM call: complexity + task name/summary.

Merges question_confirm and summary_task into a single request (issue #1427).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

@Desel72
Copy link
Contributor Author

Desel72 commented Mar 5, 2026

Hi @bytecii thank you for your feedback and I addressed all. Please review again.

@Desel72 Desel72 requested a review from bytecii March 6, 2026 11:50
@Desel72
Copy link
Contributor Author

Desel72 commented Mar 7, 2026

Hi @bytecii @Wendong-Fan, sorry for tagging you. Could you please review it again when you have a moment and share your feedback?

@Desel72
Copy link
Contributor Author

Desel72 commented Mar 10, 2026

@Wendong-Fan @4pmtong @fengju0213 Do you have any feedback on my PR? If there are any issues, please feel free to let me know and I’ll address them.

@Desel72
Copy link
Contributor Author

Desel72 commented Mar 11, 2026

Hi @bytecii @Wendong-Fan @4pmtong @fengju0213, just following up on this PR. I addressed the previous feedback last week, but haven’t heard back yet. Could someone please take another look and let me know if there are any remaining issues? I’d really appreciate your review so we can move this forward. Thanks!

@Desel72
Copy link
Contributor Author

Desel72 commented Mar 17, 2026

Hi @bytecii @Wendong-Fan @4pmtong @fengju0213 why still no answer? please review this and if no issues on this, please feel free to merge it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Merge duplicate meta LLM calls before task execution into one request

2 participants