Skip to content

Commit

Permalink
HotPotQA better search tool failure message (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbraza authored Nov 8, 2024
1 parent e545add commit ec8a975
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/hotpotqa/src/aviary/envs/hotpotqa/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ async def search(self, entity: str) -> str:
if result_divs: # mismatch
result_titles = [clean_str(div.get_text().strip()) for div in result_divs]
self.state.page = None
return f"Could not find {entity}. Similar: {result_titles[:5]}."
return f"Search for {entity!r} returned no results. Similar: {result_titles[:5]}."

page = [p.get_text().strip() for p in soup.find_all("p") + soup.find_all("ul")]
if any("may refer to:" in p for p in page): # Recurse
Expand Down

0 comments on commit ec8a975

Please sign in to comment.