Skip to content

fix: Recover from failed searches on follow-up questions (#265) - #572

Open
cybr-wisp wants to merge 1 commit into
Aggregate-Intellect:mainfrom
cybr-wisp:fix/265-search-recovery
Open

cybr-wisp wants to merge 1 commit into
Aggregate-Intellect:mainfrom
cybr-wisp:fix/265-search-recovery

Conversation

@cybr-wisp

Copy link
Copy Markdown

Summary

This PR addresses [#265](#265), where Sherpa sometimes fails to search again after an earlier attempt returned incomplete information.

For example, if Sherpa couldn't find information about LangChain while comparing it with LlamaIndex, it could repeat the same response when asked about LangChain again.

I've updated the QA agent to recognize these cases and make a new search attempt instead of relying on the previous failed result.

Changes

  • Updated the QA agent's instructions to handle comparisons involving multiple subjects.
  • Added conversation context to the ReAct policy so it can make better decisions based on previous interactions.
  • Added a recovery check that identifies when a user asks about something Sherpa previously couldn't find.
  • Limited recovery to one additional search per execution to avoid repeated retries.
  • Added regression tests to cover failed searches, successful searches, unrelated follow-up questions, and retry limits.

Testing

  • All 19 targeted QA agent and policy tests passed.
  • Confirmed that a follow-up question triggers a new search using a mocked search action.
  • Verified that the search results are saved in the agent's belief state and recorded in its action history.
  • Checked that unrelated questions don't trigger unnecessary searches.

Limitations

The recovery check currently handles explicit failed-search responses, such as "I couldn't find information about LangChain." It doesn't cover every possible case of incomplete retrieval, and the recovery tests use mocked searches rather than live Google Search results.

Related Issue

Addresses [#265](#265).

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.

1 participant