mamei16 / LLM_Web_search

An extension for oobabooga/text-generation-webui that enables the LLM to search the web using DuckDuckGo
GNU Affero General Public License v3.0
170 stars 26 forks source link

Error when searching #92

Open LanceLake opened 2 months ago

LanceLake commented 2 months ago

Describe the bug When my AI searches, they get this response.

https://imgur.com/zF1YBTt

I did not change any of the base settings that might cause an overload.

My console says this.

https://imgur.com/AYB5lJp

mamei16 commented 2 months ago

Hi, thanks for the report. I have a couple of questions to help narrow down the issue:

  1. Are you using the newest version of LLM_Web_search?
  2. Do you have the newest dependencies installed? (Mainly, what version of duckduckgo-search do you have?)
  3. Lastly, how many searches do you have to trigger for the issue to occur? And over what time frame?

This is a problem that has occurred multiple times in the past with the search back-end (see https://github.com/deedy5/duckduckgo_search/issues?q=is%3Aissue+is%3Aclosed+ratelimit), but has been fixed for a couple of months now.
If you can get it to trigger consistently, please trigger it a couple of times, then update duckduckgo-search by running the following command inside cmd_linux.sh or whatever OS you have:

pip install --upgrade duckduckgo-search

Then see if you can still trigger it.

LanceLake commented 2 months ago
  1. Yes
  2. Not sure, but I updated, so I presume the latest.
  3. First one. Only one I did.

Updated it via pip. https://imgur.com/fFC4il6

Same error. https://imgur.com/lqtAsqf

No error on the console though. Just the return from duckduckgo.

mamei16 commented 2 months ago

Are you sure you upgraded duckduckgo-search in the conda environment used by text-generation-webui? If not, try following step 2.i in the installation instructions. I'm asking because I unfortunately can't reproduce the issue, neither locally nor in the automated unit test that runs every day on GitHub.

LanceLake commented 2 months ago

Yes. I used 2.i for updating and I also did the manual update to duckduckgo as well.

As for trying the second option there, I don't think I even have conda installed.

image

But yes. I do follow 2i and do the one step update wizard. I update LLM search and I also update the main program.

Perhaps you can tell me where the URL is generated and I can try to juryrig something that may work better?

mamei16 commented 2 months ago

Okay, that should do. If you used the One-click-installer, then you have conda installed, see https://github.com/oobabooga/text-generation-webui/blob/5522584992c632d75d2389e9342793fd1dcc391d/README.md?plain=1#L48.

What do you mean by "where the URL is generated"?

I think it might make sense to create a new issue directly in the duckduckgo_search project, which is the cause of the problem you're experiencing. You can use this minimal script to manually trigger the error for debugging:

import duckduckgo_search

print(f"Running duckduckgo_search version {duckduckgo_search.__version__}\n")
query = "test test 123"

with duckduckgo_search.DDGS() as ddgs:
    instant_answers = ddgs.answers(query)
    if instant_answers:
        print(instant_answers)
    for result in ddgs.text(query, region='wt-wt', safesearch='moderate', timelimit=None, max_results=10):
        print(result["title"])
        print(result["href"])
        print(result["body"])
        print()
LanceLake commented 2 months ago

Ok. Put in a post there as well. It's not working with any version.

As for where the URL is generated, I mean where you are adding on all the extra things in the URL query fields.

LanceLake commented 2 months ago

This is what they said..

image

Are you doing the html or lite thing?

mamei16 commented 2 months ago

I'm using the default backend, which is "api". So unless your ISP is blocking duckduckgo, it seems we've come to a dead end :/

LanceLake commented 2 months ago

and that isn't happening..

image

So yeah.. Thanks for at least checking it out. The other dev sounds like an ass. He said it's not an issue, but the first 20 or so most recent issues are all about this. I think he just has his head buried in the sand or some such.

mamei16 commented 2 months ago

That's a bummer.

If you want, you can try using SearXNG as an alternative search engine instead. It's a so-called meta search engine that aggregates results from several different sources. Everybody can create their own instance and either run in locally or make it public to the internet. Using a public instance of some random person means that searches might be a bit slower than using DuckDuckGo and that whoever is running the instance might log all search queries, including yours.

If you want to try it, simply paste the following URL into the "SearXNG URL" field at the bottom of the LLM Web Search tab: https://etsi.me This is just some random instance I found that works. You can also try some of the other listed here, but only some of them will work. The ones that don't work will create the error 403 Client Error: Forbidden.

LanceLake commented 2 months ago

Thank you. I will try that.