langchain
langchain copied to clipboard
SearxSearchWrapper: ('Searx API returned an error: ', 'Too Many Requests')
The following code produces the "too many requests" error. Using a different host does not fix it.
name="Execute Query Tool"
description="Useful for executing a query against a search engine. Returns the results of the query."
search = SearxSearchWrapper(searx_host="https://www.gruble.de")
def func (query: Query) -> SearchResult:
searx_results = search.results(query, num_results=10, engines=['wiki'])
results_stack = [SearchResult.from_searx_result(result) for result in searx_results]
return results_stack
If you are hosting locally - make sure that you have server.limiter set to false and json is included in search.formats. These parameters can be defined in searxng/settings.yml.
server:
limiter: false
general:
debug: true
search:
formats:
- html
- json
Seems to work though they are other issues of Wikidata and Wikipedia engines not cooperating and timing out.
Had to resort to turning them off via the settings.yml config in case if it helps anyone
engines:
- name: wikidata
engine: wikidata
shortcut: wd
timeout: 3.0
weight: 2
tests: *tests_infobox
enabled: False
- name: wikipedia
engine: wikipedia
shortcut: wp
base_url: 'https://{language}.wikipedia.org/'
enabled: False
Hi, @AlexW00! I'm helping the LangChain team manage their backlog and I wanted to let you know that we are marking this issue as stale.
Based on the comments, it seems that the issue you reported has been resolved. The "too many requests" error was resolved by checking and adjusting the server.limiter and json parameters in the searxng/settings.yml file. Additionally, turning off the Wikidata and Wikipedia engines via the settings.yml config helped resolve the issue with timing out.
Before we close this issue, we wanted to check if it is still relevant to the latest version of the LangChain repository. If it is, please let us know and the LangChain team will take a look. Otherwise, if we don't hear back from you within 7 days, the issue will be automatically closed.
Thank you for your understanding and contribution to the LangChain project!