Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix intermittent Internet Search Tool key errors #3377

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

415matt
Copy link
Contributor

@415matt 415matt commented Dec 9, 2024

Description

When the internet search tool query generated by the LLM contains quotations, the Bing Search API does not return any search results, leading to the following error in Danswer:

  File "/app/danswer/tools/tool_implementations/internet_search/internet_search_tool.py", line 237, in run
    results = self._perform_search(query)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/danswer/tools/tool_implementations/internet_search/internet_search_tool.py", line 230, in _perform_search
    for result in results["webPages"]["value"][: self.num_results]
                  ~~~~~~~^^^^^^^^^^^^
KeyError: 'webPages'

This seems the most prevalent with our Llama model deployments, however it should still be reproducible by prompting any model to wrap its generated query in quotes.

How Has This Been Tested?

Docker compose dev
Extensive prompting w/Llama 3.1 70b + Internet Search tool in UCSD dev/stage envs (Onyx 0.15.4)

Accepted Risk (provide if relevant)

N/A

Related Issue(s) (provide if relevant)

N/A

Mental Checklist:

  • All of the automated tests pass
  • All PR comments are addressed and marked resolved
  • If there are migrations, they have been rebased to latest main
  • If there are new dependencies, they are added to the requirements
  • If there are new environment variables, they are added to all of the deployment methods
  • If there are new APIs that don't require auth, they are added to PUBLIC_ENDPOINT_SPECS
  • Docker images build and basic functionalities work
  • Author has done a final read through of the PR right before merge

Backporting (check the box to trigger backport action)

Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.

  • This PR should be backported (make sure to check that the backport attempt succeeds)

Copy link

vercel bot commented Dec 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
internal-search ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 9, 2024 6:38pm

Copy link

vercel bot commented Dec 9, 2024

@415matt is attempting to deploy a commit to the Danswer Team on Vercel.

A member of the Team first needs to authorize it.

@415matt 415matt changed the title Fix intermittent Internet Search key errors Fix intermittent Internet Search Tool key errors Dec 9, 2024
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