Skip to content

fix: remove duplicate FINAL ANSWER output in CLI query#263

Open
octo-patch wants to merge 1 commit intozilliztech:masterfrom
octo-patch:fix/issue-246-duplicate-final-answer-output
Open

fix: remove duplicate FINAL ANSWER output in CLI query#263
octo-patch wants to merge 1 commit intozilliztech:masterfrom
octo-patch:fix/issue-246-duplicate-final-answer-output

Conversation

@octo-patch
Copy link
Copy Markdown

Fixes #246

Problem

When running deepsearcher query, the final answer is printed twice to the console:

  1. First print: Each agent (DeepSearch, NaiveRAG, ChainOfRAG) already prints ==== FINAL ANSWER==== and the answer content inside its own query() method as part of the streaming thought-process output.
  2. Second print: cli.py then prints ==== FINAL ANSWER==== and the same answer again after query() returns.

The second print also includes a ### References section with different content (references are shown the second time but not the first), making the duplication even more confusing.

Solution

Remove the redundant ==== FINAL ANSWER==== header and answer body from cli.py. The agents already handle printing the answer. The ### References section is kept in cli.py since it is not printed by the agents.

Testing

Traced the execution path for deepsearcher query "...":

  • cli.py calls online_query.query()default_searcher.query()
  • Agents print ==== FINAL ANSWER==== + answer during execution
  • cli.py no longer re-prints the same content; only appends the references list

…ech#246)

The query() method in each agent (deep_search, naive_rag, chain_of_rag)
already prints the '==== FINAL ANSWER====' header and answer content
as part of its execution. cli.py was printing it a second time after
the call returned, causing duplicate output in the terminal.

Remove the redundant print from cli.py; keep only the References
section which is unique to the CLI.
@sre-ci-robot
Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: octo-patch
To complete the pull request process, please assign zc277584121 after the PR has been reviewed.
You can assign the PR to them by writing /assign @zc277584121 in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@octo-patch
Copy link
Copy Markdown
Author

/assign @xiaofan-luan

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The CLI mode query repeatedly outputs results in the console.

3 participants